Home Home > GIT Browse > SLE15-SP1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-07-16 16:15:55 +0200
committerTakashi Iwai <tiwai@suse.de>2019-07-16 16:15:55 +0200
commit0a74943b6a1c57903c435b71688dd617c0f3f635 (patch)
treec5c36ed2d04d2fc432440c0a825c402b953521c6
parenteb96010000cd4337caa142769d0a353af2aaacee (diff)
PCI/P2PDMA: Fix missing check for dma_virt_ops (bsc#1111666).
-rw-r--r--patches.fixes/PCI-P2PDMA-Fix-missing-check-for-dma_virt_ops.patch55
-rw-r--r--series.conf1
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.fixes/PCI-P2PDMA-Fix-missing-check-for-dma_virt_ops.patch b/patches.fixes/PCI-P2PDMA-Fix-missing-check-for-dma_virt_ops.patch
new file mode 100644
index 0000000000..54bac97f85
--- /dev/null
+++ b/patches.fixes/PCI-P2PDMA-Fix-missing-check-for-dma_virt_ops.patch
@@ -0,0 +1,55 @@
+From 9c002bb66f5bd8b8f470926489a115b7f486f501 Mon Sep 17 00:00:00 2001
+From: Logan Gunthorpe <logang@deltatee.com>
+Date: Tue, 2 Jul 2019 11:35:44 -0600
+Subject: [PATCH] PCI/P2PDMA: Fix missing check for dma_virt_ops
+Git-commit: 9c002bb66f5bd8b8f470926489a115b7f486f501
+Patch-mainline: v5.3-rc1
+References: bsc#1111666
+
+Drivers that use dma_virt_ops were meant to be rejected when testing
+compatibility for P2PDMA.
+
+This check got inadvertently dropped in one of the later versions of the
+original patchset, so add it back.
+
+Fixes: 52916982af48 ("PCI/P2PDMA: Support peer-to-peer memory")
+Link: https://lore.kernel.org/r/20190702173544.21950-1-logang@deltatee.com
+Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/pci/p2pdma.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
+index 742928d0053e..1940a7a0a684 100644
+--- a/drivers/pci/p2pdma.c
++++ b/drivers/pci/p2pdma.c
+@@ -468,6 +468,14 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients,
+ return -1;
+
+ for (i = 0; i < num_clients; i++) {
++ if (IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
++ clients[i]->dma_ops == &dma_virt_ops) {
++ if (verbose)
++ dev_warn(clients[i],
++ "cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n");
++ return -1;
++ }
++
+ pci_client = find_parent_pci_dev(clients[i]);
+ if (!pci_client) {
+ if (verbose)
+@@ -732,7 +740,7 @@ int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+ * p2pdma mappings are not compatible with devices that use
+ * dma_virt_ops. If the upper layers do the right thing
+ * this should never happen because it will be prevented
+- * by the check in pci_p2pdma_add_client()
++ * by the check in pci_p2pdma_distance_many()
+ */
+ if (WARN_ON_ONCE(IS_ENABLED(CONFIG_DMA_VIRT_OPS) &&
+ dev->dma_ops == &dma_virt_ops))
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 60ada5703e..fb4c8de859 100644
--- a/series.conf
+++ b/series.conf
@@ -47740,6 +47740,7 @@
patches.drm/drm-amd-display-Make-some-functions-static.patch
patches.drm/drm-atmel-hlcdc-revert-shift-by-8.patch
patches.drm/drm-msm-mdp5-Fix-mdp5_cfg_init-error-return.patch
+ patches.fixes/PCI-P2PDMA-Fix-missing-check-for-dma_virt_ops.patch
# davem/net-next
patches.drivers/cxgb4-Enable-hash-filter-with-offload.patch