Re: [PATCH 2/2] riscv: Restart via EFI runtime services when available

Sunil V L <[email protected]> Tue, 16 Jun 2026 09:59:33 +0530
Newsgroups org.kernel.vger.linux-efi,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <CAB19ukEZhGc=4mi2D1e3FxZdJ_yENGt_=B+2R+3WDkxtT+xmYw@mail.gmail.com>
On Tue, Jun 16, 2026 at 4:59 AM Atish Patra <[email protected]> wrote:
>
> From: Atish Patra <[email protected]>
>
> Firmware-preferred reset and EFI capsule update support requires reset
> via EFI runtime services rather than direction M-mode firmware invocation
> via SBI. Unlike poweroff, restart mechanism is directly controlled from
> machine_restart function though.
>
> Prefer the EFI runtime ResetSystem() service for restart when UEFI
> runtime services are available.
>
> Signed-off-by: Atish Patra <[email protected]>
> ---
>  arch/riscv/kernel/reset.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c
> index 912288572226..541e2162c85a 100644
> --- a/arch/riscv/kernel/reset.c
> +++ b/arch/riscv/kernel/reset.c
> @@ -3,6 +3,7 @@
>   * Copyright (C) 2012 Regents of the University of California
>   */
>
> +#include <linux/efi.h>
>  #include <linux/reboot.h>
>  #include <linux/pm.h>
>
> @@ -17,6 +18,12 @@ EXPORT_SYMBOL(pm_power_off);
>
>  void machine_restart(char *cmd)
>  {
> +       /*
> +        * UpdateCapsule() depends on the system being reset via ResetSystem().
> +        */
> +       if (efi_enabled(EFI_RUNTIME_SERVICES))
> +               efi_reboot(reboot_mode, NULL);
> +
>         do_kernel_restart(cmd);
>         while (1);
>  }
>
LGTM.
Reviewed-by: Sunil V L <[email protected]>