MIPS: cpu-features: Use boot_cpu_type for CPU type based features
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Wed, 7 Jun 2023 05:51:22 +0000 (13:51 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 9 Jun 2023 07:56:22 +0000 (09:56 +0200)
Some CPU feature macros were using current_cpu_type to mark feature
availability.

However current_cpu_type will use smp_processor_id, which is prohibited
under preemptable context.

Since those features are all uniform on all CPUs in a SMP system, use
boot_cpu_type instead of current_cpu_type to fix preemptable kernel.

Cc: stable@vger.kernel.org
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/include/asm/cpu-features.h

index 51a1737..404390b 100644 (file)
 ({                                                                     \
        int __res;                                                      \
                                                                        \
-       switch (current_cpu_type()) {                                   \
+       switch (boot_cpu_type()) {                                      \
        case CPU_CAVIUM_OCTEON:                                         \
        case CPU_CAVIUM_OCTEON_PLUS:                                    \
        case CPU_CAVIUM_OCTEON2:                                        \
 ({                                                                     \
        int __res;                                                      \
                                                                        \
-       switch (current_cpu_type()) {                                   \
+       switch (boot_cpu_type()) {                                      \
        case CPU_M14KC:                                                 \
        case CPU_74K:                                                   \
        case CPU_1074K:                                                 \