[PATCH 6/9] dmar-driver-name

Chris Wilson chris at chris-wilson.co.uk
Sun Sep 8 09:46:16 UTC 2019


---
 drivers/iommu/dmar.c | 22 ++++++++++++++++------
 drivers/pci/search.c |  1 -
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5d0754ed5fa0..92db917724cc 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1613,21 +1613,31 @@ void dmar_msi_read(int irq, struct msi_msg *msg)
 static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
 		u8 fault_reason, u16 source_id, unsigned long long addr)
 {
+	struct pci_dev *pdev;
 	const char *reason;
+	const char *name;
 	int fault_type;
 
+	pdev = pci_get_domain_bus_and_slot(0,
+					   source_id >> 0,
+					   PCI_DEVFN(PCI_SLOT(source_id & 0xff),
+						     PCI_FUNC(source_id & 0xff)));
+	name = pdev ? pci_name(pdev) : "unknown";
+
 	reason = dmar_get_fault_reason(fault_reason, &fault_type);
 
 	if (fault_type == INTR_REMAP)
-		pr_err("[INTR-REMAP] Request device [%02x:%02x.%d] fault index %llx [fault reason %02d] %s\n",
-			source_id >> 8, PCI_SLOT(source_id & 0xFF),
-			PCI_FUNC(source_id & 0xFF), addr >> 48,
-			fault_reason, reason);
+		pr_err("[INTR-REMAP] Request device %s [%02x:%02x.%d] fault index %llx [fault reason %02d] %s\n",
+		       name, source_id >> 8, PCI_SLOT(source_id & 0xFF),
+		       PCI_FUNC(source_id & 0xFF), addr >> 48,
+		       fault_reason, reason);
 	else
-		pr_err("[%s] Request device [%02x:%02x.%d] fault addr %llx [fault reason %02d] %s\n",
+		pr_err("[%s] Request device %s [%02x:%02x.%d] fault addr %llx [fault reason %02d] %s\n",
 		       type ? "DMA Read" : "DMA Write",
-		       source_id >> 8, PCI_SLOT(source_id & 0xFF),
+		       name, source_id >> 8, PCI_SLOT(source_id & 0xFF),
 		       PCI_FUNC(source_id & 0xFF), addr, fault_reason, reason);
+
+	pci_dev_put(pdev);
 	return 0;
 }
 
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 7f4e65872b8d..17da9b2e2b62 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -269,7 +269,6 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
 	struct device *dev_start = NULL;
 	struct pci_dev *pdev = NULL;
 
-	WARN_ON(in_interrupt());
 	if (from)
 		dev_start = &from->dev;
 	dev = bus_find_device(&pci_bus_type, dev_start, (void *)id,
-- 
2.23.0



More information about the Intel-gfx-trybot mailing list