Skip to content

Commit b7b27aa

Browse files
KarimAllah AhmedKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Cc: [email protected] Cc: Radim Krčmář <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a96223f commit b7b27aa

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ u64 kvm_supported_xcr0(void)
6767

6868
#define F(x) bit(X86_FEATURE_##x)
6969

70-
/* These are scattered features in cpufeatures.h. */
71-
#define KVM_CPUID_BIT_AVX512_4VNNIW 2
72-
#define KVM_CPUID_BIT_AVX512_4FMAPS 3
70+
/* For scattered features from cpufeatures.h; we currently expose none */
7371
#define KF(x) bit(KVM_CPUID_BIT_##x)
7472

7573
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,
392390

393391
/* cpuid 7.0.edx*/
394392
const u32 kvm_cpuid_7_0_edx_x86_features =
395-
KF(AVX512_4VNNIW) | KF(AVX512_4FMAPS);
393+
F(AVX512_4VNNIW) | F(AVX512_4FMAPS);
396394

397395
/* all calls to cpuid_count() should be made on the same cpu */
398396
get_cpu();
@@ -477,7 +475,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
477475
if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE))
478476
entry->ecx &= ~F(PKU);
479477
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);
481479
} else {
482480
entry->ebx = 0;
483481
entry->ecx = 0;

arch/x86/kvm/cpuid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ static const struct cpuid_reg reverse_cpuid[] = {
5454
[CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX},
5555
[CPUID_7_ECX] = { 7, 0, CPUID_ECX},
5656
[CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX},
57+
[CPUID_7_EDX] = { 7, 0, CPUID_EDX},
5758
};
5859

5960
static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature)

0 commit comments

Comments
 (0)