From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Wed, 19 Oct 2016 16:31:13 +0200 Subject: [U-Boot] [PATCH v6 2/6] efi_loader: AArch64: Run EFI payloads in EL2 if U-Boot runs in EL3 In-Reply-To: <1476887477-189387-1-git-send-email-agraf@suse.de> References: <1476887477-189387-1-git-send-email-agraf@suse.de> Message-ID: <1476887477-189387-3-git-send-email-agraf@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Reviewed-by: York Sun --- v4 -> v5: - Remove manual ttbr / tcr copy - Regenerate page tables in EL2, getting us non-secured page tables --- cmd/bootefi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index c8079c4..a9910d7 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -226,6 +226,17 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt) return status == EFI_SUCCESS ? 0 : -EINVAL; } +#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 */ + dcache_enable(); + } +#endif + return entry(&loaded_image_info, &systab); } -- 1.8.5.6