Skip to content

Commit b2b2069

Browse files
author
Christoph Hellwig
committed
tile: use generic swiotlb_ops
These are identical to the tile ops, and would also support CMA if enabled on tile. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Christian König <[email protected]>
1 parent d3ce48e commit b2b2069

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

arch/tile/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ config NEED_SG_DMA_LENGTH
261261
config SWIOTLB
262262
bool
263263
default TILEGX
264+
select DMA_DIRECT_OPS
264265
select IOMMU_HELPER
265266
select NEED_SG_DMA_LENGTH
266267
select ARCH_HAS_DMA_SET_COHERENT_MASK

arch/tile/kernel/pci-dma.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -509,39 +509,9 @@ EXPORT_SYMBOL(gx_pci_dma_map_ops);
509509
/* PCI DMA mapping functions for legacy PCI devices */
510510

511511
#ifdef CONFIG_SWIOTLB
512-
static void *tile_swiotlb_alloc_coherent(struct device *dev, size_t size,
513-
dma_addr_t *dma_handle, gfp_t gfp,
514-
unsigned long attrs)
515-
{
516-
gfp |= GFP_DMA32;
517-
return swiotlb_alloc_coherent(dev, size, dma_handle, gfp);
518-
}
519-
520-
static void tile_swiotlb_free_coherent(struct device *dev, size_t size,
521-
void *vaddr, dma_addr_t dma_addr,
522-
unsigned long attrs)
523-
{
524-
swiotlb_free_coherent(dev, size, vaddr, dma_addr);
525-
}
526-
527-
static const struct dma_map_ops pci_swiotlb_dma_ops = {
528-
.alloc = tile_swiotlb_alloc_coherent,
529-
.free = tile_swiotlb_free_coherent,
530-
.map_page = swiotlb_map_page,
531-
.unmap_page = swiotlb_unmap_page,
532-
.map_sg = swiotlb_map_sg_attrs,
533-
.unmap_sg = swiotlb_unmap_sg_attrs,
534-
.sync_single_for_cpu = swiotlb_sync_single_for_cpu,
535-
.sync_single_for_device = swiotlb_sync_single_for_device,
536-
.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
537-
.sync_sg_for_device = swiotlb_sync_sg_for_device,
538-
.dma_supported = swiotlb_dma_supported,
539-
.mapping_error = swiotlb_dma_mapping_error,
540-
};
541-
542512
static const struct dma_map_ops pci_hybrid_dma_ops = {
543-
.alloc = tile_swiotlb_alloc_coherent,
544-
.free = tile_swiotlb_free_coherent,
513+
.alloc = swiotlb_alloc,
514+
.free = swiotlb_free,
545515
.map_page = tile_pci_dma_map_page,
546516
.unmap_page = tile_pci_dma_unmap_page,
547517
.map_sg = tile_pci_dma_map_sg,
@@ -552,7 +522,7 @@ static const struct dma_map_ops pci_hybrid_dma_ops = {
552522
.sync_sg_for_device = tile_pci_dma_sync_sg_for_device,
553523
};
554524

555-
const struct dma_map_ops *gx_legacy_pci_dma_map_ops = &pci_swiotlb_dma_ops;
525+
const struct dma_map_ops *gx_legacy_pci_dma_map_ops = &swiotlb_dma_ops;
556526
const struct dma_map_ops *gx_hybrid_pci_dma_map_ops = &pci_hybrid_dma_ops;
557527
#else
558528
const struct dma_map_ops *gx_legacy_pci_dma_map_ops;

0 commit comments

Comments
 (0)