summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/cpuid.c
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2020-03-03 00:56:26 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-16 17:58:11 +0100
commit7392079c4e740572a5af72a7223ef5e162e442c9 (patch)
tree69bdea208fcc16adee95d2e44689a233692b744e /arch/x86/kvm/cpuid.c
parentKVM: x86: Make kvm_mpx_supported() an inline function (diff)
downloadlinux-7392079c4e740572a5af72a7223ef5e162e442c9.tar.xz
linux-7392079c4e740572a5af72a7223ef5e162e442c9.zip
KVM: x86: Clear output regs for CPUID 0x14 if PT isn't exposed to guest
Clear the output regs for the main CPUID 0x14 leaf (index=0) if Intel PT isn't exposed to the guest. Leaf 0x14 enumerates Intel PT capabilities and should return zeroes if PT is not supported. Incorrectly reporting PT capabilities is essentially a cosmetic error, i.e. doesn't negatively affect any known userspace/kernel, as the existence of PT itself is correctly enumerated via CPUID 0x7. Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.c')
-rw-r--r--arch/x86/kvm/cpuid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 1ff16300a468..c194e49622b9 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -663,8 +663,10 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
break;
/* Intel PT */
case 0x14:
- if (!f_intel_pt)
+ if (!f_intel_pt) {
+ entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
break;
+ }
for (i = 1, max_idx = entry->eax; i <= max_idx; ++i) {
if (!do_host_cpuid(array, function, i))