summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2025-02-07 15:49:08 +0100
committerVasily Gorbik <gor@linux.ibm.com>2025-03-04 17:18:07 +0100
commitdb14f78ecb02292e5013d7f46cf01be4d006262d (patch)
tree3d4c114a05a190ef65ac56f3239b573d0c28d3b6
parent52109a067aaa96474a5b0f12aee60d73cf5f92e1 (diff)
s390/vx: Convert cpu_has_vx() to cpu feature function
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>
-rw-r--r--arch/s390/boot/startup.c2
-rw-r--r--arch/s390/include/asm/cpufeature.h1
-rw-r--r--arch/s390/include/asm/fpu.h7
-rw-r--r--arch/s390/kernel/early.c9
-rw-r--r--lib/raid6/s390vx.uc1
5 files changed, 6 insertions, 14 deletions
diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c
index 9c4b2b317af2..98649e504989 100644
--- a/arch/s390/boot/startup.c
+++ b/arch/s390/boot/startup.c
@@ -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)
diff --git a/arch/s390/include/asm/cpufeature.h b/arch/s390/include/asm/cpufeature.h
index 026a43b86fd7..781f45e88821 100644
--- a/arch/s390/include/asm/cpufeature.h
+++ b/arch/s390/include/asm/cpufeature.h
@@ -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 */
diff --git a/arch/s390/include/asm/fpu.h b/arch/s390/include/asm/fpu.h
index c84cb33913e2..960c6c67ad6c 100644
--- a/arch/s390/include/asm/fpu.h
+++ b/arch/s390/include/asm/fpu.h
@@ -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>
@@ -51,12 +52,6 @@
#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,
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index fc30eb222ee9..081f67abe05e 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -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();
diff --git a/lib/raid6/s390vx.uc b/lib/raid6/s390vx.uc
index 863e2d320938..8aa53eb2f395 100644
--- a/lib/raid6/s390vx.uc
+++ b/lib/raid6/s390vx.uc
@@ -11,6 +11,7 @@
* This file is postprocessed using unroll.awk.
*/
+#include <linux/cpufeature.h>
#include <linux/raid/pq.h>
#include <asm/fpu.h>