KVM: vmx: simplify MSR bitmap setup
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 20 Dec 2017 10:32:16 +0000 (11:32 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Tue, 16 Jan 2018 15:52:48 +0000 (16:52 +0100)
The APICv-enabled MSR bitmap is a superset of the APICv-disabled bitmap.
Make that obvious in vmx_disable_intercept_msr_x2apic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Resolved rebase conflict after removing Intel PT. - Radim]
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/vmx.c

index bbadd8c7e59229bd537a0de01246a232432c1ad2..1f4a3037b99e090bca7329342854e8e6e8d57260 100644 (file)
@@ -5017,14 +5017,13 @@ static void vmx_disable_intercept_for_msr(u32 msr, bool longmode_only)
                                                msr, MSR_TYPE_R | MSR_TYPE_W);
 }
 
-static void vmx_disable_intercept_msr_x2apic(u32 msr, int type, bool apicv_active)
+static void vmx_disable_intercept_msr_x2apic(u32 msr, int type, bool apicv_only)
 {
-       if (apicv_active) {
-               __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv,
-                               msr, type);
-               __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv,
-                               msr, type);
-       } else {
+       __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv,
+                                       msr, type);
+       __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv,
+                                       msr, type);
+       if (!apicv_only) {
                __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic,
                                msr, type);
                __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic,
@@ -6872,7 +6871,6 @@ static __init int hardware_setup(void)
         * TPR reads and writes can be virtualized even if virtual interrupt
         * delivery is not in use.
         */
-       vmx_disable_intercept_msr_x2apic(0x808, MSR_TYPE_W, true);
        vmx_disable_intercept_msr_x2apic(0x808, MSR_TYPE_R | MSR_TYPE_W, false);
 
        /* EOI */