Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-28 Thread Joerg Roedel
Hi Will, On Wed, May 20, 2015 at 06:09:26PM +0100, Will Deacon wrote: > On Tue, May 19, 2015 at 04:24:35PM +0100, Joerg Roedel wrote: > > > + /* Page sizes */ > > > + if (reg & IDR5_GRAN64K) > > > + pgsize_bitmap |= SZ_64K | SZ_512M; > > > + if (reg & IDR5_GRAN16K) > > > + pgsize_b

Re: [PATCH 2/4] iommu: Implement common IOMMU ops for DMA mapping

2015-05-28 Thread Yingjoe Chen
Hi Robin, More info, hope this make it clearer. We are calling dma_map_sg_attrs with the following 2 sg. With IOMMU, we are expecting it got merged into 1 contiguous va range, but instead we get 2 va range. sg0 dma_address 0xfeeddc00 size 0x400, offset 0xc00 sg1 dma_address 0xfeede000 size 0x100

Re: [PATCH 2/4] iommu: Implement common IOMMU ops for DMA mapping

2015-05-28 Thread Yong Wu
Hi Robin, Thanks. While we test venc in v4l2, we get a problem: When we enter the funtion[0], it will be break unexpectedly in the funcion[1] while the offset of sg table is not zero. It is ok if the offset is zero. Then I add more log in dma-iommu.c, please help check below. All w

Re: [PATCH v7 00/25] Exynos SYSMMU (IOMMU) integration with DT andDMA-mapping subsystem

2015-05-28 Thread Krzysztof Kozlowski
On 23.05.2015 12:56, Kukjin Kim wrote: > On 05/20/15 16:31, Javier Martinez Canillas wrote: >> Hello Marek, >> >> On Tue, May 19, 2015 at 3:20 PM, Marek Szyprowski >> wrote: >>> Hello Everyone, >>> >>> This is yet another attempt to get Exynos SYSMMU driver with integrated >>> with IOMMU & DMA-map

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

2015-05-28 Thread Laura Abbott
On 05/14/2015 04:00 PM, Laurent Pinchart wrote: 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

[PATCH 19/22] iommu/amd: Put IOMMUv2 devices in a direct mapped domain

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel A device that might be used for HSA needs to be in a direct mapped domain so that all DMA-API mappings stay alive when the IOMMUv2 stack is used. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-)

[PATCH 21/22] iommu/amd: Remove unused fields from struct dma_ops_domain

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel The list_head and target_dev members are not used anymore. Remove them. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 1 - drivers/iommu/amd_iommu_types.h | 8 2 files changed, 9 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iomm

[PATCH 13/22] iommu: Introduce iommu_request_dm_for_dev()

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel This function can be called by an IOMMU driver to request that a device's default domain is direct mapped. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 52 +++ include/linux/iommu.h | 6 ++ 2 files changed, 58 i

[PATCH 22/22] iommu/amd: Propagate errors from amd_iommu_init_api

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel This function can fail. Propagate any errors back to the initialization state machine. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 4 ++-- drivers/iommu/amd_iommu_init.c | 5 +++-- drivers/iommu/amd_iommu_proto.h | 2 +- 3 files changed, 6 insertions(+

[PATCH 18/22] iommu/amd: Support IOMMU_DOMAIN_IDENTITY type allocation

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Add support to allocate direct mapped domains through the IOMMU-API. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 06d19e8..33bbb4d 100644 --- a

[PATCH 17/22] iommu/amd: Support IOMMU_DOMAIN_DMA type allocation

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel This enables allocation of DMA-API default domains from the IOMMU core and switches allocation of domain dma-api domain to the IOMMU core too. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 311 ++-- drivers/iommu/amd_io

[PATCH 16/22] iommu/amd: Implement add_device and remove_device

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Implement these two iommu-ops call-backs to make use of the initialization and notifier features of the iommu core. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 210 +++-- drivers/iommu/amd_iommu_init.c | 31 ++ 2

[PATCH 20/22] iommu/amd: Get rid of device_dma_ops_init()

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel With device intialization done in the add_device call-back now there is no reason for this function anymore. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 40 +--- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a

[PATCH 15/22] iommu/amd: Use default domain if available for DMA-API

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 9da3f0e..dc8e44b 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2495,12

[PATCH 12/22] iommu: Add function to query the default domain of a group

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel This will be used to handle unity mappings in the iommu drivers. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 5 + include/linux/iommu.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ffad1ea..224c6dd

[PATCH 14/22] iommu/amd: Implement dm_region call-backs

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Add the get_dm_regions and put_dm_regions callbacks to the iommu_ops of the AMD IOMMU driver. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 37 + 1 file changed, 37 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/driv

[PATCH 10/22] iommu: Introduce direct mapped region handling

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Add two new functions to the IOMMU-API to allow the IOMMU drivers to export the requirements for direct mapped regions per device. This is useful for exporting the information in Intel VT-d's RMRR entries or AMD-Vi's unity mappings. Signed-off-by: Joerg Roedel --- drivers/io

[PATCH 03/22] iommu: Propagate error in add_iommu_group

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Make sure any errors reported from the IOMMU drivers get progapated back to the IOMMU core. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 755e48

[PATCH 11/22] iommu: Create direct mappings in default domains

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Use the information exported by the IOMMU drivers to create direct mapped regions in the default domains. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 48 1 file changed, 48 insertions(+) diff --git a/drivers/iommu

[PATCH 06/22] iommu: Allocate a default domain for iommu groups

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel The default domain will be used (if supported by the iommu driver) when the devices in the iommu group are not attached to any other domain. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 32 1 file changed, 28 insertions(+), 4 delet

[PATCH 04/22] iommu: Clean up after a failed bus initialization

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Make sure we call the ->remove_device call-back on all devices already initialized with ->add_device when the bus initialization fails. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 35 ++- 1 file changed, 26 insertions(+), 9 deletio

[PATCH 07/22] iommu: Limit iommu_attach/detach_device to devices with their own group

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel This patch changes the behavior of the iommu_attach_device and iommu_detach_device functions. With this change these functions only work on devices that have their own group. For all other devices the iommu_group_attach/detach functions must be used. Signed-off-by: Joerg Roede

[PATCH 00/22 v2] Introduce default domains for iommu groups

2015-05-28 Thread Joerg Roedel
Hi, here is the second version of my patch-set to introduce default domains into the iommu core. This time it has a lot more patches, mostly because I added a proof of concept implementation by converting the AMD IOMMU driver to make use of it. Converting the first driver to the new concept trigg

[PATCH 08/22] iommu: Make sure a device is always attached to a domain

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Make use of the default domain and re-attach a device to it when it is detached from another domain. Also enforce that a device has to be in the default domain before it can be attached to a different domain. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 83 +++

[PATCH 05/22] iommu: Call remove_device call-back after driver release

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Do not remove the device from the IOMMU while the driver is still attached. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index f0e0a23..d69e0ca 100644 -

[PATCH 01/22] iommu: Remove function name from pr_fmt()

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Including the function name is only useful for debugging messages. They don't belong into other messages from the iommu core. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/dri

[PATCH 02/22] iommu: Add a few printk messages to group handling code

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel Write a message to the kernel log when a device is added or removed from a group and add debug messages to group allocation and release routines. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/

[PATCH 09/22] iommu: Add iommu_get_domain_for_dev function

2015-05-28 Thread Joerg Roedel
From: Joerg Roedel This function can be used to request the current domain a device is attached to. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 18 ++ include/linux/iommu.h | 6 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/

ACPI crash with big gart IOMMU area (stack overflow?)

2015-05-28 Thread Meelis Roos
I have a computer where I had noticed that I must not turn on IOMMU in the BIOS, or Linux would crash on boot. The computer is Sun Ultra 20 workstation with dual-core 1st gen Opteron (175) and Nvidia CK804 chipset and 4G RAM. So IOMMU never worked for me before. I investigated it more today - s

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

2015-05-28 Thread Will Deacon
Hi Laurent, On Fri, May 15, 2015 at 12:00:09AM +0100, Laurent Pinchart wrote: > 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 lac

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

2015-05-28 Thread Will Deacon
On Fri, May 15, 2015 at 12:00:08AM +0100, Laurent Pinchart wrote: > The function isn't trivial, document its behaviour. > > Signed-off-by: Laurent Pinchart > --- > drivers/iommu/of_iommu.c | 13 + > 1 file changed, 13 insertions(+) Thanks for doing this. Acked-by: Will Deacon Wil

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

2015-05-28 Thread Will Deacon
On Fri, May 15, 2015 at 12:00:06AM +0100, Laurent Pinchart wrote: > 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 config

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

2015-05-28 Thread Will Deacon
(sorry for the mid-review delay, I got side-tracked yesterday evening) On Fri, May 15, 2015 at 12:00:05AM +0100, Laurent Pinchart wrote: > 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 m