@@ -41,3 +41,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
@@ -169,3 +169,9 @@ psci_vectors:
b default_psci_vector /* 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
@@ -251,6 +251,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);
}