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>
pull/1188/head
Heiko Carstens 2025-02-07 15:49:08 +01:00 committed by Vasily Gorbik
parent 52109a067a
commit db14f78ecb
5 changed files with 6 additions and 14 deletions

View File

@ -141,6 +141,8 @@ static void detect_facilities(void)
set_machine_feature(MFEATURE_TX); set_machine_feature(MFEATURE_TX);
local_ctl_set_bit(0, CR0_TRANSACTIONAL_EXECUTION_BIT); 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) static int cmma_test_essa(void)

View File

@ -31,5 +31,6 @@ int cpu_have_feature(unsigned int nr);
#define cpu_has_seq_insn() test_facility(85) #define cpu_has_seq_insn() test_facility(85)
#define cpu_has_tlb_lc() test_facility(51) #define cpu_has_tlb_lc() test_facility(51)
#define cpu_has_topology() test_facility(11) #define cpu_has_topology() test_facility(11)
#define cpu_has_vx() test_facility(129)
#endif /* __ASM_S390_CPUFEATURE_H */ #endif /* __ASM_S390_CPUFEATURE_H */

View File

@ -44,6 +44,7 @@
#ifndef _ASM_S390_FPU_H #ifndef _ASM_S390_FPU_H
#define _ASM_S390_FPU_H #define _ASM_S390_FPU_H
#include <linux/cpufeature.h>
#include <linux/processor.h> #include <linux/processor.h>
#include <linux/preempt.h> #include <linux/preempt.h>
#include <linux/string.h> #include <linux/string.h>
@ -51,12 +52,6 @@
#include <asm/sigcontext.h> #include <asm/sigcontext.h>
#include <asm/fpu-types.h> #include <asm/fpu-types.h>
#include <asm/fpu-insn.h> #include <asm/fpu-insn.h>
#include <asm/facility.h>
static inline bool cpu_has_vx(void)
{
return likely(test_facility(129));
}
enum { enum {
KERNEL_FPC_BIT = 0, KERNEL_FPC_BIT = 0,

View File

@ -184,16 +184,10 @@ static noinline __init void setup_lowcore_early(void)
lc->return_mcck_lpswe = gen_lpswe(__LC_RETURN_MCCK_PSW); 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) static inline void save_vector_registers(void)
{ {
#ifdef CONFIG_CRASH_DUMP #ifdef CONFIG_CRASH_DUMP
if (test_facility(129)) if (cpu_has_vx())
save_vx_regs(boot_cpu_vector_save_area); save_vx_regs(boot_cpu_vector_save_area);
#endif #endif
} }
@ -232,7 +226,6 @@ void __init startup_init(void)
setup_lowcore_early(); setup_lowcore_early();
setup_arch_string(); setup_arch_string();
setup_boot_command_line(); setup_boot_command_line();
detect_machine_facilities();
save_vector_registers(); save_vector_registers();
setup_topology(); setup_topology();
sclp_early_detect(); sclp_early_detect();

View File

@ -11,6 +11,7 @@
* This file is postprocessed using unroll.awk. * This file is postprocessed using unroll.awk.
*/ */
#include <linux/cpufeature.h>
#include <linux/raid/pq.h> #include <linux/raid/pq.h>
#include <asm/fpu.h> #include <asm/fpu.h>