Re: [Nouveau] [PATCH 4/6] mm/hmm: add output flag for compound page mapping

2020-05-08 Thread Christoph Hellwig
On Fri, May 08, 2020 at 12:20:07PM -0700, Ralph Campbell wrote: > hmm_range_fault() returns an array of page frame numbers and flags for > how the pages are mapped in the requested process' page tables. The PFN > can be used to get the struct page with hmm_pfn_to_page() and the page size > order ca

Re: [Nouveau] linux-next 20200508 - build failure in kernel/resource.c w/ SPARSEMEM=n

2020-05-09 Thread Christoph Hellwig
I think the problem is the select of CONFIG_DEVICE_PRIVATE. Jason is looking into it already. ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [RESEND PATCH 2/3] nouveau: fix mixed normal and device private page migration

2020-06-24 Thread Christoph Hellwig
On Mon, Jun 22, 2020 at 04:38:53PM -0700, Ralph Campbell wrote: > The OpenCL function clEnqueueSVMMigrateMem(), without any flags, will > migrate memory in the given address range to device private memory. The > source pages might already have been migrated to device private memory. > In that case,

[Nouveau] [PATCH 21/28] hal2: convert from dma_cache_sync to dma_sync_single_for_device

2020-08-19 Thread Christoph Hellwig
Use the proper modern API to transfer cache ownership for incoherent DMA. This also means we can allocate the buffer memory with the proper direction instead of bidirectional. Signed-off-by: Christoph Hellwig --- sound/mips/hal2.c | 44 1 file

[Nouveau] [PATCH 11/28] dma-mapping: add (back) arch_dma_mark_clean for ia64

2020-08-19 Thread Christoph Hellwig
Add back a hook to optimize dcache flushing after reading executable code using DMA. This gets ia64 out of the business of pretending to be dma incoherent just for this optimization. Signed-off-by: Christoph Hellwig --- arch/ia64/Kconfig | 3 +-- arch/ia64/kernel/dma-mapping.c

[Nouveau] [PATCH 09/28] MIPS/jazzdma: remove the unused vdma_remap function

2020-08-19 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- arch/mips/include/asm/jazzdma.h | 2 - arch/mips/jazz/jazzdma.c| 70 - 2 files changed, 72 deletions(-) diff --git a/arch/mips/include/asm/jazzdma.h b/arch/mips/include/asm/jazzdma.h index d13f940022d5f9

[Nouveau] [PATCH 01/28] mm: turn alloc_pages into an inline function

2020-08-19 Thread Christoph Hellwig
To prevent a compiler error when a method call alloc_pages is added (which I plan to for the dma_map_ops). Signed-off-by: Christoph Hellwig --- include/linux/gfp.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index

[Nouveau] [PATCH 18/28] dma-mapping: move the dma_declare_coherent_memory documentation

2020-08-19 Thread Christoph Hellwig
dma_declare_coherent_memory should not be in a DMA API guide aimed at driver writers (that is consumers of the API). Move it to a comment near the function instead. Signed-off-by: Christoph Hellwig --- Documentation/core-api/dma-api.rst | 24 kernel/dma/coherent.c

[Nouveau] [PATCH 03/28] drm/nouveau/gk20a: stop setting DMA_ATTR_NON_CONSISTENT

2020-08-19 Thread Christoph Hellwig
DMA_ATTR_NON_CONSISTENT is a no-op except on PARISC and some mips configs, so don't set it in this ARM specific driver part. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/driver

[Nouveau] a saner API for allocating DMA addressable pages

2020-08-19 Thread Christoph Hellwig
Hi all, this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs with a separate new dma_alloc_pages API, which is available on all platforms. In addition to cleaning up the convoluted code path, this ensures that other drivers that have asked for better support for non-coherent D

[Nouveau] [PATCH 02/28] drm/exynos: stop setting DMA_ATTR_NON_CONSISTENT

2020-08-19 Thread Christoph Hellwig
DMA_ATTR_NON_CONSISTENT is a no-op except on PARISC and some mips configs, so don't set it in this ARM specific driver. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem

[Nouveau] [PATCH 23/28] lib82596: convert from dma_cache_sync to dma_sync_single_for_device

2020-08-19 Thread Christoph Hellwig
Use the proper modern API to transfer cache ownership for incoherent DMA. Note that this moves the DMA helpers to the main lib82596.c file, so that they can use virt_to_dma. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/i825xx/lasi_82596.c | 11 +-- drivers/net/ethernet/i825xx

[Nouveau] [PATCH 13/28] dma-direct: lift gfp_t manipulation out of__dma_direct_alloc_pages

2020-08-19 Thread Christoph Hellwig
Move the detailed gfp_t setup from __dma_direct_alloc_pages into the caller to clean things up a little. Signed-off-by: Christoph Hellwig --- kernel/dma/direct.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index

[Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
The V4L2-FLAG-MEMORY-NON-CONSISTENT flag is entirely unused, and causes weird gymanstics with the DMA_ATTR_NON_CONSISTENT flag, which is unimplemented except on PARISC and some MIPS configs, and about to be removed. Signed-off-by: Christoph Hellwig --- .../userspace-api/media/v4l/buffer.rst

[Nouveau] [PATCH 28/28] nvme-pci: use dma_alloc_pages backed dmapools

2020-08-19 Thread Christoph Hellwig
Switch from coherent DMA pools to those backed by dma_alloc_pages. This helps device with non-coherent DMA to avoid host accesses to uncached memory for every submission of a larger than single entry I/O. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 80

[Nouveau] [PATCH 17/28] dma-mapping: move dma_common_{mmap, get_sgtable} out of mapping.c

2020-08-19 Thread Christoph Hellwig
Add a new file that contains helpera for misc DMA ops, which is only built when CONFIG_DMA_OPS is set. Signed-off-by: Christoph Hellwig --- kernel/dma/Makefile | 1 + kernel/dma/mapping.c | 47 +--- kernel/dma/ops_helpers.c | 51

[Nouveau] [PATCH 26/28] dmapool: add dma_alloc_pages support

2020-08-19 Thread Christoph Hellwig
similar dma_pool_init_coherent helper, but that is better done as a separate series including a few conversions. Signed-off-by: Christoph Hellwig --- include/linux/dmapool.h | 23 - mm/dmapool.c| 211 +--- 2 files changed, 154 insertions(+), 80

[Nouveau] [PATCH 04/28] net/au1000-eth: stop using DMA_ATTR_NON_CONSISTENT

2020-08-19 Thread Christoph Hellwig
: Christoph Hellwig --- drivers/net/ethernet/amd/au1000_eth.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index 75dbd221dc594b..19e195420e2434 100644 --- a/drivers/net/ethernet/amd

[Nouveau] [PATCH 14/28] dma-direct: use phys_to_dma_direct in dma_direct_alloc

2020-08-19 Thread Christoph Hellwig
Replace the currently open code copy. Signed-off-by: Christoph Hellwig --- kernel/dma/direct.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 01120510968fa1..2e280b9c063449 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma

[Nouveau] [PATCH 12/28] dma-direct: remove dma_direct_{alloc, free}_pages

2020-08-19 Thread Christoph Hellwig
Just merge these helpers into the main dma_direct_{alloc,free} routines, as the additional checks are always false for the two callers. Signed-off-by: Christoph Hellwig --- arch/x86/kernel/amd_gart_64.c | 6 +++--- include/linux/dma-direct.h| 4 kernel/dma/direct.c | 39

[Nouveau] [PATCH 24/28] 53c700: convert from dma_cache_sync to dma_sync_single_for_device

2020-08-19 Thread Christoph Hellwig
Use the proper modern API to transfer cache ownership for incoherent DMA. Signed-off-by: Christoph Hellwig --- drivers/scsi/53c700.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 521950d0731e4a..57a08c42d00325

[Nouveau] [PATCH 07/28] 53c700: improve non-coherent DMA handling

2020-08-19 Thread Christoph Hellwig
ction argument of dma_cache_sync is ignored, so this will not change behavior in any way. Signed-off-by: Christoph Hellwig --- drivers/scsi/53c700.c | 113 +++--- drivers/scsi/53c700.h | 9 ++-- 2 files changed, 68 insertions(+), 54 deletions(-) diff --git a/dr

[Nouveau] [PATCH 15/28] dma-direct: remove __dma_to_phys

2020-08-19 Thread Christoph Hellwig
There is no harm in just always clearing the SME encryption bit, while significantly simplifying the interface. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/dma-direct.h | 2 +- arch/mips/bmips/dma.c | 2 +- arch/mips/cavium-octeon/dma-octeon.c | 2

[Nouveau] [PATCH 08/28] MIPS: make dma_sync_*_for_cpu a little less overzealous

2020-08-19 Thread Christoph Hellwig
that kmap_atomic is stubbed out for the !HIGHMEM case to simplify the code a bit. Signed-off-by: Christoph Hellwig --- arch/mips/mm/dma-noncoherent.c | 44 +- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips

[Nouveau] [PATCH 06/28] lib82596: move DMA allocation into the callers of i82596_probe

2020-08-19 Thread Christoph Hellwig
This allows us to get rid of the LIB82596_DMA_ATTR defined and prepare for untangling the coherent vs non-coherent DMA allocation API. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/i825xx/lasi_82596.c | 24 ++-- drivers/net/ethernet/i825xx/lib82596.c | 36

[Nouveau] [PATCH 19/28] dma-mapping: replace DMA_ATTR_NON_CONSISTENT with dma_{alloc, free}_pages

2020-08-19 Thread Christoph Hellwig
. Switch all drivers over to this new API, but keep the usage of the crufty dma_cache_sync API for now, which will be cleaned up on a driver by driver basis. Signed-off-by: Christoph Hellwig --- Documentation/core-api/dma-api.rst| 68 +++ Documentation/core-api/dma

[Nouveau] [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-08-19 Thread Christoph Hellwig
Use the proper modern API to transfer cache ownership for incoherent DMA. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/seeq/sgiseeq.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq

[Nouveau] [PATCH 25/28] dma-mapping: remove dma_cache_sync

2020-08-19 Thread Christoph Hellwig
All users are gone now, remove the API. Signed-off-by: Christoph Hellwig --- arch/mips/Kconfig | 1 - arch/mips/jazz/jazzdma.c| 1 - arch/mips/mm/dma-noncoherent.c | 6 -- arch/parisc/Kconfig | 1 - arch/parisc/kernel/pci-dma.c| 6 -- include

[Nouveau] [PATCH 10/28] MIPS/jazzdma: decouple from dma-direct

2020-08-19 Thread Christoph Hellwig
. Signed-off-by: Christoph Hellwig --- arch/mips/jazz/jazzdma.c | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index fe40dbed04c1d6..d0b5a2ba2b1a8a 100644 --- a/arch/mips/jazz/jazzdma.c +++ b

[Nouveau] [PATCH 20/28] sgiwd93: convert from dma_cache_sync to dma_sync_single_for_device

2020-08-19 Thread Christoph Hellwig
Use the proper modern API to transfer cache ownership for incoherent DMA. This also means we can allocate the memory as DMA_TO_DEVICE instead of bidirectional. Signed-off-by: Christoph Hellwig --- drivers/scsi/sgiwd93.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a

[Nouveau] [PATCH 27/28] nvme-pci: fix PRP pool size

2020-08-19 Thread Christoph Hellwig
All operations are based on the controller, not the host page size. Switch the dma pool to use the controller page size as well to avoid massive overallocations on large page size systems. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1

[Nouveau] [PATCH 16/28] dma-direct: rename and cleanup __phys_to_dma

2020-08-19 Thread Christoph Hellwig
The __phys_to_dma vs phys_to_dma distinction isn't exactly obvious. Try to improve the situation by renaming __phys_to_dma to phys_to_dma_unencryped, and not forcing architectures that want to override phys_to_dma to actually provide __phys_to_dma. Signed-off-by: Christoph Hellwig --- arc

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 02:49:01PM +0200, Tomasz Figa wrote: > With the default config it doesn't, but with > CONFIG_DMA_NONCOHERENT_CACHE_SYNC enabled it makes dma_pgprot() keep > the pgprot value as is, without enforcing coherence attributes. Which isn't selected on arm64, and that is for a good

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 01:16:51PM +0200, Tomasz Figa wrote: > Hi Christoph, > > On Wed, Aug 19, 2020 at 8:56 AM Christoph Hellwig wrote: > > > > The V4L2-FLAG-MEMORY-NON-CONSISTENT flag is entirely unused, > > Could you explain what makes you think it's unus

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 04:11:52PM +0200, Tomasz Figa wrote: > > > By the way, as a videobuf2 reviewer, I'd appreciate being CC'd on any > > > series related to the subsystem-facing DMA API changes, since > > > videobuf2 is one of the biggest users of it. > > > > The cc list is too long - I cc list

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 04:22:29PM +0200, Tomasz Figa wrote: > > > FWIW, I asked back in time what the plan is for non-coherent > > > allocations and it seemed like DMA_ATTR_NON_CONSISTENT and > > > dma_sync_*() was supposed to be the right thing to go with. [2] The > > > same thread also explains

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 03:57:53PM +0200, Tomasz Figa wrote: > > > Could you explain what makes you think it's unused? It's a feature of > > > the UAPI generally supported by the videobuf2 framework and relied on > > > by Chromium OS to get any kind of reasonable performance when > > > accessing V4

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 03:07:04PM +0100, Robin Murphy wrote: >> FWIW, I asked back in time what the plan is for non-coherent >> allocations and it seemed like DMA_ATTR_NON_CONSISTENT and >> dma_sync_*() was supposed to be the right thing to go with. [2] The >> same thread also explains why dma_all

Re: [Nouveau] [PATCH 19/28] dma-mapping: replace DMA_ATTR_NON_CONSISTENT with dma_{alloc, free}_pages

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 05:03:52PM +0200, Tomasz Figa wrote: > > > > -Warning: These pieces of the DMA API should not be used in the > > -majority of cases, since they cater for unlikely corner cases that > > -don't belong in usual drivers. > > +These APIs allow to allocate pages that can be used l

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Thu, Aug 20, 2020 at 06:43:47AM +0200, Christoph Hellwig wrote: > On Wed, Aug 19, 2020 at 03:57:53PM +0200, Tomasz Figa wrote: > > > > Could you explain what makes you think it's unused? It's a feature of > > > > the UAPI generally supported by the videobu

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-20 Thread Christoph Hellwig
On Thu, Aug 20, 2020 at 12:05:29PM +0200, Tomasz Figa wrote: > The UAPI and V4L2/videobuf2 changes are in good shape and the only > wrong part is the use of DMA API, which was based on an earlier email > guidance anyway, and a change to the synchronization part . I find > conclusions like the above

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-20 Thread Christoph Hellwig
On Thu, Aug 20, 2020 at 12:09:34PM +0200, Tomasz Figa wrote: > > I'm happy to Cc and active participant in the discussion. I'm not > > going to add all reviewers because even with the trimmed CC list > > I'm already hitting the number of receipients limit on various lists. > > Fair enough. > > W

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-20 Thread Christoph Hellwig
On Thu, Aug 20, 2020 at 12:24:31PM +0200, Tomasz Figa wrote: > > Of course this still uses the scatterlist structure with its annoying > > mix of input and output parametes, so I'd rather not expose it as > > an official API at the DMA layer. > > The problem with the above open coded approach is t

Re: [Nouveau] a saner API for allocating DMA addressable pages

2020-08-25 Thread Christoph Hellwig
On Tue, Aug 25, 2020 at 01:30:41PM +0200, Marek Szyprowski wrote: > I really wonder what is the difference between this new API and > alloc_pages(GFP_DMA, n). Is this API really needed? I thought that this > is legacy thing to be removed one day... The difference is that the pages returned are g

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-09-01 Thread Christoph Hellwig
On Thu, Aug 20, 2020 at 07:33:48PM +0200, Tomasz Figa wrote: > > It wasn't meant to be too insulting, but I found this out when trying > > to figure out how to just disable it. But it also ends up using > > the actual dma attr flags for it's own consistency checks, so just > > not setting the flag

Re: [Nouveau] [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-01 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 07:12:41PM +0200, Thomas Bogendoerfer wrote: > On Tue, Sep 01, 2020 at 05:22:09PM +0200, Thomas Bogendoerfer wrote: > > On Wed, Aug 19, 2020 at 08:55:49AM +0200, Christoph Hellwig wrote: > > > Use the proper modern API to transfer cache ownership

Re: [Nouveau] [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-03 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 07:38:10PM +0200, Thomas Bogendoerfer wrote: > this is the problem: > >/* Always check for received packets. */ > sgiseeq_rx(dev, sp, hregs, sregs); > > so the driver will look at the rx descriptor on every interrupt, so > we cache the rx descriptor on the

Re: [Nouveau] [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-03 Thread Christoph Hellwig
On Wed, Sep 02, 2020 at 11:38:09PM +0200, Thomas Bogendoerfer wrote: > the patch below fixes the problem. But is very wrong unfortunately. > static inline void dma_sync_desc_cpu(struct net_device *dev, void *addr) > { > - dma_cache_sync(dev->dev.parent, addr, sizeof(struct sgiseeq_rx_desc

Re: [Nouveau] [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 10:43:02AM +0200, Christoph Hellwig wrote: > On Tue, Sep 01, 2020 at 07:38:10PM +0200, Thomas Bogendoerfer wrote: > > this is the problem: > > > >/* Always check for received packets. */ > > sgiseeq_rx(dev, sp, hregs, sregs);

[Nouveau] [PATCH 16/17] dma-iommu: implement ->alloc_noncoherent

2020-09-14 Thread Christoph Hellwig
Implement the alloc_noncoherent method to provide memory that is neither coherent not contiguous. Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 41 +++ 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/dma-iommu.c

[Nouveau] [PATCH 10/17] hal2: convert to dma_alloc_noncoherent

2020-09-14 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This also means we can allocate the buffer memory with the proper direction instead of bidirectional. Signed-off-by: Christoph Hellwig --- sound/mips/hal2.c | 58 ++- 1 file

[Nouveau] [PATCH 09/17] sgiwd93: convert to dma_alloc_noncoherent

2020-09-14 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This also means we can allocate the memory as DMA_TO_DEVICE instead of bidirectional. Signed-off-by: Christoph Hellwig --- drivers/scsi/sgiwd93.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

[Nouveau] [PATCH 15/17] dma-mapping: add new {alloc, free}_noncoherent dma_map_ops methods

2020-09-14 Thread Christoph Hellwig
This will allow IOMMU drivers to allocate non-contigous memory and return a vmapped virtual address. Signed-off-by: Christoph Hellwig --- include/linux/dma-mapping.h | 5 + kernel/dma/mapping.c| 33 +++-- 2 files changed, 32 insertions(+), 6 deletions

[Nouveau] [PATCH 03/17] drm/exynos: stop setting DMA_ATTR_NON_CONSISTENT

2020-09-14 Thread Christoph Hellwig
DMA_ATTR_NON_CONSISTENT is a no-op except on PARISC and some mips configs, so don't set it in this ARM specific driver. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem

[Nouveau] [PATCH 11/17] sgiseeq: convert to dma_alloc_noncoherent

2020-09-14 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This includes adding additional calls to dma_sync_desc_dev as the old syncing was rather ad-hoc. Thanks to Thomas Bogendoerfer for debugging the ownership transfer issues. Signed-off-by: Christoph Hellwig --- drivers/net

[Nouveau] [PATCH 01/17] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT flag

2020-09-14 Thread Christoph Hellwig
revers both kernel and user space parts: removes the DMA consistency attr functions, rollbacks changes to v4l2_requestbuffers, v4l2_create_buffers structures and corresponding UAPI functions (plus compat32 layer) and cleanups the documentation. Signed-off-by: Christoph Hellwig Signed-off-by

[Nouveau] [PATCH 06/17] lib82596: move DMA allocation into the callers of i82596_probe

2020-09-14 Thread Christoph Hellwig
This allows us to get rid of the LIB82596_DMA_ATTR defined and prepare for untangling the coherent vs non-coherent DMA allocation API. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/i825xx/lasi_82596.c | 24 ++-- drivers/net/ethernet/i825xx/lib82596.c | 36

[Nouveau] [PATCH 17/17] firewire-ohci: use dma_alloc_pages

2020-09-14 Thread Christoph Hellwig
Use dma_alloc_pages to allocate DMAable pages instead of hoping that the architecture either has GFP_DMA32 or not more than 4G of memory. Signed-off-by: Christoph Hellwig --- drivers/firewire/ohci.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a

[Nouveau] [PATCH 07/17] 53c700: improve non-coherent DMA handling

2020-09-14 Thread Christoph Hellwig
ction argument of dma_cache_sync is ignored, so this will not change behavior in any way. Signed-off-by: Christoph Hellwig --- drivers/scsi/53c700.c | 113 +++--- drivers/scsi/53c700.h | 9 ++-- 2 files changed, 68 insertions(+), 54 deletions(-) diff --git a/dr

[Nouveau] [PATCH 08/17] dma-mapping: add a new dma_alloc_noncoherent API

2020-09-14 Thread Christoph Hellwig
. For now the new calls are implemented on top of dma_alloc_attrs just like the old-noncoherent API, but once all drivers are switched to the new API it will be replaced with a better working implementation that is available on all architectures. Signed-off-by: Christoph Hellwig --- Documentation

[Nouveau] a saner API for allocating DMA addressable pages v2

2020-09-14 Thread Christoph Hellwig
Hi all, this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs with a separate new dma_alloc_pages API, which is available on all platforms. In addition to cleaning up the convoluted code path, this ensures that other drivers that have asked for better support for non-coherent D

[Nouveau] [PATCH 02/17] mm: turn alloc_pages into an inline function

2020-09-14 Thread Christoph Hellwig
To prevent a compiler error when a method call alloc_pages is added (which I plan to for the dma_map_ops). Signed-off-by: Christoph Hellwig --- include/linux/gfp.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index

[Nouveau] [PATCH 12/17] 53c700: convert to dma_alloc_noncoherent

2020-09-14 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. Signed-off-by: Christoph Hellwig --- drivers/scsi/53c700.c | 11 +-- drivers/scsi/53c700.h | 16 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi

[Nouveau] [PATCH 13/17] dma-mapping: remove dma_cache_sync

2020-09-14 Thread Christoph Hellwig
All users are gone now, remove the API. Signed-off-by: Christoph Hellwig --- arch/mips/Kconfig | 1 - arch/mips/jazz/jazzdma.c| 1 - arch/mips/mm/dma-noncoherent.c | 6 -- arch/parisc/Kconfig | 1 - arch/parisc/kernel/pci-dma.c| 6 -- include

[Nouveau] [PATCH 05/17] net/au1000-eth: stop using DMA_ATTR_NON_CONSISTENT

2020-09-14 Thread Christoph Hellwig
: Christoph Hellwig --- drivers/net/ethernet/amd/au1000_eth.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index 75dbd221dc594b..19e195420e2434 100644 --- a/drivers/net/ethernet/amd

[Nouveau] [PATCH 14/17] dma-mapping: add a new dma_alloc_pages API

2020-09-14 Thread Christoph Hellwig
over to use dma_alloc_pages as its backend. Signed-off-by: Christoph Hellwig --- Documentation/core-api/dma-attributes.rst | 8 --- arch/alpha/kernel/pci_iommu.c | 2 + arch/arm/mm/dma-mapping-nommu.c | 2 + arch/arm/mm/dma-mapping.c | 4 ++ arch/ia64/hp

[Nouveau] [PATCH 04/17] drm/nouveau/gk20a: stop setting DMA_ATTR_NON_CONSISTENT

2020-09-14 Thread Christoph Hellwig
DMA_ATTR_NON_CONSISTENT is a no-op except on PARISC and some mips configs, so don't set it in this ARM specific driver part. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/driver

[Nouveau] [PATCH 17/18] dma-iommu: implement ->alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
Implement the alloc_noncoherent method to provide memory that is neither coherent not contiguous. Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 41 +++ 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/dma-iommu.c

[Nouveau] [PATCH 12/18] sgiseeq: convert to dma_alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This includes adding additional calls to dma_sync_desc_dev as the old syncing was rather ad-hoc. Thanks to Thomas Bogendoerfer for debugging the ownership transfer issues. Signed-off-by: Christoph Hellwig --- drivers/net

Re: [Nouveau] [PATCH 07/17] 53c700: improve non-coherent DMA handling

2020-09-15 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 08:20:18AM -0700, James Bottomley wrote: > If you're going to change the macros from taking a device to taking a > hostdata structure then the descriptive argument name needs to change > ... it can't be dev anymore. I'm happy with it simply becoming 'h' if > hostdata is too

[Nouveau] a saner API for allocating DMA addressable pages v3

2020-09-15 Thread Christoph Hellwig
Hi all, this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs with a separate new dma_alloc_pages API, which is available on all platforms. In addition to cleaning up the convoluted code path, this ensures that other drivers that have asked for better support for non-coherent D

[Nouveau] [PATCH 16/18] dma-mapping: add new {alloc, free}_noncoherent dma_map_ops methods

2020-09-15 Thread Christoph Hellwig
This will allow IOMMU drivers to allocate non-contigous memory and return a vmapped virtual address. Signed-off-by: Christoph Hellwig --- include/linux/dma-mapping.h | 5 + kernel/dma/mapping.c| 33 +++-- 2 files changed, 32 insertions(+), 6 deletions

[Nouveau] [PATCH 03/18] drm/exynos: stop setting DMA_ATTR_NON_CONSISTENT

2020-09-15 Thread Christoph Hellwig
DMA_ATTR_NON_CONSISTENT is a no-op except on PA-RISC and a few MIPS configs, so don't set it in this ARM specific driver. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem

[Nouveau] [PATCH 10/18] hal2: convert to dma_alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This also means we can allocate the buffer memory with the proper direction instead of bidirectional. Signed-off-by: Christoph Hellwig --- sound/mips/hal2.c | 58 ++- 1 file

Re: [Nouveau] [PATCH 03/17] drm/exynos: stop setting DMA_ATTR_NON_CONSISTENT

2020-09-15 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 06:34:02PM +0300, Sergei Shtylyov wrote: > On 9/14/20 5:44 PM, Christoph Hellwig wrote: > > > DMA_ATTR_NON_CONSISTENT is a no-op except on PARISC and some mips > > configs, so don't set it in this ARM specific driver. > >Hm, PARICS an

[Nouveau] [PATCH 05/18] net/au1000-eth: stop using DMA_ATTR_NON_CONSISTENT

2020-09-15 Thread Christoph Hellwig
: Christoph Hellwig --- drivers/net/ethernet/amd/au1000_eth.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c index 75dbd221dc594b..19e195420e2434 100644 --- a/drivers/net/ethernet/amd

[Nouveau] [PATCH 01/18] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT flag

2020-09-15 Thread Christoph Hellwig
revers both kernel and user space parts: removes the DMA consistency attr functions, rollbacks changes to v4l2_requestbuffers, v4l2_create_buffers structures and corresponding UAPI functions (plus compat32 layer) and cleanups the documentation. Signed-off-by: Christoph Hellwig Signed-off-by

[Nouveau] [PATCH 04/18] drm/nouveau/gk20a: stop setting DMA_ATTR_NON_CONSISTENT

2020-09-15 Thread Christoph Hellwig
DMA_ATTR_NON_CONSISTENT is a no-op except on PA-RISC and a few MIPS configs, so don't set it in this ARM specific driver part. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dr

[Nouveau] [PATCH 14/18] dma-mapping: remove dma_cache_sync

2020-09-15 Thread Christoph Hellwig
All users are gone now, remove the API. Signed-off-by: Christoph Hellwig --- arch/mips/Kconfig | 1 - arch/mips/jazz/jazzdma.c| 1 - arch/mips/mm/dma-noncoherent.c | 6 -- arch/parisc/Kconfig | 1 - arch/parisc/kernel/pci-dma.c| 6 -- include

[Nouveau] [PATCH 07/18] 53c700: improve non-coherent DMA handling

2020-09-15 Thread Christoph Hellwig
ction argument of dma_cache_sync is ignored, so this will not change behavior in any way. Signed-off-by: Christoph Hellwig --- drivers/scsi/53c700.c | 113 +++--- drivers/scsi/53c700.h | 17 --- 2 files changed, 72 insertions(+), 58 deletions(-) diff --

[Nouveau] [PATCH 18/18] firewire-ohci: use dma_alloc_pages

2020-09-15 Thread Christoph Hellwig
Use dma_alloc_pages to allocate DMAable pages instead of hoping that the architecture either has GFP_DMA32 or not more than 4G of memory. Signed-off-by: Christoph Hellwig --- drivers/firewire/ohci.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a

[Nouveau] [PATCH 02/18] mm: turn alloc_pages into an inline function

2020-09-15 Thread Christoph Hellwig
To prevent a compiler error when a method call alloc_pages is added (which I plan to for the dma_map_ops). Signed-off-by: Christoph Hellwig --- include/linux/gfp.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-15 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 04:53:25PM -0700, Ralph Campbell wrote: > Since set_page_refcounted() is defined in mm_interal.h I would have to > move the definition to someplace like page_ref.h or have the drivers > cal init_page_count() or set_page_count() since get_page() calls > VM_BUG_ON_PAGE() if re

Re: [Nouveau] a saner API for allocating DMA addressable pages v2

2020-09-15 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 04:26:17PM +0100, Matthew Wilcox wrote: > On Mon, Sep 14, 2020 at 04:44:16PM +0200, Christoph Hellwig wrote: > > I'm still a little unsure about the API naming, as alloc_pages sort of > > implies a struct page return value, but we return a kernel

[Nouveau] [PATCH 15/18] dma-mapping: add a new dma_alloc_pages API

2020-09-15 Thread Christoph Hellwig
over to use dma_alloc_pages as its backend. Signed-off-by: Christoph Hellwig --- Documentation/core-api/dma-attributes.rst | 8 --- arch/alpha/kernel/pci_iommu.c | 2 + arch/arm/mm/dma-mapping-nommu.c | 2 + arch/arm/mm/dma-mapping.c | 4 ++ arch/ia64/hp

[Nouveau] [PATCH 06/18] lib82596: move DMA allocation into the callers of i82596_probe

2020-09-15 Thread Christoph Hellwig
This allows us to get rid of the LIB82596_DMA_ATTR defined and prepare for untangling the coherent vs non-coherent DMA allocation API. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/i825xx/lasi_82596.c | 24 ++-- drivers/net/ethernet/i825xx/lib82596.c | 36

[Nouveau] [PATCH 11/18] lib82596: convert to dma_alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This includes moving the DMA helpers to lib82596 based of an ifdef to avoid include order problems. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/i825xx/lasi_82596.c | 25 ++--- drivers/net/ethernet/i825xx

[Nouveau] [PATCH 13/18] 53c700: convert to dma_alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. Signed-off-by: Christoph Hellwig --- drivers/scsi/53c700.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index c59226d7e2f6b5

[Nouveau] [PATCH 08/18] dma-mapping: add a new dma_alloc_noncoherent API

2020-09-15 Thread Christoph Hellwig
. For now the new calls are implemented on top of dma_alloc_attrs just like the old-noncoherent API, but once all drivers are switched to the new API it will be replaced with a better working implementation that is available on all architectures. Signed-off-by: Christoph Hellwig --- Documentation

Re: [Nouveau] [PATCH 11/17] sgiseeq: convert to dma_alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 04:13:58PM +0100, Matthew Wilcox wrote: > On Mon, Sep 14, 2020 at 04:44:27PM +0200, Christoph Hellwig wrote: > > drivers/net/ethernet/i825xx/lasi_82596.c | 25 ++--- > > drivers/net/ethernet/i825xx/lib82596.c | 114 ++- > >

[Nouveau] [PATCH 09/18] sgiwd93: convert to dma_alloc_noncoherent

2020-09-15 Thread Christoph Hellwig
Use the new non-coherent DMA API including proper ownership transfers. This also means we can allocate the memory as DMA_TO_DEVICE instead of bidirectional. Signed-off-by: Christoph Hellwig --- drivers/scsi/sgiwd93.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-15 Thread Christoph Hellwig
On Tue, Sep 15, 2020 at 09:39:47AM -0700, Ralph Campbell wrote: >> I don't think any of the three ->page_free instances even cares about >> the page refcount. >> > Not true. The page_free() callback records the page is free by setting > a bit or putting the page on a free list but when it allocates

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-17 Thread Christoph Hellwig
> diff --git a/include/linux/mm.h b/include/linux/mm.h > index 517751310dd2..5a82037a4b26 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -1093,34 +1093,6 @@ static inline bool is_zone_device_page(const struct > page *page) > #ifdef CONFIG_DEV_PAGEMAP_OPS > void free_devmap_man

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-17 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 04:10:38PM -0700, Dan Williams wrote: > You also need to fix up ext4_break_layouts() and > xfs_break_dax_layouts() to expect ->_refcount is 0 instead of 1. This > also needs some fstests exposure. While we're at it, can we add a wait_fsdax_unref helper macro that hides the

Re: [Nouveau] a saner API for allocating DMA addressable pages v3

2020-09-21 Thread Christoph Hellwig
, and chance you could retest it? On Tue, Sep 15, 2020 at 05:51:04PM +0200, Christoph Hellwig wrote: > Hi all, > > this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs > with a separate new dma_alloc_pages API, which is available on all > platforms. In additio

Re: [Nouveau] a saner API for allocating DMA addressable pages v3

2020-09-25 Thread Christoph Hellwig
This is in dma-mapping for-next now. ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH 08/18] dma-mapping: add a new dma_alloc_noncoherent API

2020-09-25 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 12:15:37PM +0100, Robin Murphy wrote: > On 2020-09-15 16:51, Christoph Hellwig wrote: > [...] >> +These APIs allow to allocate pages in the kernel direct mapping that are >> +guaranteed to be DMA addressable. This means that unlike >> dma_alloc_co

Re: [Nouveau] [PATCH 2/2] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-26 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 01:44:42PM -0700, Ralph Campbell wrote: > ZONE_DEVICE struct pages have an extra reference count that complicates the > code for put_page() and several places in the kernel that need to check the > reference count to see that a page is not being used (gup, compaction, > migr

Re: [Nouveau] [PATCH 17/18] dma-iommu: implement ->alloc_noncoherent

2020-09-26 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 06:46:22PM +, Tomasz Figa wrote: > > +static void *iommu_dma_alloc_noncoherent(struct device *dev, size_t size, > > + dma_addr_t *handle, enum dma_data_direction dir, gfp_t gfp) > > +{ > > + if (!gfpflags_allow_blocking(gfp)) { > > + struct page *pa

Re: [Nouveau] [PATCH 1/2] ext4/xfs: add page refcount helper

2020-09-26 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 01:44:41PM -0700, Ralph Campbell wrote: > error = ___wait_var_event(&page->_refcount, > - atomic_read(&page->_refcount) == 1, > + dax_layout_is_idle_page(page), > TASK_INTERRU

  1   2   3   4   5   6   >