Skip to contentSkip to conversation

ARM: NOMMU: Setup VBAR/Hivecs for secondaries cores

PATCH Superseded Vladimir Murzin 2 participants 3 messages Dec 19, 2017 – Dec 21, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: NOMMU: Setup VBAR/Hivecs for secondaries cores

With switch to dynamic exception base address setting, VBAR/Hivecs set only for boot CPU, but secondaries stay unaware of that. That might lead to weird effects when trying up to bring up secondaries.

Fixes ad475117d201 ("ARM: 8649/2: nommu: remove Hivecs configuration is asm")
---
 arch/arm/include/asm/memory.h | 1 +
 arch/arm/kernel/smp.c         | 3 +++
 arch/arm/mm/nommu.c           | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/include/asm/memory.h +1 -0
index 1f54e4e..4966677 100644
@@ -88,6 +88,7 @@
 #else /* CONFIG_MMU */
 
 #ifndef __ASSEMBLY__
+extern unsigned long setup_vectors_base(void);
 extern unsigned long vectors_base;
 #define VECTORS_BASE		vectors_base
 #endif
arch/arm/kernel/smp.c +3 -0
index b4fbf00..2da0879 100644
@@ -379,6 +379,9 @@ asmlinkage void secondary_start_kernel(void)
 
 	cpu_init();
 
+#ifndef CONFIG_MMU
+	setup_vectors_base();
+#endif
 	pr_debug("CPU%u: Booted secondary processor\n", cpu);
 
 	preempt_disable();
arch/arm/mm/nommu.c +2 -2
index 885b106..c8beaab 100644
@@ -31,7 +31,7 @@ struct mpu_rgn_info mpu_rgn_info;
 
 #ifdef CONFIG_CPU_CP15
 #ifdef CONFIG_CPU_HIGH_VECTOR
-static unsigned long __init setup_vectors_base(void)
+unsigned long setup_vectors_base(void)
 {
 	unsigned long reg = get_cr();
 
@@ -58,7 +58,7 @@ static inline bool security_extensions_enabled(void)
 	return 0;
 }
 
-static unsigned long __init setup_vectors_base(void)
+unsigned long setup_vectors_base(void)
 {
 	unsigned long base = 0, reg = get_cr();
 
Signature · 1 line
2.0.0
#1 lore raw

PATCH v2 1/1 ARM: NOMMU: Setup VBAR/Hivecs for secondaries cores

Hi,

arch/arm/kernel/smp.c asmlinkage void secondary_start_kernel(void) · line 384

Quoted 10 lines · Vladimir Murzin

With switch to dynamic exception base address setting, VBAR/Hivecs set only for boot CPU, but secondaries stay unaware of that. That might lead to weird effects when trying up to bring up secondaries.

Fixes ad475117d201 ("ARM: 8649/2: nommu: remove Hivecs configuration is asm")
arch/arm/kernel/smp.c +3 -0
+#ifndef CONFIG_MMU
+	setup_vectors_base();
+#endif

i would have preferred instead,

        if (!IS_ENABLED(CONFIG_MMU))
                setup_vectors_base();

either way,

afzal

#2 lore raw

PATCH v2 1/1 ARM: NOMMU: Setup VBAR/Hivecs for secondaries cores

Quoted 10 lines · afzal mohammed

Hi,

Quoted 6 lines · Vladimir Murzin

With switch to dynamic exception base address setting, VBAR/Hivecs set only for boot CPU, but secondaries stay unaware of that. That might lead to weird effects when trying up to bring up secondaries.

Fixes ad475117d201 ("ARM: 8649/2: nommu: remove Hivecs configuration is asm")
Quoted 8 lines

arch/arm/kernel/smp.c asmlinkage void secondary_start_kernel(void) · line 384

Quoted 3 lines
arch/arm/kernel/smp.c +3 -0
+#ifndef CONFIG_MMU
+	setup_vectors_base();
+#endif

i would have preferred instead,

        if (!IS_ENABLED(CONFIG_MMU))
                setup_vectors_base();

I agree that IS_ENABLED() macro is a nice feature, especially for block of code, but not here, IMO. First, I wanted to keep consistent with a existing style in smp.c; the second, I find it easier to read if_not_defined rather than if_not_is_enabled.

@Russell, do you have any preference?

Quoted 4 lines

either way,

Thanks!

Vladimir

Quoted 3 lines

afzal