KVM: vmx: simplify MSR bitmap setup

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:22 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/1f6e5b25643e539e55a4c7553e4be6562c88fb76
Commit:     1f6e5b25643e539e55a4c7553e4be6562c88fb76
Parent:     07f36616cde482a9fd65da9a64f504190c7a0edb
Refname:    refs/heads/master
Author:     Paolo Bonzini <[email protected]>
AuthorDate: Wed Dec 20 11:32:16 2017 +0100
Committer:  Radim Krčmář <[email protected]>
CommitDate: Tue Jan 16 16:52:48 2018 +0100

    KVM: vmx: simplify MSR bitmap setup
    
    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 <[email protected]>
    [Resolved rebase conflict after removing Intel PT. - Radim]
    Signed-off-by: Radim Krčmář <[email protected]>
---
 arch/x86/kvm/vmx.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bbadd8c7e592..1f4a3037b99e 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -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 */
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html