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

Andrea Arcangeli
2019-11-04T23:01:22Z

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@redhat.com>
---
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 1a58ae38c8f2..9c5f0c67b899 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7103,7 +7103,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,