Re: [PATCH 9/9] csky: use the generic remapping dma alloc implementation

2018-11-05 Thread Guo Ren
On Mon, Nov 05, 2018 at 01:19:31PM +0100, Christoph Hellwig wrote: > The csky code was largely copied from arm/arm64, so switch to the > generic arm64-based implementation instead. > > Signed-off-by: Christoph Hellwig > --- > arch/csky/Kconfig | 2 +- > arch/csky/mm/dma-mapping.c |

Re: [PATCH v4 6/8] vfio/mdev: Add iommu place holders in mdev_device

2018-11-05 Thread Lu Baolu
Hi, On 11/5/18 10:51 PM, Christoph Hellwig wrote: Please use EXPORT_SYMBOL_GPL like most of the vfio code. Sure. Will use this in the next version. Best regards, Lu Baolu ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH RFC] dma-direct: do not allocate a single page from CMA area

2018-11-05 Thread Nicolin Chen
On Fri, Nov 02, 2018 at 07:35:42AM +0100, Christoph Hellwig wrote: > On Thu, Nov 01, 2018 at 02:07:55PM +, Robin Murphy wrote: > > On 31/10/2018 20:03, Nicolin Chen wrote: > >> The addresses within a single page are always contiguous, so it's > >> not so necessary to allocate one single page

Re: [PATCH] MIPS: Fix `dma_alloc_coherent' returning a non-coherent allocation

2018-11-05 Thread Paul Burton
Hi Maciej, On Thu, Nov 01, 2018 at 07:54:24AM +, Maciej W. Rozycki wrote: > Fix a MIPS `dma_alloc_coherent' regression from commit bc3ec75de545 > ("dma-mapping: merge direct and noncoherent ops") that causes a cached > allocation to be returned on noncoherent cache systems. > > This is due

Re: [PATCH 8/9] csky: don't use GFP_DMA in atomic_pool_init

2018-11-05 Thread Guo Ren
On Mon, Nov 05, 2018 at 01:19:30PM +0100, Christoph Hellwig wrote: > csky does not implement ZONE_DMA, which means passing GFP_DMA is a no-op. > > Signed-off-by: Christoph Hellwig > --- > arch/csky/mm/dma-mapping.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH 7/9] csky: don't select DMA_NONCOHERENT_OPS

2018-11-05 Thread Guo Ren
On Mon, Nov 05, 2018 at 01:19:29PM +0100, Christoph Hellwig wrote: > This option is gone past Linux 4.19. > > Signed-off-by: Christoph Hellwig > --- > arch/csky/Kconfig | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig > index

Re: [PATCH] iommu/dma: Zero pages manually in a length of scatterlist

2018-11-05 Thread Christoph Hellwig
On Fri, Nov 02, 2018 at 04:36:13PM -0700, Nicolin Chen wrote: > > What if the pages came from highmem? I know that doesn't happen on arm64 > > today, but the point of this code *is* to be generic, and other users will > > arrive eventually. > > Hmm, so it probably should use sg_miter_start/stop()

Re: [PATCH v4 6/8] vfio/mdev: Add iommu place holders in mdev_device

2018-11-05 Thread Christoph Hellwig
Please use EXPORT_SYMBOL_GPL like most of the vfio code. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH 8/9] csky: don't use GFP_DMA in atomic_pool_init

2018-11-05 Thread Christoph Hellwig
csky does not implement ZONE_DMA, which means passing GFP_DMA is a no-op. Signed-off-by: Christoph Hellwig --- arch/csky/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/csky/mm/dma-mapping.c b/arch/csky/mm/dma-mapping.c index 85437b21e045..ad4046939713

[PATCH 6/9] dma-remap: support DMA_ATTR_NO_KERNEL_MAPPING

2018-11-05 Thread Christoph Hellwig
Do not waste vmalloc space on allocations that do not require a mapping into the kernel address space. Signed-off-by: Christoph Hellwig --- kernel/dma/remap.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index

[PATCH 9/9] csky: use the generic remapping dma alloc implementation

2018-11-05 Thread Christoph Hellwig
The csky code was largely copied from arm/arm64, so switch to the generic arm64-based implementation instead. Signed-off-by: Christoph Hellwig --- arch/csky/Kconfig | 2 +- arch/csky/mm/dma-mapping.c | 142 + 2 files changed, 3 insertions(+), 141

[PATCH 5/9] dma-mapping: support highmem in the generic remap allocator

2018-11-05 Thread Christoph Hellwig
By using __dma_direct_alloc_pages we can deal entirely with struct page instead of having to derive a kernel virtual address. Signed-off-by: Christoph Hellwig --- kernel/dma/remap.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/dma/remap.c

[PATCH 7/9] csky: don't select DMA_NONCOHERENT_OPS

2018-11-05 Thread Christoph Hellwig
This option is gone past Linux 4.19. Signed-off-by: Christoph Hellwig --- arch/csky/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 8a30e006a845..c0cf8e948821 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -8,7 +8,6 @@ config

[PATCH 4/9] dma-mapping: move the arm64 ncoherent alloc/free support to common code

2018-11-05 Thread Christoph Hellwig
The arm64 codebase to implement coherent dma allocation for architectures with non-coherent DMA is a good start for a generic implementation, given that is uses the generic remap helpers, provides the atomic pool for allocations that can't sleep and still is realtively simple and well tested.

[PATCH 3/9] dma-mapping: move the remap helpers to a separate file

2018-11-05 Thread Christoph Hellwig
The dma remap code only really makes sense for not cache coherent architectures, and currently is only used by arm, arm64 and xtensa. Split it out into a separate file with a separate Kconfig symbol, which gets the right copyright notice given that this code was written by Laura Abbott working for

[PATCH 2/9] dma-direct: reject highmem pages from dma_alloc_from_contiguous

2018-11-05 Thread Christoph Hellwig
dma_alloc_from_contiguous can return highmem pages depending on the setup, which a plain non-remapping DMA allocator can't handle. Detect this case and try the normal page allocator instead. Signed-off-by: Christoph Hellwig --- kernel/dma/direct.c | 12 1 file changed, 12

[PATCH 1/9] dma-direct: provide page based alloc/free helpers

2018-11-05 Thread Christoph Hellwig
Some architectures support remapping highmem into DMA coherent allocations. To use the common code for them we need variants of dma_direct_{alloc,free}_pages that do not use kernel virtual addresses. Signed-off-by: Christoph Hellwig --- include/linux/dma-direct.h | 3 +++ kernel/dma/direct.c

move the arm arch_dma_alloc implementation to common code

2018-11-05 Thread Christoph Hellwig
Hi all, this series moves the existing arm64 implementation of arch_dma_alloc and arch_dma_free to common code given that it is not arm64-specific, and then also uses it for csky. Given how many architectures remap memory for the DMA coherent implementation it should be usable for many more, and