[PATCH 04/14] KVM: monolithic: x86: handle the request_immediate_exit variation

From: Andrea Arcangeli
Date: Sat Sep 28 2019 - 13:24:39 EST


request_immediate_exit is one of those few cases where the pointer to
function of the method isn't fixed at build time and it requires
special handling because hardware_setup() may override it at runtime.

Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
---
arch/x86/kvm/vmx/vmx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index bb122ab4b96c..aad44e62b20a 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7022,7 +7022,10 @@ void kvm_x86_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)

void kvm_x86_request_immediate_exit(struct kvm_vcpu *vcpu)
{
- to_vmx(vcpu)->req_immediate_exit = true;
+ if (likely(enable_preemption_timer))
+ to_vmx(vcpu)->req_immediate_exit = true;
+ else
+ __kvm_request_immediate_exit(vcpu);
}

int kvm_x86_check_intercept(struct kvm_vcpu *vcpu,