[v2] ARM: NOMMU: Setup VBAR/Hivecs for secondaries cores
diff mbox

Message ID 1513694293-5441-1-git-send-email-vladimir.murzin@arm.com
State New, archived
Headers show

Commit Message

Vladimir Murzin Dec. 19, 2017, 2:38 p.m. UTC
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")
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 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(-)

Comments

afzal mohammed Dec. 21, 2017, 4:23 a.m. UTC | #1
Hi,

On Tue, Dec 19, 2017 at 02:38:13PM +0000, Vladimir Murzin wrote:
> 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")
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

> +#ifndef CONFIG_MMU
> +	setup_vectors_base();
> +#endif

i would have preferred instead,

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

either way,

Acked-by: afzal mohammed <afzal.mohd.ma@gmail.com>

afzal
Vladimir Murzin Dec. 21, 2017, 9:34 a.m. UTC | #2
On 21/12/17 04:23, afzal mohammed wrote:
> Hi,
> 
> On Tue, Dec 19, 2017 at 02:38:13PM +0000, Vladimir Murzin wrote:
>> 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")
>> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
> 
>> +#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?

> 
> either way,
> 
> Acked-by: afzal mohammed <afzal.mohd.ma@gmail.com>

Thanks!

Vladimir

> 
> afzal
>

Patch
diff mbox

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 1f54e4e..4966677 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -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
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index b4fbf00..2da0879 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -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();
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 885b106..c8beaab 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -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();