[PATCH 6/9] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-01-11 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH 7/9] iommu/rockchip: Use iommu_group_get_for_dev() for add_device

2018-01-11 Thread Jeffy Chen
-iommu driver to comply with this requirement. Signed-off-by: Tomasz Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- drivers/iommu/rockchip-iommu.c | 122 + 1 file changed, 64 insertions(+), 58 deleti

[PATCH 9/9] iommu/rockchip: Use OF_IOMMU to attach devices automatically

2018-01-11 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 <jeffy.c...@rock-chips.com> --- drivers/iommu/rockchip-iommu.c | 13 + 1 file chang

[PATCH 8/9] iommu/rockchip: Use IOMMU device for dma mapping operations

2018-01-11 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 <jeffy.c...@rock-chips.com> --- drivers/iommu/rockchip-iommu.c | 96 --

[PATCH 5/9] iommu/rockchip: Use iopoll helpers to wait for hardware

2018-01-11 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH 1/9] iommu/of: Drop early initialisation hooks

2018-01-11 Thread Jeffy Chen
With the probe-deferral mechanism, early initialisation hooks are no longer needed. Suggested-by: Robin Murphy <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- drivers/iommu/arm-smmu-v3.c | 2 +- drivers/iommu/arm-smmu.c | 12 ++-- d

[PATCH 2/9] iommu/rockchip: Fix error handling in attach

2018-01-11 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- drivers/iommu/rockchip-iommu.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c

[PATCH 3/9] iommu/rockchip: Fix error handling in probe

2018-01-11 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- drivers/iommu/rockchip-iommu.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c

[PATCH 0/9] iommu/rockchip: Use OF_IOMMU

2018-01-11 Thread Jeffy Chen
This series fixes some issues in rockchip iommu driver, and add of_iommu support in it. Also drop of_iommu early initialisation hooks as Robin suggested. Jeffy Chen (5): iommu/of: Drop early initialisation hooks iommu/rockchip: Fix error handling in probe iommu/rockchip: Fix error

[PATCH 4/9] iommu/rockchip: Fix error handling in init

2018-01-11 Thread Jeffy Chen
It's hard to undo bus_set_iommu() in the error path, so move it to the end of init call. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- drivers/iommu/rockchip-iommu.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/ro

[PATCH v3 03/12] iommu/rockchip: Request irqs in rk_iommu_probe()

2018-01-17 Thread Jeffy Chen
Move request_irq to the end of rk_iommu_probe(). Suggested-by: Robin Murphy <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v3: Loop platform_get_irq() as Robin suggested. Changes in v2: None drivers/iommu/rockchip-

[PATCH v3 01/12] iommu/rockchip: Prohibiat unbind and remove

2018-01-17 Thread Jeffy Chen
Removal the IOMMUs cannot be done reliably. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v3: Also remove remove() and module_exit() as Tomasz suggested. Changes in v2: None drivers/iommu/rockchip-iommu.

[PATCH v3 00/12] iommu/rockchip: Use OF_IOMMU

2018-01-17 Thread Jeffy Chen
() for add_device Only call startup() and shutdown() when iommu attached. Remove pm_mutex. Check runtime PM disabled. Check pm_runtime in rk_iommu_irq(). Remove rk_iommudata->domain. Changes in v2: Move irq request to probe(in patch[0]) Move bus_set_iommu() to rk_iommu_probe(). Jeffy Chen (8): iommu/rockc

[PATCH v3 02/12] iommu/rockchip: Fix error handling in probe

2018-01-17 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 6 +- 1 file changed, 5 insertions(+), 1 delet

[PATCH v3 12/12] iommu/rockchip: Support sharing IOMMU between masters

2018-01-17 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 <jeffy.c...@rock-chips.com> --- Changes in v3: Remove rk_iommudata->domain. Changes in v2: None drivers/iommu/rockchip-iom

[PATCH v3 11/12] iommu/rockchip: Add runtime PM support

2018-01-17 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 <jeff

[PATCH v3 09/12] iommu/rockchip: Use OF_IOMMU to attach devices automatically

2018-01-17 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 <jeffy.c...@rock-chips.com> --- Changes in v3: Add struct rk_iommudata. Squash iommu/rockchi

[PATCH v3 08/12] iommu/rockchip: Use IOMMU device for dma mapping operations

2018-01-17 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v3: None Changes

[PATCH v3 10/12] iommu/rockchip: Fix error handling in init

2018-01-17 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v3: None Changes in v2: Move bus_set_iommu() to rk_iommu_probe(). d

[PATCH v3 07/12] iommu/rockchip: Control clocks needed to access the IOMMU

2018-01-17 Thread Jeffy Chen
he VB2 framework using DMA mapping API and doesn't engage the master driver at all. This patch fixes the problem by letting clocks needed for IOMMU operation to be listed in Device Tree and making the driver enable them for the time of accessing the hardware. Signed-off-by: Jeffy Chen <jeffy.

[PATCH v3 06/12] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-01-17 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH v2 05/13] iommu/rockchip: Fix error handling in init

2018-01-16 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 <jeffy.c...@rock-chips.com> --- Changes in v2: Move bus_set_iommu() to rk_iommu_probe(). drivers/iommu/rockchip-iommu.c | 20 +++- 1 file chan

[PATCH v2 07/13] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-01-16 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH v2 11/13] iommu/rockchip: Use OF_IOMMU to attach devices automatically

2018-01-16 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 <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.c

[PATCH v2 08/13] iommu/rockchip: Control clocks needed to access the IOMMU

2018-01-16 Thread Jeffy Chen
he VB2 framework using DMA mapping API and doesn't engage the master driver at all. This patch fixes the problem by letting clocks needed for IOMMU operation to be listed in Device Tree and making the driver enable them for the time of accessing the hardware. Signed-off-by: Jeffy Chen <jeffy.

[PATCH v2 10/13] iommu/rockchip: Use IOMMU device for dma mapping operations

2018-01-16 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 <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.

[PATCH v2 09/13] iommu/rockchip: Use iommu_group_get_for_dev() for add_device

2018-01-16 Thread Jeffy Chen
. Signed-off-by: Tomasz Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.c | 120 + 1 file changed, 63 insertions(+), 57 deletions(-) diff --git a/drivers/io

[PATCH v2 13/13] iommu/rockchip: Support sharing IOMMU between masters

2018-01-16 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 <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.c | 39 +++ 1 file c

[PATCH v2 03/13] iommu/rockchip: Fix error handling in attach

2018-01-16 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v2: Move irq request to probe(in patch[0]) drivers/iommu/rockchip-iommu.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/driv

[PATCH v2 02/13] iommu/rockchip: Suppress unbinding

2018-01-16 Thread Jeffy Chen
It's not safe to unbind rockchip IOMMU driver. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 4a12d4

[PATCH v2 01/13] iommu/rockchip: Request irqs in rk_iommu_probe()

2018-01-16 Thread Jeffy Chen
Suggested-by: Robin Murphy <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.c | 38 +++--- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/drivers/io

[PATCH v2 04/13] iommu/rockchip: Fix error handling in probe

2018-01-16 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Also adjust sequence of deinit functions in the remove. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v2: None drivers/iommu/rockchip-iommu.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-)

[PATCH v2 12/13] iommu/rockchip: Add runtime PM support

2018-01-16 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 <jeff

[PATCH] iommu/of: Only do IOMMU lookup for available ones

2018-01-02 Thread Jeffy Chen
The for_each_matching_node_and_match() would return every matching nodes including unavailable ones. It's pointless to init unavailable IOMMUs, so add a sanity check to avoid that. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- drivers/iommu/of_iommu.c | 3 +++ 1 file chan

[PATCH v5 01/13] iommu/rockchip: Prohibit unbind and remove

2018-01-24 Thread Jeffy Chen
Removal of IOMMUs cannot be done reliably. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v5: None Changes in v4: Rewrite commit message. Changes in v3: Also r

[PATCH v5 02/13] iommu/rockchip: Fix error handling in probe

2018-01-24 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 6 +- 1

[PATCH v5 05/13] iommu/rockchip: Use iopoll helpers to wait for hardware

2018-01-24 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH v5 00/13] iommu/rockchip: Use OF_IOMMU

2018-01-24 Thread Jeffy Chen
startup() and shutdown() when iommu attached. Remove pm_mutex. Check runtime PM disabled. Check pm_runtime in rk_iommu_irq(). Remove rk_iommudata->domain. Changes in v2: Move irq request to probe(in patch[0]) Move bus_set_iommu() to rk_iommu_probe(). Jeffy Chen (9): iommu/rockchip: Prohibit unb

[PATCH v5 06/13] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-01-24 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH v5 04/13] iommu/rockchip: Fix error handling in attach

2018-01-24 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v5: Use out labels to save the duplication between the error and success paths. Changes in v4: None Changes in v3: None Changes in v2: M

[PATCH v5 03/13] iommu/rockchip: Request irqs in rk_iommu_probe()

2018-01-24 Thread Jeffy Chen
Move request_irq to the end of rk_iommu_probe(). Suggested-by: Robin Murphy <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v5: None Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes in v2: None d

[PATCH v5 10/13] iommu/rockchip: Use OF_IOMMU to attach devices automatically

2018-01-24 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 <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes

[PATCH v5 09/13] iommu/rockchip: Use IOMMU device for dma mapping operations

2018-01-24 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Reviewed-by: Robin Murphy <robin

[PATCH v5 11/13] iommu/rockchip: Fix error handling in init

2018-01-24 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v5: None Changes i

[PATCH v5 13/13] iommu/rockchip: Support sharing IOMMU between masters

2018-01-24 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 <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v5: None Changes in v4: None Changes i

[PATCH v5 08/13] iommu/rockchip: Control clocks needed to access the IOMMU

2018-01-24 Thread Jeffy Chen
he VB2 framework using DMA mapping API and doesn't engage the master driver at all. This patch fixes the problem by letting clocks needed for IOMMU operation to be listed in Device Tree and making the driver enable them for the time of accessing the hardware. Signed-off-by: Jeffy Chen <jeffy.

[PATCH v5 12/13] iommu/rockchip: Add runtime PM support

2018-01-24 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 <jeff

[PATCH v4 00/13] iommu/rockchip: Use OF_IOMMU

2018-01-18 Thread Jeffy Chen
mmu() to rk_iommu_probe(). Jeffy Chen (9): iommu/rockchip: Prohibit unbind and remove iommu/rockchip: Fix error handling in probe iommu/rockchip: Request irqs in rk_iommu_probe() ARM: dts: rockchip: add clocks in vop iommu nodes iommu/rockchip: Use IOMMU device for dma mapping operations iommu/rockchip:

[PATCH v4 04/13] iommu/rockchip: Fix error handling in attach

2018-01-18 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v4: None Changes in v3: None Changes in v2: Move irq request to probe(in patch[0]) drivers/iommu/rockchip-iommu.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --g

[PATCH v4 03/13] iommu/rockchip: Request irqs in rk_iommu_probe()

2018-01-18 Thread Jeffy Chen
Move request_irq to the end of rk_iommu_probe(). Suggested-by: Robin Murphy <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes in v2: None drivers/iommu/rockchip-

[PATCH v4 05/13] iommu/rockchip: Use iopoll helpers to wait for hardware

2018-01-18 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[PATCH v4 01/13] iommu/rockchip: Prohibit unbind and remove

2018-01-18 Thread Jeffy Chen
Removal of IOMMUs cannot be done reliably. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v4: Rewrite commit message. Changes in v3: Also remove remove() and module_exit

[PATCH v4 02/13] iommu/rockchip: Fix error handling in probe

2018-01-18 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 6 +- 1 file changed, 5 inse

[PATCH v4 09/13] iommu/rockchip: Use IOMMU device for dma mapping operations

2018-01-18 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v4: None Changes in v3:

[PATCH v4 10/13] iommu/rockchip: Use OF_IOMMU to attach devices automatically

2018-01-18 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 <jeffy.c...@rock-chips.com> --- Changes in v4: None Changes in v3: Add struct rk_iommudata.

[PATCH v4 13/13] iommu/rockchip: Support sharing IOMMU between masters

2018-01-18 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 <jeffy.c...@rock-chips.com> --- Changes in v4: None Changes in v3: Remove rk_iommudata->domain. Changes in v2: None drivers/iommu

[PATCH v4 08/13] iommu/rockchip: Control clocks needed to access the IOMMU

2018-01-18 Thread Jeffy Chen
he VB2 framework using DMA mapping API and doesn't engage the master driver at all. This patch fixes the problem by letting clocks needed for IOMMU operation to be listed in Device Tree and making the driver enable them for the time of accessing the hardware. Signed-off-by: Jeffy Chen <jeffy.

[PATCH v4 12/13] iommu/rockchip: Add runtime PM support

2018-01-18 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 <jeff

[PATCH v4 11/13] iommu/rockchip: Fix error handling in init

2018-01-18 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v4: None Changes in v3: None Changes in v2: Move bus_set_iommu() to rk

[PATCH v4 06/13] iommu/rockchip: Fix TLB flush of secondary IOMMUs

2018-01-18 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[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 <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes

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

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-01 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v6: None Changes in v5: Use out labels to save the duplication between the error and success paths. Changes in v4: None Changes in v3:

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip

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

2018-03-01 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v6: None Changes in v5: Use out labels to save the duplication between the error and success paths. Changes in v4: None Changes in v3:

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v6: None Changes in v5: None Changes in v4: Rewrite commit message. Changes in v3:

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

2018-03-01 Thread Jeffy Chen
in rk_iommu_irq(). Remove rk_iommudata->domain. Changes in v2: Move irq request to probe(in patch[0]) Move bus_set_iommu() to rk_iommu_probe(). Jeffy Chen (10): iommu/rockchip: Prohibit unbind and remove iommu/rockchip: Fix error handling in probe iommu/rockchip: Request i

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Reviewed-by: Robin Murphy <robin

[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 <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes

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

2018-03-01 Thread Jeffy Chen
in rk_iommu_irq(). Remove rk_iommudata->domain. Changes in v2: Move irq request to probe(in patch[0]) Move bus_set_iommu() to rk_iommu_probe(). Jeffy Chen (10): iommu/rockchip: Prohibit unbind and remove iommu/rockchip: Fix error handling in probe iommu/rockchip: Request i

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v6: None Changes in v5: None Changes in v4: Rewrite commit message. Changes in v3:

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v6: None Changes i

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes

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

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-01 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

[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 <jeff

[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 <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v6: None Changes in v5: None Changes

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

2018-03-01 Thread Jeffy Chen
he VB2 framework using DMA mapping API and doesn't engage the master driver at all. This patch fixes the problem by letting clocks needed for IOMMU operation to be listed in Device Tree and making the driver enable them for the time of accessing the hardware. Signed-off-by: Jeffy Chen <jeffy.

[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 <jeffy.c...@rock-chips.com> --- 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 e135ab

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

2018-03-23 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Reviewed-by: Robin Murphy <robin

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

2018-03-23 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 <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: None Changes i

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

2018-03-23 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-23 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 <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes

[PATCH v8 09/14] dt-bindings: iommu/rockchip: Add clock property

2018-03-23 Thread Jeffy Chen
Add clock property, since we are going to control clocks in rockchip iommu driver. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes

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

2018-03-23 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Acked-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: Don't introduce the additional return. Changes in v7:

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

2018-03-23 Thread Jeffy Chen
Removal of IOMMUs cannot be done reliably. This is similar to exynos iommu driver. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> Acked-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: Rebase on newest for-next. C

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

2018-03-23 Thread Jeffy Chen
in rk_iommu_irq(). Remove rk_iommudata->domain. Changes in v2: Move irq request to probe(in patch[0]) Move bus_set_iommu() to rk_iommu_probe(). Jeffy Chen (10): iommu/rockchip: Prohibit unbind and remove iommu/rockchip: Fix error handling in probe iommu/rockchip: Request i

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

2018-03-23 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: Use out labels to save the duplication between the error and success pat

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

2018-03-23 Thread Jeffy Chen
Move request_irq to the end of rk_iommu_probe(). Suggested-by: Robin Murphy <robin.mur...@arm.com> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Acked-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5:

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

2018-03-23 Thread Jeffy Chen
omium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Acked-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: None Changes in v7: None Changes in v6: Fix dt-binding as Robin suggested. Use aclk and iface clk as Rob and Robin suggested, and split binding patch. Cha

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

2018-03-23 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-23 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 enable and disable IOMMU. Signed-off-by: Jeffy Chen <jeffy.c...@r

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

2018-03-23 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 <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v8: None Changes in v7: Use iommu_g

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

2018-03-05 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-05 Thread Jeffy Chen
From: Tomasz Figa <tf...@chromium.org> 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 <tf...@chromium.org> Signed-off-by

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

2018-03-05 Thread Jeffy Chen
z Figa <tf...@chromium.org> Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Robin Murphy <robin.mur...@arm.com> --- Changes in v7: None Changes in v6: None Changes in v5: Use out labels to save the duplication between the error and success paths. Changes in v4:

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

2018-03-05 Thread Jeffy Chen
he VB2 framework using DMA mapping API and doesn't engage the master driver at all. This patch fixes the problem by letting clocks needed for IOMMU operation to be listed in Device Tree and making the driver enable them for the time of accessing the hardware. Signed-off-by: Jeffy Chen <jeffy.

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

2018-03-05 Thread Jeffy Chen
Add missing iommu_device_sysfs_remove in error path. Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com> Reviewed-by: Tomasz Figa <tf...@chromium.org> --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None d

  1   2   >