mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
x86/cpu: Hide and rename static_cpu_has()
cpu_feature_enabled() is the one to use to test feature flags so hide the static thing which doesn't pay attention to disabled mask bits anyway. Use the following command to do the replacement: $ git grep --files-with-matches -w static_cpu_has -- ':(exclude)*cpufeature.h' \ | xargs sed -i 's/static_cpu_has(/cpu_feature_enabled\(/g' There should be no functional changes resulting from this. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: https://patch.msgid.link/20260620015041.336288-1-bp@kernel.org
This commit is contained in:
@@ -49,7 +49,7 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
|
||||
* is not relevant.
|
||||
*/
|
||||
#define cpu_feature_enabled(bit) \
|
||||
(__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
|
||||
(__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
|
||||
|
||||
#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
|
||||
|
||||
@@ -64,15 +64,7 @@ extern void setup_clear_cpu_cap(unsigned int bit);
|
||||
|
||||
#define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit)
|
||||
|
||||
/*
|
||||
* Static testing of CPU features. Used the same as boot_cpu_has(). It
|
||||
* statically patches the target code for additional performance. Use
|
||||
* static_cpu_has() only in fast paths, where every cycle counts. Which
|
||||
* means that the boot_cpu_has() variant is already fast enough for the
|
||||
* majority of cases and you should stick to using it as it is generally
|
||||
* only two instructions: a RIP-relative MOV and a TEST.
|
||||
*/
|
||||
static __always_inline bool _static_cpu_has(u16 bit)
|
||||
static __always_inline bool __static_cpu_has(u16 bit)
|
||||
{
|
||||
asm goto("1: jmp 6f\n"
|
||||
"2:\n"
|
||||
@@ -116,7 +108,7 @@ t_no:
|
||||
return false;
|
||||
}
|
||||
|
||||
#define static_cpu_has(bit) \
|
||||
#define _static_cpu_has(bit) \
|
||||
( \
|
||||
__builtin_constant_p(boot_cpu_has(bit)) ? \
|
||||
boot_cpu_has(bit) : \
|
||||
@@ -126,7 +118,7 @@ t_no:
|
||||
#define cpu_has_bug(c, bit) cpu_has(c, (bit))
|
||||
#define set_cpu_bug(c, bit) set_cpu_cap(c, (bit))
|
||||
|
||||
#define static_cpu_has_bug(bit) static_cpu_has((bit))
|
||||
#define static_cpu_has_bug(bit) _static_cpu_has((bit))
|
||||
#define boot_cpu_has_bug(bit) cpu_has_bug(&boot_cpu_data, (bit))
|
||||
#define boot_cpu_set_bug(bit) set_cpu_cap(&boot_cpu_data, (bit))
|
||||
|
||||
|
||||
@@ -1388,7 +1388,7 @@ static struct attribute *amd_brs_events_attrs[] = {
|
||||
static umode_t
|
||||
amd_brs_is_visible(struct kobject *kobj, struct attribute *attr, int i)
|
||||
{
|
||||
return static_cpu_has(X86_FEATURE_BRS) && x86_pmu.lbr_nr ?
|
||||
return cpu_feature_enabled(X86_FEATURE_BRS) && x86_pmu.lbr_nr ?
|
||||
attr->mode : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -6360,7 +6360,7 @@ static void intel_pmu_cpu_starting(int cpu)
|
||||
* Deal with CPUs that don't clear their LBRs on power-up, and that may
|
||||
* even boot with LBRs enabled.
|
||||
*/
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && x86_pmu.lbr_nr)
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR) && x86_pmu.lbr_nr)
|
||||
msr_clear_bit(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR_BIT);
|
||||
intel_pmu_lbr_reset();
|
||||
|
||||
|
||||
+13
-13
@@ -109,7 +109,7 @@ static void intel_pmu_lbr_filter(struct cpu_hw_events *cpuc);
|
||||
|
||||
static __always_inline bool is_lbr_call_stack_bit_set(u64 config)
|
||||
{
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return !!(config & ARCH_LBR_CALL_STACK);
|
||||
|
||||
return !!(config & LBR_CALL_STACK);
|
||||
@@ -138,13 +138,13 @@ static void __intel_pmu_lbr_enable(bool pmi)
|
||||
*/
|
||||
if (cpuc->lbr_sel)
|
||||
lbr_select = cpuc->lbr_sel->config & x86_pmu.lbr_sel_mask;
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && !pmi && cpuc->lbr_sel)
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR) && !pmi && cpuc->lbr_sel)
|
||||
wrmsrq(MSR_LBR_SELECT, lbr_select);
|
||||
|
||||
rdmsrq(MSR_IA32_DEBUGCTLMSR, debugctl);
|
||||
orig_debugctl = debugctl;
|
||||
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
debugctl |= DEBUGCTLMSR_LBR;
|
||||
/*
|
||||
* LBR callstack does not work well with FREEZE_LBRS_ON_PMI.
|
||||
@@ -159,7 +159,7 @@ static void __intel_pmu_lbr_enable(bool pmi)
|
||||
if (orig_debugctl != debugctl)
|
||||
wrmsrq(MSR_IA32_DEBUGCTLMSR, debugctl);
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
wrmsrq(MSR_ARCH_LBR_CTL, lbr_select | ARCH_LBR_CTL_LBREN);
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ void intel_pmu_lbr_reset(void)
|
||||
|
||||
cpuc->last_task_ctx = NULL;
|
||||
cpuc->last_log_id = 0;
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
|
||||
wrmsrq(MSR_LBR_SELECT, 0);
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ static void intel_pmu_arch_lbr_xrstors(void *ctx)
|
||||
|
||||
static __always_inline bool lbr_is_reset_in_cstate(void *ctx)
|
||||
{
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return x86_pmu.lbr_deep_c_reset && !rdlbr_from(0, NULL);
|
||||
|
||||
return !rdlbr_from(((struct x86_perf_task_context *)ctx)->tos, NULL);
|
||||
@@ -624,7 +624,7 @@ void release_lbr_buffers(void)
|
||||
struct cpu_hw_events *cpuc;
|
||||
int cpu;
|
||||
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
@@ -643,7 +643,7 @@ void reserve_lbr_buffers(void)
|
||||
struct cpu_hw_events *cpuc;
|
||||
int cpu;
|
||||
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
@@ -730,7 +730,7 @@ void intel_pmu_lbr_disable_all(void)
|
||||
struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
|
||||
|
||||
if (cpuc->lbr_users && !vlbr_exclude_host()) {
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return __intel_pmu_arch_lbr_disable();
|
||||
|
||||
__intel_pmu_lbr_disable();
|
||||
@@ -889,7 +889,7 @@ static __always_inline u16 get_lbr_cycles(u64 info)
|
||||
{
|
||||
u16 cycles = info & LBR_INFO_CYCLES;
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR) &&
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR) &&
|
||||
(!static_branch_likely(&x86_lbr_cycles) ||
|
||||
!(info & LBR_INFO_CYC_CNT_VALID)))
|
||||
cycles = 0;
|
||||
@@ -1124,7 +1124,7 @@ static int intel_pmu_setup_hw_lbr_filter(struct perf_event *event)
|
||||
reg = &event->hw.branch_reg;
|
||||
reg->idx = EXTRA_REG_LBR;
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR)) {
|
||||
reg->config = mask;
|
||||
|
||||
/*
|
||||
@@ -1232,7 +1232,7 @@ intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
|
||||
* Doesn't support OTHER_BRANCH decoding for now.
|
||||
* OTHER_BRANCH branch type still rely on software decoding.
|
||||
*/
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR) &&
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR) &&
|
||||
type <= ARCH_LBR_BR_TYPE_KNOWN_MAX) {
|
||||
to_plm = kernel_ip(to) ? X86_BR_KERNEL : X86_BR_USER;
|
||||
type = arch_lbr_br_type_map[type] | to_plm;
|
||||
@@ -1279,7 +1279,7 @@ void intel_pmu_store_pebs_lbrs(struct lbr_entry *lbr)
|
||||
struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
|
||||
|
||||
/* Cannot get TOS for large PEBS and Arch LBR */
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR) ||
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR) ||
|
||||
(cpuc->n_pebs == cpuc->n_large_pebs))
|
||||
cpuc->lbr_stack.hw_idx = -1ULL;
|
||||
else
|
||||
|
||||
@@ -1175,7 +1175,7 @@ DECLARE_STATIC_CALL(x86_pmu_pebs_disable_all, *x86_pmu.pebs_disable_all);
|
||||
|
||||
static __always_inline struct x86_perf_task_context_opt *task_context_opt(void *ctx)
|
||||
{
|
||||
if (static_cpu_has(X86_FEATURE_ARCH_LBR))
|
||||
if (cpu_feature_enabled(X86_FEATURE_ARCH_LBR))
|
||||
return &((struct x86_perf_task_context_arch_lbr *)ctx)->opt;
|
||||
|
||||
return &((struct x86_perf_task_context *)ctx)->opt;
|
||||
|
||||
@@ -45,12 +45,12 @@ static inline bool __must_check rdseed_long(unsigned long *v)
|
||||
|
||||
static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)
|
||||
{
|
||||
return max_longs && static_cpu_has(X86_FEATURE_RDRAND) && rdrand_long(v) ? 1 : 0;
|
||||
return max_longs && cpu_feature_enabled(X86_FEATURE_RDRAND) && rdrand_long(v) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)
|
||||
{
|
||||
return max_longs && static_cpu_has(X86_FEATURE_RDSEED) && rdseed_long(v) ? 1 : 0;
|
||||
return max_longs && cpu_feature_enabled(X86_FEATURE_RDSEED) && rdseed_long(v) ? 1 : 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_UML
|
||||
|
||||
@@ -69,7 +69,7 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
|
||||
* is not relevant.
|
||||
*/
|
||||
#define cpu_feature_enabled(bit) \
|
||||
(__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit))
|
||||
(__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
|
||||
|
||||
#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
|
||||
|
||||
@@ -96,7 +96,7 @@ void check_cpufeature_deps(struct cpuinfo_x86 *c);
|
||||
* it to manifest the address of boot_cpu_data in a register, fouling
|
||||
* the mainline (post-initialization) code.
|
||||
*/
|
||||
static __always_inline bool _static_cpu_has(u16 bit)
|
||||
static __always_inline bool __static_cpu_has(u16 bit)
|
||||
{
|
||||
asm goto(ALTERNATIVE_TERNARY("jmp 6f", %c[feature], "", "jmp %l[t_no]")
|
||||
".pushsection .altinstr_aux,\"ax\"\n"
|
||||
@@ -116,17 +116,17 @@ t_no:
|
||||
return false;
|
||||
}
|
||||
|
||||
#define static_cpu_has(bit) \
|
||||
#define _static_cpu_has(bit) \
|
||||
( \
|
||||
__builtin_constant_p(boot_cpu_has(bit)) ? \
|
||||
boot_cpu_has(bit) : \
|
||||
_static_cpu_has(bit) \
|
||||
__static_cpu_has(bit) \
|
||||
)
|
||||
|
||||
#define cpu_has_bug(c, bit) cpu_has(c, (bit))
|
||||
#define set_cpu_bug(c, bit) set_cpu_cap(c, (bit))
|
||||
|
||||
#define static_cpu_has_bug(bit) static_cpu_has((bit))
|
||||
#define static_cpu_has_bug(bit) _static_cpu_has((bit))
|
||||
#define boot_cpu_has_bug(bit) cpu_has_bug(&boot_cpu_data, (bit))
|
||||
#define boot_cpu_set_bug(bit) set_cpu_cap(&boot_cpu_data, (bit))
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ static __always_inline unsigned long local_db_save(void)
|
||||
{
|
||||
unsigned long dr7;
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_HYPERVISOR) && !hw_breakpoint_active())
|
||||
if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) && !hw_breakpoint_active())
|
||||
return 0;
|
||||
|
||||
get_debugreg(dr7, 7);
|
||||
|
||||
@@ -911,7 +911,7 @@ pgd_t __pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd);
|
||||
*/
|
||||
static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)
|
||||
{
|
||||
if (!static_cpu_has(X86_FEATURE_PTI))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_PTI))
|
||||
return pgd;
|
||||
return __pti_set_user_pgtbl(pgdp, pgd);
|
||||
}
|
||||
@@ -1471,7 +1471,7 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
|
||||
{
|
||||
memcpy(dst, src, count * sizeof(pgd_t));
|
||||
#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
|
||||
if (!static_cpu_has(X86_FEATURE_PTI))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_PTI))
|
||||
return;
|
||||
/* Clone the user space pgd as well */
|
||||
memcpy(kernel_to_user_pgdp(dst), kernel_to_user_pgdp(src),
|
||||
|
||||
@@ -61,7 +61,7 @@ static __always_inline void sync_core(void)
|
||||
* The SERIALIZE instruction is the most straightforward way to
|
||||
* do this, but it is not universally available.
|
||||
*/
|
||||
if (static_cpu_has(X86_FEATURE_SERIALIZE)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_SERIALIZE)) {
|
||||
serialize();
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ static __always_inline void sync_core(void)
|
||||
static inline void sync_core_before_usermode(void)
|
||||
{
|
||||
/* With PTI, we unconditionally serialize before running user code. */
|
||||
if (static_cpu_has(X86_FEATURE_PTI))
|
||||
if (cpu_feature_enabled(X86_FEATURE_PTI))
|
||||
return;
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,7 +31,7 @@ static u32 numachip1_get_apic_id(u32 x)
|
||||
unsigned long value;
|
||||
unsigned int id = (x >> 24) & 0xff;
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_NODEID_MSR)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_NODEID_MSR)) {
|
||||
rdmsrq(MSR_FAM10H_NODE_ID, value);
|
||||
id |= (value << 2) & 0xff00;
|
||||
}
|
||||
|
||||
@@ -192,8 +192,8 @@ x86_virt_spec_ctrl(u64 guest_virt_spec_ctrl, bool setguest)
|
||||
* If SSBD is not handled in MSR_SPEC_CTRL on AMD, update
|
||||
* MSR_AMD64_L2_CFG or MSR_VIRT_SPEC_CTRL if supported.
|
||||
*/
|
||||
if (!static_cpu_has(X86_FEATURE_LS_CFG_SSBD) &&
|
||||
!static_cpu_has(X86_FEATURE_VIRT_SSBD))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_LS_CFG_SSBD) &&
|
||||
!cpu_feature_enabled(X86_FEATURE_VIRT_SSBD))
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -201,7 +201,7 @@ x86_virt_spec_ctrl(u64 guest_virt_spec_ctrl, bool setguest)
|
||||
* virtual MSR value. If its not permanently enabled, evaluate
|
||||
* current's TIF_SSBD thread flag.
|
||||
*/
|
||||
if (static_cpu_has(X86_FEATURE_SPEC_STORE_BYPASS_DISABLE))
|
||||
if (cpu_feature_enabled(X86_FEATURE_SPEC_STORE_BYPASS_DISABLE))
|
||||
hostval = SPEC_CTRL_SSBD;
|
||||
else
|
||||
hostval = ssbd_tif_to_spec_ctrl(ti->flags);
|
||||
@@ -2499,8 +2499,8 @@ static void __init ssb_apply_mitigation(void)
|
||||
* Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may
|
||||
* use a completely different MSR and bit dependent on family.
|
||||
*/
|
||||
if (!static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) &&
|
||||
!static_cpu_has(X86_FEATURE_AMD_SSBD)) {
|
||||
if (!cpu_feature_enabled(X86_FEATURE_SPEC_CTRL_SSBD) &&
|
||||
!cpu_feature_enabled(X86_FEATURE_AMD_SSBD)) {
|
||||
x86_amd_ssb_disable();
|
||||
} else {
|
||||
x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
|
||||
|
||||
@@ -654,7 +654,7 @@ static DEFINE_RAW_SPINLOCK(cache_disable_lock);
|
||||
*/
|
||||
static void maybe_flush_caches(void)
|
||||
{
|
||||
if (!static_cpu_has(X86_FEATURE_SELFSNOOP))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_SELFSNOOP))
|
||||
wbinvd();
|
||||
}
|
||||
|
||||
|
||||
@@ -874,7 +874,7 @@ void fpu_flush_thread(void)
|
||||
*/
|
||||
void switch_fpu_return(void)
|
||||
{
|
||||
if (!static_cpu_has(X86_FEATURE_FPU))
|
||||
if (!cpu_feature_enabled(X86_FEATURE_FPU))
|
||||
return;
|
||||
|
||||
fpregs_restore_userregs();
|
||||
|
||||
@@ -187,7 +187,7 @@ bool copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size, u
|
||||
ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
|
||||
IS_ENABLED(CONFIG_IA32_EMULATION));
|
||||
|
||||
if (!static_cpu_has(X86_FEATURE_FPU)) {
|
||||
if (!cpu_feature_enabled(X86_FEATURE_FPU)) {
|
||||
struct user_i387_ia32_struct fp;
|
||||
|
||||
fpregs_soft_get(current, NULL, (struct membuf){.p = &fp,
|
||||
|
||||
@@ -77,7 +77,7 @@ found:
|
||||
static void synthesize_clac(kprobe_opcode_t *addr)
|
||||
{
|
||||
/*
|
||||
* Can't be static_cpu_has() due to how objtool treats this feature bit.
|
||||
* Can't be cpu_feature_enabled() due to how objtool treats this feature bit.
|
||||
* This isn't a fast path anyway.
|
||||
*/
|
||||
if (!boot_cpu_has(X86_FEATURE_SMAP))
|
||||
|
||||
@@ -61,7 +61,7 @@ void load_mm_ldt(struct mm_struct *mm)
|
||||
*/
|
||||
|
||||
if (unlikely(ldt)) {
|
||||
if (static_cpu_has(X86_FEATURE_PTI)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_PTI)) {
|
||||
if (WARN_ON_ONCE((unsigned long)ldt->slot > 1)) {
|
||||
/*
|
||||
* Whoops -- either the new LDT isn't mapped
|
||||
|
||||
@@ -579,7 +579,7 @@ static __always_inline void amd_set_core_ssb_state(unsigned long tifn)
|
||||
struct ssb_state *st = this_cpu_ptr(&ssb_state);
|
||||
u64 msr = x86_amd_ls_cfg_base;
|
||||
|
||||
if (!static_cpu_has(X86_FEATURE_ZEN)) {
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ZEN)) {
|
||||
msr |= ssbd_tif_to_amd_ls_cfg(tifn);
|
||||
wrmsrq(MSR_AMD64_LS_CFG, msr);
|
||||
return;
|
||||
@@ -646,14 +646,14 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp,
|
||||
lockdep_assert_irqs_disabled();
|
||||
|
||||
/* Handle change of TIF_SSBD depending on the mitigation method. */
|
||||
if (static_cpu_has(X86_FEATURE_VIRT_SSBD)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_VIRT_SSBD)) {
|
||||
if (tif_diff & _TIF_SSBD)
|
||||
amd_set_ssb_virt_state(tifn);
|
||||
} else if (static_cpu_has(X86_FEATURE_LS_CFG_SSBD)) {
|
||||
} else if (cpu_feature_enabled(X86_FEATURE_LS_CFG_SSBD)) {
|
||||
if (tif_diff & _TIF_SSBD)
|
||||
amd_set_core_ssb_state(tifn);
|
||||
} else if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) ||
|
||||
static_cpu_has(X86_FEATURE_AMD_SSBD)) {
|
||||
} else if (cpu_feature_enabled(X86_FEATURE_SPEC_CTRL_SSBD) ||
|
||||
cpu_feature_enabled(X86_FEATURE_AMD_SSBD)) {
|
||||
updmsr |= !!(tif_diff & _TIF_SSBD);
|
||||
msr |= ssbd_tif_to_spec_ctrl(tifn);
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ static __always_inline void save_fsgs(struct task_struct *task)
|
||||
{
|
||||
savesegment(fs, task->thread.fsindex);
|
||||
savesegment(gs, task->thread.gsindex);
|
||||
if (static_cpu_has(X86_FEATURE_FSGSBASE)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_FSGSBASE)) {
|
||||
/*
|
||||
* If FSGSBASE is enabled, we can't make any useful guesses
|
||||
* about the base, and user code expects us to save the current
|
||||
@@ -391,7 +391,7 @@ static __always_inline void x86_pkru_load(struct thread_struct *prev,
|
||||
static __always_inline void x86_fsgsbase_load(struct thread_struct *prev,
|
||||
struct thread_struct *next)
|
||||
{
|
||||
if (static_cpu_has(X86_FEATURE_FSGSBASE)) {
|
||||
if (cpu_feature_enabled(X86_FEATURE_FSGSBASE)) {
|
||||
/* Update the FS and GS selectors if they could have changed. */
|
||||
if (unlikely(prev->fsindex || next->fsindex))
|
||||
loadseg(FS, next->fsindex);
|
||||
@@ -533,7 +533,7 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
|
||||
{
|
||||
WARN_ON_ONCE(regs != current_pt_regs());
|
||||
|
||||
if (static_cpu_has(X86_BUG_NULL_SEG)) {
|
||||
if (cpu_feature_enabled(X86_BUG_NULL_SEG)) {
|
||||
/* Loading zero below won't clear the base. */
|
||||
loadsegment(fs, __USER_DS);
|
||||
load_gs_index(__USER_DS);
|
||||
|
||||
@@ -357,7 +357,7 @@ int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
|
||||
unsafe_put_user(ptr_to_compat(&frame->uc), &frame->puc, Efault);
|
||||
|
||||
/* Create the ucontext. */
|
||||
if (static_cpu_has(X86_FEATURE_XSAVE))
|
||||
if (cpu_feature_enabled(X86_FEATURE_XSAVE))
|
||||
unsafe_put_user(UC_FP_XSTATE, &frame->uc.uc_flags, Efault);
|
||||
else
|
||||
unsafe_put_user(0, &frame->uc.uc_flags, Efault);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user