*/
#define X86_FEATURE_L1TF_PTEINV ( 2*32+0) /* "" L1TF workaround PTE inversion */
#define X86_FEATURE_FLUSH_L1D ( 2*32+1) /* Flush L1D cache */
-#define X86_FEATURE_AMD_SSBD ( 2*32+2) /* "" Speculative Store Bypass Disable */
/* Other features, Linux-defined mapping, word 3 */
/* This range is used for feature bits which conflict or are synthesized */
if (ssb_mode == SPEC_STORE_BYPASS_DISABLE) {
/*
- * Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may
- * use a completely different MSR and bit dependent on family.
+ * Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD uses
+ * a completely different MSR and bit dependent on family.
*/
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL:
- case X86_VENDOR_AMD:
- if (ssb_mode == SPEC_STORE_BYPASS_DISABLE &&
- !static_cpu_has(X86_FEATURE_IBRS)) {
- x86_amd_ssbd_enable();
- break;
- }
-
x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
x86_spec_ctrl_mask |= SPEC_CTRL_SSBD;
x86_spec_ctrl_priv |= SPEC_CTRL_SSBD;
update_cpu_spec_ctrl_all();
break;
+ case X86_VENDOR_AMD:
+ if (ssb_mode == SPEC_STORE_BYPASS_DISABLE)
+ x86_amd_ssbd_enable();
+ break;
}
}
if (boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS))
set_cpu_cap(c, X86_FEATURE_IBRS);
if (ebx & BIT(15))
set_cpu_cap(c, X86_FEATURE_STIBP);
- if (ebx & BIT(24))
- set_cpu_cap(c, X86_FEATURE_AMD_SSBD);
if (ebx & BIT(25))
set_cpu_cap(c, X86_FEATURE_VIRT_SSBD);
}
return xcr0;
}
+
int kvm_update_cpuid(struct kvm_vcpu *vcpu)
{
struct kvm_cpuid_entry2 *best;
/* cpuid 0x80000008.ebx */
const u32 kvm_cpuid_80000008_ebx_x86_features =
- KF(IBPB) | KF(IBRS) | KF(AMD_SSBD) | KF(VIRT_SSBD);
+ KF(IBPB) | KF(IBRS) | KF(VIRT_SSBD);
/* all calls to cpuid_count() should be made on the same cpu */
get_cpu();
if ( !boot_cpu_has(X86_FEATURE_IBPB) )
entry->ebx &= ~(1u << KVM_CPUID_BIT_IBPB);
- /*
- * The preference is to use SPEC CTRL MSR instead of the
- * VIRT_SPEC MSR.
- */
- if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) &&
- !boot_cpu_has(X86_FEATURE_AMD_SSBD))
+ if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD))
entry->ebx |= KF(VIRT_SSBD);
break;
}
/* These are scattered features in cpufeatures.h. */
#define KVM_CPUID_BIT_IBPB 12
-#define KVM_CPUID_BIT_AMD_SSBD 24
#define KVM_CPUID_BIT_VIRT_SSBD 25
#define KVM_CPUID_BIT_IBRS 26
#define KVM_CPUID_BIT_STIBP 27
best = kvm_find_cpuid_entry(vcpu, 7, 0);
return best && (best->edx & KF(SSBD));
}
-
-static inline bool guest_cpuid_has_amd_ssbd(struct kvm_vcpu *vcpu)
-{
- struct kvm_cpuid_entry2 *best;
-
- best = kvm_find_cpuid_entry(vcpu, 7, 0);
- return best && (best->edx & KF(AMD_SSBD));
-}
#endif
case MSR_IA32_SPEC_CTRL:
if (!msr_info->host_initiated &&
!guest_cpuid_has_ibrs(vcpu) &&
- !guest_cpuid_has_amd_ssbd(vcpu))
+ !guest_cpuid_has_ssbd(vcpu))
return 1;
msr_info->data = svm->spec_ctrl;
case MSR_IA32_SPEC_CTRL:
if (!msr->host_initiated &&
!guest_cpuid_has_ibrs(vcpu) &&
- !guest_cpuid_has_amd_ssbd(vcpu))
+ !guest_cpuid_has_ssbd(vcpu))
return 1;
/* The STIBP bit doesn't fault even if it's not advertised */
- if (data & ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP | SPEC_CTRL_SSBD))
+ if (data & ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP))
return 1;
svm->spec_ctrl = data;