Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/amd: Keep track of amd_iommu_irq_remap state

The amd_iommu_irq_remap variable is set to true in amd_iommu_prepare().
But if initialization fails it is not set to false. Fix that and
correctly keep track of whether irq remapping is enabled or not.

References: https://bugzilla.kernel.org/show_bug.cgi?id=212133
References: https://bugzilla.suse.com/show_bug.cgi?id=1183132
Fixes: b34f10c2dc59 ("iommu/amd: Stop irq_remapping_select() matching when remapping is disabled")
Cc: stable@vger.kernel.org # v5.11
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20210317091037.31374-4-joro@8bytes.org
Acked-by: Huang Rui <ray.huang@amd.com>

+4 -1
+4 -1
drivers/iommu/amd/init.c
··· 3002 3002 amd_iommu_irq_remap = true; 3003 3003 3004 3004 ret = iommu_go_to_state(IOMMU_ACPI_FINISHED); 3005 - if (ret) 3005 + if (ret) { 3006 + amd_iommu_irq_remap = false; 3006 3007 return ret; 3008 + } 3009 + 3007 3010 return amd_iommu_irq_remap ? 0 : -ENODEV; 3008 3011 } 3009 3012