[PATCH 1/2] riscv: efi: Power off via EFI runtime services when available

Sunil V L sunilvl at oss.qualcomm.com
Mon Jun 15 21:29:58 PDT 2026


On Tue, Jun 16, 2026 at 4:59 AM Atish Patra <atish.patra at linux.dev> wrote:
>
> From: Atish Patra <atishp at meta.com>
>
> When booted via UEFI with runtime services enabled, EFI Reset Shutdown is
> the firmware-preferred shutdown path: it lets firmware run its own
> shutdown hooks which may invoke SBI SRST extension internally. However,
> RISC-V always powers off via the SBI SRST extension today and EFI runtime
> path is never used even when firmware provides it.
>
> Enable the poweroff via EFI by overriding efi_poweroff_required()
>
> Signed-off-by: Atish Patra <atishp at meta.com>
> ---
>  arch/riscv/kernel/efi.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
> index b64bf1624a05..2d3cc57b4535 100644
> --- a/arch/riscv/kernel/efi.c
> +++ b/arch/riscv/kernel/efi.c
> @@ -95,3 +95,8 @@ int __init efi_set_mapping_permissions(struct mm_struct *mm,
>                                    md->num_pages << EFI_PAGE_SHIFT,
>                                    set_permissions, md);
>  }
> +
> +bool efi_poweroff_required(void)
> +{
> +       return efi_enabled(EFI_RUNTIME_SERVICES);
> +}
>
Reviewed-by: Sunil V L <sunilvl at oss.qualcomm.com>



More information about the linux-riscv mailing list