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

2018-02-23 Thread JeffyChen
Hi guys, On 02/01/2018 07:19 PM, JeffyChen wrote: diff --git a/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt b/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt index 2098f7732264..33dd853359fa 100644 --- a/Documentation/devicetree/bindings/iommu/rockchip,iommu.txt +++ b/

Re: [PATCH v7 3/6] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device

2018-02-23 Thread Vivek Gautam
On Fri, Feb 23, 2018 at 5:22 AM, Jordan Crouse wrote: > On Wed, Feb 07, 2018 at 04:01:19PM +0530, Vivek Gautam wrote: >> From: Sricharan R >> >> The smmu device probe/remove and add/remove master device callbacks >> gets called when the smmu is not linked to its master, that is without >> the con

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

2018-02-23 Thread JeffyChen
Hi guys, On 01/25/2018 06:24 PM, JeffyChen wrote: On 01/25/2018 05:42 PM, Randy Li wrote: confirmed with Simon, there might be some iommus don't have a pd, and We use the pd to control the NIU node(not on upstream), without a pd or fake pd, none of the platform would work. after talked off

Re: [Freedreno] [PATCH v7 3/6] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device

2018-02-23 Thread Jordan Crouse
On Fri, Feb 23, 2018 at 04:06:39PM +0530, Vivek Gautam wrote: > On Fri, Feb 23, 2018 at 5:22 AM, Jordan Crouse wrote: > > On Wed, Feb 07, 2018 at 04:01:19PM +0530, Vivek Gautam wrote: > >> From: Sricharan R > >> > >> The smmu device probe/remove and add/remove master device callbacks > >> gets ca

Re: [Freedreno] [PATCH v7 3/6] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device

2018-02-23 Thread Vivek Gautam
On Fri, Feb 23, 2018 at 9:10 PM, Jordan Crouse wrote: > On Fri, Feb 23, 2018 at 04:06:39PM +0530, Vivek Gautam wrote: >> On Fri, Feb 23, 2018 at 5:22 AM, Jordan Crouse >> wrote: >> > On Wed, Feb 07, 2018 at 04:01:19PM +0530, Vivek Gautam wrote: >> >> From: Sricharan R >> >> >> >> The smmu devic

[PATCH 02/10] iommu/amd: turn dev_data_list into a lock less list

2018-02-23 Thread Sebastian Andrzej Siewior
alloc_dev_data() adds new items to dev_data_list and search_dev_data() is searching for items in this list. Both protect the access to the list with a spinlock. There is no need to navigate forth and back within the list and there is also no deleting of a specific item. This qualifies the list to b

[PATCH 04/10] iommu/amd: split irq_lookup_table out of the amd_iommu_devtable_lock

2018-02-23 Thread Sebastian Andrzej Siewior
The function get_irq_table() reads/writes irq_lookup_table while holding the amd_iommu_devtable_lock. It also modifies amd_iommu_dev_table[].data[2]. set_dte_entry() is using amd_iommu_dev_table[].data[0|1] (under the domain->lock) so it should be okay. The access to the iommu is serialized with it

[PATCH 03/10] iommu/amd: split domain id out of amd_iommu_devtable_lock

2018-02-23 Thread Sebastian Andrzej Siewior
domain_id_alloc() and domain_id_free() is used for id management. Those two function share a bitmap (amd_iommu_pd_alloc_bitmap) and set/clear bits based on id allocation. There is no need to share this with amd_iommu_devtable_lock, it can use its own lock for this operation. Signed-off-by: Sebasti

iommu/amd: lock splitting & GFP_KERNEL allocation

2018-02-23 Thread Sebastian Andrzej Siewior
Hi, I have no idea why but suddenly my A10 box complained loudly about locking and memory allocations within the iommu code under RT. Looking at the code it has been like this for a longer time so the iommu must have appeared recently (well there was a bios upgrade due to other issues so it might

[PATCH 08/10] iommu/amd: drop the lock while allocating new irq remap table

2018-02-23 Thread Sebastian Andrzej Siewior
The irq_remap_table is allocated while the iommu_table_lock is held with interrupts disabled. While this works it makes RT scream very loudly. >From looking at the call sites, all callers are in the early device initialisation (apic_bsp_setup(), pci_enable_device(), pci_enable_msi()) so make sense

[PATCH 09/10] iommu/amd: declare irq_remap_table's and amd_iommu's lock as a raw_spin_lock

2018-02-23 Thread Sebastian Andrzej Siewior
The irq affinity setting is called while desc->lock is held. The desc->lock is a raw_spin_lock called with interrupts disabled. The call chain involves modify_irte_ga() which needs to take the irq_remap_table->lock in order to update the entry and later iommu->lock in order to update and flush the

[PATCH 01/10] iommu/amd: take into account that alloc_dev_data() may return NULL

2018-02-23 Thread Sebastian Andrzej Siewior
find_dev_data() does not check whether the return value alloc_dev_data() is NULL. This was okay once because the pointer was returned once as-is. Since commit df3f7a6e8e85 ("iommu/amd: Use is_attach_deferred call-back") the pointer may be used within find_dev_data() so a NULL check is required. Cc

[PATCH 06/10] iommu/amd: use `table' instead `irt' as variable name in amd_iommu_update_ga()

2018-02-23 Thread Sebastian Andrzej Siewior
The variable of type struct irq_remap_table is always named `table' except in amd_iommu_update_ga() where it is called `irt'. Make it consistent and name it also `table'. Signed-off-by: Sebastian Andrzej Siewior --- drivers/iommu/amd_iommu.c | 10 +- 1 file changed, 5 insertions(+), 5 de

[PATCH 07/10] iommu/amd: factor out setting the remap table for a devid

2018-02-23 Thread Sebastian Andrzej Siewior
Setting the IRQ remap table for a specific devid (or its alias devid) includes three steps. Those three steps are always repeated each time this is done. Introduce a new helper function, move those steps there and use that function instead. The compiler can still decide if it is worth to inline. S

[PATCH 05/10] iommu/amd: remove the special case from get_irq_table()

2018-02-23 Thread Sebastian Andrzej Siewior
get_irq_table() has a special ioapic argument. If set then it will pre-allocate / reserve the first 32 indexes. The argument is only once true and it would make get_irq_table() a little simpler if we would extract the special bits to the caller. Signed-off-by: Sebastian Andrzej Siewior --- drive

[PATCH 10/10] iommu/amd: make amd_iommu_devtable_lock a spin_lock

2018-02-23 Thread Sebastian Andrzej Siewior
Before commit 0bb6e243d7fb ("iommu/amd: Support IOMMU_DOMAIN_DMA type allocation") amd_iommu_devtable_lock had a read_lock() user but now there are none. In fact, after the mentioned commit we had only write_lock() user of the lock. Since there is no reason to keep it as writer lock, change its typ

[PATCH 1/1] iommu/vt-d: Fix a potential memory leak

2018-02-23 Thread Lu Baolu
A memory block was allocated in intel_svm_bind_mm() but never freed in a failure path. This patch fixes this by free it to avoid memory leakage. Cc: Ashok Raj Cc: Jacob Pan Cc: # v4.4+ Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dr