[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8dfb288e02cdd34e777061e725a5da55ebec6cf1.camel@redhat.com>
Date: Thu, 05 Oct 2023 15:49:49 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Joerg Roedel <joro@...tes.org>
Cc: kvm@...r.kernel.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/10] KVM: SVM: Drop pointless masking of default APIC
base when setting V_APIC_BAR
У вт, 2023-08-15 у 14:35 -0700, Sean Christopherson пише:
> Drop VMCB_AVIC_APIC_BAR_MASK, it's just a regurgitation of the maximum
> theoretical 4KiB-aligned physical address, i.e. is not novel in any way,
> and its only usage is to mask the default APIC base, which is 4KiB aligned
> and (obviously) a legal physical address.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> arch/x86/include/asm/svm.h | 2 --
> arch/x86/kvm/svm/avic.c | 2 +-
> 2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
> index 72ebd5e4e975..1e70600e84f7 100644
> --- a/arch/x86/include/asm/svm.h
> +++ b/arch/x86/include/asm/svm.h
> @@ -257,8 +257,6 @@ struct __attribute__ ((__packed__)) vmcb_control_area {
>
> #define AVIC_DOORBELL_PHYSICAL_ID_MASK GENMASK_ULL(11, 0)
>
> -#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL
While this mask is indeed not needed now because AVIC doesn't support non default APIC base,
this mask will be needed in my upcoming nested AVIC support, because nested hypervisor can
ask for any apic base it wishes for.
> -
> #define AVIC_UNACCEL_ACCESS_WRITE_MASK 1
> #define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0
> #define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index cfc8ab773025..7062164e4041 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -251,7 +251,7 @@ void avic_init_vmcb(struct vcpu_svm *svm, struct vmcb *vmcb)
> vmcb->control.avic_backing_page = bpa & AVIC_HPA_MASK;
> vmcb->control.avic_logical_id = lpa & AVIC_HPA_MASK;
> vmcb->control.avic_physical_id = ppa & AVIC_HPA_MASK;
> - vmcb->control.avic_vapic_bar = APIC_DEFAULT_PHYS_BASE & VMCB_AVIC_APIC_BAR_MASK;
> + vmcb->control.avic_vapic_bar = APIC_DEFAULT_PHYS_BASE;
Here I agree that the '&' is functionally pointless,
although I am not sure that removing it makes the code more readable.
Best regards,
Maxim Levitsky
>
> if (kvm_apicv_activated(svm->vcpu.kvm))
> avic_activate_vmcb(svm);
Powered by blists - more mailing lists