summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2019-12-10 14:44:14 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-21 13:58:05 +0100
commitf1cdecf5807b1a91829a2dc4f254bfe6bafd4776 (patch)
tree25e4fa75712b31e9eee2e602fad3f1be6869218e
parentb11306b53b2540c6ba068c4deddb6a17d9f8d95b (diff)
downloadlwn-f1cdecf5807b1a91829a2dc4f254bfe6bafd4776.tar.gz
lwn-f1cdecf5807b1a91829a2dc4f254bfe6bafd4776.zip
KVM: x86: Ensure all logical CPUs have consistent reserved cr4 bits
Check the current CPU's reserved cr4 bits against the mask calculated for the boot CPU to ensure consistent behavior across all CPUs. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8a907cd7b1e1..960b886e1e43 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9461,6 +9461,13 @@ void kvm_arch_hardware_unsetup(void)
int kvm_arch_check_processor_compat(void)
{
+ struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
+
+ WARN_ON(!irqs_disabled());
+
+ if (kvm_host_cr4_reserved_bits(c) != cr4_reserved_bits)
+ return -EIO;
+
return kvm_x86_ops->check_processor_compatibility();
}