Skip to content

Hacks to allow booting ARM SMP kernel on UP ARMv7

Russell King - ARM Linux linux-arm-kernel linux-omap 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 4 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 4 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] Hacks to allow booting ARM SMP kernel on UP ARMv7
Quoted 10 lines · Catalin Marinas
Quoted 6 lines · Russell King - ARM Linux
Quoted 3 lines · Catalin Marinas

I haven't followed your patches closely but can we restrict the ARMv6 SMP/UP support to only those cores that have TEX remapping (most of them probably)?

We don't support TEX remapping on ARMv6.

I know but it's easy to enable if useful for the SMP/UP v6/v7 combination (with some restrictions).

It'll make proc-v6.S much more complicated than it already is, requiring it to carry both the non-remap and remapping code selected via an ifdef.

Is it worth it? For the sake of one conditional in mmu.c, I don't think so - and the view is that using TEX remapping to get rid of the shared bit is a horrible hack anyway.

In any case, it's unnecessary. We can use my word-replacement to modify a variable to indicate whether we're running on SMP or not, and so have the test for SMP-on-UP in just one place. Like this:

arch/arm/include/asm/smp_plat.h +15 -0
index e621530..7de5aa5 100644
@@ -18,4 +18,19 @@ static inline int cache_ops_need_broadcast(void)
 	return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 1;
 }
 
+/*
+ * Return true if we are running on a SMP platform
+ */
+static inline bool is_smp(void)
+{
+#ifndef CONFIG_SMP
+	return false;
+#elif defined(CONFIG_SMP_ON_UP)
+	extern unsigned int smp_on_up;
+	return !!smp_on_up;
+#else
+	return true;
+#endif
+}
+
 #endif
arch/arm/kernel/head.S +10 -2
index 26ec521..360bf06 100644
@@ -343,7 +343,7 @@ __fixup_smp:
 	orr	r7, r7, #0x41000000	@ val 0x41070000
 	and	r0, r9, r6
 	teq	r0, r7			@ ARM CPU and ARMv6/v7?
-	bne	smp_on_up		@ no, assume UP
+	bne	fixup_smp_on_up		@ no, assume UP
 
 	orr	r6, r6, #0x0000ff00
 	orr	r6, r6, #0x000000f0	@ mask 0xff07fff0
@@ -357,7 +357,7 @@ __fixup_smp:
 	tst	r0, #1 << 31
 	movne	pc, lr			@ bit 31 => SMP
 
-smp_on_up:
+fixup_smp_on_up:
 	adr	r0, 1f
 	ldmia	r0, {r3, r6, r7}
 	sub	r3, r0, r3
@@ -373,6 +373,14 @@ ENDPROC(__fixup_smp)
 1:	.word	.
 	.word	__smpalt_begin
 	.word	__smpalt_end
+
+	.pushsection .data
+	.globl	smp_on_up
+smp_on_up:
+	SMP(.long	1)
+	UP(.long	0)
+	.popsection
+
 #endif
 
 #include "head-common.S"
arch/arm/kernel/setup.c +3 -3
index d5231ae..fe94467 100644
@@ -36,6 +36,7 @@
 #include <asm/procinfo.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
+#include <asm/smp_plat.h>
 #include <asm/mach-types.h>
 #include <asm/cacheflush.h>
 #include <asm/cachetype.h>
@@ -824,9 +825,8 @@ void __init setup_arch(char **cmdline_p)
 	paging_init(mdesc);
 	request_standard_resources(&meminfo, mdesc);
 
-#ifdef CONFIG_SMP
-	smp_init_cpus();
-#endif
+	if (is_smp())
+		smp_init_cpus();
 	reserve_crashkernel();
 
 	cpu_init();
arch/arm/mm/mmu.c +19 -23

76 lines not on this page · raw message