arm64: versal: Add support to load an app at EL1
authorAshok Reddy Soma <ashok.reddy.soma@xilinx.com>
Fri, 6 May 2022 05:53:45 +0000 (23:53 -0600)
committerMichal Simek <michal.simek@amd.com>
Fri, 24 Jun 2022 12:11:05 +0000 (14:11 +0200)
Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
board/xilinx/versal/board.c

index a88f5bb..81663e0 100644 (file)
@@ -91,6 +91,23 @@ int board_early_init_r(void)
        return 0;
 }
 
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+                        char *const argv[])
+{
+       int ret = 0;
+
+       if (current_el() > 1) {
+               smp_kick_all_cpus();
+               dcache_disable();
+               armv8_switch_to_el1(0x0, 0, 0, 0, (unsigned long)entry,
+                                   ES_TO_AARCH64);
+       } else {
+               printf("FAIL: current EL is not above EL1\n");
+               ret = EINVAL;
+       }
+       return ret;
+}
+
 static u8 versal_get_bootmode(void)
 {
        u8 bootmode;