Skip to content

Commit 6dbbd05

Browse files
lsgunthbjorn-helgaas
authored andcommitted
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/[email protected]/ Fixes: 0f97da8 ("PCI/P2PDMA: Allow P2P DMA between any devices under AMD ZEN Root Complex") Signed-off-by: Logan Gunthorpe <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Cc: Christoph Hellwig <[email protected]>
1 parent a188339 commit 6dbbd05

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/pci/p2pdma.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/percpu-refcount.h>
1919
#include <linux/random.h>
2020
#include <linux/seq_buf.h>
21+
#include <linux/iommu.h>
2122

2223
struct pci_p2pdma {
2324
struct percpu_ref devmap_ref;
@@ -284,6 +285,9 @@ static bool root_complex_whitelist(struct pci_dev *dev)
284285
struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0));
285286
unsigned short vendor, device;
286287

288+
if (iommu_present(dev->dev.bus))
289+
return false;
290+
287291
if (!root)
288292
return false;
289293

0 commit comments

Comments
 (0)