[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <34459274f8eb734c771e67bdb29371c95a3d807b.camel@redhat.com>
Date: Sun, 27 Mar 2022 18:15:30 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org
Cc: Jim Mattson <jmattson@...gle.com>,
Wanpeng Li <wanpengli@...cent.com>,
Borislav Petkov <bp@...en8.de>, Joerg Roedel <joro@...tes.org>,
Ingo Molnar <mingo@...hat.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
linux-kernel@...r.kernel.org,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 2/8] KVM: x86: SVM: use vmcb01 in avic_init_vmcb and
init_vmcb
On Thu, 2022-03-24 at 19:12 +0100, Paolo Bonzini wrote:
> On 3/22/22 18:24, Maxim Levitsky wrote:
> >
> > void avic_init_vmcb(struct vcpu_svm *svm)
> > {
> > - struct vmcb *vmcb = svm->vmcb;
> > + struct vmcb *vmcb = svm->vmcb01.ptr;
> > struct kvm_svm *kvm_svm = to_kvm_svm(svm->vcpu.kvm);
> > phys_addr_t bpa = __sme_set(page_to_phys(svm->avic_backing_page));
> > phys_addr_t lpa = __sme_set(page_to_phys(kvm_svm->avic_logical_id_table_page));
>
> Let's do this for consistency with e.g. svm_hv_init_vmcb:
>
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index b39fe614467a..ab202158137d 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -165,9 +165,8 @@ int avic_vm_init(struct kvm *kvm)
> return err;
> }
>
> -void avic_init_vmcb(struct vcpu_svm *svm)
> +void avic_init_vmcb(struct vcpu_svm *svm, struct vmcb *vmcb)
> {
> - struct vmcb *vmcb = svm->vmcb01.ptr;
> struct kvm_svm *kvm_svm = to_kvm_svm(svm->vcpu.kvm);
> phys_addr_t bpa = __sme_set(page_to_phys(svm->avic_backing_page));
> phys_addr_t lpa = __sme_set(page_to_phys(kvm_svm->avic_logical_id_table_page));
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index cc02506b7a19..ced8edad0c87 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -1123,7 +1123,7 @@ static void init_vmcb(struct kvm_vcpu *vcpu)
> set_msr_interception(vcpu, svm->msrpm, MSR_IA32_SPEC_CTRL, 1, 1);
>
> if (kvm_vcpu_apicv_active(vcpu))
> - avic_init_vmcb(svm);
> + avic_init_vmcb(svm, vmcb);
>
> if (vgif) {
> svm_clr_intercept(svm, INTERCEPT_STGI);
> diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
> index d07a5b88ea96..bbac6c24a8b8 100644
> --- a/arch/x86/kvm/svm/svm.h
> +++ b/arch/x86/kvm/svm/svm.h
> @@ -591,7 +591,7 @@ extern struct kvm_x86_nested_ops svm_nested_ops;
> int avic_ga_log_notifier(u32 ga_tag);
> void avic_vm_destroy(struct kvm *kvm);
> int avic_vm_init(struct kvm *kvm);
> -void avic_init_vmcb(struct vcpu_svm *svm);
> +void avic_init_vmcb(struct vcpu_svm *svm, struct vmcb *vmcb);
> int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu);
> int avic_unaccelerated_access_interception(struct kvm_vcpu *vcpu);
> int avic_init_vcpu(struct vcpu_svm *svm);
>
This is a very good idea, I will do this in the
next version of the patches.
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists