powerpc/pci: add dma_set_mask to pci_controller_ops
authorDaniel Axtens <dja@axtens.net>
Tue, 28 Apr 2015 05:12:06 +0000 (15:12 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 2 Jun 2015 03:18:49 +0000 (13:18 +1000)
Some systems only need to deal with DMA masks for PCI devices.
For these systems, we can avoid the need for a platform hook and
instead use a pci controller based hook.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/pci-bridge.h
arch/powerpc/kernel/dma.c

index a3b6252bcfc9f45284ec1814ed8d924aea8c4c12..6d17bb8498bf3a101c800ddb20cd3c73c55bd2ed 100644 (file)
@@ -36,6 +36,8 @@ struct pci_controller_ops {
                                          int nvec, int type);
        void            (*teardown_msi_irqs)(struct pci_dev *dev);
 #endif
+
+       int             (*dma_set_mask)(struct pci_dev *dev, u64 dma_mask);
 };
 
 /*
index 484b2d4462c10cd954aad0a5e9cb7776022b1db1..35e4dcc5dce362eb941fc18eabe39f797c90fba1 100644 (file)
@@ -248,6 +248,14 @@ int dma_set_mask(struct device *dev, u64 dma_mask)
 {
        if (ppc_md.dma_set_mask)
                return 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)
+                       return phb->controller_ops.dma_set_mask(pdev, dma_mask);
+       }
+
        return __dma_set_mask(dev, dma_mask);
 }
 EXPORT_SYMBOL(dma_set_mask);