summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/virt-v7.c
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@linaro.org>2013-09-19 18:06:44 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-10-03 21:28:51 +0200
commitba6a1698116da272f14c53a3ae41467cb7fc4372 (patch)
tree135476d83f61ee09d473a66a2a341290cb050307 /arch/arm/cpu/armv7/virt-v7.c
parentbb975455650b1f36681de31a93ffe54952ed3a6b (diff)
downloadu-boot-imx-ba6a1698116da272f14c53a3ae41467cb7fc4372.zip
u-boot-imx-ba6a1698116da272f14c53a3ae41467cb7fc4372.tar.gz
u-boot-imx-ba6a1698116da272f14c53a3ae41467cb7fc4372.tar.bz2
ARM: add SMP support for non-secure switch
Currently the non-secure switch is only done for the boot processor. To enable full SMP support, we have to switch all secondary cores into non-secure state also. So we add an entry point for secondary CPUs coming out of low-power state and make sure we put them into WFI again after having switched to non-secure state. For this we acknowledge and EOI the wake-up IPI, then go into WFI. Once being kicked out of it later, we sanity check that the start address has actually been changed (since another attempt to switch to non-secure would block the core) and jump to the new address. The actual CPU kick is done by sending an inter-processor interrupt via the GIC to all CPU interfaces except the requesting processor. The secondary cores will then setup their respective GIC CPU interface. While this approach is pretty universal across several ARMv7 boards, we make this function weak in case someone needs to tweak this for a specific board. The way of setting the secondary's start address is board specific, but mostly different only in the actual SMP pen address, so we also provide a weak default implementation and just depend on the proper address to be set in the config file. Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
Diffstat (limited to 'arch/arm/cpu/armv7/virt-v7.c')
-rw-r--r--arch/arm/cpu/armv7/virt-v7.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
index 068ac85..a0b8742 100644
--- a/arch/arm/cpu/armv7/virt-v7.c
+++ b/arch/arm/cpu/armv7/virt-v7.c
@@ -79,6 +79,17 @@ static unsigned long get_gicd_base_address(void)
#endif
}
+static void kick_secondary_cpus_gic(unsigned long gicdaddr)
+{
+ /* kick all CPUs (except this one) by writing to GICD_SGIR */
+ writel(1U << 24, gicdaddr + GICD_SGIR);
+}
+
+void __weak smp_kick_all_cpus(void)
+{
+ kick_secondary_cpus_gic(gic_dist_addr);
+}
+
int armv7_switch_nonsec(void)
{
unsigned int reg;
@@ -115,7 +126,10 @@ int armv7_switch_nonsec(void)
for (i = 1; i <= itlinesnr; i++)
writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
- /* call the non-sec switching code on this CPU */
+ smp_set_core_boot_addr((unsigned long)_smp_pen, -1);
+ smp_kick_all_cpus();
+
+ /* call the non-sec switching code on this CPU also */
_nonsec_init();
return 0;