[U-Boot] [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3

Prabhakar Kushwaha prabhakar.kushwaha at nxp.com
Wed Jun 22 04:50:15 CEST 2016


Hi Alex

> -----Original Message-----
> From: Alexander Graf [mailto:agraf at suse.de]
> Sent: Tuesday, June 21, 2016 4:37 AM
> To: u-boot at lists.denx.de
> Cc: york sun <york.sun at nxp.com>; Prabhakar Kushwaha
> <prabhakar.kushwaha at nxp.com>
> Subject: [PATCH v4 2/9] efi_loader: AArch64: Run EFI payloads in EL2 if U-
> Boot runs in EL3
> 
> Some boards decided not to run ATF or other secure firmware in EL3, so they
> instead run U-Boot there. The uEFI spec doesn't know what EL3 is though - it
> only knows about EL2 and EL1. So if we see that we're running in EL3, let's get
> into EL2 to make payloads happy.
> 
> Signed-off-by: Alexander Graf <agraf at suse.de>
> ---

<snip>

>  	asm volatile("isb");
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 2169065..edd0980 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -205,6 +205,17 @@ static unsigned long do_bootefi_exec(void *efi, void
> *fdt)
>  		loaded_image_info.device_handle = nethandle;  #endif
> 
> +#ifdef CONFIG_ARM64
> +	/* On AArch64 we need to make sure we call our payload in < EL3 */
> +	if (current_el() == 3) {
> +		smp_kick_all_cpus();
> +		dcache_disable();	/* flush cache before switch to EL2 */
> +		armv8_switch_to_el2();
> +		/* Enable caches again */
> +		set_sctlr(get_sctlr() | (CR_C|CR_M));
> +	}

As exception level switch to EL2. Who is creating MMU table for EL2.

--prabhakar


More information about the U-Boot mailing list