diff mbox series

[09/11] Revert "powerpc/pci: remove the dma_set_mask pci_controller ops methods"

Message ID 1572454800-17976-10-git-send-email-arbab@linux.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series powerpv/powernv: Restore pnv_npu_try_dma_set_bypass() | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (904ea5d546fe35c670396e4813e15c8b075b69f1)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked

Commit Message

Reza Arbab Oct. 30, 2019, 4:59 p.m. UTC
Bring back the pci controller based hook in dma_set_mask(), as it will
have a user again.

This reverts commit 662acad4067a ("powerpc/pci: remove the dma_set_mask
pci_controller ops methods"). The callback signature has been adjusted
with void return to fit its caller.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
---
 arch/powerpc/include/asm/pci-bridge.h | 2 ++
 arch/powerpc/kernel/dma-mask.c        | 9 +++++++++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index ea6ec65970ef..8512dcd053c5 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -43,6 +43,8 @@  struct pci_controller_ops {
 	void		(*teardown_msi_irqs)(struct pci_dev *pdev);
 #endif
 
+	void		(*dma_set_mask)(struct pci_dev *pdev, u64 dma_mask);
+
 	void		(*shutdown)(struct pci_controller *hose);
 };
 
diff --git a/arch/powerpc/kernel/dma-mask.c b/arch/powerpc/kernel/dma-mask.c
index ffbbbc432612..35b5fd1b03a6 100644
--- a/arch/powerpc/kernel/dma-mask.c
+++ b/arch/powerpc/kernel/dma-mask.c
@@ -2,11 +2,20 @@ 
 
 #include <linux/dma-mapping.h>
 #include <linux/export.h>
+#include <linux/pci.h>
 #include <asm/machdep.h>
 
 void arch_dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
 		ppc_md.dma_set_mask(dev, dma_mask);
+
+	if (dev_is_pci(dev)) {
+		struct pci_dev *pdev = to_pci_dev(dev);
+		struct pci_controller *phb = pci_bus_to_host(pdev->bus);
+
+		if (phb->controller_ops.dma_set_mask)
+			phb->controller_ops.dma_set_mask(pdev, dma_mask);
+	}
 }
 EXPORT_SYMBOL(arch_dma_set_mask);