Re: [PATCH] iommu/amd: Fix iommu remap panic while amd_iommu is set to disable

From: Joerg Roedel
Date: Tue Mar 16 2021 - 09:17:20 EST


Hi Huang,

On Thu, Mar 11, 2021 at 10:28:07PM +0800, Huang Rui wrote:
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index f0adbc48fd17..a08e885403b7 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -3862,7 +3862,7 @@ static int irq_remapping_select(struct irq_domain *d, struct irq_fwspec *fwspec,
> else if (x86_fwspec_is_hpet(fwspec))
> devid = get_hpet_devid(fwspec->param[0]);
>
> - if (devid < 0)
> + if (devid < 0 || !amd_iommu_rlookup_table)
> return 0;

The problem is deeper than this fix suggests. I prepared other fixes for
this particular problem. Please find them here:

https://git.kernel.org/pub/scm/linux/kernel/git/joro/linux.git/log/?h=iommu-fixes

Regards,

Joerg