]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: nVMX: Drop pointless msr_bitmap_map field from struct nested_vmx
authorSean Christopherson <seanjc@google.com>
Thu, 10 Oct 2024 18:23:26 +0000 (11:23 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Oct 2024 16:57:59 +0000 (12:57 -0400)
Remove vcpu_vmx.msr_bitmap_map and instead use an on-stack structure in
the one function that uses the map, nested_vmx_prepare_msr_bitmap().

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20241010182427.1434605-25-seanjc@google.com>

arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.h

index e94a25373a596c6aaee86974d91dfd40426f3df2..fb37658b62c9156727bb93aaa3a54ef1c9c5c50b 100644 (file)
@@ -621,7 +621,7 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
        int msr;
        unsigned long *msr_bitmap_l1;
        unsigned long *msr_bitmap_l0 = vmx->nested.vmcs02.msr_bitmap;
-       struct kvm_host_map *map = &vmx->nested.msr_bitmap_map;
+       struct kvm_host_map msr_bitmap_map;
 
        /* Nothing to do if the MSR bitmap is not in use.  */
        if (!cpu_has_vmx_msr_bitmap() ||
@@ -644,10 +644,10 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
                        return true;
        }
 
-       if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->msr_bitmap), map))
+       if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->msr_bitmap), &msr_bitmap_map))
                return false;
 
-       msr_bitmap_l1 = (unsigned long *)map->hva;
+       msr_bitmap_l1 = (unsigned long *)msr_bitmap_map.hva;
 
        /*
         * To keep the control flow simple, pay eight 8-byte writes (sixteen
@@ -711,7 +711,7 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
        nested_vmx_set_intercept_for_msr(vmx, msr_bitmap_l1, msr_bitmap_l0,
                                         MSR_IA32_FLUSH_CMD, MSR_TYPE_W);
 
-       kvm_vcpu_unmap(vcpu, &vmx->nested.msr_bitmap_map, false);
+       kvm_vcpu_unmap(vcpu, &msr_bitmap_map, false);
 
        vmx->nested.force_msr_bitmap_recalc = false;
 
index 2325f773a20be0ea8068675a17c634c15984f41d..40303b43da6c8dc1dc78d1b683dca4da50602884 100644 (file)
@@ -200,8 +200,6 @@ struct nested_vmx {
        struct kvm_host_map virtual_apic_map;
        struct kvm_host_map pi_desc_map;
 
-       struct kvm_host_map msr_bitmap_map;
-
        struct pi_desc *pi_desc;
        bool pi_pending;
        u16 posted_intr_nv;