Re: [PATCH v4 07/13] ARM: dts: rockchip: add clocks in vop iommu nodes

2018-01-18 Thread Tomasz Figa
On Fri, Jan 19, 2018 at 1:55 PM, JeffyChen wrote: > Hi Tomasz, > > Thanks for your reply. > > > On 01/19/2018 11:23 AM, Tomasz Figa wrote: >> >> On Thu, Jan 18, 2018 at 8:52 PM, Jeffy Chen >> wrote: >>> >>> Add clocks in vop iommu nodes, since we are going to control clocks in >>> rockchip iommu

Re: [PATCH v4 07/13] ARM: dts: rockchip: add clocks in vop iommu nodes

2018-01-18 Thread JeffyChen
Hi Tomasz, Thanks for your reply. On 01/19/2018 11:23 AM, Tomasz Figa wrote: On Thu, Jan 18, 2018 at 8:52 PM, Jeffy Chen wrote: Add clocks in vop iommu nodes, since we are going to control clocks in rockchip iommu driver. Signed-off-by: Jeffy Chen --- Changes in v4: None Changes in v3: Non

Re: [RFCv2 PATCH 05/36] iommu/process: Bind and unbind process to and from devices

2018-01-18 Thread Sinan Kaya
Hi Jean-Philippe, On 10/6/2017 9:31 AM, Jean-Philippe Brucker wrote: > /** > + * iommu_process_bind_device - Bind a process address space to a device > + * @dev: the device > + * @task: the process to bind > + * @pasid: valid address where the PASID will be stored > + * @flags: bond properties (I

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

2018-01-18 Thread Tomasz Figa
On Thu, Jan 18, 2018 at 8:52 PM, Jeffy Chen wrote: > 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

Re: [PATCH v3 10/16] iommu: introduce device fault report API

2018-01-18 Thread Jean-Philippe Brucker
Hi Jacob, I've got minor comments after working with this patch, sorry for the multiple replies On 17/11/17 18:55, Jacob Pan wrote: [...] > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 829e9e9..97b7990 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -

Re: [RFC PATCH v2 1/2] vfio/type1: Adopt fast IOTLB flush interface when unmap IOVAs

2018-01-18 Thread Alex Williamson
On Thu, 18 Jan 2018 10:25:12 +0700 Suravee Suthikulpanit wrote: > Hi Alex, > > On 1/9/18 3:53 AM, Alex Williamson wrote: > > On Wed, 27 Dec 2017 04:20:34 -0500 > > Suravee Suthikulpanit wrote: > >> diff --git a/drivers/vfio/vfio_iommu_type1.c > >> b/drivers/vfio/vfio_iommu_type1.c > >> index

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread Matthew Wilcox
On Thu, Jan 18, 2018 at 05:56:12PM +0100, David Sterba wrote: > On Thu, Jan 18, 2018 at 08:48:43AM -0800, Matthew Wilcox wrote: > > Thank you! I shall attempt to debug. Was this with a btrfs root > > filesystem? I'm most suspicious of those patches right now, since they've > > received next to n

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread David Sterba
On Thu, Jan 18, 2018 at 08:48:43AM -0800, Matthew Wilcox wrote: > Thank you! I shall attempt to debug. Was this with a btrfs root > filesystem? I'm most suspicious of those patches right now, since they've > received next to no testing. I'm going to put together a smaller patchset > which just

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread Matthew Wilcox
On Thu, Jan 18, 2018 at 05:07:50PM +0100, David Sterba wrote: > On Wed, Jan 17, 2018 at 12:20:24PM -0800, Matthew Wilcox wrote: > > From: Matthew Wilcox > > > > This version of the XArray has no known bugs. > > I've booted this patchset on 2 boxes, both had random problems during > boot. On one

Re: [PATCH v6 00/99] XArray version 6

2018-01-18 Thread David Sterba
On Wed, Jan 17, 2018 at 12:20:24PM -0800, Matthew Wilcox wrote: > From: Matthew Wilcox > > This version of the XArray has no known bugs. I've booted this patchset on 2 boxes, both had random problems during boot. On one I was not able to diagnose what went wrong. On the other one the system boot

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

2018-01-18 Thread JeffyChen
Hi Will, Thanks for your reply. On 01/18/2018 10:41 PM, Will Deacon wrote: > >Makes sense to me, but I'd like to have an OK from Robin or Will (added >to Cc) before applying this. I don't think this patch makes a lot of sense in isolation: the SMMU drivers themselves will likely still probe, a

Re: [PATCH v6 85/99] btrfs: Remove unused spinlock

2018-01-18 Thread David Sterba
On Wed, Jan 17, 2018 at 12:21:49PM -0800, Matthew Wilcox wrote: > From: Matthew Wilcox > > The reada_lock in struct btrfs_device was only initialised, and not > actually used. That's good because there's another lock also called > reada_lock in the btrfs_fs_info that was quite heavily used. Rem

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

2018-01-18 Thread Will Deacon
On Wed, Jan 17, 2018 at 02:28:08PM +0100, Joerg Roedel wrote: > On Wed, Jan 03, 2018 at 02:09:20PM +0800, Jeffy Chen wrote: > > 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 sanit

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

2018-01-18 Thread JeffyChen
Hi Robin, On 01/18/2018 08:27 PM, Robin Murphy wrote: Is it worth using the clk_bulk_*() APIs for this? At a glance, most of the code being added here appears to duplicate what those functions already do (but I'm no clk API expert, for sure). right, i think it's doable, the clk_bulk APIs are

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

2018-01-18 Thread JeffyChen
Hi Robin, On 01/18/2018 09:23 PM, Robin Murphy wrote: @@ -837,7 +837,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain, ret = rk_iommu_enable_paging(iommu); if (ret) -return ret; +goto err_disable_stall; spin_lock_irqsave(&rk_domain->iommus_loc

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

2018-01-18 Thread JeffyChen
Hi Robin, On 01/18/2018 09:09 PM, Robin Murphy wrote: -#define FORCE_RESET_TIMEOUT100/* ms */ +#define FORCE_RESET_TIMEOUT10/* us */ +#define POLL_TIMEOUT1000/* us */ Nit: the callsites look a bit odd with the combination of POLL_TIMEOUT and the magic number 100

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

2018-01-18 Thread JeffyChen
Hi Joerg, Thanks for your reply. On 01/18/2018 08:44 PM, Joerg Roedel wrote: On Thu, Jan 18, 2018 at 07:52:38PM +0800, Jeffy Chen wrote: Jeffy Chen (9): iommu/rockchip: Prohibit unbind and remove iommu/rockchip: Fix error handling in probe iommu/rockchip: Request irqs in rk_iommu_prob

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, Jeffy Chen wrote: 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

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, Jeffy Chen wrote: 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 --- Cha

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, 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. Reviewed-by: Robin Murphy Signed-off-by: Jeffy Chen --- Changes in v4: None Changes in v3: Remove rk_iommudata->domain. Changes

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, Jeffy Chen wrote: It's hard to undo bus_set_iommu() in the error path, so move it to the end of rk_iommu_probe(). Reviewed-by: Robin Murphy Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa --- Changes in v4: None Changes in v3: None Changes in v2: Move bus_set_iommu()

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, Jeffy Chen wrote: 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 --- Changes in v4: None Changes in v3: Add struct rk_iommudata.

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

2018-01-18 Thread Joerg Roedel
On Thu, Jan 18, 2018 at 07:52:38PM +0800, Jeffy Chen wrote: > 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:

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, Jeffy Chen wrote: Use the first registered IOMMU device for dma mapping operations, and drop the domain platform device. This is similar to exynos iommu driver. I'd been meaning to look into this myself for the sake of removing the arch_setup_dma_ops() hack, so I'm glad to

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

2018-01-18 Thread Robin Murphy
On 18/01/18 11:52, Jeffy Chen wrote: 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

[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 Reviewed-by: Tomasz Figa --- Changes in v4: None Changes in v3: None Changes in v2: Move bus_set_iommu() to rk_iommu_probe(). drivers/iommu/rockchip-iommu.c | 15 ++---

[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 Reviewed-by: Tomasz Figa --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 8

[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 --- Changes in v4: None Changes in v3: Add struct rk_iommudata. Squash iommu/rockchip: Use iommu_group_

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

2018-01-18 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 framework using DMA map

[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 --- Changes i

[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 --- Changes in v4: None Changes in v3: Remove rk_iommudata->domain. Changes in v2: None drivers/iommu/rockchip-iommu.c | 22 ++

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

2018-01-18 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 --- Changes in v4: None Changes in v3:

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

2018-01-18 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 --- Changes in v4: None Changes in v3: None Ch

[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 Signed-off-by: Jeffy Chen --- Changes in v4: None Changes in v3: Loop platform_get_irq() as Robin suggested. Changes in v2: None drivers/iommu/rockchip-iommu.c | 38 +- 1 file chan

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

2018-01-18 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 Signed-off-by: Jeffy

[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 Reviewed-by: Tomasz Figa --- Changes in v4: Rewrite commit message. Changes in v3: Also remove remove() and module_exit() as Tomasz suggested. Changes in v2: None drivers/iommu/rock

[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 Reviewed-by: Tomasz Figa --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/iommu/rockchip-iommu.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/rockchi

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

2018-01-18 Thread Jeffy Chen
This series fixes some issues in rockchip iommu driver, and add of_iommu support in it. Changes in v4: Rewrite commit message. Changes in v3: Also remove remove() and module_exit() as Tomasz suggested. Loop platform_get_irq() as Robin suggested. Add struct rk_iommudata. Squash iommu/rockchip: Us

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

2018-01-18 Thread JeffyChen
Hi Tomasz, Thanks for your reply. and just found i forgot to add iommu clocks for other rockchip platforms(rk3399 already has that)...will also do that in the next version. On 01/18/2018 12:17 PM, Tomasz Figa wrote: On Thu, Jan 18, 2018 at 12:25 AM, Jeffy Chen wrote: Removal the IOMMUs can