RE: ARC compact700 NPS platform - EZ_MachineCheck exception handler

2018-05-22 Thread Ofer Levi(SW)
There are two cases to consider for this exception: > but others can't so continuing despite it is recipe for disaster. Perhaps > your chip > has some spurious Machine check exceptions ? 1. Except for core 0, which is running the linux os, all other cores are running packet processing code in

[PATCH 22/25] sparc: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. This removes the previous sync_single_for_device implementation, which looks bogus given that no syncing is happening in the similar but more important map_single case. Signed-off-by: Christoph Hellwig --- arch/sparc/Kconfig

[PATCH 11/25] nios2: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/nios2/Kconfig | 3 + arch/nios2/include/asm/Kbuild| 1 + arch/nios2/include/asm/dma-mapping.h | 20 arch/nios2/mm/dma-mapping.c | 139 +++---

[PATCH 17/25] sh: introduce a sh_cacheop_vaddr helper

2018-05-22 Thread Christoph Hellwig
And use it in the maple bus code to avoid a dma API dependency. Signed-off-by: Christoph Hellwig --- arch/sh/include/asm/cacheflush.h | 7 +++ arch/sh/mm/consistent.c | 6 +- drivers/sh/maple/maple.c | 7 --- 3 files changed, 12 insertions(+), 8 deletions(-) diff --

[PATCH 18/25] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case

2018-05-22 Thread Christoph Hellwig
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 --- arch/sh/Kconfig | 1 + arch/sh/include/asm/dma-mappin

[PATCH 16/25] sh: simplify get_arch_dma_ops

2018-05-22 Thread Christoph Hellwig
Remove the indirection through the dma_ops variable, and just return nommu_dma_ops directly from get_arch_dma_ops. Signed-off-by: Christoph Hellwig --- arch/sh/include/asm/dma-mapping.h | 5 ++--- arch/sh/kernel/dma-nommu.c| 8 +--- arch/sh/mm/consistent.c | 3 --- arch/

[PATCH 15/25] openrisc: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/openrisc/Kconfig | 2 + arch/openrisc/include/asm/Kbuild| 1 + arch/openrisc/include/asm/dma-mapping.h | 35 - arch/openrisc/kernel/dma.c

[PATCH 13/25] openrisc: remove the no-op unmap_page and unmap_sg DMA operations

2018-05-22 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- arch/openrisc/kernel/dma.c | 23 --- 1 file changed, 23 deletions(-) diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c index 47601274abf7..7cadff93d179 100644 --- a/arch/openrisc/kernel/dma.c +++ b/arch/openrisc/kernel/d

[PATCH 14/25] openrisc: fix cache maintainance the the sync_single_for_device DMA operation

2018-05-22 Thread Christoph Hellwig
The cache maintaince in the sync_single_for_device operation should be equivalent to the map_page operation to facilitate reusing buffers. Fix the openrisc implementation by moving the cache maintaince performed in map_page into the sync_single method, and calling that from map_page. Signed-off-b

[PATCH 12/25] openrisc: remove the sync_single_for_cpu DMA operation

2018-05-22 Thread Christoph Hellwig
openrisc does all the required cache maintainance at dma map time, and none at unmap time. It thus has to implement sync_single_for_device to match the map cace for buffer reuse, but there is no point in doing another invalidation in the sync_single_cpu_case, which in terms of cache maintainance i

[PATCH 10/25] nds32: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/nds32/Kconfig | 3 + arch/nds32/include/asm/Kbuild| 1 + arch/nds32/include/asm/dma-mapping.h | 14 arch/nds32/kernel/dma.c | 113 +++---

[PATCH 09/25] nds32: implement the unmap_sg DMA operation

2018-05-22 Thread Christoph Hellwig
This matches the implementation of the more commonly used unmap_single routines and the sync_sg_for_cpu method which should provide equivalent cache maintainance. Signed-off-by: Christoph Hellwig --- arch/nds32/kernel/dma.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/nds32/ker

[PATCH 23/25] parisc: merge pcx_dma_ops and pcxl_dma_ops

2018-05-22 Thread Christoph Hellwig
The only difference is that pcxl supports dma coherent allocations, while pcx only supports non-consistent allocations and otherwise fails. But dma_alloc* is not in the fast path, and merging these two allows an easy migration path to the generic dma-noncoherent implementation, so do it. Signed-o

[PATCH 25/25] parisc: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Fix sync_single_for_cpu to do skip the cache flush unless the transfer is to the device to match the more tested unmap_single path which should have the same cache coherency implications. Signed-off-by: Christoph Hellwig --- arch/

[PATCH 24/25] parisc: always use flush_kernel_dcache_range for DMA cache maintainance

2018-05-22 Thread Christoph Hellwig
Current the S/G list based DMA ops use flush_kernel_vmap_range which contains a few UP optimizations, while the rest of the DMA operations uses flush_kernel_dcache_range. The single vs sg operations are supposed to have the same effect, so they should use the same routines. Use the more conservat

[PATCH 21/25] xtensa: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/xtensa/Kconfig | 3 + arch/xtensa/include/asm/Kbuild| 1 + arch/xtensa/include/asm/dma-mapping.h | 26 -- arch/xtensa/kernel/pci-dma.c | 130 +++-

[PATCH 20/25] sh: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/sh/Kconfig | 3 +- arch/sh/include/asm/Kbuild| 1 + arch/sh/include/asm/dma-mapping.h | 26 --- arch/sh/kernel/Makefile | 2 +- arch/sh/kernel

[PATCH 19/25] sh: split arch/sh/mm/consistent.c

2018-05-22 Thread Christoph Hellwig
Half of the file just contains platform device memory setup code which is required for all builds, and half contains helpers for dma coherent allocation, which is only needed if CONFIG_DMA_NONCOHERENT is enabled. Signed-off-by: Christoph Hellwig --- arch/sh/kernel/Makefile | 2 +- arch/sh

[PATCH 08/25] nds32: consolidate DMA cache maintainance routines

2018-05-22 Thread Christoph Hellwig
Make sure all other DMA methods call nds32_dma_sync_single_for_{device,cpu} to perform cache maintaince, and remove the consisteny_sync helper that implemented both with entirely separate code based off an argument. Signed-off-by: Christoph Hellwig --- arch/nds32/kernel/dma.c | 140 +

[PATCH 07/25] nds32: remove the broken kmap code in nds32_dma_map_sg

2018-05-22 Thread Christoph Hellwig
nds32_dma_map_sg is the only of the various DMA operations that tries to deal with highmem (the single page variants and SG sync routines are missing, SG unmap is entirely unimplemented), and it does so without taking into account S/G list items that are bigger than a page, which are legal and can

[PATCH 06/25] microblaze: remove the consistent_sync and consistent_sync_page

2018-05-22 Thread Christoph Hellwig
Both unused. Signed-off-by: Christoph Hellwig --- arch/microblaze/include/asm/pgtable.h | 3 -- arch/microblaze/mm/consistent.c | 45 --- 2 files changed, 48 deletions(-) diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h i

[PATCH 02/25] hexagon: implement the sync_sg_for_device DMA operation

2018-05-22 Thread Christoph Hellwig
This methods needs to provide the equivalent of sync_single_for_device for each S/G list element, but was missing. Signed-off-by: Christoph Hellwig --- arch/hexagon/kernel/dma.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma

[PATCH 03/25] hexagon: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/hexagon/Kconfig | 2 + arch/hexagon/include/asm/Kbuild| 1 + arch/hexagon/include/asm/dma-mapping.h | 40 --- arch/hexagon/kernel/dma.c | 148

[PATCH 04/25] m68k: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. Signed-off-by: Christoph Hellwig --- arch/m68k/Kconfig | 2 + arch/m68k/include/asm/Kbuild| 1 + arch/m68k/include/asm/dma-mapping.h | 12 - arch/m68k/kernel/dma.c | 68 -

[PATCH 05/25] microblaze: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
Switch to the generic noncoherent direct mapping implementation. This removes the direction-based optimizations in sync_{single,sg}_for_{cpu,device} which were marked untestested and do not match the usually very well tested {un,}map_{single,sg} implementations. Signed-off-by: Christoph Hellwig

common non-cache coherent direct dma mapping ops v2

2018-05-22 Thread Christoph Hellwig
Hi all, this series continues consolidating the dma-mapping code, with a focus on architectures that do not (always) provide cache coherence for DMA. Three architectures (arm, mips and powerpc) are still left to be converted later due to complexity of their dma ops selection. The dma-noncoherent

[PATCH 01/25] hexagon: remove the sync_single_for_cpu DMA operation

2018-05-22 Thread Christoph Hellwig
hexagon does all the required cache maintainance at dma map time, and none at unmap time. It thus has to implement sync_single_for_device to match the map cace for buffer reuse, but there is no point in doing another invalidation in the sync_single_cpu_case, which in terms of cache maintainance is

Re: [PATCH 04/20] arm-nommu: use generic dma_noncoherent_ops

2018-05-22 Thread Christoph Hellwig
On Fri, May 11, 2018 at 10:11:15AM +0100, Russell King - ARM Linux wrote: > > +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, > > + size_t size, enum dma_data_direction dir) > > Please no. There is a lot of history of these (__dma_page_cpu_to_dev etc) > functions b