Commit 6dbbd053 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Bjorn Helgaas

PCI/P2PDMA: Ignore root complex whitelist when an IOMMU is present

Presently, there is no path to DMA map P2PDMA memory, so if a TLP targeting
this memory hits the root complex and an IOMMU is present, the IOMMU will
reject the transaction, even if the RC would support P2PDMA.

So until the kernel knows to map these DMA addresses in the IOMMU, we
should not enable the whitelist when an IOMMU is present.

Link: https://lore.kernel.org/linux-pci/20190522201252.2997-1-logang@deltatee.com/
Fixes: 0f97da83 ("PCI/P2PDMA: Allow P2P DMA between any devices under AMD ZEN Root Complex")
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Christoph Hellwig <hch@lst.de>
parent a188339c
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/percpu-refcount.h> #include <linux/percpu-refcount.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/seq_buf.h> #include <linux/seq_buf.h>
#include <linux/iommu.h>
struct pci_p2pdma { struct pci_p2pdma {
struct percpu_ref devmap_ref; struct percpu_ref devmap_ref;
...@@ -284,6 +285,9 @@ static bool root_complex_whitelist(struct pci_dev *dev) ...@@ -284,6 +285,9 @@ static bool root_complex_whitelist(struct pci_dev *dev)
struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0)); struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0));
unsigned short vendor, device; unsigned short vendor, device;
if (iommu_present(dev->dev.bus))
return false;
if (!root) if (!root)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment