]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/vx: Convert cpu_has_vx() to cpu feature function
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 7 Feb 2025 14:49:08 +0000 (15:49 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 4 Mar 2025 16:18:07 +0000 (17:18 +0100)
Instead of having a private cpu_has_vx() implementation use the new common
cpu feature method. Move the facility detection to the decompressor so it
matches all other cpu features.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/boot/startup.c
arch/s390/include/asm/cpufeature.h
arch/s390/include/asm/fpu.h
arch/s390/kernel/early.c
lib/raid6/s390vx.uc

index 9c4b2b317af26c0b537381a761697eca509fd225..98649e5049895dc08052e733e032b04fc5d1394d 100644 (file)
@@ -141,6 +141,8 @@ static void detect_facilities(void)
                set_machine_feature(MFEATURE_TX);
                local_ctl_set_bit(0, CR0_TRANSACTIONAL_EXECUTION_BIT);
        }
+       if (cpu_has_vx())
+               local_ctl_set_bit(0, CR0_VECTOR_BIT);
 }
 
 static int cmma_test_essa(void)
index 026a43b86fd7279a881a67a8dd89d93bae0cfd10..781f45e88821c88c134c8fba4eb9c5963cb27eb4 100644 (file)
@@ -31,5 +31,6 @@ int cpu_have_feature(unsigned int nr);
 #define cpu_has_seq_insn()     test_facility(85)
 #define cpu_has_tlb_lc()       test_facility(51)
 #define cpu_has_topology()     test_facility(11)
+#define cpu_has_vx()           test_facility(129)
 
 #endif /* __ASM_S390_CPUFEATURE_H */
index c84cb33913e2946f55cea4228fe5a241ad35e86d..960c6c67ad6cffafbf096908af0a4d09ddcfad69 100644 (file)
@@ -44,6 +44,7 @@
 #ifndef _ASM_S390_FPU_H
 #define _ASM_S390_FPU_H
 
+#include <linux/cpufeature.h>
 #include <linux/processor.h>
 #include <linux/preempt.h>
 #include <linux/string.h>
 #include <asm/sigcontext.h>
 #include <asm/fpu-types.h>
 #include <asm/fpu-insn.h>
-#include <asm/facility.h>
-
-static inline bool cpu_has_vx(void)
-{
-       return likely(test_facility(129));
-}
 
 enum {
        KERNEL_FPC_BIT = 0,
index fc30eb222ee9f4e91687dae14a17cb6cbfebcdd7..081f67abe05ea371d7a09d181025f0435a8d310d 100644 (file)
@@ -184,16 +184,10 @@ static noinline __init void setup_lowcore_early(void)
        lc->return_mcck_lpswe = gen_lpswe(__LC_RETURN_MCCK_PSW);
 }
 
-static __init void detect_machine_facilities(void)
-{
-       if (test_facility(129))
-               system_ctl_set_bit(0, CR0_VECTOR_BIT);
-}
-
 static inline void save_vector_registers(void)
 {
 #ifdef CONFIG_CRASH_DUMP
-       if (test_facility(129))
+       if (cpu_has_vx())
                save_vx_regs(boot_cpu_vector_save_area);
 #endif
 }
@@ -232,7 +226,6 @@ void __init startup_init(void)
        setup_lowcore_early();
        setup_arch_string();
        setup_boot_command_line();
-       detect_machine_facilities();
        save_vector_registers();
        setup_topology();
        sclp_early_detect();
index 863e2d32093891c7302fb81ab169022c6684eaf9..8aa53eb2f3958ce049fa2e1b035bcb32a3e14de7 100644 (file)
@@ -11,6 +11,7 @@
  * This file is postprocessed using unroll.awk.
  */
 
+#include <linux/cpufeature.h>
 #include <linux/raid/pq.h>
 #include <asm/fpu.h>