aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0093-check-pci-dev-before-getting-pci-alias.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0093-check-pci-dev-before-getting-pci-alias.patch')
-rwxr-xr-xmeta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0093-check-pci-dev-before-getting-pci-alias.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0093-check-pci-dev-before-getting-pci-alias.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0093-check-pci-dev-before-getting-pci-alias.patch
new file mode 100755
index 00000000..9890a61c
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0093-check-pci-dev-before-getting-pci-alias.patch
@@ -0,0 +1,56 @@
+From 1bca08eb860a16e2679655918bd36f21fa213422 Mon Sep 17 00:00:00 2001
+From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
+Date: Thu, 26 Apr 2018 23:31:29 -0500
+Subject: [PATCH 93/95] check pci dev before getting pci alias
+
+Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
+---
+ drivers/iommu/amd_iommu.c | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
+index 10190e3..33dd869 100644
+--- a/drivers/iommu/amd_iommu.c
++++ b/drivers/iommu/amd_iommu.c
+@@ -254,7 +254,9 @@ static u16 get_alias(struct device *dev)
+ /* The callers make sure that get_device_id() does not fail here */
+ devid = get_device_id(dev);
+ ivrs_alias = amd_iommu_alias_table[devid];
+- pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);
++ if (dev_is_pci(dev)) {
++ pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);
++ }
+
+ if (ivrs_alias == pci_alias)
+ return ivrs_alias;
+@@ -280,18 +282,20 @@ static u16 get_alias(struct device *dev)
+ return pci_alias;
+ }
+
+- pr_info("AMD-Vi: Using IVRS reported alias %02x:%02x.%d "
+- "for device %s[%04x:%04x], kernel reported alias "
+- "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias),
+- PCI_FUNC(ivrs_alias), dev_name(dev), pdev->vendor, pdev->device,
+- PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias),
+- PCI_FUNC(pci_alias));
++ if (dev_is_pci(dev)) {
++ pr_info("AMD-Vi: Using IVRS reported alias %02x:%02x.%d "
++ "for device %s[%04x:%04x], kernel reported alias "
++ "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias),
++ PCI_FUNC(ivrs_alias), dev_name(dev), pdev->vendor, pdev->device,
++ PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias),
++ PCI_FUNC(pci_alias));
++ }
+
+ /*
+ * If we don't have a PCI DMA alias and the IVRS alias is on the same
+ * bus, then the IVRS table may know about a quirk that we don't.
+ */
+- if (pci_alias == devid &&
++ if (dev_is_pci(dev) && pci_alias == devid &&
+ PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) {
+ pci_add_dma_alias(pdev, ivrs_alias & 0xff);
+ pr_info("AMD-Vi: Added PCI DMA alias %02x.%d for %s\n",
+--
+2.7.4
+