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

Reza Arbab arbab at linux.ibm.com
Thu Oct 31 03:59:58 AEDT 2019


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 at linux.ibm.com>
Cc: Christoph Hellwig <hch at lst.de>
---
 arch/powerpc/include/asm/pci-bridge.h | 2 ++
 arch/powerpc/kernel/dma-mask.c        | 9 +++++++++
 2 files changed, 11 insertions(+)

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);
-- 
1.8.3.1



More information about the Linuxppc-dev mailing list