- Make sure the "svm" feature flag is cleared from /proc/cpuinfo when
virtualization support is disabled in the BIOS on AMD and Hygon platforms - A minor cleanup -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmU77KoACgkQEsHwGGHe VUrophAAtfsB+WhRydin0V6kjQeH+RbiWyx/jOw6eNqvzOzaOPxVXn0cAHRSgAO4 +S8tKIqaWpXNNNKpOIKBVaDkh9qr50/p36/jfVkXi8GOLYrK633F0BMjcG4+/vYQ A9b5iNiJhZ7xWE6+qRrqdg+o+a6UyPUGz34HNp3KwJVTdaHU2OnXXwuWeiUkgRrJ uQSfLc4+UIeefIzNy8Tqg083iaENBYMya7U90rzewD64NF0bsA15AEPut/6tnUVq ej3UU3cqO7nKXyhuZX+zpt856MZFa1rNYVXUAfoAO4xhqdN0Q5LFWO506sqajNx/ hqbT+hKDoC03zuLmbZO21s/uWQdtVFo63FU0h9QBRp1m6Ug5P3rQQCK8ydJc5xwr Yd7je6UPK9jIKBo9VP1qmsyzGwADNevNf1qGExHI2T6Wml7HgDmPysAHnGiKqRGI 1o9+Yqa+VBt8Wml9M8Ny+dLyr5F/2uq8sMrQedQlXdFMSzVm2JYecukJ5BvUWE/r Qyll8mTpIdgGXjBt56lMrgH7ibMC5ct/4MvTHOHuA997g/PwuwtWj7QyKXpUq2Rf o/c3zKKWIFxevjzwU86haCBaz+5xAQlB6dJw61ExxsmUuT/kZzkN15w6aqGZtpns PsARwnvuwZJ7vfqFLIa0ZkPN4OgnkRX7HlNqrVyKpONDTocZd9E= =i9On -----END PGP SIGNATURE----- Merge tag 'x86_cpu_for_6.7_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 cpuid updates from Borislav Petkov: - Make sure the "svm" feature flag is cleared from /proc/cpuinfo when virtualization support is disabled in the BIOS on AMD and Hygon platforms - A minor cleanup * tag 'x86_cpu_for_6.7_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu/amd: Remove redundant 'break' statement x86/cpu: Clear SVM feature if disabled by BIOS
This commit is contained in:
commit
ca2e9c3bee
5 changed files with 25 additions and 16 deletions
|
@ -1117,12 +1117,16 @@
|
|||
#define MSR_IA32_VMX_MISC_INTEL_PT (1ULL << 14)
|
||||
#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
|
||||
#define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE 0x1F
|
||||
/* AMD-V MSRs */
|
||||
|
||||
/* AMD-V MSRs */
|
||||
#define MSR_VM_CR 0xc0010114
|
||||
#define MSR_VM_IGNNE 0xc0010115
|
||||
#define MSR_VM_HSAVE_PA 0xc0010117
|
||||
|
||||
#define SVM_VM_CR_VALID_MASK 0x001fULL
|
||||
#define SVM_VM_CR_SVM_LOCK_MASK 0x0008ULL
|
||||
#define SVM_VM_CR_SVM_DIS_MASK 0x0010ULL
|
||||
|
||||
/* Hardware Feedback Interface */
|
||||
#define MSR_IA32_HW_FEEDBACK_PTR 0x17d0
|
||||
#define MSR_IA32_HW_FEEDBACK_CONFIG 0x17d1
|
||||
|
|
|
@ -229,10 +229,6 @@ struct __attribute__ ((__packed__)) vmcb_control_area {
|
|||
#define SVM_IOIO_SIZE_MASK (7 << SVM_IOIO_SIZE_SHIFT)
|
||||
#define SVM_IOIO_ASIZE_MASK (7 << SVM_IOIO_ASIZE_SHIFT)
|
||||
|
||||
#define SVM_VM_CR_VALID_MASK 0x001fULL
|
||||
#define SVM_VM_CR_SVM_LOCK_MASK 0x0008ULL
|
||||
#define SVM_VM_CR_SVM_DIS_MASK 0x0010ULL
|
||||
|
||||
#define SVM_NESTED_CTL_NP_ENABLE BIT(0)
|
||||
#define SVM_NESTED_CTL_SEV_ENABLE BIT(1)
|
||||
#define SVM_NESTED_CTL_SEV_ES_ENABLE BIT(2)
|
||||
|
@ -572,8 +568,6 @@ struct vmcb {
|
|||
|
||||
#define SVM_CPUID_FUNC 0x8000000a
|
||||
|
||||
#define SVM_VM_CR_SVM_DISABLE 4
|
||||
|
||||
#define SVM_SELECTOR_S_SHIFT 4
|
||||
#define SVM_SELECTOR_DPL_SHIFT 5
|
||||
#define SVM_SELECTOR_P_SHIFT 7
|
||||
|
|
|
@ -1014,7 +1014,6 @@ static bool cpu_has_zenbleed_microcode(void)
|
|||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (boot_cpu_data.microcode < good_rev)
|
||||
|
@ -1044,6 +1043,8 @@ static void zenbleed_check(struct cpuinfo_x86 *c)
|
|||
|
||||
static void init_amd(struct cpuinfo_x86 *c)
|
||||
{
|
||||
u64 vm_cr;
|
||||
|
||||
early_init_amd(c);
|
||||
|
||||
/*
|
||||
|
@ -1095,6 +1096,14 @@ static void init_amd(struct cpuinfo_x86 *c)
|
|||
|
||||
init_amd_cacheinfo(c);
|
||||
|
||||
if (cpu_has(c, X86_FEATURE_SVM)) {
|
||||
rdmsrl(MSR_VM_CR, vm_cr);
|
||||
if (vm_cr & SVM_VM_CR_SVM_DIS_MASK) {
|
||||
pr_notice_once("SVM disabled (by BIOS) in MSR_VM_CR\n");
|
||||
clear_cpu_cap(c, X86_FEATURE_SVM);
|
||||
}
|
||||
}
|
||||
|
||||
if (!cpu_has(c, X86_FEATURE_LFENCE_RDTSC) && cpu_has(c, X86_FEATURE_XMM2)) {
|
||||
/*
|
||||
* Use LFENCE for execution serialization. On families which
|
||||
|
|
|
@ -290,6 +290,8 @@ static void early_init_hygon(struct cpuinfo_x86 *c)
|
|||
|
||||
static void init_hygon(struct cpuinfo_x86 *c)
|
||||
{
|
||||
u64 vm_cr;
|
||||
|
||||
early_init_hygon(c);
|
||||
|
||||
/*
|
||||
|
@ -320,6 +322,14 @@ static void init_hygon(struct cpuinfo_x86 *c)
|
|||
|
||||
init_hygon_cacheinfo(c);
|
||||
|
||||
if (cpu_has(c, X86_FEATURE_SVM)) {
|
||||
rdmsrl(MSR_VM_CR, vm_cr);
|
||||
if (vm_cr & SVM_VM_CR_SVM_DIS_MASK) {
|
||||
pr_notice_once("SVM disabled (by BIOS) in MSR_VM_CR\n");
|
||||
clear_cpu_cap(c, X86_FEATURE_SVM);
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu_has(c, X86_FEATURE_XMM2)) {
|
||||
/*
|
||||
* Use LFENCE for execution serialization. On families which
|
||||
|
|
|
@ -531,8 +531,6 @@ static bool __kvm_is_svm_supported(void)
|
|||
int cpu = smp_processor_id();
|
||||
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
||||
|
||||
u64 vm_cr;
|
||||
|
||||
if (c->x86_vendor != X86_VENDOR_AMD &&
|
||||
c->x86_vendor != X86_VENDOR_HYGON) {
|
||||
pr_err("CPU %d isn't AMD or Hygon\n", cpu);
|
||||
|
@ -549,12 +547,6 @@ static bool __kvm_is_svm_supported(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
rdmsrl(MSR_VM_CR, vm_cr);
|
||||
if (vm_cr & (1 << SVM_VM_CR_SVM_DISABLE)) {
|
||||
pr_err("SVM disabled (by BIOS) in MSR_VM_CR on CPU %d\n", cpu);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue