summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/cpuid.c
diff options
context:
space:
mode:
authorLike Xu <likexu@tencent.com>2022-01-17 08:45:31 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-01-19 18:09:25 +0100
commite9737468829c2f6abc0c67e5372f8878dff11653 (patch)
tree04048690d06ce1c577d22010672507e59b901abe /arch/x86/kvm/cpuid.c
parentKVM: x86/mmu: Improve TLB flush comment in kvm_mmu_slot_remove_write_access() (diff)
downloadlinux-e9737468829c2f6abc0c67e5372f8878dff11653.tar.xz
linux-e9737468829c2f6abc0c67e5372f8878dff11653.zip
KVM: x86/cpuid: Clear XFD for component i if the base feature is missing
According to Intel extended feature disable (XFD) spec, the sub-function i (i > 1) of CPUID function 0DH enumerates "details for state component i. ECX[2] enumerates support for XFD support for this state component." If KVM does not report F(XFD) feature (e.g. due to CONFIG_X86_64), then the corresponding XFD support for any state component i should also be removed. Translate this dependency into KVM terms. Fixes: 690a757d610e ("kvm: x86: Add CPUID support for Intel AMX") Signed-off-by: Like Xu <likexu@tencent.com> Message-Id: <20220117074531.76925-1-likexu@tencent.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.c')
-rw-r--r--arch/x86/kvm/cpuid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index a7c280d2113b..3902c28fb6cb 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -936,6 +936,9 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
--array->nent;
continue;
}
+
+ if (!kvm_cpu_cap_has(X86_FEATURE_XFD))
+ entry->ecx &= ~BIT_ULL(2);
entry->edx = 0;
}
break;