@@ -154,3 +154,26 @@ int cleanup_before_linux(void)
return 0;
}
+
+#ifdef CONFIG_ARMV8_PSCI
+
+static void relocate_secure_section(void)
+{
+#ifdef CONFIG_ARMV8_SECURE_BASE
+ size_t sz = __secure_end - __secure_start;
+
+ memcpy((void *)CONFIG_ARMV8_SECURE_BASE, __secure_start, sz);
+ flush_dcache_range(CONFIG_ARMV8_SECURE_BASE,
+ CONFIG_ARMV8_SECURE_BASE + sz + 1);
+ invalidate_icache_all();
+#endif
+}
+
+void setup_psci(void)
+{
+ relocate_secure_section();
+ fixup_vectors();
+ psci_arch_init();
+}
+
+#endif
@@ -160,3 +160,9 @@ psci_vectors:
b unhandled_exception /* Lower EL Error (64b) */
.popsection
+
+ENTRY(fixup_vectors)
+ adr x0, psci_vectors
+ msr vbar_el3, x0
+ ret
+ENDPROC(fixup_vectors)
@@ -78,6 +78,9 @@ void gic_send_sgi(unsigned long sgino);
void wait_for_wakeup(void);
void smp_kick_all_cpus(void);
#ifdef CONFIG_ARMV8_PSCI
+void setup_psci(void);
+void fixup_vectors(void);
+void psci_arch_init(void);
extern char __secure_start[];
extern char __secure_end[];
#endif
@@ -275,6 +275,9 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
announce_and_cleanup(fake);
if (!fake) {
+#ifdef CONFIG_ARMV8_PSCI
+ setup_psci();
+#endif
do_nonsec_virt_switch();
kernel_entry(images->ft_addr, NULL, NULL, NULL);
}
Setup the ARMv8 PSCI code just before switching to EL2 and jumping to the kernel. Signed-off-by: Arnab Basu <arnab_basu@rocketmail.com> Cc: Bhupesh Sharma <bhupesh.sharma@freescale.com> Cc: Marc Zyngier <marc.zyngier@arm.com> --- arch/arm/cpu/armv8/cpu.c | 23 +++++++++++++++++++++++ arch/arm/cpu/armv8/psci.S | 6 ++++++ arch/arm/include/asm/system.h | 3 +++ arch/arm/lib/bootm.c | 3 +++ 4 files changed, 35 insertions(+)