@@ -1072,6 +1072,34 @@ void dmar_msi_read(int irq, struct msi_msg *msg)
spin_unlock_irqrestore(&iommu->register_lock, flag);
}
+static struct pci_dev *domain_find_pdev(u8 bus, u8 devfn)
+{
+ unsigned long flags;
+ struct pci_dev *pdev = NULL;
+ struct device_domain_info *info;
+
+ spin_lock_irqsave(&device_domain_lock, flags);
+ list_for_each_entry(info, &device_domain_list, global) {
+ if (info->bus == bus && info->devfn == devfn) {
+ pdev = info->dev;
+ break;
+ }
+ }
+ spin_unlock_irqrestore(&device_domain_lock, flags);
+ return pdev;
+}
+
+static void dump_mappings(u16 source_id)
+{
+ struct pci_dev *pdev;
+ u8 bus = source_id >> 8;
+ u8 devfn = source_id & 0xff;
+
+ pdev = domain_find_pdev(bus, devfn);
+ if (pdev)
+ debug_dma_dump_mappings(&pdev->dev);
+}
+
static int iommu_page_fault_do_one(struct intel_iommu *iommu, int type,
u8 fault_reason, u16 source_id, unsigned long long addr)
{
@@ -1086,6 +1114,8 @@ static int iommu_page_fault_do_one(struct intel_iommu *iommu, int type,
(type ? "DMA Read" : "DMA Write"),
(source_id >> 8), PCI_SLOT(source_id & 0xFF),
PCI_FUNC(source_id & 0xFF), addr, fault_reason, reason);
+
+ dump_mappings(source_id);
return 0;
}