Skip to contentSkip to conversation

MIPS: remove mips_swiotlb_ops

PATCH Applied Christoph Hellwig 2 participants 2 messages Jul 27, 2018 – Jul 28, 2018 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: remove mips_swiotlb_ops

mips_swiotlb_ops differs from the generic swiotlb_dma_ops only in that it contains a mb() barrier after each operations that maps or syncs dma memory to the device.

The dma operations are defined to not be memory barriers, but instead the write* operations to kick the DMA off are supposed to contain them.

For mips this handled by war_io_reorder_wmb(), which evaluates to the stronger wmb() instead of the pure compiler barrier barrier() for just those platforms that use swiotlb, so I think we are covered properly.

---
 arch/mips/include/asm/dma-mapping.h |  3 +-
 arch/mips/mm/Makefile               |  1 -
 arch/mips/mm/dma-swiotlb.c          | 61 -----------------------------
 3 files changed, 1 insertion(+), 64 deletions(-)
 delete mode 100644 arch/mips/mm/dma-swiotlb.c
arch/mips/include/asm/dma-mapping.h +1 -2
index 1c6e0c8ef4830..8ae7b20b68627 100644
@@ -3,14 +3,13 @@
 #define _ASM_DMA_MAPPING_H
 
 extern const struct dma_map_ops jazz_dma_ops;
-extern const struct dma_map_ops mips_swiotlb_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #if defined(CONFIG_MACH_JAZZ)
 	return &jazz_dma_ops;
 #elif defined(CONFIG_SWIOTLB)
-	return &mips_swiotlb_ops;
+	return &swiotlb_dma_ops;
 #elif defined(CONFIG_DMA_NONCOHERENT_OPS)
 	return &dma_noncoherent_ops;
 #else
arch/mips/mm/Makefile +0 -1
index 6922f393af196..3e5bb203c95ac 100644
@@ -18,7 +18,6 @@ obj-$(CONFIG_64BIT)		+= pgtable-64.o
 obj-$(CONFIG_HIGHMEM)		+= highmem.o
 obj-$(CONFIG_HUGETLB_PAGE)	+= hugetlbpage.o
 obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-noncoherent.o
-obj-$(CONFIG_SWIOTLB)		+= dma-swiotlb.o
 
 obj-$(CONFIG_CPU_R4K_CACHE_TLB) += c-r4k.o cex-gen.o tlb-r4k.o
 obj-$(CONFIG_CPU_R3000)		+= c-r3k.o tlb-r3k.o
arch/mips/mm/dma-swiotlb.c deleted +0 -61

61 lines not on this page · raw message

Signature · 1 line
2.18.0
Applied
#1 lore raw

Hi Christoph,

Quoted 12 lines · Christoph Hellwig

mips_swiotlb_ops differs from the generic swiotlb_dma_ops only in that it contains a mb() barrier after each operations that maps or syncs dma memory to the device.

The dma operations are defined to not be memory barriers, but instead the write* operations to kick the DMA off are supposed to contain them.

For mips this handled by war_io_reorder_wmb(), which evaluates to the stronger wmb() instead of the pure compiler barrier barrier() for just those platforms that use swiotlb, so I think we are covered properly.

Quoted 7 lines
---
 arch/mips/include/asm/dma-mapping.h |  3 +-
 arch/mips/mm/Makefile               |  1 -
 arch/mips/mm/dma-swiotlb.c          | 61 -----------------------------
 3 files changed, 1 insertion(+), 64 deletions(-)
 delete mode 100644 arch/mips/mm/dma-swiotlb.c

Thanks - this looks reasonable, but needed a small tweak to gain the definition of swiotlb_dma_ops from linux/swiotlb.h (as riscv & unicore32 do) in order to avoid build failures.

Hooray for even more deleted code :)

Applied to mips-next for 4.19.

Paul