arm64: zynqmp: Add support to load an app at EL1
authorNitin Jain <nitin.jain@xilinx.com>
Fri, 16 Feb 2018 07:26:17 +0000 (12:56 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 23 Mar 2018 08:34:42 +0000 (09:34 +0100)
This patch is adding support to switch to EL1 while loading an EL1
application with u-boot running at EL above EL1 in aarch64 mode.

Signed-off-by: Nitin Jain <nitinj@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c
include/command.h

index ff0b3c75f53327faa489afab503fc9d3fce020bd..b9825ddaa881154c07441e8b227bb7872adb9a80 100644 (file)
@@ -316,6 +316,23 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
        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;
+}
+
 #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
 int dram_init_banksize(void)
 {
index 767cabb3df09752e36d46987b32b774a716061e1..56499b8ad5ca17bc61a4422f82afe9e72f3b2aad 100644 (file)
@@ -111,6 +111,8 @@ extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
 extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 extern int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
+extern unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+                               char * const argv[]);
 /*
  * Error codes that commands return to cmd_process(). We use the standard 0
  * and 1 for success and failure, but add one more case - failure with a