[U-Boot] [PATCH 1/1] efi_loader: PSCI reset and shutdown for EL1

Sumit Garg sumit.garg at linaro.org
Thu Oct 11 12:20:07 UTC 2018


On Thu, 11 Oct 2018 at 08:56, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> When starting an aarch64 system under QEMU it runs in EL1/EL0. So we have
> to use HVC for PSCI calls.
>
> Without the patch resetting Linux started with bootefi under
> qemu-system-aarch64 results in a crash.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  arch/arm/cpu/armv8/fwcall.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>

I too was facing this crash and got it fixed before I saw this patch today.

Tested-by: Sumit Garg <sumit.garg at linaro.org>

> diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
> index 0ba3dad8cc..f1b6e60bae 100644
> --- a/arch/arm/cpu/armv8/fwcall.c
> +++ b/arch/arm/cpu/armv8/fwcall.c
> @@ -78,12 +78,10 @@ void __efi_runtime smc_call(struct pt_regs *args)
>  }
>
>  /*
> - * For now, all systems we support run at least in EL2 and thus
> - * trigger PSCI calls to EL3 using SMC. If anyone ever wants to
> - * use PSCI on U-Boot running below a hypervisor, please detect
> - * this and set the flag accordingly.
> + * This flag controls if SMC or HVC is used to call PSCI services. If U-Boot has
> + * been called by a hypervisor (e.g. QEMU), it has to be set to false.
>   */
> -static const __efi_runtime_data bool use_smc_for_psci = true;
> +static __efi_runtime_data bool use_smc_for_psci = true;
>
>  void __noreturn __efi_runtime psci_system_reset(void)
>  {
> @@ -138,6 +136,12 @@ void reset_misc(void)
>  }
>
>  #ifdef CONFIG_EFI_LOADER
> +efi_status_t efi_reset_system_init(void)
> +{
> +       use_smc_for_psci = (current_el() >= 2);
> +       return EFI_SUCCESS;
> +}
> +
>  void __efi_runtime EFIAPI efi_reset_system(
>                         enum efi_reset_type reset_type,
>                         efi_status_t reset_status,
> --
> 2.19.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list