diff options
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/Kconfig | 3 | ||||
-rw-r--r-- | arch/tile/include/asm/dma-mapping.h | 20 | ||||
-rw-r--r-- | arch/tile/kernel/pci-dma.c | 38 | ||||
-rw-r--r-- | arch/tile/kernel/setup.c | 8 |
4 files changed, 10 insertions, 59 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 02f269cfa538..ef9d403cbbe4 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig @@ -249,7 +249,7 @@ config HIGHMEM If unsure, say "true". -config ZONE_DMA +config ZONE_DMA32 def_bool y config IOMMU_HELPER @@ -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 diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index 97ad62878290..d25fce101fc0 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h @@ -44,26 +44,6 @@ static inline void set_dma_offset(struct device *dev, dma_addr_t off) dev->archdata.dma_offset = off; } -static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) -{ - return paddr; -} - -static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) -{ - return daddr; -} - -static inline void dma_mark_clean(void *addr, size_t size) {} - -static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) -{ - if (!dev->dma_mask) - return 0; - - return addr + size - 1 <= *dev->dma_mask; -} - #define HAVE_ARCH_DMA_SET_MASK 1 int dma_set_mask(struct device *dev, u64 mask); diff --git a/arch/tile/kernel/pci-dma.c b/arch/tile/kernel/pci-dma.c index f2abedc8a080..6a1efe5543fa 100644 --- a/arch/tile/kernel/pci-dma.c +++ b/arch/tile/kernel/pci-dma.c @@ -54,7 +54,7 @@ static void *tile_dma_alloc_coherent(struct device *dev, size_t size, * which case we will return NULL. But such devices are uncommon. */ if (dma_mask <= DMA_BIT_MASK(32)) { - gfp |= GFP_DMA; + gfp |= GFP_DMA32; node = 0; } @@ -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_DMA; - 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; diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index ad83c1e66dbd..eb4e198f6f93 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c @@ -814,11 +814,11 @@ static void __init zone_sizes_init(void) #endif if (start < dma_end) { - zones_size[ZONE_DMA] = min(zones_size[ZONE_NORMAL], + zones_size[ZONE_DMA32] = min(zones_size[ZONE_NORMAL], dma_end - start); - zones_size[ZONE_NORMAL] -= zones_size[ZONE_DMA]; + zones_size[ZONE_NORMAL] -= zones_size[ZONE_DMA32]; } else { - zones_size[ZONE_DMA] = 0; + zones_size[ZONE_DMA32] = 0; } /* Take zone metadata from controller 0 if we're isolnode. */ @@ -830,7 +830,7 @@ static void __init zone_sizes_init(void) PFN_UP(node_percpu[i])); /* Track the type of memory on each node */ - if (zones_size[ZONE_NORMAL] || zones_size[ZONE_DMA]) + if (zones_size[ZONE_NORMAL] || zones_size[ZONE_DMA32]) node_set_state(i, N_NORMAL_MEMORY); #ifdef CONFIG_HIGHMEM if (end != start) |