cleanup the dma_pgprot handling

2019-08-16 Thread Christoph Hellwig
Hi all, this series replaced the arch_dma_mmap_pgprot hooks with the simpler pgprot_dmacoherent as used by the arm code already and cleans up various bits around that area. I'd still like to hear a confirmation from the mips folks how the write combibe attribute can or can't work with the KSEG1 u

[PATCH 1/6] MIPS: remove support for DMA_ATTR_WRITE_COMBINE

2019-08-16 Thread Christoph Hellwig
Mips uses the KSEG1 kernel memory segment do map dma coherent allocations for non-coherent devices as uncachable, and does not have any kind of special support for DMA_ATTR_WRITE_COMBINE in the allocation path. Thus supporting DMA_ATTR_WRITE_COMBINE in dma_mmap_attrs will lead to multiple mappings

[PATCH 2/6] unicore32: remove the unused pgprot_dmacoherent define

2019-08-16 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- arch/unicore32/include/asm/pgtable.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h index 9492aa304f03..126e961a8cb0 100644 --- a/arch/unicore32/include/asm/pgtable.h +++ b/arch

[PATCH 3/6] arm-nommu: remove the unused pgprot_dmacoherent define

2019-08-16 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/pgtable-nommu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h index 0b1f6799a32e..d0de24f06724 100644 --- a/arch/arm/include/asm/pgtable-nommu.h +++ b/arch/a

[PATCH 4/6] dma-mapping: remove arch_dma_mmap_pgprot

2019-08-16 Thread Christoph Hellwig
arch_dma_mmap_pgprot is used for two things: 1) to override the "normal" uncached page attributes for mapping memory coherent to devices that can't snoop the CPU caches 2) to provide the special DMA_ATTR_WRITE_COMBINE semantics on older arm systems Replace one with the pgprot_dmacoheren

[PATCH 5/6] dma-mapping: make dma_atomic_pool_init self-contained

2019-08-16 Thread Christoph Hellwig
The memory allocated for the atomic pool needs to have the same mapping attributes that we use for remapping, so use pgprot_dmacoherent instead of open coding it. Also deduct a suitable zone to allocate the memory from based on the presence of the DMA zones. Signed-off-by: Christoph Hellwig ---

Re: [PATCH v9 08/21] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-08-16 Thread Yong Wu
On Thu, 2019-08-15 at 12:50 +0100, Will Deacon wrote: > Ok, I think speaking to Robin helped me a bit with this... > > On Thu, Aug 15, 2019 at 06:18:38PM +0800, Yong Wu wrote: > > On Thu, 2019-08-15 at 10:51 +0100, Will Deacon wrote: > > > On Thu, Aug 15, 2019 at 04:47:49PM +0800, Yong Wu wrote: >

[PATCH 6/6] arm64: document the choice of page attributes for pgprot_dmacoherent

2019-08-16 Thread Christoph Hellwig
Based on an email from Will Deacon. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/pgtable.h | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 6700371227d1..6ff221d9a631 100644 --- a/arch/arm64/inclu

Re: [PATCH 6/6] driver core: initialize a default DMA mask for platform device

2019-08-16 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Aug 16, 2019 at 8:30 AM Christoph Hellwig wrote: > We still treat devices without a DMA mask as defaulting to 32-bits for > both mask, but a few releases ago we've started warning about such > cases, as they require special cases to work around this sloppyness. > Add a dma_m

Re: [PATCH 4/6] dma-mapping: remove arch_dma_mmap_pgprot

2019-08-16 Thread Geert Uytterhoeven
On Fri, Aug 16, 2019 at 9:19 AM Christoph Hellwig wrote: > arch_dma_mmap_pgprot is used for two things: > > 1) to override the "normal" uncached page attributes for mapping > memory coherent to devices that can't snoop the CPU caches > 2) to provide the special DMA_ATTR_WRITE_COMBINE semanti

Re: [PATCH 00/13] Rework IOMMU API to allow for batching of invalidation

2019-08-16 Thread John Garry
On 15/08/2019 14:55, Will Deacon wrote: On Thu, Aug 15, 2019 at 12:19:58PM +0100, John Garry wrote: On 14/08/2019 18:56, Will Deacon wrote: If you'd like to play with the patches, then I've also pushed them here: https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=iommu/un

Re: [PATCH v2 2/2] iommu/arm-smmu-v3: add nr_ats_masters for quickly check

2019-08-16 Thread Leizhen (ThunderTown)
On 2019/8/15 23:23, Will Deacon wrote: > On Thu, Aug 15, 2019 at 01:44:39PM +0800, Zhen Lei wrote: >> When (smmu_domain->smmu->features & ARM_SMMU_FEAT_ATS) is true, even if a >> smmu domain does not contain any ats master, the operations of >> arm_smmu_atc_inv_to_cmd() and lock protection in ar

swiotlb-xen cleanups

2019-08-16 Thread Christoph Hellwig
Hi Xen maintainers and friends, please take a look at this series that cleans up the parts of swiotlb-xen that deal with non-coherent caches. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH 04/11] xen/arm: remove xen_dma_ops

2019-08-16 Thread Christoph Hellwig
arm and arm64 can just use xen_swiotlb_dma_ops directly like x86, no need for a pointer indirection. Signed-off-by: Christoph Hellwig --- arch/arm/mm/dma-mapping.c| 3 ++- arch/arm/xen/mm.c| 4 arch/arm64/mm/dma-mapping.c | 3 ++- include/xen/arm/hypervisor.h | 2 -- 4 file

[PATCH 05/11] xen: remove the exports for xen_{create,destroy}_contiguous_region

2019-08-16 Thread Christoph Hellwig
These routines are only used by swiotlb-xen, which cannot be modular. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 2 -- arch/x86/xen/mmu_pv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index 388a45002bad..a59980f1aa54 100644 --- a

[PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint

2019-08-16 Thread Christoph Hellwig
Instead of taking apart the dma address in both callers do it inside dma_cache_maint itself. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index 90574d89d0d4..d9da24fda2f

[PATCH 09/11] swiotlb-xen: simplify cache maintainance

2019-08-16 Thread Christoph Hellwig
Now that we know we always have the dma-noncoherent.h helpers available if we are on an architecture with support for non-coherent devices, we can just call them directly, and remove the calls to the dma-direct routines, including the fact that we call the dma_direct_map_page routines but ignore th

[PATCH 02/11] xen/arm: use dev_is_dma_coherent

2019-08-16 Thread Christoph Hellwig
Use the dma-noncoherent dev_is_dma_coherent helper instead of the home grown variant. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/dma-mapping.h | 6 -- arch/arm/xen/mm.c| 12 ++-- arch/arm64/include/asm/dma-mapping.h | 9 - 3 files change

[PATCH 01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance

2019-08-16 Thread Christoph Hellwig
Reuse the arm64 code that uses the dma-direct/swiotlb helpers for DMA non-coherent devices. Signed-off-by: Christoph Hellwig --- arch/arm/Kconfig | 4 + arch/arm/include/asm/device.h | 3 - arch/arm/include/asm/xen/page-coherent.h | 93 -

[PATCH 06/11] swiotlb-xen: always use dma-direct helpers to alloc coherent pages

2019-08-16 Thread Christoph Hellwig
x86 currently calls alloc_pages, but using dma-direct works as well there, with the added benefit of using the CMA pool if available. The biggest advantage is of course to remove a pointless bit of architecture specific code. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/xen/page-coh

[PATCH 07/11] swiotlb-xen: provide a single page-coherent.h header

2019-08-16 Thread Christoph Hellwig
Merge the various page-coherent.h files into a single one that either provides prototypes or stubs depending on the need for cache maintainance. For extra benefits alo include in the file actually implementing the interfaces provided. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/x

[PATCH 10/11] swiotlb-xen: merge xen_unmap_single into xen_swiotlb_unmap_page

2019-08-16 Thread Christoph Hellwig
No need for a no-op wrapper. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index c3c383033ae4..b6b9c4c1b397 100644 --- a/drivers/xen/swiotlb

[PATCH 11/11] arm64: use asm-generic/dma-mapping.h

2019-08-16 Thread Christoph Hellwig
Now that the Xen special cases are gone nothing worth mentioning is left in the arm64 file, so switch to use the asm-generic version instead. Signed-off-by: Christoph Hellwig --- arch/arm64/include/asm/Kbuild| 1 + arch/arm64/include/asm/dma-mapping.h | 22 -- arch/

[PATCH 08/11] swiotlb-xen: use the same foreign page check everywhere

2019-08-16 Thread Christoph Hellwig
xen_dma_map_page uses a different and more complicated check for foreign pages than the other three cache maintainance helpers. Switch it to the simpler pfn_vali method a well. Signed-off-by: Christoph Hellwig --- include/xen/page-coherent.h | 9 ++--- 1 file changed, 2 insertions(+), 7 dele

Re: [PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint

2019-08-16 Thread Robin Murphy
On 16/08/2019 14:00, Christoph Hellwig wrote: Instead of taking apart the dma address in both callers do it inside dma_cache_maint itself. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/xen/mm.c b

Re: DMA-API: cacheline tracking ENOMEM, dma-debug disabled due to nouveau ?

2019-08-16 Thread Corentin Labbe
On Wed, Aug 14, 2019 at 07:49:27PM +0200, Daniel Vetter wrote: > On Wed, Aug 14, 2019 at 04:50:33PM +0200, Corentin Labbe wrote: > > Hello > > > > Since lot of release (at least since 4.19), I hit the following error > > message: > > DMA-API: cacheline tracking ENOMEM, dma-debug disabled > > > >

Re: [PATCH v3 hmm 00/11] Add mmu_notifier_get/put for managing mmu notifier registrations

2019-08-16 Thread Jason Gunthorpe
On Tue, Aug 06, 2019 at 08:15:37PM -0300, Jason Gunthorpe wrote: > This series is already entangled with patches in the hmm & RDMA tree and > will require some git topic branches for the RDMA ODP stuff. I intend for > it to go through the hmm tree. > Jason Gunthorpe (11): > mm/mmu_notifiers: hoi

regression in ath10k dma allocation

2019-08-16 Thread Tobias Klausmann
Hello all, within the current development cycle i noted the ath10k driver failing to setup: [    3.185660] ath10k_pci :02:00.0: failed to alloc CE dest ring 1: -12 [    3.185664] ath10k_pci :02:00.0: failed to allocate copy engine pipe 1: -12 [    3.185667] ath10k_pci :02:00.0: fa

Re: regression in ath10k dma allocation

2019-08-16 Thread Christoph Hellwig
Hi Tobias, do you have CONFIG_DMA_CMA set in your config? If not please make sure you have this commit in your testing tree, and if the problem still persists it would be a little odd and we'd have to dig deeper: commit dd3dcede9fa0a0b661ac1f24843f4a1b1317fdb6 Author: Nicolin Chen Date: Wed M

Re: [PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint

2019-08-16 Thread Christoph Hellwig
On Fri, Aug 16, 2019 at 02:37:58PM +0100, Robin Murphy wrote: > On 16/08/2019 14:00, Christoph Hellwig wrote: >> Instead of taking apart the dma address in both callers do it inside >> dma_cache_maint itself. >> >> Signed-off-by: Christoph Hellwig >> --- >> arch/arm/xen/mm.c | 10 ++ >>

Re: [Freedreno] [PATCH v3 0/2] iommu/arm-smmu: Split pagetable support

2019-08-16 Thread Robin Murphy
Hi Jordan, On 15/08/2019 16:33, Jordan Crouse wrote: On Wed, Aug 07, 2019 at 04:21:38PM -0600, Jordan Crouse wrote: (Sigh, resend. I freaked out my SMTP server) This is part of an ongoing evolution for enabling split pagetable support for arm-smmu. Previous versions can be found [1]. In the d

Re: [PATCH 6/6] arm64: document the choice of page attributes for pgprot_dmacoherent

2019-08-16 Thread Will Deacon
Hi Christoph, Thanks for spinning this into a patch. On Fri, Aug 16, 2019 at 09:07:54AM +0200, Christoph Hellwig wrote: > Based on an email from Will Deacon. > > Signed-off-by: Christoph Hellwig > --- > arch/arm64/include/asm/pgtable.h | 8 > 1 file changed, 8 insertions(+) > > diff

Re: [PATCH 6/6] arm64: document the choice of page attributes for pgprot_dmacoherent

2019-08-16 Thread Mark Rutland
On Fri, Aug 16, 2019 at 06:31:18PM +0100, Will Deacon wrote: > Hi Christoph, > > Thanks for spinning this into a patch. > > On Fri, Aug 16, 2019 at 09:07:54AM +0200, Christoph Hellwig wrote: > > Based on an email from Will Deacon. > > > > Signed-off-by: Christoph Hellwig > > --- > > arch/arm64

Re: [PATCH 6/6] arm64: document the choice of page attributes for pgprot_dmacoherent

2019-08-16 Thread Christoph Hellwig
On Fri, Aug 16, 2019 at 06:31:18PM +0100, Will Deacon wrote: > Mind if I tweak the second sentence to be: > > This is different from "Device-nGnR[nE]" memory which is intended for MMIO > and thus forbids speculation, preserves access size, requires strict > alignment and can also force write

Re: [PATCH 6/6] arm64: document the choice of page attributes for pgprot_dmacoherent

2019-08-16 Thread Will Deacon
On Fri, Aug 16, 2019 at 07:59:42PM +0200, Christoph Hellwig wrote: > On Fri, Aug 16, 2019 at 06:31:18PM +0100, Will Deacon wrote: > > Mind if I tweak the second sentence to be: > > > > This is different from "Device-nGnR[nE]" memory which is intended for MMIO > > and thus forbids speculation,

Re: [Freedreno] [PATCH v3 0/2] iommu/arm-smmu: Split pagetable support

2019-08-16 Thread Rob Clark
On Fri, Aug 16, 2019 at 9:58 AM Robin Murphy wrote: > > Hi Jordan, > > On 15/08/2019 16:33, Jordan Crouse wrote: > > On Wed, Aug 07, 2019 at 04:21:38PM -0600, Jordan Crouse wrote: > >> (Sigh, resend. I freaked out my SMTP server) > >> > >> This is part of an ongoing evolution for enabling split pa

Re: DMA-API: cacheline tracking ENOMEM, dma-debug disabled due to nouveau ?

2019-08-16 Thread Daniel Vetter
On Fri, Aug 16, 2019 at 4:31 PM Corentin Labbe wrote: > On Wed, Aug 14, 2019 at 07:49:27PM +0200, Daniel Vetter wrote: > > On Wed, Aug 14, 2019 at 04:50:33PM +0200, Corentin Labbe wrote: > > > Hello > > > > > > Since lot of release (at least since 4.19), I hit the following error > > > message: >

Re: [Freedreno] [PATCH v3 0/2] iommu/arm-smmu: Split pagetable support

2019-08-16 Thread Robin Murphy
On 16/08/2019 19:12, Rob Clark wrote: On Fri, Aug 16, 2019 at 9:58 AM Robin Murphy wrote: Hi Jordan, On 15/08/2019 16:33, Jordan Crouse wrote: On Wed, Aug 07, 2019 at 04:21:38PM -0600, Jordan Crouse wrote: (Sigh, resend. I freaked out my SMTP server) This is part of an ongoing evolution fo

Re: [PATCH v9 2/5] iommu/dma: Add a new dma_map_ops of get_merge_boundary()

2019-08-16 Thread Wolfram Sang
On Fri, Jul 26, 2019 at 05:31:13PM +0900, Yoshihiro Shimoda wrote: > This patch adds a new dma_map_ops of get_merge_boundary() to > expose the DMA merge boundary if the domain type is IOMMU_DOMAIN_DMA. > > Signed-off-by: Yoshihiro Shimoda > Reviewed-by: Simon Horman Joerg, can we have your ack

Re: [PATCH v9 3/5] block: sort headers on blk-setting.c

2019-08-16 Thread Wolfram Sang
On Fri, Jul 26, 2019 at 05:31:14PM +0900, Yoshihiro Shimoda wrote: > This patch sorts the headers in alphabetic order to ease > the maintenance for this part. > > Signed-off-by: Yoshihiro Shimoda > Reviewed-by: Wolfram Sang > Reviewed-by: Simon Horman > --- Jens, can we have your ack for this

Re: [Freedreno] [PATCH v3 0/2] iommu/arm-smmu: Split pagetable support

2019-08-16 Thread Jordan Crouse
On Fri, Aug 16, 2019 at 08:43:53PM +0100, Robin Murphy wrote: > On 16/08/2019 19:12, Rob Clark wrote: > >On Fri, Aug 16, 2019 at 9:58 AM Robin Murphy wrote: > >> > >>Hi Jordan, > >> > >>On 15/08/2019 16:33, Jordan Crouse wrote: > >>>On Wed, Aug 07, 2019 at 04:21:38PM -0600, Jordan Crouse wrote: >

Re: regression in ath10k dma allocation

2019-08-16 Thread Nicolin Chen
Hi Tobias On Fri, Aug 16, 2019 at 10:16:45PM +0200, Tobias Klausmann wrote: > > do you have CONFIG_DMA_CMA set in your config? If not please make sure > > you have this commit in your testing tree, and if the problem still > > persists it would be a little odd and we'd have to dig deeper: > > >

Re: [Xen-devel] [PATCH 07/11] swiotlb-xen: provide a single page-coherent.h header

2019-08-16 Thread Julien Grall
Hi, On 8/16/19 2:00 PM, Christoph Hellwig wrote: Merge the various page-coherent.h files into a single one that either provides prototypes or stubs depending on the need for cache maintainance. For extra benefits alo include in the file actually implementing the interfaces provided. Signed-of

Re: regression in ath10k dma allocation

2019-08-16 Thread Tobias Klausmann
Hi Nicolin, On 17.08.19 00:25, Nicolin Chen wrote: Hi Tobias On Fri, Aug 16, 2019 at 10:16:45PM +0200, Tobias Klausmann wrote: do you have CONFIG_DMA_CMA set in your config? If not please make sure you have this commit in your testing tree, and if the problem still persists it would be a litt

[PATCH] iommu/omap: Use the correct type for SLAB_HWCACHE_ALIGN

2019-08-16 Thread Suman Anna via iommu
The macro SLAB_HWCACHE_ALIGN is of type slab_flags_t, but is currently assigned in the OMAP IOMMU driver using a unsigned long variable. This generates a sparse warning around the type check. Fix this by defining the variable flags using the correct type. Signed-off-by: Suman Anna --- drivers/io

Re: [PATCH V5 3/5] iommu/dma-iommu: Handle deferred devices

2019-08-16 Thread Hillf Danton
On Thu, 15 Aug 2019 12:09:41 +0100 Tom Murphy wrote: > > Handle devices which defer their attach to the iommu in the dma-iommu api > > Signed-off-by: Tom Murphy > --- > drivers/iommu/dma-iommu.c | 27 ++- > 1 file changed, 26 insertions(+), 1 deletion(-) > > diff --gi

[PATCH v2] iommu/amd: Override wrong IVRS IOAPIC on Raven Ridge systems

2019-08-16 Thread Kai-Heng Feng
Raven Ridge systems may have malfunction touchpad or hang at boot if incorrect IVRS IOAPIC is provided by BIOS. Users already found correct "ivrs_ioapic=" values, let's put them inside kernel to workaround buggy BIOS. BugLink: https://bugs.launchpad.net/bugs/1795292 BugLink: https://bugs.launchpa

Re: [Xen-devel] [PATCH 07/11] swiotlb-xen: provide a single page-coherent.h header

2019-08-16 Thread Christoph Hellwig
On Fri, Aug 16, 2019 at 11:40:43PM +0100, Julien Grall wrote: > I am not sure I agree with this rename. The implementation of the helpers > are very Arm specific as this is assuming Dom0 is 1:1 mapped. > > This was necessary due to the lack of IOMMU on Arm platforms back then. > But this is now a