[RFC/PATCH 8/9] iommu: of: Handle IOMMU lookup failure with deferred probing or error

2015-05-14 Thread Laurent Pinchart
Failures to look up an IOMMU when parsing the DT iommus property need to be handled separately from the .of_xlate() failures to support deferred probing. The lack of a registered IOMMU can be caused by the lack of a driver for the IOMMU, the IOMMU device probe not having been performed yet, having

[RFC/PATCH 5/9] of: dma: Split of_configure_dma() into mask and ops configuration

2015-05-14 Thread Laurent Pinchart
The of_configure_dma() function configures both the DMA masks and ops. Moving DMA ops configuration to probe time would thus also delay configuration of the DMA masks, which might not be safe. To avoid issues split the configuration in two to allow keeping masks configuration at device add time and

[RFC/PATCH 3/9] of: dma: Move range size workaround to of_dma_get_range()

2015-05-14 Thread Laurent Pinchart
Invalid dma-ranges values should be worked around when retrieving the DMA range in of_dma_get_range(), not by all callers of the function. This isn't much of a problem now that we have a single caller, but that situation will change when moving DMA configuration to device probe time. Signed-off-by

[RFC/PATCH 9/9] iommu/ipmmu-vmsa: Use DT-based instantiation

2015-05-14 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart --- drivers/iommu/ipmmu-vmsa.c | 189 ++--- 1 file changed, 60 insertions(+), 129 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 24a950091458..7fa2afb5d7d1 100644 --- a/drivers/iommu/

[RFC/PATCH 7/9] iommu: of: Document the of_iommu_configure() function

2015-05-14 Thread Laurent Pinchart
The function isn't trivial, document its behaviour. Signed-off-by: Laurent Pinchart --- drivers/iommu/of_iommu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 43429ab62228..b922ed4f9fb3 100644 --- a/drivers/iommu/of_i

[RFC/PATCH 4/9] of: dma: Make of_dma_deconfigure() public

2015-05-14 Thread Laurent Pinchart
As part of moving DMA initializing to probe time the of_dma_deconfigure() function will need to be called from different source files. Make it public and move it to drivers/of/device.c where the of_dma_configure() function is. Signed-off-by: Laurent Pinchart --- drivers/of/device.c | 12 ++

[RFC/PATCH 6/9] drivers: platform: Configure dma operations at probe time

2015-05-14 Thread Laurent Pinchart
Configuring DMA ops at probe time will allow deferring device probe when the IOMMU isn't available yet. Signed-off-by: Laurent Pinchart --- drivers/base/platform.c | 9 + drivers/of/platform.c | 7 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/base/pla

[RFC/PATCH 0/9] IOMMU probe deferral support

2015-05-14 Thread Laurent Pinchart
Hello, This patch series attempts to implement support for deferring probe of both IOMMU drivers and bus master drivers. The relationship between bus masters and IOMMUs creates a strong ordering during initialization of devices. As in the general case IOMMUs are hidden behind the DMA mapping API,

[RFC/PATCH 2/9] arm: dma-mapping: Support IOMMU mappings spanning the full 32 bits range

2015-05-14 Thread Laurent Pinchart
The arm_iommu_create_mapping() function takes the IOMMU mapping size as a size_t, limiting the size to 4GB - 1 on 32 bit platforms while most bus masters would support the full 32 bits range. Fix this by passing the size as a 64 bits integer, and limiting it to 4GB for now. Signed-off-by: Laurent

[RFC/PATCH 1/9] arm: dma-mapping: Don't override dma_ops in arch_setup_dma_ops()

2015-05-14 Thread Laurent Pinchart
The arch_setup_dma_ops() function is in charge of setting dma_ops with a call to set_dma_ops(). set_dma_ops() is also called from - highbank and mvebu bus notifiers - dmabounce (to be replaced with swiotlb) - arm_iommu_attach_device (arm_iommu_attach_device is itself called from IOMMU and bus mas

Re: SRIOV and clear_context_table

2015-05-14 Thread Alejandro Lucero
I have found out the problem is related to using iommu=pt and a device not setting dma_mask_coherent. In that case the kernel does not use the identity mapping but a specific one for that device. But a kernel bug avoids the device mapping being removed if iommu=pt whatever the device gets or not t

RE: [PATCH] iommu/fsl: Fix the dependency check for PAMU driver.

2015-05-14 Thread Varun Sethi
Hi Scott, > -Original Message- > From: Wood Scott-B07421 > Sent: Thursday, May 14, 2015 11:43 PM > To: Sethi Varun-B16395 > Cc: linuxppc-...@lists.ozlabs.org; jroe...@suse.de; j...@8bytes.org; > iommu@lists.linux-foundation.org > Subject: Re: [PATCH] iommu/fsl: Fix the dependency check for

Re: [PATCH] iommu/fsl: Fix the dependency check for PAMU driver.

2015-05-14 Thread Scott Wood
On Thu, 2015-05-14 at 23:11 +0530, Varun Sethi wrote: > Fix the build dependency for the PAMU driver. PPC32 build dependecy is > incorrect. > Add the CORENET_GENERIC build dependency for PAMU driver. > > Signed-off-by: Varun Sethi > --- > drivers/iommu/Kconfig |2 +- > 1 file changed, 1 ins

[PATCH] iommu/fsl: Fix the dependency check for PAMU driver.

2015-05-14 Thread Varun Sethi
Fix the build dependency for the PAMU driver. PPC32 build dependecy is incorrect. Add the CORENET_GENERIC build dependency for PAMU driver. Signed-off-by: Varun Sethi --- drivers/iommu/Kconfig |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/Kconfig b/drivers

[PATCH] iommu/ipmmu-vmsa: Replace spinlock with mutex

2015-05-14 Thread Laurent Pinchart
The spinlock is used to protect domain initialization when attaching a device, which allocates memory with GFP_KERNEL. Replace it with a mutex as the initialization always runs in a sleepable context. Signed-off-by: Laurent Pinchart --- drivers/iommu/ipmmu-vmsa.c | 11 ++- 1 file changed