Merge branch 'kvm-lapic-fix-and-cleanup' into HEAD
[linux-block.git] / arch / x86 / kvm / svm / svm.c
index 799b24801d310134903920c4bdbee78384659207..d13cf53e739067485f64b303b2f945b93117ae67 100644 (file)
@@ -825,7 +825,7 @@ void svm_set_x2apic_msr_interception(struct vcpu_svm *svm, bool intercept)
        if (intercept == svm->x2avic_msrs_intercepted)
                return;
 
-       if (avic_mode != AVIC_MODE_X2 ||
+       if (!x2avic_enabled ||
            !apic_x2apic_mode(svm->vcpu.arch.apic))
                return;
 
@@ -4769,10 +4769,10 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
        .enable_nmi_window = svm_enable_nmi_window,
        .enable_irq_window = svm_enable_irq_window,
        .update_cr8_intercept = svm_update_cr8_intercept,
-       .set_virtual_apic_mode = avic_set_virtual_apic_mode,
+       .set_virtual_apic_mode = avic_refresh_virtual_apic_mode,
        .refresh_apicv_exec_ctrl = avic_refresh_apicv_exec_ctrl,
-       .check_apicv_inhibit_reasons = avic_check_apicv_inhibit_reasons,
        .apicv_post_state_restore = avic_apicv_post_state_restore,
+       .required_apicv_inhibits = AVIC_REQUIRED_APICV_INHIBITS,
 
        .get_exit_info = svm_get_exit_info,
 
@@ -5026,6 +5026,8 @@ static __init int svm_hardware_setup(void)
                svm_x86_ops.vcpu_blocking = NULL;
                svm_x86_ops.vcpu_unblocking = NULL;
                svm_x86_ops.vcpu_get_apicv_inhibit_reasons = NULL;
+       } else if (!x2avic_enabled) {
+               svm_x86_ops.allow_apicv_in_x2apic_without_x2apic_virtualization = true;
        }
 
        if (vls) {