]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: nVMX: Implement evmcs_field_offset() suitable for handle_vmread()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 12 Jan 2022 17:01:33 +0000 (18:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Feb 2022 16:29:19 +0000 (17:29 +0100)
commit01a15e36b1fb209a0cd589a1ce007e11776b640b
tree8b38eafdac3fa1c3a4b6f2b0525476cbbdeed8e6
parentea30a90df837a3442f15e6b171fba390674227fe
KVM: nVMX: Implement evmcs_field_offset() suitable for handle_vmread()

commit 892a42c10ddb945d3a4dcf07dccdf9cb98b21548 upstream.

In preparation to allowing reads from Enlightened VMCS from
handle_vmread(), implement evmcs_field_offset() to get the correct
read offset. get_evmcs_offset(), which is being used by KVM-on-Hyper-V,
is almost what's needed but a few things need to be adjusted. First,
WARN_ON() is unacceptable for handle_vmread() as any field can (in
theory) be supplied by the guest and not all fields are defined in
eVMCS v1. Second, we need to handle 'holes' in eVMCS (missing fields).
It also sounds like a good idea to WARN_ON() if such fields are ever
accessed by KVM-on-Hyper-V.

Implement dedicated evmcs_field_offset() helper.

No functional change intended.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220112170134.1904308-5-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/vmx/evmcs.c
arch/x86/kvm/vmx/evmcs.h