]> git.baikalelectronics.ru Git - kernel.git/commit
x86/kvm/hyper-v: move VMX controls sanitization out of nested_enable_evmcs()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 5 Feb 2020 12:30:33 +0000 (13:30 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 5 Feb 2020 14:55:06 +0000 (15:55 +0100)
commit6f1b53a166c62048e3376d21dd9ee338d226d95c
tree0f1d1ebeab2e9cfd7a2e63abc7547446345c25da
parentf3bda4d77a1abd98d340f5cebc7e882fd6e4fa3b
x86/kvm/hyper-v: move VMX controls sanitization out of nested_enable_evmcs()

With fine grained VMX feature enablement QEMU>=4.2 tries to do KVM_SET_MSRS
with default (matching CPU model) values and in case eVMCS is also enabled,
fails.

It would be possible to drop VMX feature filtering completely and make
this a guest's responsibility: if it decides to use eVMCS it should know
which fields are available and which are not. Hyper-V mostly complies to
this, however, there are some problematic controls:
SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES
VM_{ENTRY,EXIT}_LOAD_IA32_PERF_GLOBAL_CTRL

which Hyper-V enables. As there are no corresponding fields in eVMCS, we
can't handle this properly in KVM. This is a Hyper-V issue.

Move VMX controls sanitization from nested_enable_evmcs() to vmx_get_msr(),
and do the bare minimum (only clear controls which are known to cause issues).
This allows userspace to keep setting controls it wants and at the same
time hides them from the guest.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/evmcs.c
arch/x86/kvm/vmx/evmcs.h
arch/x86/kvm/vmx/vmx.c