OSDN Git Service

KVM: x86: Add support for RDPID without RDTSCP
authorSean Christopherson <seanjc@google.com>
Tue, 4 May 2021 17:17:26 +0000 (10:17 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 May 2021 10:06:17 +0000 (06:06 -0400)
commit36fa06f9ff39f23e03cd8206dc6bbb7711c23be6
tree061a01f384438101cb391e99db0f213fb0cfdf75
parent0caa0a77c2f6fcd0830cdcd018db1af98fe35e28
KVM: x86: Add support for RDPID without RDTSCP

Allow userspace to enable RDPID for a guest without also enabling RDTSCP.
Aside from checking for RDPID support in the obvious flows, VMX also needs
to set ENABLE_RDTSCP=1 when RDPID is exposed.

For the record, there is no known scenario where enabling RDPID without
RDTSCP is desirable.  But, both AMD and Intel architectures allow for the
condition, i.e. this is purely to make KVM more architecturally accurate.

Fixes: 41cd02c6f7f6 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID")
Cc: stable@vger.kernel.org
Reported-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210504171734.1434054-8-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c