KVM: nVMX: generate MSR_IA32_CR{0,4}_FIXED1 from guest CPUID
authorDavid Matlack <dmatlack@google.com>
Wed, 30 Nov 2016 02:14:09 +0000 (18:14 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 8 Dec 2016 14:31:08 +0000 (15:31 +0100)
commit8322ebbb24088c22049ef53cd066c6c220640edb
treed91152a0df6fc1700e5f6c296f0f553b6572e439
parent3899152ccbf42d7e3d3c7830b1fae75a575a1ed6
KVM: nVMX: generate MSR_IA32_CR{0,4}_FIXED1 from guest CPUID

MSR_IA32_CR{0,4}_FIXED1 define which bits in CR0 and CR4 are allowed to
be 1 during VMX operation. Since the set of allowed-1 bits is the same
in and out of VMX operation, we can generate these MSRs entirely from
the guest's CPUID. This lets userspace avoiding having to save/restore
these MSRs.

This patch also initializes MSR_IA32_CR{0,4}_FIXED1 from the CPU's MSRs
by default. This is a saner than the current default of -1ull, which
includes bits that the host CPU does not support.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/vmx.c