[PATCH v6 05/14] iommu/rockchip: Use iopoll helpers to wait for hardware

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa This patch converts the rockchip-iommu driver to use the in-kernel iopoll helpers to wait for certain status bits to change in registers instead of an open-coded custom macro. Signed-off-by: Tomasz Figa Signed-off-by: Jeffy Chen

[PATCH v6 03/14] iommu/rockchip: Request irqs in rk_iommu_probe()

2018-03-01 Thread Jeffy Chen
Move request_irq to the end of rk_iommu_probe(). Suggested-by: Robin Murphy Signed-off-by: Jeffy Chen --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes in v2: None

[PATCH v6 06/14] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa Due to the bug in current code, only first IOMMU has the TLB lines flushed in rk_iommu_zap_lines. This patch fixes the inner loop to execute for all IOMMUs and properly flush the TLB. Signed-off-by: Tomasz Figa Signed-off-by: Jeffy Chen

[PATCH v6 04/14] iommu/rockchip: Fix error handling in attach

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa Currently if the driver encounters an error while attaching device, it will leave the IOMMU in an inconsistent state. Even though it shouldn't really happen in reality, let's just add proper error path to keep things consistent. Signed-off-by: Tomasz Figa

[PATCH v6 02/14] iommu/rockchip: Fix error handling in probe

2018-03-01 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 6

[RESEND PATCH v6 04/14] iommu/rockchip: Fix error handling in attach

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa Currently if the driver encounters an error while attaching device, it will leave the IOMMU in an inconsistent state. Even though it shouldn't really happen in reality, let's just add proper error path to keep things consistent. Signed-off-by: Tomasz Figa

[RESEND PATCH v6 02/14] iommu/rockchip: Fix error handling in probe

2018-03-01 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 6

[RESEND PATCH v6 01/14] iommu/rockchip: Prohibit unbind and remove

2018-03-01 Thread Jeffy Chen
Removal of IOMMUs cannot be done reliably. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa --- Changes in v6: None Changes in v5: None Changes in v4: Rewrite commit message. Changes in v3: Also remove

[RESEND PATCH v6 00/14] iommu/rockchip: Use OF_IOMMU

2018-03-01 Thread Jeffy Chen
This series fixes some issues in rockchip iommu driver, and add of_iommu support in it. Changes in v6: Add clk names, and modify all iommu nodes in all existing rockchip dts Fix dt-binding as Robin suggested. Use aclk and iface clk as Rob and Robin suggested, and split binding patch. Changes in

[RESEND PATCH v6 10/14] iommu/rockchip: Use IOMMU device for dma mapping operations

2018-03-01 Thread Jeffy Chen
Use the first registered IOMMU device for dma mapping operations, and drop the domain platform device. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa Reviewed-by: Robin Murphy ---

[RESEND PATCH v6 03/14] iommu/rockchip: Request irqs in rk_iommu_probe()

2018-03-01 Thread Jeffy Chen
Move request_irq to the end of rk_iommu_probe(). Suggested-by: Robin Murphy Signed-off-by: Jeffy Chen --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes in v2: None

[PATCH v6 00/14] iommu/rockchip: Use OF_IOMMU

2018-03-01 Thread Jeffy Chen
This series fixes some issues in rockchip iommu driver, and add of_iommu support in it. Changes in v6: Add clk names, and modify all iommu nodes in all existing rockchip dts Fix dt-binding as Robin suggested. Use aclk and iface clk as Rob and Robin suggested, and split binding patch. Changes in

[PATCH v6 01/14] iommu/rockchip: Prohibit unbind and remove

2018-03-01 Thread Jeffy Chen
Removal of IOMMUs cannot be done reliably. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa --- Changes in v6: None Changes in v5: None Changes in v4: Rewrite commit message. Changes in v3: Also remove

[RESEND PATCH v6 12/14] iommu/rockchip: Fix error handling in init

2018-03-01 Thread Jeffy Chen
It's hard to undo bus_set_iommu() in the error path, so move it to the end of rk_iommu_probe(). Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa Reviewed-by: Robin Murphy --- Changes in v6: None Changes in v5: None Changes

Re: [PATCH 03/37] iommu/sva: Manage process address spaces

2018-03-01 Thread Christian König
Am 01.03.2018 um 07:52 schrieb Lu Baolu: Hi Jean, On 02/13/2018 02:33 AM, Jean-Philippe Brucker wrote: [SNIP] + pasid = idr_alloc_cyclic(_pasid_idr, io_mm, dev_param->min_pasid, +dev_param->max_pasid + 1, GFP_ATOMIC); Can the pasid management code be

[RESEND PATCH v6 11/14] iommu/rockchip: Use OF_IOMMU to attach devices automatically

2018-03-01 Thread Jeffy Chen
Converts the rockchip-iommu driver to use the OF_IOMMU infrastructure, which allows attaching master devices to their IOMMUs automatically according to DT properties. Signed-off-by: Jeffy Chen Reviewed-by: Robin Murphy --- Changes in v6: None

[RESEND PATCH v6 06/14] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa Due to the bug in current code, only first IOMMU has the TLB lines flushed in rk_iommu_zap_lines. This patch fixes the inner loop to execute for all IOMMUs and properly flush the TLB. Signed-off-by: Tomasz Figa Signed-off-by: Jeffy Chen

[RESEND PATCH v6 05/14] iommu/rockchip: Use iopoll helpers to wait for hardware

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa This patch converts the rockchip-iommu driver to use the in-kernel iopoll helpers to wait for certain status bits to change in registers instead of an open-coded custom macro. Signed-off-by: Tomasz Figa Signed-off-by: Jeffy Chen

[RESEND PATCH v6 13/14] iommu/rockchip: Add runtime PM support

2018-03-01 Thread Jeffy Chen
When the power domain is powered off, the IOMMU cannot be accessed and register programming must be deferred until the power domain becomes enabled. Add runtime PM support, and use runtime PM device link from IOMMU to master to startup and shutdown IOMMU. Signed-off-by: Jeffy Chen

[RESEND PATCH v6 14/14] iommu/rockchip: Support sharing IOMMU between masters

2018-03-01 Thread Jeffy Chen
There would be some masters sharing the same IOMMU device. Put them in the same iommu group and share the same iommu domain. Signed-off-by: Jeffy Chen Reviewed-by: Robin Murphy --- Changes in v6: None Changes in v5: None Changes in v4: None

[RESEND PATCH v6 08/14] iommu/rockchip: Control clocks needed to access the IOMMU

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa Current code relies on master driver enabling necessary clocks before IOMMU is accessed, however there are cases when the IOMMU should be accessed while the master is not running yet, for example allocating V4L2 videobuf2 buffers, which is done by the VB2

Re: [RESEND PATCH v6 14/14] iommu/rockchip: Support sharing IOMMU between masters

2018-03-01 Thread Robin Murphy
On 01/03/18 10:18, Jeffy Chen wrote: There would be some masters sharing the same IOMMU device. Put them in the same iommu group and share the same iommu domain. Signed-off-by: Jeffy Chen Reviewed-by: Robin Murphy --- Changes in v6: None

Re: [RESEND PATCH v6 14/14] iommu/rockchip: Support sharing IOMMU between masters

2018-03-01 Thread JeffyChen
Hi Robin, On 03/01/2018 07:03 PM, Robin Murphy wrote: +static struct iommu_group *rk_iommu_device_group(struct device *dev) +{ +struct rk_iommu *iommu; + +iommu = rk_iommu_from_dev(dev); + +return iommu->group; Oops, seems I overlooked this in my previous review - it should

[PATCH] iommu/omap: Increase group ref in .device_group()

2018-03-01 Thread Jeffy Chen
Increase group refcounting in omap_iommu_device_group(). Signed-off-by: Jeffy Chen --- drivers/iommu/omap-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index

Re: RFC on Kdump and PCIe on ARM64

2018-03-01 Thread Bjorn Helgaas
[+cc Joerg, David, iommu list] On Thu, Mar 01, 2018 at 12:44:26PM -0500, Sinan Kaya wrote: > Hi, > > We are seeing IOMMU faults when booting the kdump kernel on ARM64. > > [7.220162] arm-smmu-v3 arm-smmu-v3.0.auto: event 0x02 received: > [7.226123] arm-smmu-v3 arm-smmu-v3.0.auto:

Re: RFC on Kdump and PCIe on ARM64

2018-03-01 Thread Sinan Kaya
On 3/1/2018 2:05 PM, Bjorn Helgaas wrote: > [+cc Joerg, David, iommu list] > > On Thu, Mar 01, 2018 at 12:44:26PM -0500, Sinan Kaya wrote: >> Hi, >> >> We are seeing IOMMU faults when booting the kdump kernel on ARM64. >> >> [7.220162] arm-smmu-v3 arm-smmu-v3.0.auto: event 0x02 received: >> [

Re: RFC on Kdump and PCIe on ARM64

2018-03-01 Thread Bjorn Helgaas
On Thu, Mar 01, 2018 at 02:19:09PM -0500, Sinan Kaya wrote: > On 3/1/2018 2:05 PM, Bjorn Helgaas wrote: > > On Thu, Mar 01, 2018 at 12:44:26PM -0500, Sinan Kaya wrote: > >> Hi, > >> > >> We are seeing IOMMU faults when booting the kdump kernel on ARM64. > >> > >> [7.220162] arm-smmu-v3

Re: RFC on Kdump and PCIe on ARM64

2018-03-01 Thread Baoquan He
On 03/01/18 at 01:05pm, Bjorn Helgaas wrote: > [+cc Joerg, David, iommu list] > > On Thu, Mar 01, 2018 at 12:44:26PM -0500, Sinan Kaya wrote: > > Hi, > > > > We are seeing IOMMU faults when booting the kdump kernel on ARM64. > > > > [7.220162] arm-smmu-v3 arm-smmu-v3.0.auto: event 0x02