KVM: x86: Make vmx_get_exit_qual() and vmx_get_intr_info() noinstr-friendly
authorSean Christopherson <seanjc@google.com>
Tue, 13 Dec 2022 06:09:06 +0000 (06:09 +0000)
committerSean Christopherson <seanjc@google.com>
Tue, 24 Jan 2023 18:35:38 +0000 (10:35 -0800)
commitfc9465be8aad2042978590d44c01350534c1ac11
treeb5a41794944c78411c5b155bab40ec5c630ee6fd
parente8733482f59e23a8bf79526b7f83ed0d0ff5a9b2
KVM: x86: Make vmx_get_exit_qual() and vmx_get_intr_info() noinstr-friendly

Add an extra special noinstr-friendly helper to test+mark a "register"
available and use it when caching vmcs.EXIT_QUALIFICATION and
vmcs.VM_EXIT_INTR_INFO.  Make the caching helpers __always_inline too so
that they can be used in noinstr functions.

A future fix will move VMX's handling of NMI exits into the noinstr
vmx_vcpu_enter_exit() so that the NMI is processed before any kind of
instrumentation can trigger a fault and thus IRET, i.e. so that KVM
doesn't invoke the NMI handler with NMIs enabled.

Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20221213060912.654668-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/vmx/vmx.h