Why can't Linux call SBI reset directly?


Heinrich Schuchardt
 

On Fri, Sep 10, 2021 at 3:19 PM Heinrich Schuchardt wrote:

The platform specification makes it clear that reset drivers should
sit in SBI and that Linux should rely on UEFI firmware calling it.

On 9/10/21 9:26 AM, Bin Meng wrote:

Why can't Linux call SBI reset directly?
Hello Bin,

I am copying in tech-unixplatformspec@... because we should add a reason for this design decision in the specification.

Linux' efi_reboot() in drivers/firmware/efi/reboot.c checks if a capsule update is ongoing.

The UEFI firmware may rely on being informed of a reset for cleanup tasks like adding an event log entry or preparing for a capsule update.

ResetSystem() has parameter ResetData to pass a message with a reset reason which Linux currently is not using.

Best regards

Heinrich


Anup Patel
 

On 10/09/21, 1:49 PM, "tech-unixplatformspec@... on behalf of Heinrich Schuchardt" <tech-unixplatformspec@... on behalf of heinrich.schuchardt@...> wrote:

On Fri, Sep 10, 2021 at 3:19 PM Heinrich Schuchardt wrote:

> The platform specification makes it clear that reset drivers should
sit in SBI and that Linux should rely on UEFI firmware calling it.

On 9/10/21 9:26 AM, Bin Meng wrote:

> Why can't Linux call SBI reset directly?

Hello Bin,

I am copying in tech-unixplatformspec@... because we should
add a reason for this design decision in the specification.

Linux' efi_reboot() in drivers/firmware/efi/reboot.c checks if a capsule
update is ongoing.

The UEFI firmware may rely on being informed of a reset for cleanup
tasks like adding an event log entry or preparing for a capsule update.

ResetSystem() has parameter ResetData to pass a message with a reset
reason which Linux currently is not using.

[Anup] While I mostly agree with you but we have cases (such as Linux
running inside Guest/VM under hypervisor) where UEFI runtime services
might not be always available so Linux use UEFI system reset whenever
available otherwise fallback to directly using SBI reset. This is what even
ARM does.

Regards,
Anup

Best regards

Heinrich


Bin Meng
 

On Fri, Sep 10, 2021 at 6:53 PM Anup Patel <Anup.Patel@...> wrote:



On 10/09/21, 1:49 PM, "tech-unixplatformspec@... on behalf of Heinrich Schuchardt" <tech-unixplatformspec@... on behalf of heinrich.schuchardt@...> wrote:

On Fri, Sep 10, 2021 at 3:19 PM Heinrich Schuchardt wrote:

> The platform specification makes it clear that reset drivers should
sit in SBI and that Linux should rely on UEFI firmware calling it.

On 9/10/21 9:26 AM, Bin Meng wrote:

> Why can't Linux call SBI reset directly?

Hello Bin,

I am copying in tech-unixplatformspec@... because we should
add a reason for this design decision in the specification.

Linux' efi_reboot() in drivers/firmware/efi/reboot.c checks if a capsule
update is ongoing.

The UEFI firmware may rely on being informed of a reset for cleanup
tasks like adding an event log entry or preparing for a capsule update.

ResetSystem() has parameter ResetData to pass a message with a reset
reason which Linux currently is not using.

[Anup] While I mostly agree with you but we have cases (such as Linux
running inside Guest/VM under hypervisor) where UEFI runtime services
might not be always available so Linux use UEFI system reset whenever
available otherwise fallback to directly using SBI reset. This is what even
ARM does.
This is my understanding as well. We should not force Linux to only
call EFI runtime services to do the reboot.

Regards,
Bin


Anup Patel
 

On Fri, Sep 10, 2021 at 1:48 PM Heinrich Schuchardt
<heinrich.schuchardt@...> wrote:

On Fri, Sep 10, 2021 at 3:19 PM Heinrich Schuchardt wrote:

> The platform specification makes it clear that reset drivers should
sit in SBI and that Linux should rely on UEFI firmware calling it.

On 9/10/21 9:26 AM, Bin Meng wrote:

Why can't Linux call SBI reset directly?
Hello Bin,

I am copying in tech-unixplatformspec@... because we should
add a reason for this design decision in the specification.

Linux' efi_reboot() in drivers/firmware/efi/reboot.c checks if a capsule
update is ongoing.

The UEFI firmware may rely on being informed of a reset for cleanup
tasks like adding an event log entry or preparing for a capsule update.

ResetSystem() has parameter ResetData to pass a message with a reset
reason which Linux currently is not using.
It seems there is a confusion in interpreting platform spec reset related
requirement.

This requirement only applies to RISC-V platforms claiming OS-A platform
compliance but Linux will be supporting much more platforms in addition
to OS-A platforms so Linux kernel will have to fallback to directly calling
SBI reset when UEFI runtime services are not available.

Regards,
Anup


Best regards

Heinrich







Rahul Pathak
 

The explicit reset example in the spec is from the perspective of the firmware implementation. 
But from the OS usage perspective, it clearly states that EFI interfaces should be given the priority before SBI and other platform specific mechanisms.

On Fri, Sep 10, 2021 at 5:39 PM Anup Patel <anup@...> wrote:
On Fri, Sep 10, 2021 at 1:48 PM Heinrich Schuchardt
<heinrich.schuchardt@...> wrote:
>
> On Fri, Sep 10, 2021 at 3:19 PM Heinrich Schuchardt wrote:
>
>  > The platform specification makes it clear that reset drivers should
> sit in SBI and that Linux should rely on UEFI firmware calling it.
>
> On 9/10/21 9:26 AM, Bin Meng wrote:
>
> > Why can't Linux call SBI reset directly?
>
> Hello Bin,
>
> I am copying in tech-unixplatformspec@... because we should
> add a reason for this design decision in the specification.
>
> Linux' efi_reboot() in drivers/firmware/efi/reboot.c checks if a capsule
> update is ongoing.
>
> The UEFI firmware may rely on being informed of a reset for cleanup
> tasks like adding an event log entry or preparing for a capsule update.
>
> ResetSystem() has parameter ResetData to pass a message with a reset
> reason which Linux currently is not using.

It seems there is a confusion in interpreting platform spec reset related
requirement.

This requirement only applies to RISC-V platforms claiming OS-A platform
compliance but Linux will be supporting much more platforms in addition
to OS-A platforms so Linux kernel will have to fallback to directly calling
SBI reset when UEFI runtime services are not available.

Regards,
Anup

>
> Best regards
>
> Heinrich
>
>
>
>
>
>
>