History

powerpc/dma: stop overriding dma_get_required_mask

The ppc_md and pci_controller_ops methods are unused now and can be removed. The dma_nommu implementation is generic to the generic one except for using max_pfn instead of calling into the memblock API, and all other dma_map_ops instances implement a method of their own.

Christoph Hellwig committed 7 years ago

Commit ffe3dfd1 parent 2d6ad416 files · +0 −38Browse files

Unified · Split

6 files
  1. arch/powerpc/include/asm/device.h +0 −2
  2. arch/powerpc/include/asm/dma-mapping.h +0 −2
  3. arch/powerpc/include/asm/machdep.h +0 −2
  4. arch/powerpc/include/asm/pci-bridge.h +0 −1
  5. arch/powerpc/kernel/dma.c +0 −29
  6. kernel/dma/mapping.c +0 −2
arch/powerpc/include/asm/device.h+0−2
@@ -59,6 +59,4 @@ struct pdev_archdata { · 58 unmodified lines
59 u64 dma_mask;59 u64 dma_mask;
60};60};
61 61
62#define ARCH_HAS_DMA_GET_REQUIRED_MASK
63
64#endif /* _ASM_POWERPC_DEVICE_H */62#endif /* _ASM_POWERPC_DEVICE_H */
arch/powerpc/include/asm/dma-mapping.h+0−2
@@ -112,7 +112,5 @@ static inline void set_dma_offset(struct device *dev, dma_addr_t off) · 111 unmodified lines
112 112
113#define HAVE_ARCH_DMA_SET_MASK 1113#define HAVE_ARCH_DMA_SET_MASK 1
114 114
115extern u64 __dma_get_required_mask(struct device *dev);
116
117#endif /* __KERNEL__ */115#endif /* __KERNEL__ */
118#endif /* _ASM_DMA_MAPPING_H */116#endif /* _ASM_DMA_MAPPING_H */
arch/powerpc/include/asm/machdep.h+0−2
@@ -47,9 +47,7 @@ struct machdep_calls { · 46 unmodified lines
47#endif47#endif
48#endif /* CONFIG_PPC64 */48#endif /* CONFIG_PPC64 */
49 49
50 /* Platform set_dma_mask and dma_get_required_mask overrides */
51 int (*dma_set_mask)(struct device *dev, u64 dma_mask);50 int (*dma_set_mask)(struct device *dev, u64 dma_mask);
52 u64 (*dma_get_required_mask)(struct device *dev);
53 51
54 int (*probe)(void);52 int (*probe)(void);
55 void (*setup_arch)(void); /* Optional, may be NULL */53 void (*setup_arch)(void); /* Optional, may be NULL */
arch/powerpc/include/asm/pci-bridge.h+0−1
@@ -46,7 +46,6 @@ struct pci_controller_ops { · 45 unmodified lines
46#endif46#endif
47 47
48 int (*dma_set_mask)(struct pci_dev *pdev, u64 dma_mask);48 int (*dma_set_mask)(struct pci_dev *pdev, u64 dma_mask);
49 u64 (*dma_get_required_mask)(struct pci_dev *pdev);
50 49
51 void (*shutdown)(struct pci_controller *hose);50 void (*shutdown)(struct pci_controller *hose);
52};51};
arch/powerpc/kernel/dma.c+0−29
@@ -318,35 +318,6 @@ int dma_set_mask(struct device *dev, u64 dma_mask) · 317 unmodified lines
318}318}
319EXPORT_SYMBOL(dma_set_mask);319EXPORT_SYMBOL(dma_set_mask);
320 320
321u64 __dma_get_required_mask(struct device *dev)
322{
323 const struct dma_map_ops *dma_ops = get_dma_ops(dev);
324
325 if (unlikely(dma_ops == NULL))
326 return 0;
327
328 if (dma_ops->get_required_mask)
329 return dma_ops->get_required_mask(dev);
330
331 return DMA_BIT_MASK(8 * sizeof(dma_addr_t));
332}
333
334u64 dma_get_required_mask(struct device *dev)
335{
336 if (ppc_md.dma_get_required_mask)
337 return ppc_md.dma_get_required_mask(dev);
338
339 if (dev_is_pci(dev)) {
340 struct pci_dev *pdev = to_pci_dev(dev);
341 struct pci_controller *phb = pci_bus_to_host(pdev->bus);
342 if (phb->controller_ops.dma_get_required_mask)
343 return phb->controller_ops.dma_get_required_mask(pdev);
344 }
345
346 return __dma_get_required_mask(dev);
347}
348EXPORT_SYMBOL_GPL(dma_get_required_mask);
349
350static int __init dma_init(void)321static int __init dma_init(void)
351{322{
352#ifdef CONFIG_IBMVIO323#ifdef CONFIG_IBMVIO
kernel/dma/mapping.c+0−2
@@ -207,7 +207,6 @@ int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, · 206 unmodified lines
207}207}
208EXPORT_SYMBOL(dma_mmap_attrs);208EXPORT_SYMBOL(dma_mmap_attrs);
209 209
210#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK
211static u64 dma_default_get_required_mask(struct device *dev)210static u64 dma_default_get_required_mask(struct device *dev)
212{211{
213 u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);212 u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
@@ -238,7 +237,6 @@ u64 dma_get_required_mask(struct device *dev) · 24 unmodified lines
238 return dma_default_get_required_mask(dev);237 return dma_default_get_required_mask(dev);
239}238}
240EXPORT_SYMBOL_GPL(dma_get_required_mask);239EXPORT_SYMBOL_GPL(dma_get_required_mask);
241#endif
242 240
243#ifndef arch_dma_alloc_attrs241#ifndef arch_dma_alloc_attrs
244#define arch_dma_alloc_attrs(dev) (true)242#define arch_dma_alloc_attrs(dev) (true)