Skip to contentSkip to conversation

ls2080: efi_loader: Move EL2 switch to function call based version

PATCH New Alexander Graf 2 participants 2 messages Nov 22, 2016 – Nov 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ls2080: efi_loader: Move EL2 switch to function call based version

We moved the EL2 switch to be function call based rather than implicit. This patch changes the EL3 -> EL2 switch to the new way of doing things.

I've tested and verified this patch on LS2085ARDB.

---

York, feel free to squash this in with the EL2 switch.

---
 cmd/bootefi.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
cmd/bootefi.c +20 -3
index ca41170..97a0fc9 100644
@@ -141,6 +141,18 @@ static void *copy_fdt(void *fdt)
 	return new_fdt;
 }
 
+#ifdef CONFIG_ARM64
+static unsigned long efi_run_in_el2(ulong (*entry)(void *image_handle,
+		struct efi_system_table *st), void *image_handle,
+		struct efi_system_table *st)
+{
+	/* Enable caches again */
+	dcache_enable();
+
+	return entry(image_handle, st);
+}
+#endif
+
 /*
  * Load an EFI payload into a newly allocated piece of memory, register all
  * EFI objects it would want to access and jump to it.
@@ -231,9 +243,14 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
 	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();
+
+		/* Move into EL2 and keep running there */
+		armv8_switch_to_el2((ulong)entry, (ulong)&loaded_image_info,
+				    (ulong)&systab, (ulong)efi_run_in_el2,
+				    ES_TO_AARCH64);
+
+		/* Should never reach here, efi exits with longjmp */
+		while (1) { }
 	}
 #endif
 
Signature · 1 line
1.8.5.6
#1 lore raw

PATCH 1/1 ls2080: efi_loader: Move EL2 switch to function call based version

Quoted 10 lines · Alexander Graf

We moved the EL2 switch to be function call based rather than implicit. This patch changes the EL3 -> EL2 switch to the new way of doing things.

I've tested and verified this patch on LS2085ARDB.

---

York, feel free to squash this in with the EL2 switch.

Squashed with Alison's "armv8: Support loading 32-bit OS in AArch32 execution state", awaiting upstream. Thanks.

York