]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
armv8: fsl-layerscape: SMP support for loading 32-bit OS
authorAlison Wang <b18965@freescale.com>
Thu, 10 Nov 2016 02:49:04 +0000 (10:49 +0800)
committerYork Sun <york.sun@nxp.com>
Tue, 22 Nov 2016 19:40:24 +0000 (11:40 -0800)
Spin-table method is used for secondary cores to load 32-bit OS. The
architecture information will be got through checking FIT image and
saved in the os_arch element of spin-table, then the secondary cores
will check os_arch and jump to 32-bit OS or 64-bit OS automatically.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
arch/arm/cpu/armv8/fsl-layerscape/mp.c
arch/arm/include/asm/arch-fsl-layerscape/mp.h
arch/arm/lib/bootm.c

index 97c626996fc1d82533a438d8faf50733eb175288..80fe1ade2e61097a34b0981afd89379f5f3849be 100644 (file)
@@ -24,6 +24,16 @@ phys_addr_t determine_mp_bootpg(void)
        return (phys_addr_t)&secondary_boot_code;
 }
 
+void update_os_arch_secondary_cores(uint8_t os_arch)
+{
+       u64 *table = get_spin_tbl_addr();
+       int i;
+
+       for (i = 1; i < CONFIG_MAX_CPUS; i++)
+               table[i * WORDS_PER_SPIN_TABLE_ENTRY +
+                       SPIN_TABLE_ELEM_OS_ARCH_IDX] = os_arch;
+}
+
 #ifdef CONFIG_FSL_LSCH3
 void wake_secondary_core_n(int cluster, int core, int cluster_cores)
 {
index ebf84b65f4aae68e5ab57bb89a62d8d7f7ae2d4b..d0832b54bc546b975ff4a1fe1ceae160bd5a64fc 100644 (file)
@@ -13,6 +13,7 @@
 *      uint64_t entry_addr;
 *      uint64_t status;
 *      uint64_t lpid;
+*      uint64_t os_arch;
 * };
 * we pad this struct to 64 bytes so each entry is in its own cacheline
 * the actual spin table is an array of these structures
@@ -20,6 +21,7 @@
 #define SPIN_TABLE_ELEM_ENTRY_ADDR_IDX 0
 #define SPIN_TABLE_ELEM_STATUS_IDX     1
 #define SPIN_TABLE_ELEM_LPID_IDX       2
+#define SPIN_TABLE_ELEM_OS_ARCH_IDX    3
 #define WORDS_PER_SPIN_TABLE_ENTRY     8       /* pad to 64 bytes */
 #define SPIN_TABLE_ELEM_SIZE           64
 
index 6f3be8b528c2f9c28f2be33c6af9dee2efa48966..35e6b06733b8f8c9e00060d0e1efb4b98f25df77 100644 (file)
@@ -277,6 +277,10 @@ bool armv7_boot_nonsec(void)
 #endif
 
 #ifdef CONFIG_ARM64
+__weak void update_os_arch_secondary_cores(uint8_t os_arch)
+{
+}
+
 #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
 static void switch_to_el1(void)
 {
@@ -314,6 +318,8 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
        if (!fake) {
                do_nonsec_virt_switch();
 
+               update_os_arch_secondary_cores(images->os.arch);
+
 #ifdef CONFIG_ARMV8_SWITCH_TO_EL1
                armv8_switch_to_el2((u64)images->ft_addr, 0, 0,
                                    (u64)switch_to_el1, ES_TO_AARCH64);