ensure dma_alloc_coherent always returns zeroed memory

2018-12-14 Thread Christoph Hellwig
For security reasons we already returned zeroed memory from dma_alloc_coherent on most common platforms, but some implementation missed out. Make sure we provide a consistent behavior. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists

[PATCH 2/2] dma-mapping: deprecate dma_zalloc_coherent

2018-12-14 Thread Christoph Hellwig
We now always return zeroed memory from dma_alloc_coherent. Note that simply passing GFP_ZERO to dma_alloc_coherent wasn't always doing the right thing to start with given that various allocators are not backed by the page allocator and thus would ignore GFP_ZERO. Signed-off-by: Christoph Hellwig

[PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Christoph Hellwig
If we want to map memory from the DMA allocator to userspace it must be zeroed at allocation time to prevent stale data leaks. We already do this on most common architectures, but some architectures don't do this yet, fix them up, either by passing GFP_ZERO when we use the normal page allocator o

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > If we want to map memory from the DMA allocator to userspace it must be > zeroed at allocation time to prevent stale data leaks. We already do > this on most common architectures, but some architectures don't do this > yet

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common arch

Re: [PATCH] dt-bindings: iommu: ipmmu-vmsa: Add r8a774c0 support

2018-12-14 Thread Geert Uytterhoeven
On Thu, Dec 13, 2018 at 9:19 PM Fabrizio Castro wrote: > Document RZ/G2E (R8A774C0) SoC bindings. > > Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68

Re: [PATCH] iommu/ipmmu-vmsa: Hook up r8a774c0 DT matching code

2018-12-14 Thread Geert Uytterhoeven
On Thu, Dec 13, 2018 at 9:22 PM Fabrizio Castro wrote: > Support RZ/G2E (a.k.a. R8A774C0) IPMMU. > > Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Christoph Hellwig
On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages() a

Re: use generic DMA mapping code in powerpc V4

2018-12-14 Thread Christian Zigotzky
On 12 December 2018 at 3:15PM, Christoph Hellwig wrote: > Thanks for bisecting.  I've spent some time going over the conversion > but can't really pinpoint it.  I have three little patches that switch > parts of the code to the generic version.  This is on top of the > last good commmit (977706f97

[PATCH] nios2: use dma_direct_alloc_pages

2018-12-14 Thread Christoph Hellwig
Use the generic dma allocator to get various quirks and support for CMA allocations (if enabled) for free. Signed-off-by: Christoph Hellwig --- arch/nios2/mm/dma-mapping.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/arch/nios2/mm/dma-mapping.c b/arch/ni

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread h...@lst.de
On Fri, Dec 14, 2018 at 12:12:00PM +, Eugeniy Paltsev wrote: > Hi Christoph, > > do you have any public git repository with all your dma changes? Most of the tree show up in my misc.git repo for testing. This series is here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dm

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Dec 14, 2018 at 12:47 PM Christoph Hellwig wrote: > > On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: > > > - page = alloc_pages(flag, order); > > > + page = alloc_pages(flag | GFP_ZERO, order); > > > if (!page) > > > r

Re: [PATCH 12/34] powerpc/cell: move dma direct window setup out of dma_configure

2018-12-14 Thread Michael Ellerman
Christoph Hellwig writes: > On Sun, Dec 09, 2018 at 09:23:39PM +1100, Michael Ellerman wrote: >> Christoph Hellwig writes: >> >> > Configure the dma settings at device setup time, and stop playing games >> > with get_pci_dma_ops. This prepares for using the common dma_configure >> > code later

Re: ensure dma_alloc_coherent always returns zeroed memory

2018-12-14 Thread Christoph Hellwig
And in various places this used GFP_ZERO instead of __GFP_ZERO, so won't compile. The fixed version is available here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-alloc-always-zero ___ iommu mailing list iommu@lists.linux-founda

Re: [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct

2018-12-14 Thread Marek Szyprowski
Hi Christoph, On 2018-12-07 20:07, Christoph Hellwig wrote: > Avoid expensive indirect calls in the fast path DMA mapping > operations by directly calling the dma_direct_* ops if we are using > the directly mapped DMA operations. > > Signed-off-by: Christoph Hellwig This breaks direct DMA on ARM

Re: [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct

2018-12-14 Thread Christoph Hellwig
On Fri, Dec 14, 2018 at 03:11:37PM +0100, Marek Szyprowski wrote: > Hi Christoph, > > On 2018-12-07 20:07, Christoph Hellwig wrote: > > Avoid expensive indirect calls in the fast path DMA mapping > > operations by directly calling the dma_direct_* ops if we are using > > the directly mapped DMA op

Re: [PATCH 15/15] dma-mapping: bypass indirect calls for dma-direct

2018-12-14 Thread Marek Szyprowski
Hi Christoph, On 2018-12-14 15:24, Christoph Hellwig wrote: > On Fri, Dec 14, 2018 at 03:11:37PM +0100, Marek Szyprowski wrote: >> Hi Christoph, >> >> On 2018-12-07 20:07, Christoph Hellwig wrote: >>> Avoid expensive indirect calls in the fast path DMA mapping >>> operations by directly calling th

[PATCH dma-mapping tree] arm64: default to the direct mapping in get_arch_dma_ops

2018-12-14 Thread Christoph Hellwig
Otherwise the direct mapping won't work at all given that a NULL dev->dma_ops causes a fallback. Note that we already explicitly set dev->dma_ops to dma_dummy_ops for dma-incapable devices, so this fallback should not be needed anyway. Fixes: 356da6d0cd ("dma-mapping: bypass indirect calls for dm

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Greg Ungerer
On 14/12/18 9:47 pm, Christoph Hellwig wrote: On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: - page = alloc_pages(flag, order); + page = alloc_pages(flag | GFP_ZERO, order); if (!page) return NULL; There's second implementation below

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Eugeniy Paltsev
Hi Christoph, do you have any public git repository with all your dma changes? I want to test them for ARC. Thanks. On Fri, 2018-12-14 at 09:25 +0100, Christoph Hellwig wrote: > If we want to map memory from the DMA allocator to userspace it must be > zeroed at allocation time to prevent stale

Re: [PATCH] iommu/ipmmu-vmsa: Hook up r8a774c0 DT matching code

2018-12-14 Thread Simon Horman
On Thu, Dec 13, 2018 at 08:22:44PM +, Fabrizio Castro wrote: > Support RZ/G2E (a.k.a. R8A774C0) IPMMU. > > Signed-off-by: Fabrizio Castro Reviewed-by: Simon Horman ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundati

Re: [PATCH 12/34] powerpc/cell: move dma direct window setup out of dma_configure

2018-12-14 Thread Christoph Hellwig
On Sat, Dec 15, 2018 at 12:29:11AM +1100, Michael Ellerman wrote: > I think the problem is that we don't want to set iommu_bypass_supported > unless cell_iommu_fixed_mapping_init() succeeds. > > Yep. This makes it work for me on cell on top of your v5. Thanks, this looks good. I've folded it wit

Re: use generic DMA mapping code in powerpc V4

2018-12-14 Thread Christoph Hellwig
On Fri, Dec 14, 2018 at 01:00:26PM +0100, Christian Zigotzky wrote: > On 12 December 2018 at 3:15PM, Christoph Hellwig wrote: > > Thanks for bisecting.  I've spent some time going over the conversion > > but can't really pinpoint it.  I have three little patches that switch > > parts of the code to

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Sam Ravnborg
Hi Christoph, I stumbled upon this one: #define __get_dma_pages(gfp_mask, order) \ __get_free_pages((gfp_mask) | GFP_DMA, (order)) (include/linux/gfp.h) Should it also have the __GFP_ZERO treatment? Or maybe this is already done in your tree.. As for the sparc bits: Acked-by: Sa

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Christoph Hellwig
On Fri, Dec 14, 2018 at 07:10:56PM +0100, Sam Ravnborg wrote: > Hi Christoph, > > I stumbled upon this one: > > #define __get_dma_pages(gfp_mask, order) \ > __get_free_pages((gfp_mask) | GFP_DMA, (order)) This isn't directly related to the dma mapping, but another place that hide

Re: [PATCH 13/15] ACPI / scan: Refactor _CCA enforcement

2018-12-14 Thread Bjorn Helgaas
On Fri, Dec 07, 2018 at 11:07:18AM -0800, Christoph Hellwig wrote: > From: Robin Murphy > > Rather than checking the DMA attribute at each callsite, just pass it > through for acpi_dma_configure() to handle directly. That can then deal > with the relatively exceptional DEV_DMA_NOT_SUPPORTED case

Re: [PATCH 14/15] vmd: use the proper dma_* APIs instead of direct methods calls

2018-12-14 Thread Bjorn Helgaas
Conventional spelling in subject is PCI: vmd: Use dma_* APIs instead of direct method calls On Fri, Dec 07, 2018 at 11:07:19AM -0800, Christoph Hellwig wrote: > With the bypass support for the direct mapping we might not always have > methods to call, so use the proper APIs instead. The only d

Re: [PATCH 14/15] vmd: use the proper dma_* APIs instead of direct methods calls

2018-12-14 Thread Derrick, Jonathan
Looks good to me Thanks Christoph Acked-by: Jon Derrick On Fri, 2018-12-14 at 15:17 -0600, Bjorn Helgaas wrote: > Conventional spelling in subject is > > PCI: vmd: Use dma_* APIs instead of direct method calls > > On Fri, Dec 07, 2018 at 11:07:19AM -0800, Christoph Hellwig wrote: > > With th

Re: [RFC v2 14/20] iommu: introduce device fault data

2018-12-14 Thread Jacob Pan
On Wed, 12 Dec 2018 09:21:43 +0100 Auger Eric wrote: > Hi Jacob, > > On 9/21/18 12:06 AM, Jacob Pan wrote: > > On Tue, 18 Sep 2018 16:24:51 +0200 > > Eric Auger wrote: > > > >> From: Jacob Pan > >> > >> Device faults detected by IOMMU can be reported outside IOMMU > >> subsystem for further

Re: [PATCH 3/6] sparc: remove the sparc32_dma_ops indirection

2018-12-14 Thread Guenter Roeck
On Sat, Dec 08, 2018 at 09:41:12AM -0800, Christoph Hellwig wrote: > There is no good reason to have a double indirection for the sparc32 > dma ops, so remove the sparc32_dma_ops and define separate dma_map_ops > instance for the different IOMMU types. > Except maybe this: scsi host0: esp scsi h