MIPS: only register MT SMP ops if MT is supported
authorSander Vanheule <sander@svanheule.net>
Sat, 18 Dec 2021 10:05:10 +0000 (11:05 +0100)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 21 Dec 2021 12:51:39 +0000 (13:51 +0100)
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.

Suggested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/include/asm/smp-ops.h

index 65618ff..864aea8 100644 (file)
@@ -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;