[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0895007e-95d9-410e-8b24-d17172b0b908@amd.com>
Date: Fri, 11 Apr 2025 13:58:25 +0530
From: Sairaj Kodilkar <sarunkod@....com>
To: Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>, Joerg Roedel <joro@...tes.org>, David Woodhouse
<dwmw2@...radead.org>, Lu Baolu <baolu.lu@...ux.intel.com>
CC: <kvm@...r.kernel.org>, <iommu@...ts.linux.dev>,
<linux-kernel@...r.kernel.org>, Maxim Levitsky <mlevitsk@...hat.com>, "Joao
Martins" <joao.m.martins@...cle.com>, David Matlack <dmatlack@...gle.com>,
Naveen N Rao <naveen.rao@....com>, Vasant Hegde <vasant.hegde@....com>
Subject: Re: [PATCH 06/67] iommu/amd: WARN if KVM attempts to set vCPU
affinity without posted intrrupts
On 4/5/2025 1:08 AM, Sean Christopherson wrote:
> WARN if KVM attempts to set vCPU affinity when posted interrupts aren't
> enabled, as KVM shouldn't try to enable posting when they're unsupported,
> and the IOMMU driver darn well should only advertise posting support when
> AMD_IOMMU_GUEST_IR_VAPIC() is true.
>
> Note, KVM consumes is_guest_mode only on success.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> drivers/iommu/amd/iommu.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index b3a01b7757ee..4f69a37cf143 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -3852,19 +3852,12 @@ static int amd_ir_set_vcpu_affinity(struct irq_data *data, void *vcpu_info)
> if (!dev_data || !dev_data->use_vapic)
> return -EINVAL;
>
> + if (WARN_ON_ONCE(!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)))
> + return -EINVAL;
> +
Hi Sean,
'dev_data->use_vapic' is always zero when AMD IOMMU uses legacy
interrupts i.e. when AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) is 0.
Hence you can remove this additional check.
Regards
Sairaj Kodilkar
> ir_data->cfg = irqd_cfg(data);
> pi_data->ir_data = ir_data;
>
> - /* Note:
> - * SVM tries to set up for VAPIC mode, but we are in
> - * legacy mode. So, we force legacy mode instead.
> - */
> - if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) {
> - pr_debug("%s: Fall back to using intr legacy remap\n",
> - __func__);
> - pi_data->is_guest_mode = false;
> - }
> -
> pi_data->prev_ga_tag = ir_data->cached_ga_tag;
> if (pi_data->is_guest_mode) {
> ir_data->ga_root_ptr = (pi_data->base >> 12);
Powered by blists - more mailing lists