diff options
author | KarimAllah Ahmed <karahmed@amazon.de> | 2018-02-01 16:59:42 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-02-03 17:06:51 -0500 |
commit | b7b27aa011a1df42728d1768fc181d9ce69e6911 (patch) | |
tree | 9bfa1fdba54f0d2c5afe023c335e233d419b9511 | |
parent | a96223f1927f5d9afd86f1bc5199db3c8068bd44 (diff) |
KVM/x86: Update the reverse_cpuid list to include CPUID_7_EDX
[dwmw2: Stop using KF() for bits in it, too]
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com>
Link: https://lkml.kernel.org/r/1517522386-18410-2-git-send-email-karahmed@amazon.de
-rw-r--r-- | arch/x86/kvm/cpuid.c | 8 | ||||
-rw-r--r-- | arch/x86/kvm/cpuid.h | 1 |
2 files changed, 4 insertions, 5 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 0099e10eb045..c0eb337e7878 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -67,9 +67,7 @@ u64 kvm_supported_xcr0(void) | |||
67 | 67 | ||
68 | #define F(x) bit(X86_FEATURE_##x) | 68 | #define F(x) bit(X86_FEATURE_##x) |
69 | 69 | ||
70 | /* These are scattered features in cpufeatures.h. */ | 70 | /* For scattered features from cpufeatures.h; we currently expose none */ |
71 | #define KVM_CPUID_BIT_AVX512_4VNNIW 2 | ||
72 | #define KVM_CPUID_BIT_AVX512_4FMAPS 3 | ||
73 | #define KF(x) bit(KVM_CPUID_BIT_##x) | 71 | #define KF(x) bit(KVM_CPUID_BIT_##x) |
74 | 72 | ||
75 | int kvm_update_cpuid(struct kvm_vcpu *vcpu) | 73 | int kvm_update_cpuid(struct kvm_vcpu *vcpu) |
@@ -392,7 +390,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
392 | 390 | ||
393 | /* cpuid 7.0.edx*/ | 391 | /* cpuid 7.0.edx*/ |
394 | const u32 kvm_cpuid_7_0_edx_x86_features = | 392 | const u32 kvm_cpuid_7_0_edx_x86_features = |
395 | KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS); | 393 | F(AVX512_4VNNIW) | F(AVX512_4FMAPS); |
396 | 394 | ||
397 | /* all calls to cpuid_count() should be made on the same cpu */ | 395 | /* all calls to cpuid_count() should be made on the same cpu */ |
398 | get_cpu(); | 396 | get_cpu(); |
@@ -477,7 +475,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
477 | if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE)) | 475 | if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE)) |
478 | entry->ecx &= ~F(PKU); | 476 | entry->ecx &= ~F(PKU); |
479 | entry->edx &= kvm_cpuid_7_0_edx_x86_features; | 477 | entry->edx &= kvm_cpuid_7_0_edx_x86_features; |
480 | entry->edx &= get_scattered_cpuid_leaf(7, 0, CPUID_EDX); | 478 | cpuid_mask(&entry->edx, CPUID_7_EDX); |
481 | } else { | 479 | } else { |
482 | entry->ebx = 0; | 480 | entry->ebx = 0; |
483 | entry->ecx = 0; | 481 | entry->ecx = 0; |
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h index c2cea6651279..9a327d5b6d1f 100644 --- a/arch/x86/kvm/cpuid.h +++ b/arch/x86/kvm/cpuid.h | |||
@@ -54,6 +54,7 @@ static const struct cpuid_reg reverse_cpuid[] = { | |||
54 | [CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX}, | 54 | [CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX}, |
55 | [CPUID_7_ECX] = { 7, 0, CPUID_ECX}, | 55 | [CPUID_7_ECX] = { 7, 0, CPUID_ECX}, |
56 | [CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX}, | 56 | [CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX}, |
57 | [CPUID_7_EDX] = { 7, 0, CPUID_EDX}, | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature) | 60 | static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature) |