tile: use generic swiotlb_ops
authorChristoph Hellwig <hch@lst.de>
Sun, 24 Dec 2017 14:14:03 +0000 (15:14 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 15 Jan 2018 08:35:58 +0000 (09:35 +0100)
These are identical to the tile ops, and would also support CMA
if enabled on tile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian König <christian.koenig@amd.com>
arch/tile/Kconfig
arch/tile/kernel/pci-dma.c

index 30c586686f2910171d15c7de8aec89fdaefd21c1..ef9d403cbbe4b126676af5c906a4f12b75109fc5 100644 (file)
@@ -261,6 +261,7 @@ config NEED_SG_DMA_LENGTH
 config SWIOTLB
        bool
        default TILEGX
+       select DMA_DIRECT_OPS
        select IOMMU_HELPER
        select NEED_SG_DMA_LENGTH
        select ARCH_HAS_DMA_SET_COHERENT_MASK
index a267fa74004819c21bedb9608d510837c5444475..6a1efe5543faef8d16f344275c04138ab1ea2a50 100644 (file)
@@ -509,39 +509,9 @@ EXPORT_SYMBOL(gx_pci_dma_map_ops);
 /* PCI DMA mapping functions for legacy PCI devices */
 
 #ifdef CONFIG_SWIOTLB
-static void *tile_swiotlb_alloc_coherent(struct device *dev, size_t size,
-                                        dma_addr_t *dma_handle, gfp_t gfp,
-                                        unsigned long attrs)
-{
-       gfp |= GFP_DMA32;
-       return swiotlb_alloc_coherent(dev, size, dma_handle, gfp);
-}
-
-static void tile_swiotlb_free_coherent(struct device *dev, size_t size,
-                                      void *vaddr, dma_addr_t dma_addr,
-                                      unsigned long attrs)
-{
-       swiotlb_free_coherent(dev, size, vaddr, dma_addr);
-}
-
-static const struct dma_map_ops pci_swiotlb_dma_ops = {
-       .alloc = tile_swiotlb_alloc_coherent,
-       .free = tile_swiotlb_free_coherent,
-       .map_page = swiotlb_map_page,
-       .unmap_page = swiotlb_unmap_page,
-       .map_sg = swiotlb_map_sg_attrs,
-       .unmap_sg = swiotlb_unmap_sg_attrs,
-       .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
-       .sync_single_for_device = swiotlb_sync_single_for_device,
-       .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
-       .sync_sg_for_device = swiotlb_sync_sg_for_device,
-       .dma_supported = swiotlb_dma_supported,
-       .mapping_error = swiotlb_dma_mapping_error,
-};
-
 static const struct dma_map_ops pci_hybrid_dma_ops = {
-       .alloc = tile_swiotlb_alloc_coherent,
-       .free = tile_swiotlb_free_coherent,
+       .alloc = swiotlb_alloc,
+       .free = swiotlb_free,
        .map_page = tile_pci_dma_map_page,
        .unmap_page = tile_pci_dma_unmap_page,
        .map_sg = tile_pci_dma_map_sg,
@@ -552,7 +522,7 @@ static const struct dma_map_ops pci_hybrid_dma_ops = {
        .sync_sg_for_device = tile_pci_dma_sync_sg_for_device,
 };
 
-const struct dma_map_ops *gx_legacy_pci_dma_map_ops = &pci_swiotlb_dma_ops;
+const struct dma_map_ops *gx_legacy_pci_dma_map_ops = &swiotlb_dma_ops;
 const struct dma_map_ops *gx_hybrid_pci_dma_map_ops = &pci_hybrid_dma_ops;
 #else
 const struct dma_map_ops *gx_legacy_pci_dma_map_ops;