OSDN Git Service

KVM: SVM: Drop redundant writes to vmcb->save.cr4 at RESET/INIT
authorSean Christopherson <seanjc@google.com>
Tue, 13 Jul 2021 16:33:09 +0000 (09:33 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 2 Aug 2021 15:01:56 +0000 (11:01 -0400)
Drop direct writes to vmcb->save.cr4 during vCPU RESET/INIT, as the
values being written are fully redundant with respect to
svm_set_cr4(vcpu, 0) a few lines earlier.  Note, svm_set_cr4() also
correctly forces X86_CR4_PAE when NPT is disabled.

No functional change intended.

Reviewed-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210713163324.627647-32-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c

index 0afa060..1038bfd 100644 (file)
@@ -1256,8 +1256,6 @@ static void init_vmcb(struct kvm_vcpu *vcpu)
        kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
        vcpu->arch.regs[VCPU_REGS_RIP] = 0x0000fff0;
 
-       save->cr4 = X86_CR4_PAE;
-
        if (npt_enabled) {
                /* Setup VMCB for Nested Paging */
                control->nested_ctl |= SVM_NESTED_CTL_NP_ENABLE;
@@ -1267,7 +1265,6 @@ static void init_vmcb(struct kvm_vcpu *vcpu)
                svm_clr_intercept(svm, INTERCEPT_CR3_WRITE);
                save->g_pat = vcpu->arch.pat;
                save->cr3 = 0;
-               save->cr4 = 0;
        }
        svm->current_vmcb->asid_generation = 0;
        svm->asid = 0;