Re: [PATCH v3 2/6] iommu/dma: add support for non-strict mode

2018-07-25 Thread Leizhen (ThunderTown)
On 2018/7/25 6:01, Robin Murphy wrote: > On 2018-07-12 7:18 AM, Zhen Lei wrote: >> 1. Save the related domain pointer in struct iommu_dma_cookie, make iovad >> capable call domain->ops->flush_iotlb_all to flush TLB. >> 2. Add a new iommu capability: IOMMU_CAP_NON_STRICT, which used to indica

Re: [PATCH v3 0/6] add non-strict mode support for arm-smmu-v3

2018-07-25 Thread Leizhen (ThunderTown)
On 2018/7/25 5:51, Robin Murphy wrote: > On 2018-07-12 7:18 AM, Zhen Lei wrote: >> v2 -> v3: >> Add a bootup option "iommu_strict_mode" to make the manager can choose which >> mode to be used. The first 5 patches have not changed. >> +iommu_strict_mode=[arm-smmu-v3] >> +0 - strict

RE: [RFC PATCH 03/10] iommu/vt-d: Allocate groups for mediated devices

2018-07-25 Thread Tian, Kevin
> From: Tian, Kevin > Sent: Thursday, July 26, 2018 11:04 AM [...] > > > > The IOMMU operations we care about don't take a device handle, I think, > > just a domain. And VFIO itself only deals with domains when doing > > map/unmap. Maybe we could add this operation to the IOMMU > subsystem: > > > >

RE: [RFC PATCH 03/10] iommu/vt-d: Allocate groups for mediated devices

2018-07-25 Thread Tian, Kevin
> From: Jean-Philippe Brucker [mailto:jean-philippe.bruc...@arm.com] > Sent: Thursday, July 26, 2018 3:20 AM > > On 25/07/18 07:19, Tian, Kevin wrote: > >> From: Tian, Kevin > >> Sent: Wednesday, July 25, 2018 10:16 AM > >> > > [...] > >>> > >>> There is another way: as we're planning to add a gen

Re: [PATCH] iommu/ipmmu-vmsa: Clarify supported platforms

2018-07-25 Thread Laurent Pinchart
Hi Geert, Thank you for the patch. On Wednesday, 25 July 2018 16:10:29 EEST Geert Uytterhoeven wrote: > The Renesas IPMMU-VMSA driver supports not just R-Car H2 and M2 SoCs, > but also other R-Car Gen2 and R-Car Gen3 SoCs. > > Drop a superfluous "Renesas" while at it. > > Signed-off-by: Geert U

Re: [RFC PATCH 03/10] iommu/vt-d: Allocate groups for mediated devices

2018-07-25 Thread Jean-Philippe Brucker
On 25/07/18 07:19, Tian, Kevin wrote: >> From: Tian, Kevin >> Sent: Wednesday, July 25, 2018 10:16 AM >> > [...] >>> >>> There is another way: as we're planning to add a generic pasid_alloc() >>> function to the IOMMU API, the mdev module itself could allocate a >>> default PASID for each mdev by c

[PATCH 2/2] iommu/arm-smmu: Add support for Stratix10 smmu-v2 variant

2018-07-25 Thread thor . thayer
From: Thor Thayer Add the clocks required for the Stratix10 SMMU. Define the clock names in the SMMU name array and add DT compatible matching element. Signed-off-by: Thor Thayer --- This patch is dependent on the patch series "iommu/arm-smmu: Add runtime pm/sleep support" (https://patchwork.oz

[PATCH 0/2] iommu/arm-smmu: Add Stratix10 SMMU Support

2018-07-25 Thread thor . thayer
From: Thor Thayer Add SMMU support for the Stratix10 SOCFPGA. This patch requires clock enables for the master TBUs and therefore has a dependency on patches currently being reviewed. This patchset is dependent on the patch series "iommu/arm-smmu: Add runtime pm/sleep support" (https://patchwork

[PATCH 1/2] arm64: dts: stratix10: Add Stratix10 SMMU support

2018-07-25 Thread thor . thayer
From: Thor Thayer Add SMMU support to the Stratix10 Device Tree which includes adding the SMMU node and adding IOMMU stream ids to the SMMU peripherals. Update bindings. Signed-off-by: Thor Thayer --- This patch is dependent on the patch series "iommu/arm-smmu: Add runtime pm/sleep support" (ht

Re: [PATCH v13 1/4] iommu/arm-smmu: Add pm_runtime/sleep ops

2018-07-25 Thread Vivek Gautam
On Tue, Jul 24, 2018 at 8:51 PM, Robin Murphy wrote: > On 19/07/18 11:15, Vivek Gautam wrote: >> >> From: Sricharan R >> >> The smmu needs to be functional only when the respective >> master's using it are active. The device_link feature >> helps to track such functional dependencies, so that the

Re: [PATCH v2 6/7] ACPI/IORT: Don't set default coherent DMA mask

2018-07-25 Thread Robin Murphy
On 2018-07-25 4:27 PM, Lorenzo Pieralisi wrote: On Mon, Jul 23, 2018 at 11:16:11PM +0100, Robin Murphy wrote: Now that we can track upstream DMA constraints properly with bus_dma_mask instead of trying (and failing) to maintain it in coherent_dma_mask, it doesn't make much sense for the firmware

Re: [PATCH v2 6/7] ACPI/IORT: Don't set default coherent DMA mask

2018-07-25 Thread Lorenzo Pieralisi
On Mon, Jul 23, 2018 at 11:16:11PM +0100, Robin Murphy wrote: > Now that we can track upstream DMA constraints properly with > bus_dma_mask instead of trying (and failing) to maintain it in > coherent_dma_mask, it doesn't make much sense for the firmware code to > be touching the latter at all. It'

Re: [PATCH] iommu/iova: Update cached node pointer when current node fails to get any free IOVA

2018-07-25 Thread Robin Murphy
On 12/07/18 08:45, Ganapatrao Kulkarni wrote: Hi Robin, On Mon, Jun 4, 2018 at 9:36 AM, Ganapatrao Kulkarni wrote: ping?? On Mon, May 21, 2018 at 6:45 AM, Ganapatrao Kulkarni wrote: On Thu, Apr 26, 2018 at 3:15 PM, Ganapatrao Kulkarni wrote: Hi Robin, On Mon, Apr 23, 2018 at 11:11 PM, G

Re: [PATCH v2 0/7] Stop losing firmware-set DMA masks

2018-07-25 Thread Ard Biesheuvel
On 25 July 2018 at 13:31, Christoph Hellwig wrote: > Hi Robin, > > this series looks fine to me. Do you want me to pull this into the > dma-mapping tree? I'd like to see a few more ACKs from the ACPI/OF/ > IOMMU maintainers though. > This fixes the issue I reported with the on-SoC NIC of the So

Re: [PATCH/RFC] drivers/vfio: Allow type-1 IOMMU instantiation with Renesas IPMMU-VMSA

2018-07-25 Thread Robin Murphy
Hi Geert, On 25/07/18 14:34, Geert Uytterhoeven wrote: The Renesas IPMMU-VMSA driver is compatible with the notion of a type-1 IOMMU in VFIO. This patch allows guests to use the VFIO_IOMMU_TYPE1 API on hosts equipped with a Renesas VMSA-compatible IPMMU. Signed-off-by: Geert Uytterhoeven ---

[PATCH/RFC] drivers/vfio: Allow type-1 IOMMU instantiation with Renesas IPMMU-VMSA

2018-07-25 Thread Geert Uytterhoeven
The Renesas IPMMU-VMSA driver is compatible with the notion of a type-1 IOMMU in VFIO. This patch allows guests to use the VFIO_IOMMU_TYPE1 API on hosts equipped with a Renesas VMSA-compatible IPMMU. Signed-off-by: Geert Uytterhoeven --- Lightly tested with sata_rcar on Renesas R-Car H3 ES2.0.

Re: [PATCH 3/3] arm64: dts: stratix10: Add SMMU Node

2018-07-25 Thread Robin Murphy
On 16/07/18 19:56, Thor Thayer wrote: [...] @@ -332,6 +342,36 @@   altr,modrst-offset = <0x20>;   }; +    smmu: iommu@fa00 { +    compatible = "arm,mmu-500", "arm,smmu-v2"; +    reg = <0xfa00 0x4>; +    #global-interrupts = <9>; +   

Re: [PATCH v2 3/7] ACPI/IORT: Set bus DMA mask as appropriate

2018-07-25 Thread Lorenzo Pieralisi
On Mon, Jul 23, 2018 at 11:16:08PM +0100, Robin Murphy wrote: > When an explicit DMA limit is described by firmware, we need to remember > it regardless of how drivers might subsequently update their devices' > masks. The new bus_dma_mask field does that. > > CC: Lorenzo Pieralisi > CC: Hanjun Gu

[PATCH v2] iommu/ipmmu-vmsa: Fix allocation in atomic context

2018-07-25 Thread Geert Uytterhoeven
When attaching a device to an IOMMU group with CONFIG_DEBUG_ATOMIC_SLEEP=y: BUG: sleeping function called from invalid context at mm/slab.h:421 in_atomic(): 1, irqs_disabled(): 128, pid: 61, name: kworker/1:1 ... Call trace: ... arm_lpae_alloc_pgtable+0x114/0x184 arm

[PATCH] iommu/ipmmu-vmsa: Clarify supported platforms

2018-07-25 Thread Geert Uytterhoeven
The Renesas IPMMU-VMSA driver supports not just R-Car H2 and M2 SoCs, but also other R-Car Gen2 and R-Car Gen3 SoCs. Drop a superfluous "Renesas" while at it. Signed-off-by: Geert Uytterhoeven --- drivers/iommu/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driv

Re: [PATCH 1/7 v6] Documentation: fsl-mc: add iommu-map device-tree binding for fsl-mc bus

2018-07-25 Thread Robin Murphy
On 09/07/18 12:18, Nipun Gupta wrote: The existing IOMMU bindings cannot be used to specify the relationship between fsl-mc devices and IOMMUs. This patch adds a generic binding for mapping fsl-mc devices to IOMMUs, using iommu-map property. No more nits from me :) Acked-by: Robin Murphy Si

Re: [PATCH 5/7 v6] bus/fsl-mc: support dma configure for devices on fsl-mc bus

2018-07-25 Thread Robin Murphy
On 09/07/18 12:18, Nipun Gupta wrote: This patch adds support of dma configuration for devices on fsl-mc bus using 'dma_configure' callback for busses. Also, directly calling arch_setup_dma_ops is removed from the fsl-mc bus. Reviewed-by: Robin Murphy Signed-off-by: Nipun Gupta Reviewed-by:

Re: [PATCH 4/7 v6] iommu/arm-smmu: Add support for the fsl-mc bus

2018-07-25 Thread Robin Murphy
On 09/07/18 12:18, Nipun Gupta wrote: Implement bus specific support for the fsl-mc bus including registering arm_smmu_ops and bus specific device add operations. I guess this is about as neat as it can get; Reviewed-by: Robin Murphy Signed-off-by: Nipun Gupta --- drivers/iommu/arm-smmu.

Re: [PATCH v2 0/7] Stop losing firmware-set DMA masks

2018-07-25 Thread Will Deacon
On Wed, Jul 25, 2018 at 01:12:56PM +0100, Robin Murphy wrote: > On 25/07/18 12:31, Christoph Hellwig wrote: > >Hi Robin, > > > >this series looks fine to me. Do you want me to pull this into the > >dma-mapping tree? I'd like to see a few more ACKs from the ACPI/OF/ > >IOMMU maintainers though. >

Re: [PATCH v2 0/7] Stop losing firmware-set DMA masks

2018-07-25 Thread Robin Murphy
On 25/07/18 12:31, Christoph Hellwig wrote: Hi Robin, this series looks fine to me. Do you want me to pull this into the dma-mapping tree? I'd like to see a few more ACKs from the ACPI/OF/ IOMMU maintainers though. Thanks, I was indeed assuming that the dma-mapping tree would be the best ro

Re: [PATCH v2 0/7] Stop losing firmware-set DMA masks

2018-07-25 Thread Joerg Roedel
On Wed, Jul 25, 2018 at 01:31:22PM +0200, Christoph Hellwig wrote: > Hi Robin, > > this series looks fine to me. Do you want me to pull this into the > dma-mapping tree? I'd like to see a few more ACKs from the ACPI/OF/ > IOMMU maintainers though. For the IOMMU parts: Acked-by: Joerg R

Re: [PATCH 3/3] iommu/arm-smmu: Error out only if not enough context interrupts

2018-07-25 Thread Will Deacon
On Tue, Jul 24, 2018 at 03:09:41PM +0530, Vivek Gautam wrote: > On 7/24/2018 2:06 PM, Will Deacon wrote: > >On Thu, Jul 19, 2018 at 11:23:56PM +0530, Vivek Gautam wrote: > >>diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > >>index 7c69736a30f8..4cb53bf4f423 100644 > >>--- a/driver

[PATCH 5/6] swiotlb: share more code between map_page and map_sg

2018-07-25 Thread Christoph Hellwig
Refactor all the common code into what previously was map_single, which is now renamed to __swiotlb_map_page. This also improves the map_sg error handling and diagnostics to match the map_page ones. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 114

[PATCH 4/6] swiotlb: mark is_swiotlb_buffer static

2018-07-25 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- include/linux/swiotlb.h | 1 - kernel/dma/swiotlb.c| 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 965be92c33b5..7ef541ce8f34 100644 --- a/include/linux/swiotlb.h +++ b/include/l

[PATCH 6/6] swiotlb: respect DMA_ATTR_NO_WARN in __swiotlb_map_page

2018-07-25 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 8ca0964ebf3a..5c3db7c89e0f 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -606,8 +606,1

[PATCH 3/6] swiotlb: merge swiotlb_unmap_page and unmap_single

2018-07-25 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 06cfc4d00325..03016221fc64 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -812,9 +812,9

[PATCH 2/6] swiotlb: do not panic on mapping failures

2018-07-25 Thread Christoph Hellwig
All properly written drivers now have error handling in the dma_map_single / dma_map_page callers. As swiotlb_tbl_map_single already prints a useful warning when running out of swiotlb pool swace we can also remove swiotlb_full entirely as it serves no purpose now. Signed-off-by: Christoph Hellwi

[PATCH 1/6] swiotlb: remove a pointless comment

2018-07-25 Thread Christoph Hellwig
This comments describes an aspect of the map_sg interface that isn't even exploited by swiotlb. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 4f8a6dbf0b60..9062b14bc7f4 100644 -

swiotlb cleanup (resend)

2018-07-25 Thread Christoph Hellwig
Hi Konrad, below are a few swiotlb patches. Mostly just cleanups, but the removal of the panic option is an actual change in (rarely used) functionality. I'd be happy to pick them up through the dma-mapping tree if you are fine with that. ___ iommu mai

Re: [PATCH v2] dma-mapping: Relax warning for per-device areas

2018-07-25 Thread Christoph Hellwig
Thanks, I'll pull this into the dma-mapping tree. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v2 0/7] Stop losing firmware-set DMA masks

2018-07-25 Thread Christoph Hellwig
Hi Robin, this series looks fine to me. Do you want me to pull this into the dma-mapping tree? I'd like to see a few more ACKs from the ACPI/OF/ IOMMU maintainers though. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfounda

Re: [PATCH v2 4/7] of/device: Set bus DMA mask as appropriate

2018-07-25 Thread Christoph Hellwig
On Mon, Jul 23, 2018 at 11:16:09PM +0100, Robin Murphy wrote: > When an explicit DMA limit is described by firmware, we need to remember > it regardless of how drivers might subsequently update their devices' > masks. The new bus_dma_mask field does that. Looks good, Reviewed-by: Christoph Hellwi

Re: [PATCH v2 3/7] ACPI/IORT: Set bus DMA mask as appropriate

2018-07-25 Thread Christoph Hellwig
On Mon, Jul 23, 2018 at 11:16:08PM +0100, Robin Murphy wrote: > When an explicit DMA limit is described by firmware, we need to remember > it regardless of how drivers might subsequently update their devices' > masks. The new bus_dma_mask field does that. Looks good, Reviewed-by: Christoph Hellwi

Re: [PATCH v2 2/7] dma-mapping: Generalise dma_32bit_limit flag

2018-07-25 Thread Christoph Hellwig
On Mon, Jul 23, 2018 at 11:16:07PM +0100, Robin Murphy wrote: > Whilst the notion of an upstream DMA restriction is most commonly seen > in PCI host bridges saddled with a 32-bit native interface, a more > general version of the same issue can exist on complex SoCs where a bus > or point-to-point i

[PATCH 5/5] sh: use generic dma_noncoherent_ops

2018-07-25 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 4/5] sh: split arch/sh/mm/consistent.c

2018-07-25 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 3/5] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case

2018-07-25 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 2/5] sh: introduce a sh_cacheop_vaddr helper

2018-07-25 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 1/5] sh: simplify get_arch_dma_ops

2018-07-25 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/

use the generic dma-noncoherent code for sh V3

2018-07-25 Thread Christoph Hellwig
Hi all, can you review these patches to switch sh to use the generic dma-noncoherent code? All the requirements are in mainline already and we've switched various architectures over to it already. Changes since V2: - drop a now obsolete export Changes since V1: - fixed two stupid compile erro