Commit 0681de1b authored by Maxim Levitsky's avatar Maxim Levitsky Committed by Paolo Bonzini

KVM: SVM: use __GFP_ZERO instead of clear_page

Another small refactoring.
Suggested-by: default avatarJim Mattson <jmattson@google.com>
Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20200827171145.374620-5-mlevitsk@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent f4c847a9
...@@ -1190,11 +1190,11 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu) ...@@ -1190,11 +1190,11 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
svm = to_svm(vcpu); svm = to_svm(vcpu);
err = -ENOMEM; err = -ENOMEM;
vmcb_page = alloc_page(GFP_KERNEL_ACCOUNT); vmcb_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
if (!vmcb_page) if (!vmcb_page)
goto out; goto out;
hsave_page = alloc_page(GFP_KERNEL_ACCOUNT); hsave_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
if (!hsave_page) if (!hsave_page)
goto free_page1; goto free_page1;
...@@ -1209,7 +1209,6 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu) ...@@ -1209,7 +1209,6 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
svm->avic_is_running = true; svm->avic_is_running = true;
svm->nested.hsave = page_address(hsave_page); svm->nested.hsave = page_address(hsave_page);
clear_page(svm->nested.hsave);
svm->msrpm = svm_vcpu_init_msrpm(); svm->msrpm = svm_vcpu_init_msrpm();
if (!svm->msrpm) if (!svm->msrpm)
...@@ -1220,7 +1219,6 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu) ...@@ -1220,7 +1219,6 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu)
goto free_page3; goto free_page3;
svm->vmcb = page_address(vmcb_page); svm->vmcb = page_address(vmcb_page);
clear_page(svm->vmcb);
svm->vmcb_pa = __sme_set(page_to_pfn(vmcb_page) << PAGE_SHIFT); svm->vmcb_pa = __sme_set(page_to_pfn(vmcb_page) << PAGE_SHIFT);
svm->asid_generation = 0; svm->asid_generation = 0;
init_vmcb(svm); init_vmcb(svm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment