]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: nVMX: Invert 'unsupported by eVMCSv1' check
authorVitaly Kuznetsov <vkuznets@redhat.com>
Fri, 4 Nov 2022 14:47:06 +0000 (15:47 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 24 Dec 2022 09:30:26 +0000 (04:30 -0500)
commit8f6972a4bf386f5b10bc4f3f81ceb981aee4fdc0
tree98097e82ec7c7f56dba7a8ebd42e6fe6b4aecf23
parent084ea02cc3361899e01e935b9fc96b83a3a64fe2
KVM: nVMX: Invert 'unsupported by eVMCSv1' check

When a new feature gets implemented in KVM, EVMCS1_UNSUPPORTED_* defines
need to be adjusted to avoid the situation when the feature is exposed
to the guest but there's no corresponding eVMCS field[s] for it. This
is not obvious and fragile. Invert 'unsupported by eVMCSv1' check and
make it 'supported by eVMCSv1' instead, this way it's much harder to
make a mistake. New features will get added to EVMCS1_SUPPORTED_*
defines when the corresponding fields are added to eVMCS definition.

No functional change intended. EVMCS1_SUPPORTED_* defines are composed
by taking KVM_{REQUIRED,OPTIONAL}_VMX_ defines and filtering out what
was previously known as EVMCS1_UNSUPPORTED_*.

From all the controls, SECONDARY_EXEC_TSC_SCALING requires special
handling as it's actually present in eVMCSv1 definition but is not
currently supported for Hyper-V-on-KVM, just for KVM-on-Hyper-V. As
evmcs_supported_ctrls will be used for both scenarios, just add it
there instead of EVMCS1_SUPPORTED_2NDEXEC.

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