]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
authorChristoph Hellwig <hch@lst.de>
Tue, 17 Apr 2018 20:02:10 +0000 (22:02 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 2 Aug 2018 11:54:11 +0000 (13:54 +0200)
This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Yoshinori Sato <ysato@users.sourceforge.jp>
arch/sh/Kconfig
arch/sh/include/asm/dma-mapping.h
arch/sh/kernel/Makefile
arch/sh/kernel/dma-nommu.c

index dd4f3d3e644fc537a8613e0c611d0932ae2d4707..c9993a0cdc7e98c3e8ac51e9926c21ef99dbb168 100644 (file)
@@ -159,6 +159,7 @@ config SWAP_IO_SPACE
        bool
 
 config DMA_COHERENT
+       select DMA_DIRECT_OPS
        bool
 
 config DMA_NONCOHERENT
index 149e71f95be740666a1737c1a0d5b0c2d75d952d..1ebc6a4eb1c5c72e3819deb020ec5e75ad2d6f33 100644 (file)
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
        return &nommu_dma_ops;
+#else
+       return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
index dc80041f73635219cbc0c30338cd30ae1d51a803..cb5f1bfb52de05a05bbe1dd1c7084eebe3570f23 100644 (file)
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y  := debugtraps.o dma-nommu.o dumpstack.o                 \
+obj-y  := debugtraps.o dumpstack.o             \
           idle.o io.o irq.o irq_$(BITS).o kdebugfs.o                   \
           machvec.o nmi_debug.o process.o                              \
           process_$(BITS).o ptrace.o ptrace_$(BITS).o                  \
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)               += disassemble.o
 obj-$(CONFIG_HIBERNATION)      += swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)   += dwarf.o
 obj-$(CONFIG_PERF_EVENTS)      += perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)  += dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)               += hw_breakpoint.o
 
 ccflags-y := -Werror
index 79a9edafa5b0e94b1f7f6f296f9cbe9a39cc5a7c..d8689b1cb743f491de8d61b4ae32d3709a1b6a8c 100644 (file)
@@ -51,7 +51,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
        return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
                              size_t size, enum dma_data_direction dir)
 {
@@ -67,16 +66,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
        for_each_sg(sg, s, nelems, i)
                sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
        .alloc                  = dma_generic_alloc_coherent,
        .free                   = dma_generic_free_coherent,
        .map_page               = nommu_map_page,
        .map_sg                 = nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
        .sync_single_for_device = nommu_sync_single_for_device,
        .sync_sg_for_device     = nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);