Skip to contentSkip to conversation

MIPS: BCM63XX: improve BMIPS support

PATCH Superseded Jonas Gorski 2 participants 17 messages Jun 29, 2013 – Jul 17, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/10 MIPS: bmips: fix compilation for BMIPS5000

In reply to Jonas Gorski

Replace the macro names in strings with actual macro invocation.

Fixes the following build error:

CC arch/mips/kernel/smp-bmips.o
{standard input}: Assembler messages:
{standard input}:951: Error: Unrecognized opcode _ssnop' {standard input}:952: Error: Unrecognized opcode _ssnop' (...)
make[6]: *** [arch/mips/kernel/smp-bmips.o] Error 1

---
 arch/mips/include/asm/bmips.h |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
arch/mips/include/asm/bmips.h +14 -14
index 552a65a..87a253d 100644
@@ -70,15 +70,15 @@ static inline unsigned long bmips_read_zscm_reg(unsigned int offset)
 		".set noreorder\n"
 		"cache %1, 0(%2)\n"
 		"sync\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
 		"mfc0 %0, $28, 3\n"
-		"_ssnop\n"
+		__stringify(___ssnop) "\n"
 		".set pop\n"
 		: "=&r" (ret)
 		: "i" (Index_Load_Tag_S), "r" (ZSCM_REG_BASE + offset)
@@ -92,13 +92,13 @@ static inline void bmips_write_zscm_reg(unsigned int offset, unsigned long data)
 		".set push\n"
 		".set noreorder\n"
 		"mtc0 %0, $28, 3\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
 		"cache %1, 0(%2)\n"
-		"_ssnop\n"
-		"_ssnop\n"
-		"_ssnop\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
+		__stringify(___ssnop) "\n"
 		: /* no outputs */
 		: "r" (data),
 		  "i" (Index_Store_Tag_S), "r" (ZSCM_REG_BASE + offset)
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/10 MIPS: allow asm/cpu.h to be included from assembly

In reply to Jonas Gorski

Add guards around the enum to allow including cpu.h from assembly.

---
 arch/mips/include/asm/cpu.h |    3 +++
 1 file changed, 3 insertions(+)
arch/mips/include/asm/cpu.h +3 -0
index 632bbe5..ad6acfa 100644
@@ -225,6 +225,8 @@
 
 #define FPIR_IMP_NONE		0x0000
 
+#if !defined(__ASSEMBLY__)
+
 enum cpu_type_enum {
 	CPU_UNKNOWN,
 
@@ -277,6 +279,7 @@ enum cpu_type_enum {
 	CPU_LAST
 };
 
+#endif /* !__ASSEMBLY */
 
 /*
  * ISA Level encodings
Signature · 1 line
1.7.10.4
#0 lore raw

cover MIPS: BCM63XX: improve BMIPS support

This patchset aims at unifying the different BMIPS support code to allow building a kernel that runs on multiple BCM63XX SoCs which might have different BMIPS flavours on them, regardless of SMP support enabled in the kernel.

The first few patches clean up BMIPS itself and prepare it for multi-cpu support, while the latter add support to BCM63XX for running a SMP kernel with support for all SoCs, even those that do not have a SMP capable CPU.

This patchset is runtime tested on BCM6348, BCM6328 and BCM6368, to verify that it actually does what it claims it does.

Lacking hardware, it is only build tested for BMIPS4380 and BMIPS5000.

Jonas Gorski (10):
MIPS: bmips: fix compilation for BMIPS5000
MIPS: allow asm/cpu.h to be included from assembly
MIPS: bmips: add macros for testing the current bmips CPU
MIPS: bmips: change compile time checks to runtime checks
MIPS: bmips: merge CPU options into one option
MIPS: BCM63XX: let the individual SoCs select the appropriate CPUs
MIPS: bmips: add a helper function for registering smp ops
MIPS: BCM63XX: always register bmips smp ops
MIPS: BCM63XX: change the guard to a BMIPS4350 check
MIPS: BCM63XX: disable SMP also on BCM3368

 arch/mips/Kconfig             |   78 ++++++-------
 arch/mips/bcm63xx/Kconfig     |    8 ++
 arch/mips/bcm63xx/prom.c      |   14 +--
 arch/mips/include/asm/bmips.h |   52 ++++++---
 arch/mips/include/asm/cpu.h   |    3 +
 arch/mips/kernel/bmips_vec.S  |   55 ++++++++--
 arch/mips/kernel/smp-bmips.c  |  241 ++++++++++++++++++++++-------------------
 7 files changed, 264 insertions(+), 187 deletions(-)
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/10 MIPS: bmips: add macros for testing the current bmips CPU

Makes it easy to make code conditionally compiled for supported CPUs without directly relying on #ifdefs.

---
 arch/mips/include/asm/bmips.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/mips/include/asm/bmips.h +11 -0
index 87a253d..8906ac3 100644
@@ -45,8 +45,19 @@
 #if !defined(__ASSEMBLY__)
 
 #include <linux/cpumask.h>
+#include <asm/cpu-features.h>
 #include <asm/r4kcache.h>
 
+#define cpu_is_bmips32()	(current_cpu_type() == CPU_BMIPS32)
+#define cpu_is_bmips3300()	(IS_ENABLED(CONFIG_CPU_BMIPS3300) && \
+				 current_cpu_type() == CPU_BMIPS3300)
+#define cpu_is_bmips4350()	(IS_ENABLED(CONFIG_CPU_BMIPS4350) && \
+				 current_cpu_type() == CPU_BMIPS4350)
+#define cpu_is_bmips4380()	(IS_ENABLED(CONFIG_CPU_BMIPS4380) && \
+				 current_cpu_type() == CPU_BMIPS4380)
+#define cpu_is_bmips5000()	(IS_ENABLED(CONFIG_CPU_BMIPS5000) && \
+				 current_cpu_type() == CPU_BMIPS5000)
+
 extern struct plat_smp_ops bmips_smp_ops;
 extern char bmips_reset_nmi_vec;
 extern char bmips_reset_nmi_vec_end;
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/10 MIPS: bmips: change compile time checks to runtime checks

In reply to Jonas Gorski

Allow building for all bmips cpus at the same time by changing ifdefs to checks for the cpu type, or adding appropriate checks to the assembly.

---
 arch/mips/kernel/bmips_vec.S |   55 +++++++---
 arch/mips/kernel/smp-bmips.c |  241 ++++++++++++++++++++++--------------------
 2 files changed, 172 insertions(+), 124 deletions(-)
arch/mips/kernel/bmips_vec.S +43 -12
index 64c4fd6..043b42c 100644
@@ -13,6 +13,7 @@
 #include <asm/asm.h>
 #include <asm/asmmacro.h>
 #include <asm/cacheops.h>
+#include <asm/cpu.h>
 #include <asm/regdef.h>
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
@@ -89,12 +90,18 @@ NESTED(bmips_reset_nmi_vec, PT_SIZE, sp)
 	beqz	k0, bmips_smp_entry
 
 #if defined(CONFIG_CPU_BMIPS5000)
+	mfc0	k0, CP0_PRID
+	li	k1, PRID_IMP_BMIPS5000
+	andi	k0, 0xff00
+	bne	k0, k1, 1f
+
 	/* if we're not on core 0, this must be the SMP boot signal */
 	li	k1, (3 << 25)
 	mfc0	k0, $22
 	and	k0, k1
 	bnez	k0, bmips_smp_entry
-#endif
+1:
+#endif /* CONFIG_CPU_BMIPS5000 */
 #endif /* CONFIG_SMP */
 
 	/* nope, it's just a regular NMI */
@@ -137,7 +144,12 @@ bmips_smp_entry:
 	xori	k0, 0x04
 	mtc0	k0, CP0_CONFIG
 
+	mfc0	k0, CP0_PRID
+	andi	k0, 0xff00
 #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
+	li	k1, PRID_IMP_BMIPS43XX
+	bne	k0, k1, 2f
+
 	/* initialize CPU1's local I-cache */
 	li	k0, 0x80000000
 	li	k1, 0x80010000
@@ -148,14 +160,21 @@ bmips_smp_entry:
 1:	cache	Index_Store_Tag_I, 0(k0)
 	addiu	k0, 16
 	bne	k0, k1, 1b
-#elif defined(CONFIG_CPU_BMIPS5000)
+
+	b	3f
+2:
+#endif /* CONFIG_CPU_BMIPS4350 || CONFIG_CPU_BMIPS4380 */
+#if defined(CONFIG_CPU_BMIPS5000)
 	/* set exception vector base */
+	li	k1, PRID_IMP_BMIPS5000
+	bne	k0, k1, 3f
+
 	la	k0, ebase
 	lw	k0, 0(k0)
 	mtc0	k0, $15, 1
 	BARRIER
-#endif
-
+#endif /* CONFIG_CPU_BMIPS5000 */
+3:
 	/* jump back to kseg0 in case we need to remap the kseg1 area */
 	la	k0, 1f
 	jr	k0
@@ -221,8 +240,18 @@ END(bmips_smp_int_vec)
 LEAF(bmips_enable_xks01)
 
 #if defined(CONFIG_XKS01)
-
+	mfc0	t0, CP0_PRID
+	andi	t2, t0, 0xff00
 #if defined(CONFIG_CPU_BMIPS4380)
+	li	t1, PRID_IMP_BMIPS43XX
+	bne	t2, t1, 1f
+
+	andi	t0, 0xff
+	addiu	t1, t0, -PRID_REV_BMIPS4380_HI
+	bgtz	t1, 2f
+	addiu	t0, -PRID_REV_BMIPS4380_LO
+	bltz	t0, 2f
+
 	mfc0	t0, $22, 3
 	li	t1, 0x1ff0
 	li	t2, (1 << 12) | (1 << 9)
@@ -231,7 +260,13 @@ LEAF(bmips_enable_xks01)
 	or	t0, t2
 	mtc0	t0, $22, 3
 	BARRIER
-#elif defined(CONFIG_CPU_BMIPS5000)
+	b	2f
+1:
+#endif /* CONFIG_CPU_BMIPS4380 */
+#if defined(CONFIG_CPU_BMIPS5000)
+	li	t1, PRID_IMP_BMIPS5000
+	bne	t2, t1, 2f
+
 	mfc0	t0, $22, 5
 	li	t1, 0x01ff
 	li	t2, (1 << 8) | (1 << 5)
@@ -240,12 +275,8 @@ LEAF(bmips_enable_xks01)
 	or	t0, t2
 	mtc0	t0, $22, 5
 	BARRIER
-#else
-
-#error Missing XKS01 setup
-
-#endif
-
+#endif /* CONFIG_CPU_BMIPS5000 */
+2:
 #endif /* defined(CONFIG_XKS01) */
 
 	jr	ra
arch/mips/kernel/smp-bmips.c +129 -112

329 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 5/10 MIPS: bmips: merge CPU options into one option

In reply to Jonas Gorski

Instead of treating each flavour as an exclusive CPU to select, make BMIPS the only option and let SYS_HAS_CPU_BMIPS* decide for which flavours to include support.

Run tested on BMIPS3300 and BMIPS4350, only build tested for BMIPS4380 and BMISP5000.

---
 arch/mips/Kconfig |   77 +++++++++++++++++++++++++----------------------------
 1 file changed, 36 insertions(+), 41 deletions(-)
arch/mips/Kconfig +36 -41
index d45fd99..e5d3a63 100644
@@ -128,6 +128,7 @@ config BCM63XX
 	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select SYS_HAS_CPU_MIPS32_R1
+	select SYS_HAS_CPU_BMIPS
 	select SYS_HAS_CPU_BMIPS4350 if !BCM63XX_CPU_6338 && !BCM63XX_CPU_6345 && !BCM63XX_CPU_6348
 	select NR_CPUS_DEFAULT_2
 	select SYS_SUPPORTS_32BIT_KERNEL
@@ -1397,41 +1398,21 @@ config CPU_CAVIUM_OCTEON
 	  can have up to 16 Mips64v2 cores and 8 integrated gigabit ethernets.
 	  Full details can be found at http://www.caviumnetworks.com.
 
-config CPU_BMIPS3300
-	bool "BMIPS3300"
-	depends on SYS_HAS_CPU_BMIPS3300
-	select CPU_BMIPS
-	help
-	  Broadcom BMIPS3300 processors.
-
-config CPU_BMIPS4350
-	bool "BMIPS4350"
-	depends on SYS_HAS_CPU_BMIPS4350
-	select CPU_BMIPS
-	select SYS_SUPPORTS_SMP
-	select SYS_SUPPORTS_HOTPLUG_CPU
-	help
-	  Broadcom BMIPS4350 ("VIPER") processors.
-
-config CPU_BMIPS4380
-	bool "BMIPS4380"
-	depends on SYS_HAS_CPU_BMIPS4380
-	select CPU_BMIPS
-	select SYS_SUPPORTS_SMP
-	select SYS_SUPPORTS_HOTPLUG_CPU
-	help
-	  Broadcom BMIPS4380 processors.
-
-config CPU_BMIPS5000
-	bool "BMIPS5000"
-	depends on SYS_HAS_CPU_BMIPS5000
-	select CPU_BMIPS
-	select CPU_SUPPORTS_HIGHMEM
-	select MIPS_CPU_SCACHE
-	select SYS_SUPPORTS_SMP
-	select SYS_SUPPORTS_HOTPLUG_CPU
+config CPU_BMIPS
+	bool "Broadcom BMIPS"
+	depends on SYS_HAS_CPU_BMIPS
+	select CPU_MIPS32
+	select CPU_BMIPS3300 if SYS_HAS_CPU_BMIPS3300
+	select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4350
+	select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4380
+	select CPU_BMIPS5000 if SYS_HAS_CPU_BMIPS5000
+	select CPU_SUPPORTS_32BIT_KERNEL
+	select DMA_NONCOHERENT
+	select IRQ_CPU
+	select SWAP_IO_SPACE
+	select WEAK_ORDERING
 	help
-	  Broadcom BMIPS5000 processors.
+	  Support for BMIPS3300/4350/4380 and BMIPS5000 processors.
 
 config CPU_XLR
 	bool "Netlogic XLR SoC"
@@ -1512,14 +1493,25 @@ config CPU_LOONGSON1
 	select CPU_SUPPORTS_32BIT_KERNEL
 	select CPU_SUPPORTS_HIGHMEM
 
-config CPU_BMIPS
+config CPU_BMIPS3300
 	bool
-	select CPU_MIPS32
-	select CPU_SUPPORTS_32BIT_KERNEL
-	select DMA_NONCOHERENT
-	select IRQ_CPU
-	select SWAP_IO_SPACE
-	select WEAK_ORDERING
+
+config CPU_BMIPS4350
+	bool
+	select SYS_SUPPORTS_SMP
+	select SYS_SUPPORTS_HOTPLUG_CPU
+
+config CPU_BMIPS4380
+	bool
+	select SYS_SUPPORTS_SMP
+	select SYS_SUPPORTS_HOTPLUG_CPU
+
+config CPU_BMIPS5000
+	bool
+	select CPU_SUPPORTS_HIGHMEM
+	select MIPS_CPU_SCACHE
+	select SYS_SUPPORTS_SMP
+	select SYS_SUPPORTS_HOTPLUG_CPU
 
 config SYS_HAS_CPU_LOONGSON2E
 	bool
@@ -1593,6 +1585,9 @@ config SYS_HAS_CPU_SB1
 config SYS_HAS_CPU_CAVIUM_OCTEON
 	bool
 
+config SYS_HAS_CPU_BMIPS
+	bool
+
 config SYS_HAS_CPU_BMIPS3300
 	bool
 
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 6/10 MIPS: BCM63XX: let the individual SoCs select the appropriate CPUs

In reply to Jonas Gorski

Let each supported chip select the appropirate SYS_HAS_CPU_BMIPS* option for its embedded processor, so support will be conditionally included.

fix bmips selection

---
 arch/mips/Kconfig         |    1 -
 arch/mips/bcm63xx/Kconfig |    8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/mips/Kconfig +0 -1
index e5d3a63..2d3788b 100644
@@ -129,7 +129,6 @@ config BCM63XX
 	select IRQ_CPU
 	select SYS_HAS_CPU_MIPS32_R1
 	select SYS_HAS_CPU_BMIPS
-	select SYS_HAS_CPU_BMIPS4350 if !BCM63XX_CPU_6338 && !BCM63XX_CPU_6345 && !BCM63XX_CPU_6348
 	select NR_CPUS_DEFAULT_2
 	select SYS_SUPPORTS_32BIT_KERNEL
 	select SYS_SUPPORTS_BIG_ENDIAN
arch/mips/bcm63xx/Kconfig +8 -0
index b78306c..6cc0fac 100644
@@ -3,33 +3,41 @@ menu "CPU support"
 
 config BCM63XX_CPU_3368
 	bool "support 3368 CPU"
+	select SYS_HAS_CPU_BMIPS4350
 	select HW_HAS_PCI
 
 config BCM63XX_CPU_6328
 	bool "support 6328 CPU"
+	select SYS_HAS_CPU_BMIPS4350
 	select HW_HAS_PCI
 
 config BCM63XX_CPU_6338
 	bool "support 6338 CPU"
+	select SYS_HAS_CPU_BMIPS3300
 	select HW_HAS_PCI
 
 config BCM63XX_CPU_6345
 	bool "support 6345 CPU"
+	select SYS_HAS_CPU_BMIPS3300
 
 config BCM63XX_CPU_6348
 	bool "support 6348 CPU"
+	select SYS_HAS_CPU_BMIPS3300
 	select HW_HAS_PCI
 
 config BCM63XX_CPU_6358
 	bool "support 6358 CPU"
+	select SYS_HAS_CPU_BMIPS4350
 	select HW_HAS_PCI
 
 config BCM63XX_CPU_6362
 	bool "support 6362 CPU"
+	select SYS_HAS_CPU_BMIPS4350
 	select HW_HAS_PCI
 
 config BCM63XX_CPU_6368
 	bool "support 6368 CPU"
+	select SYS_HAS_CPU_BMIPS4350
 	select HW_HAS_PCI
 endmenu
 
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 7/10 MIPS: bmips: add a helper function for registering smp ops

In reply to Jonas Gorski

Add a helper similar to the generic register_XXX_smp_ops() for bmips.

---
 arch/mips/include/asm/bmips.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/mips/include/asm/bmips.h +13 -0
index 8906ac3..1eb4628 100644
@@ -47,6 +47,7 @@
 #include <linux/cpumask.h>
 #include <asm/cpu-features.h>
 #include <asm/r4kcache.h>
+#include <asm/smp-ops.h>
 
 #define cpu_is_bmips32()	(current_cpu_type() == CPU_BMIPS32)
 #define cpu_is_bmips3300()	(IS_ENABLED(CONFIG_CPU_BMIPS3300) && \
@@ -59,6 +60,18 @@
 				 current_cpu_type() == CPU_BMIPS5000)
 
 extern struct plat_smp_ops bmips_smp_ops;
+
+static inline int register_bmips_smp_ops(void)
+{
+#ifdef CONFIG_CPU_BMIPS
+	register_smp_ops(&bmips_smp_ops);
+
+	return 0;
+#else
+	return -ENODEV;
+#endif
+}
+
 extern char bmips_reset_nmi_vec;
 extern char bmips_reset_nmi_vec_end;
 extern char bmips_smp_movevec;
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH 8/10 MIPS: BCM63XX: always register bmips smp ops

In reply to Jonas Gorski
---
 arch/mips/bcm63xx/prom.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/bcm63xx/prom.c +3 -3
index 8ac4e09..191936c 100644
@@ -59,10 +59,10 @@ void __init prom_init(void)
 	/* do low level board init */
 	board_prom_init();
 
-	if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
-		/* set up SMP */
-		register_smp_ops(&bmips_smp_ops);
+	/* set up SMP */
+	register_bmips_smp_ops();
 
+	if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
 		/*
 		 * BCM6328 might not have its second CPU enabled, while BCM6358
 		 * needs special handling for its shared TLB, so disable SMP
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 9/10 MIPS: BCM63XX: change the guard to a BMIPS4350 check

In reply to Jonas Gorski
---
 arch/mips/bcm63xx/prom.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/bcm63xx/prom.c +1 -1
index 191936c..1f01b84 100644
@@ -62,7 +62,7 @@ void __init prom_init(void)
 	/* set up SMP */
 	register_bmips_smp_ops();
 
-	if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
+	if (cpu_is_bmips4350()) {
 		/*
 		 * BCM6328 might not have its second CPU enabled, while BCM6358
 		 * needs special handling for its shared TLB, so disable SMP
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 10/10 MIPS: BCM63XX: disable SMP also on BCM3368

In reply to Jonas Gorski

BCM3368 has the same shared TLB as BCM6358.

---
 arch/mips/bcm63xx/prom.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/bcm63xx/prom.c +4 -4
index 1f01b84..5701b931 100644
@@ -64,9 +64,9 @@ void __init prom_init(void)
 
 	if (cpu_is_bmips4350()) {
 		/*
-		 * BCM6328 might not have its second CPU enabled, while BCM6358
-		 * needs special handling for its shared TLB, so disable SMP
-		 * for now.
+		 * BCM6328 might not have its second CPU enabled, while BCM3368
+		 * and BCM6358 need special handling for their shared TLB, so
+		 * disable SMP for now.
 		 */
 		if (BCMCPU_IS_6328()) {
 			reg = bcm_readl(BCM_6328_OTP_BASE +
@@ -74,7 +74,7 @@ void __init prom_init(void)
 
 			if (reg & OTP_6328_REG3_TP1_DISABLED)
 				bmips_smp_enabled = 0;
-		} else if (BCMCPU_IS_6358()) {
+		} else if (BCMCPU_IS_3368() || BCMCPU_IS_6358()) {
 			bmips_smp_enabled = 0;
 		}
 
Signature · 1 line
1.7.10.4
#6 lore raw

Re: [PATCH 05/10] MIPS: bmips: merge CPU options into one option

In reply to Jonas Gorski

Hello Jonas,

2013/6/29 Jonas Gorski <[email protected]>:
[snip]

arch/mips/Kconfig config CPU_CAVIUM_OCTEON · line 1407

Quoted 7 lines
arch/mips/Kconfig +7 -0
+config CPU_BMIPS
+       bool "Broadcom BMIPS"
+       depends on SYS_HAS_CPU_BMIPS
+       select CPU_MIPS32
+       select CPU_BMIPS3300 if SYS_HAS_CPU_BMIPS3300
+       select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4350
+       select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4380

As you already made me notice privately, this should be:

select CPU_BMIPS4380 if SYS_HAS_CPU_BMIPS4380
--
Florian

#7 lore raw

Re: [PATCH 05/10] MIPS: bmips: merge CPU options into one option

Quoted 13 lines · Florian Fainelli

Hello Jonas,

2013/6/29 Jonas Gorski <[email protected]>:
[snip]

arch/mips/Kconfig config CPU_CAVIUM_OCTEON · line 1407

Quoted 7 lines
arch/mips/Kconfig +7 -0
+config CPU_BMIPS
+       bool "Broadcom BMIPS"
+       depends on SYS_HAS_CPU_BMIPS
+       select CPU_MIPS32
+       select CPU_BMIPS3300 if SYS_HAS_CPU_BMIPS3300
+       select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4350
+       select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4380
Quoted 3 lines

As you already made me notice privately, this should be:

select CPU_BMIPS4380 if SYS_HAS_CPU_BMIPS4380

I'm currently preparing a V2 that will fix this, the missed squash commit message in 6/10, and adds bcm47xx bmips selection (so that Ralf's cputype patch won't break bcm47xx and bcm63xx anymore). I marked the patches in patchwork accordingly.

Jonas

#13 lore raw
In reply to Jonas Gorski

Hello Jonas,

2013/6/29 Jonas Gorski <[email protected]>:

Quoted 15 lines

This patchset aims at unifying the different BMIPS support code to allow building a kernel that runs on multiple BCM63XX SoCs which might have different BMIPS flavours on them, regardless of SMP support enabled in the kernel.

The first few patches clean up BMIPS itself and prepare it for multi-cpu support, while the latter add support to BCM63XX for running a SMP kernel with support for all SoCs, even those that do not have a SMP capable CPU.

This patchset is runtime tested on BCM6348, BCM6328 and BCM6368, to verify that it actually does what it claims it does.

Lacking hardware, it is only build tested for BMIPS4380 and BMIPS5000.

Quoted 11 lines

Jonas Gorski (10):
MIPS: bmips: fix compilation for BMIPS5000
MIPS: allow asm/cpu.h to be included from assembly
MIPS: bmips: add macros for testing the current bmips CPU
MIPS: bmips: change compile time checks to runtime checks
MIPS: bmips: merge CPU options into one option
MIPS: BCM63XX: let the individual SoCs select the appropriate CPUs
MIPS: bmips: add a helper function for registering smp ops
MIPS: BCM63XX: always register bmips smp ops
MIPS: BCM63XX: change the guard to a BMIPS4350 check
MIPS: BCM63XX: disable SMP also on BCM3368

After fixing the typo on BMIPS4350 vs BMIPS4380 and fixing the following (which I will submit just in a few minutes)

@@ -187,7 +187,7 @@ static void bmips_boot_secondary(int cpu, struct task_struct

        } else {
                if (cpu_is_bmips4350() || cpu_is_bmips4380()) {
                        /* Reset slave TP1 if booting from TP0 */
-                       if (cpu_logical_map(cpu) == 0)
+                       if (cpu_logical_map(cpu) == 1)
                                set_c0_brcm_cmt_ctrl(0x01);
                } else if (cpu_is_bmips5000()) {
                        if (cpu & 0x01)

it works just nicely on BMIPS4380. I plan on doing some testing on BMIPS5000 later this week.

Thanks!
--
Florian

#14 lore raw
Quoted 43 lines · Florian Fainelli

Hello Jonas,

2013/6/29 Jonas Gorski <[email protected]>:

Quoted 15 lines

This patchset aims at unifying the different BMIPS support code to allow building a kernel that runs on multiple BCM63XX SoCs which might have different BMIPS flavours on them, regardless of SMP support enabled in the kernel.

The first few patches clean up BMIPS itself and prepare it for multi-cpu support, while the latter add support to BCM63XX for running a SMP kernel with support for all SoCs, even those that do not have a SMP capable CPU.

This patchset is runtime tested on BCM6348, BCM6328 and BCM6368, to verify that it actually does what it claims it does.

Lacking hardware, it is only build tested for BMIPS4380 and BMIPS5000.

Quoted 11 lines

Jonas Gorski (10):
MIPS: bmips: fix compilation for BMIPS5000
MIPS: allow asm/cpu.h to be included from assembly
MIPS: bmips: add macros for testing the current bmips CPU
MIPS: bmips: change compile time checks to runtime checks
MIPS: bmips: merge CPU options into one option
MIPS: BCM63XX: let the individual SoCs select the appropriate CPUs
MIPS: bmips: add a helper function for registering smp ops
MIPS: BCM63XX: always register bmips smp ops
MIPS: BCM63XX: change the guard to a BMIPS4350 check
MIPS: BCM63XX: disable SMP also on BCM3368

After fixing the typo on BMIPS4350 vs BMIPS4380 and fixing the following (which I will submit just in a few minutes)

(quoted diff) +1 -1
@@ -187,7 +187,7 @@ static void bmips_boot_secondary(int cpu, struct task_struct
        } else {
                if (cpu_is_bmips4350() || cpu_is_bmips4380()) {
                        /* Reset slave TP1 if booting from TP0 */
-                       if (cpu_logical_map(cpu) == 0)
+                       if (cpu_logical_map(cpu) == 1)
                                set_c0_brcm_cmt_ctrl(0x01);
                } else if (cpu_is_bmips5000()) {
                        if (cpu & 0x01)
Quoted 2 lines

it works just nicely on BMIPS4380. I plan on doing some testing on BMIPS5000 later this week.

Great, thanks for testing. This change looks quite correct. I'll rebase my patchset then onto your patch.

Regards
Jonas

#15 lore raw

2013/7/16 Jonas Gorski <[email protected]>:

Quoted 34 lines · Florian Fainelli
Quoted 33 lines

Hello Jonas,

2013/6/29 Jonas Gorski <[email protected]>:

Quoted 15 lines

This patchset aims at unifying the different BMIPS support code to allow building a kernel that runs on multiple BCM63XX SoCs which might have different BMIPS flavours on them, regardless of SMP support enabled in the kernel.

The first few patches clean up BMIPS itself and prepare it for multi-cpu support, while the latter add support to BCM63XX for running a SMP kernel with support for all SoCs, even those that do not have a SMP capable CPU.

This patchset is runtime tested on BCM6348, BCM6328 and BCM6368, to verify that it actually does what it claims it does.

Lacking hardware, it is only build tested for BMIPS4380 and BMIPS5000.

Quoted 11 lines

Jonas Gorski (10):
MIPS: bmips: fix compilation for BMIPS5000
MIPS: allow asm/cpu.h to be included from assembly
MIPS: bmips: add macros for testing the current bmips CPU
MIPS: bmips: change compile time checks to runtime checks
MIPS: bmips: merge CPU options into one option
MIPS: BCM63XX: let the individual SoCs select the appropriate CPUs
MIPS: bmips: add a helper function for registering smp ops
MIPS: BCM63XX: always register bmips smp ops
MIPS: BCM63XX: change the guard to a BMIPS4350 check
MIPS: BCM63XX: disable SMP also on BCM3368

After fixing the typo on BMIPS4350 vs BMIPS4380 and fixing the following (which I will submit just in a few minutes)

Quoted 9 lines

Review static void bmips_boot_secondary(int cpu, struct task_struct · line 193

Quoted 9 lines
(quoted diff) +1 -1
@@ -187,7 +187,7 @@ static void bmips_boot_secondary(int cpu, struct task_struct
        } else {
                if (cpu_is_bmips4350() || cpu_is_bmips4380()) {
                        /* Reset slave TP1 if booting from TP0 */
-                       if (cpu_logical_map(cpu) == 0)
+                       if (cpu_logical_map(cpu) == 1)
                                set_c0_brcm_cmt_ctrl(0x01);
                } else if (cpu_is_bmips5000()) {
                        if (cpu & 0x01)

Another way would be to make the test be:

cpu_logical_map(0) == 0, which seems more accurate with respect to the above comment.

Quoted 10 lines
Quoted 3 lines

it works just nicely on BMIPS4380. I plan on doing some testing on BMIPS5000 later this week.

Great, thanks for testing. This change looks quite correct. I'll rebase my patchset then onto your patch.

Regards
Jonas

--
Florian

#16 lore raw
In reply to Florian Fainelli
Quoted 30 lines · Le mardi 16 juillet 2013 14:06:36 Florian Fainelli a écrit :

Hello Jonas,

2013/6/29 Jonas Gorski <[email protected]>:

Quoted 15 lines

This patchset aims at unifying the different BMIPS support code to allow building a kernel that runs on multiple BCM63XX SoCs which might have different BMIPS flavours on them, regardless of SMP support enabled in the kernel.

The first few patches clean up BMIPS itself and prepare it for multi-cpu support, while the latter add support to BCM63XX for running a SMP kernel with support for all SoCs, even those that do not have a SMP capable CPU.

This patchset is runtime tested on BCM6348, BCM6328 and BCM6368, to verify that it actually does what it claims it does.

Lacking hardware, it is only build tested for BMIPS4380 and BMIPS5000.

Quoted 11 lines

Jonas Gorski (10):
MIPS: bmips: fix compilation for BMIPS5000
MIPS: allow asm/cpu.h to be included from assembly
MIPS: bmips: add macros for testing the current bmips CPU
MIPS: bmips: change compile time checks to runtime checks
MIPS: bmips: merge CPU options into one option
MIPS: BCM63XX: let the individual SoCs select the appropriate CPUs
MIPS: bmips: add a helper function for registering smp ops
MIPS: BCM63XX: always register bmips smp ops
MIPS: BCM63XX: change the guard to a BMIPS4350 check
MIPS: BCM63XX: disable SMP also on BCM3368

Quoted 2 lines

After fixing the typo on BMIPS4350 vs BMIPS4380 and fixing the following (which I will submit just in a few minutes)

I just gave this patchset a try on a BMIPS5000 system, but unfortunately the kernel crashes early on due to a change in smp-bmips.c. It crashed in mem_init(), and adding a printk in bmips_ebase_setup() in the final else clause before the return did no longer make the kernel crash. This could be some nasty cache issue and simply changing the kernel size did help. Will investigate this more.

Signature · 1 line
Florian