]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: nVMX: Don't update GUEST_BNDCFGS if it's clean in HV eVMCS
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 7 May 2019 16:06:39 +0000 (09:06 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 18 Jun 2019 09:47:38 +0000 (11:47 +0200)
L1 is responsible for dirtying GUEST_GRP1 if it writes GUEST_BNDCFGS.

Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c

index ba7f16b3771914b1c2a45d7c515ef8150190446c..3363fe1e743ba30ffeb21ef7c172cacb3ce32a7b 100644 (file)
@@ -2197,6 +2197,10 @@ static void prepare_vmcs02_rare(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
                        vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2);
                        vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3);
                }
+
+               if (kvm_mpx_supported() && vmx->nested.nested_run_pending &&
+                   (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))
+                       vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);
        }
 
        if (nested_cpu_has_xsaves(vmcs12))
@@ -2232,10 +2236,6 @@ static void prepare_vmcs02_rare(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
        vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.guest.nr);
 
        set_cr4_guest_host_mask(vmx);
-
-       if (kvm_mpx_supported() && vmx->nested.nested_run_pending &&
-           (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))
-               vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);
 }
 
 /*