Skip to contentSkip to conversation

Support MT SMP on generic MIPS kernel

PATCH In review Sander Vanheule 2 participants 4 messages Dec 18, 2021 – Dec 21, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Support MT SMP on generic MIPS kernel

These patches should allow a generic kernel to enable MT SMP, if supported by the current CPU.

Changes since v1:

- Add patch suggested by Jiaxun

Sander Vanheule (2):
MIPS: only register MT SMP ops if MT is supported
MIPS: generic: enable SMP on SMVP systems

 arch/mips/generic/init.c        | 11 ++++++-----
 arch/mips/include/asm/smp-ops.h |  3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
2.33.1
#1 lore raw

PATCH v2 1/2 MIPS: only register MT SMP ops if MT is supported

Verify that the current CPU actually supports multi-threading before registering MT SMP ops, instead of unconditionally registering them if the kernel is compiled with CONFIG_MIPS_MT_SMP.

---
 arch/mips/include/asm/smp-ops.h | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/include/asm/smp-ops.h +3 -0
index 65618ff1280c..864aea803984 100644
@@ -101,6 +101,9 @@ static inline int register_vsmp_smp_ops(void)
 #ifdef CONFIG_MIPS_MT_SMP
 	extern const struct plat_smp_ops vsmp_smp_ops;
 
+	if (!cpu_has_mipsmt)
+		return -ENODEV;
+
 	register_smp_ops(&vsmp_smp_ops);
 
 	return 0;
Signature · 1 line
2.33.1
#2 lore raw

PATCH v2 2/2 MIPS: generic: enable SMP on SMVP systems

In reply to Sander Vanheule

In addition to CPS SMP setups, also try to initialise MT SMP setups with multiple VPEs per CPU core. CMP SMP support is not provided as it is considered deprecated.

Additionally, rework the code by dropping the err variable and make it similar to how other platforms perform this initialisation.

---
 arch/mips/generic/init.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/mips/generic/init.c +6 -5
index 1842cddd8356..1d712eac1617 100644
@@ -110,14 +110,15 @@ void __init plat_mem_setup(void)
 
 void __init device_tree_init(void)
 {
-	int err;
-
 	unflatten_and_copy_device_tree();
 	mips_cpc_probe();
 
-	err = register_cps_smp_ops();
-	if (err)
-		err = register_up_smp_ops();
+	if (!register_cps_smp_ops())
+		return;
+	if (!register_vsmp_smp_ops())
+		return;
+
+	register_up_smp_ops();
 }
 
 int __init apply_mips_fdt_fixups(void *fdt_out, size_t fdt_out_size,
Signature · 1 line
2.33.1
#3 lore raw
In reply to Sander Vanheule
Quoted 7 lines · Sander Vanheule

These patches should allow a generic kernel to enable MT SMP, if supported by the current CPU.

Changes since v1:

- Add patch suggested by Jiaxun

Quoted 7 lines

Sander Vanheule (2):
MIPS: only register MT SMP ops if MT is supported
MIPS: generic: enable SMP on SMVP systems

 arch/mips/generic/init.c        | 11 ++++++-----
 arch/mips/include/asm/smp-ops.h |  3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)

series applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]