kvm: x86: Use KVM CPU capabilities to determine CR4 reserved bits
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 May 2020 13:40:46 +0000 (09:40 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 6 May 2020 10:51:36 +0000 (06:51 -0400)
commit139f7425fdf54f054463e7524b9f54c41af8407f
treec6a22176977632b38d79fe96aac1828070f53fb1
parentc7cb2d650c9e78c03bd2d1c0db89891825f8c0f4
kvm: x86: Use KVM CPU capabilities to determine CR4 reserved bits

Using CPUID data can be useful for the processor compatibility
check, but that's it.  Using it to compute guest-reserved bits
can have both false positives (such as LA57 and UMIP which we
are already handling) and false negatives: in particular, with
this patch we don't allow anymore a KVM guest to set CR4.PKE
when CR4.PKE is clear on the host.

Fixes: b9dd21e104bc ("KVM: x86: simplify handling of PKRU")
Reported-by: Jim Mattson <jmattson@google.com>
Tested-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c