From: Andrew Oakley <[email protected]>

The IOAPIC always has the same device id but is sometimes reported in
the IVRS table with a different id.  This patch allows interrupt
remapping to work on devices with this bug.
---
 drivers/iommu/amd_iommu_init.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 18b0d99..ca266b9 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -751,6 +751,9 @@ static void __init set_device_exclusion_range(u16 devid, 
struct ivmd_header *m)
        }
 }
 
+/* SB IOAPIC is always on this device in AMD systems */
+#define IOAPIC_SB_DEVID                ((0x00 << 8) | PCI_DEVFN(0x14, 0))
+
 /*
  * Takes a pointer to an AMD IOMMU entry in the ACPI table and
  * initializes the hardware and our data structures with it.
@@ -928,6 +931,12 @@ static int __init init_iommu_from_acpi(struct amd_iommu 
*iommu,
                                    PCI_SLOT(devid),
                                    PCI_FUNC(devid));
 
+                       if (type == IVHD_SPECIAL_IOAPIC &&
+                           devid != IOAPIC_SB_DEVID) {
+                               pr_err(FW_BUG "AMD-Vi: wrong IOAPIC devid\n");
+                               devid = IOAPIC_SB_DEVID;
+                       }
+
                        set_dev_entry_from_acpi(iommu, devid, e->flags, 0);
                        ret = add_special_device(type, handle, devid);
                        if (ret)
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to