RE: [PATCH] iommu: fsl_pamu.c: Fix for possible null pointer dereference

2014-05-20 Thread bharat.bhus...@freescale.com
> -Original Message- > From: iommu-boun...@lists.linux-foundation.org [mailto:iommu- > boun...@lists.linux-foundation.org] On Behalf Of Rickard Strandqvist > Sent: Saturday, May 17, 2014 10:47 PM > To: Joerg Roedel; Grant Likely > Cc: devicet...@vger.kernel.org; iommu@lists.linux-foundati

Re: [PATCH v3 00/15] PCI/iommu: Fix DMA alias problems

2014-05-20 Thread colin
Alex Williamson wrote: > Wow, I didn't think that kind of broken was possible. Maybe instead of > a bitmap of function aliases we could have a single devfn alias for a > device. That means we'd only be able to support a single alias for a > device, but since I don't think we've seen devices that

[PATCH] iommu: fsl_pamu.c: Fix for possible null pointer dereference

2014-05-20 Thread Rickard Strandqvist
There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist --- drivers/iommu/fsl_pamu.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/fsl

[PATCH] remove duplicate checking code

2014-05-20 Thread Vaughan Cao
amd_iommu_rlookup_table[devid] != NULL is already guaranteed by check_device called before, it's fine to attach device at this point. Signed-off-by: Vaughan Cao --- drivers/iommu/amd_iommu.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_io

[RFC PATCH v5_v2 01/11] driver core: platform: add device binding path 'driver_override'

2014-05-20 Thread Kim Phillips
From: Kim Phillips Needed by platform device drivers, such as the vfio-platform driver later in series, in order to bypass the existing OF, ACPI, id_table and name string matches, and successfully be able to be bound to any device, like so: echo vfio-platform > /sys/bus/platform/devices/fff51000

[PATCH 5/5] iommu/amd: Handle parallel invalidate_range_start/end calls correctly

2014-05-20 Thread Joerg Roedel
From: Joerg Roedel Add a counter to the pasid_state so that we do not restore the original page-table before all invalidate_range_start to invalidate_range_end sections have finished. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_v2.c | 17 + 1 file changed, 13 inse

[PATCH 3/5] iommu/amd: Implement mmu_notifier_release call-back

2014-05-20 Thread Joerg Roedel
From: Joerg Roedel Since mmu_notifier call-backs can sleep (because they use SRCU now) we can use them to tear down PASID mappings. This allows us to finally remove the hack to use the task_exit notifier from oprofile to get notified when a process dies. Signed-off-by: Joerg Roedel Tested-by: J

[PATCH 0/5] AMD IOMMUv2 Cleanups and Fixes

2014-05-20 Thread Joerg Roedel
Hi, here is a small patch-set with some clean-ups for the AMD IOMMUv2 driver. The most important change is the conversion to use the mmu_notifier release call-back instead of the task_exit notifier to get notified when a MM dies. Please review. Thanks, Joerg Diffstat: drivers/iommu/am

[PATCH 2/5] iommu/amd: Convert IOMMUv2 state_table into state_list

2014-05-20 Thread Joerg Roedel
From: Joerg Roedel The state_table consumes 512kb of memory and is only sparsly populated. Convert it into a list to save memory. There should be no measurable performance impact. Signed-off-by: Joerg Roedel Tested-by: Jay Cornwall --- drivers/iommu/amd_iommu_v2.c | 39 ++---

[PATCH 1/5] iommu/amd: Don't access IOMMUv2 state_table directly

2014-05-20 Thread Joerg Roedel
From: Joerg Roedel This is a preparation for converting the state_table into a state_list. Signed-off-by: Joerg Roedel Tested-by: Jay Cornwall --- drivers/iommu/amd_iommu_v2.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/amd_iommu_v2.c b/dr

[PATCH 4/5] iommu/amd: Remove IOMMUv2 pasid_state_list

2014-05-20 Thread Joerg Roedel
From: Joerg Roedel This list was only used for the task_exit notifier function. Now that it is gone we can remove it. Signed-off-by: Joerg Roedel Tested-by: Jay Cornwall --- drivers/iommu/amd_iommu_v2.c | 26 -- 1 file changed, 26 deletions(-) diff --git a/drivers/i

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 17:39:12 Dave Martin wrote: > On Tue, May 20, 2014 at 04:26:59PM +0100, Will Deacon wrote: > > On Tue, May 20, 2014 at 02:23:47PM +0100, Arnd Bergmann wrote: > > > Bit# 3322 1100 > > > 10987654 32109876 54321098 76543210 > > > phys.hi ce

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 16:00:02 Thierry Reding wrote: > On Tue, May 20, 2014 at 03:34:46PM +0200, Arnd Bergmann wrote: > > On Tuesday 20 May 2014 15:17:43 Thierry Reding wrote: > > > On Tue, May 20, 2014 at 02:41:18PM +0200, Arnd Bergmann wrote: > > > > On Tuesday 20 May 2014 14:02:43 Thierry Redin

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 16:24:59 Dave Martin wrote: > On Tue, May 20, 2014 at 02:41:18PM +0200, Arnd Bergmann wrote: > > On Tuesday 20 May 2014 14:02:43 Thierry Reding wrote: > > > On Tue, May 20, 2014 at 01:15:48PM +0200, Arnd Bergmann wrote: > > > Typical values for the above include: > > > - #add

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Dave Martin
On Tue, May 20, 2014 at 04:26:59PM +0100, Will Deacon wrote: > On Tue, May 20, 2014 at 02:23:47PM +0100, Arnd Bergmann wrote: > > Bit# 3322 1100 > >10987654 32109876 54321098 76543210 > > phys.hi cell: npt000ss dfff > > phys.mid cel

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Will Deacon
On Tue, May 20, 2014 at 02:23:47PM +0100, Arnd Bergmann wrote: > Bit# 3322 1100 > 10987654 32109876 54321098 76543210 > phys.hi cell: npt000ss dfff > phys.mid cell: > phys.lo cell: ll

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Dave Martin
On Tue, May 20, 2014 at 02:41:18PM +0200, Arnd Bergmann wrote: > On Tuesday 20 May 2014 14:02:43 Thierry Reding wrote: > > On Tue, May 20, 2014 at 01:15:48PM +0200, Arnd Bergmann wrote: > > > On Tuesday 20 May 2014 13:05:37 Thierry Reding wrote: > > > > On Tue, May 20, 2014 at 12:04:54PM +0200, Arn

[PATCH v3] PCI: Introduce new device binding path using pci_dev.driver_override

2014-05-20 Thread Alex Williamson
The driver_override field allows us to specify the driver for a device rather than relying on the driver to provide a positive match of the device. This shortcuts the existing process of looking up the vendor and device ID, adding them to the driver new_id, binding the device, then removing the ID

RE: [PATCH] iommu/amd: Fix for L2 race with VM invalidation

2014-05-20 Thread Cornwall, Jay
> From: Joerg Roedel [mailto:j...@8bytes.org] > Sent: Tuesday, May 20, 2014 08:33 > > On Wed, May 14, 2014 at 11:38:25AM +, Cornwall, Jay wrote: > > Hi, > > > > I'm not sure why you're submitting this, Suravee? > > > > We already agreed that we need the extra mmu_notifier point, proposed > > b

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Thierry Reding
On Tue, May 20, 2014 at 03:34:46PM +0200, Arnd Bergmann wrote: > On Tuesday 20 May 2014 15:17:43 Thierry Reding wrote: > > On Tue, May 20, 2014 at 02:41:18PM +0200, Arnd Bergmann wrote: > > > On Tuesday 20 May 2014 14:02:43 Thierry Reding wrote: > > [...] > > > > Couldn't a single-master IOMMU be w

Re: [PATCH] iommu/amd: Fix for L2 race with VM invalidation

2014-05-20 Thread Joerg Roedel
On Wed, May 14, 2014 at 11:38:25AM +, Cornwall, Jay wrote: > Hi, > > I'm not sure why you're submitting this, Suravee? > > We already agreed that we need the extra mmu_notifier point, proposed > by Joerg back in 2011, to eliminate the race. I had thought we were > waiting on that to be implem

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 15:17:43 Thierry Reding wrote: > On Tue, May 20, 2014 at 02:41:18PM +0200, Arnd Bergmann wrote: > > On Tuesday 20 May 2014 14:02:43 Thierry Reding wrote: > [...] > > > Couldn't a single-master IOMMU be windowed? > > > > Ah, yes. That would actually be like an IBM pSeries, wh

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 14:07:09 Dave Martin wrote: > On Tue, May 20, 2014 at 12:08:44PM +0200, Arnd Bergmann wrote: > > On Monday 19 May 2014 22:32:33 Thierry Reding wrote: > > > On Mon, May 19, 2014 at 06:22:31PM +0100, Dave Martin wrote: > > > > On Mon, May 19, 2014 at 01:53:37PM +0100, Thierry R

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Thierry Reding
On Tue, May 20, 2014 at 02:41:18PM +0200, Arnd Bergmann wrote: > On Tuesday 20 May 2014 14:02:43 Thierry Reding wrote: [...] > > Couldn't a single-master IOMMU be windowed? > > Ah, yes. That would actually be like an IBM pSeries, which has a windowed > IOMMU but uses one window per virtual machine

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Dave Martin
On Tue, May 20, 2014 at 12:08:44PM +0200, Arnd Bergmann wrote: > On Monday 19 May 2014 22:32:33 Thierry Reding wrote: > > On Mon, May 19, 2014 at 06:22:31PM +0100, Dave Martin wrote: > > > On Mon, May 19, 2014 at 01:53:37PM +0100, Thierry Reding wrote: > > [...] > > > > My understanding here is mos

Re: [PATCH v2] arm: dma-iommu: Clean up redundant variable

2014-05-20 Thread Marek Szyprowski
Hello, On 2014-05-20 06:32, ritesh.harj...@gmail.com wrote: From: Ritesh Harjani mapping->size can be derived from mapping->bits << PAGE_SHIFT which makes mapping->size as redundant. Clean this up. Signed-off-by: Ritesh Harjani Reported-by: Will Deacon Thanks for this cleanup. I will add

[PATCH 1/6] iommu/vt-d: Use list_for_each_safe() to simplify code

2014-05-20 Thread Yijing Wang
Use list_for_each_entry_safe() instead of list_entry() to simplify code. Signed-off-by: Yijing Wang --- drivers/iommu/intel-iommu.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index f256ffc..e020dcf 10064

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 14:02:43 Thierry Reding wrote: > On Tue, May 20, 2014 at 01:15:48PM +0200, Arnd Bergmann wrote: > > On Tuesday 20 May 2014 13:05:37 Thierry Reding wrote: > > > On Tue, May 20, 2014 at 12:04:54PM +0200, Arnd Bergmann wrote: > > > > On Monday 19 May 2014 22:59:46 Thierry Reding

[PATCH 2/6] iommu/vt-d: move up no_iommu and dmar_disabled check

2014-05-20 Thread Yijing Wang
Move up the no_iommu and dmar_disabled check, avoid the useless initialization for dmar. Signed-off-by: Yijing Wang --- drivers/iommu/intel-iommu.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index e020dc

[PATCH 5/6] iommu/vt-d: use inline function dma_pte_superpage instead of macros

2014-05-20 Thread Yijing Wang
Use inline function dma_pte_superpage() instead of macro for better readability. Signed-off-by: Yijing Wang --- drivers/iommu/intel-iommu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index d1d6636..455896c 1

[PATCH 6/6] iommu/vt-d: fix reference count in iommu_prepare_isa

2014-05-20 Thread Yijing Wang
Decrease the device reference count avoid memory leak. Signed-off-by: Yijing Wang --- drivers/iommu/intel-iommu.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 455896c..a78a824 100644 --- a/drivers/iommu

[PATCH 3/6] iommu/vt-d: clear the redundant assignment in dmar_enable_qi

2014-05-20 Thread Yijing Wang
__dmar_enable_qi() will initialize free_head,free_tail and free_cnt for q_inval. Remove the redundant initialization in dmar_enable_qi(). Signed-off-by: Yijing Wang --- drivers/iommu/dmar.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/dmar.c b/drivers/

[PATCH 4/6] iommu/vt-d: clear the redundant assignment for domain->nid

2014-05-20 Thread Yijing Wang
Alloc_domain() will initialize domain->nid to -1. So the initialization for domain->nid in md_domain_init() is redundant, clear it. Signed-off-by: Yijing Wang --- drivers/iommu/intel-iommu.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/dr

[PATCH 0/6] trivial cleanup for iommu/vt-d

2014-05-20 Thread Yijing Wang
Some cleanup patches for iommu/vt-d. Yijing Wang (6): iommu/vt-d: Use list_for_each_safe() to simplify code iommu/vt-d: move up no_iommu and dmar_disabled check iommu/vt-d: clear the redundant assignment in dmar_enable_qi iommu/vt-d: clear the redundant assignment for domain->nid iommu/v

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Thierry Reding
On Tue, May 20, 2014 at 01:15:48PM +0200, Arnd Bergmann wrote: > On Tuesday 20 May 2014 13:05:37 Thierry Reding wrote: > > On Tue, May 20, 2014 at 12:04:54PM +0200, Arnd Bergmann wrote: > > > On Monday 19 May 2014 22:59:46 Thierry Reding wrote: > > > > On Mon, May 19, 2014 at 08:34:07PM +0200, Arnd

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Tuesday 20 May 2014 13:05:37 Thierry Reding wrote: > On Tue, May 20, 2014 at 12:04:54PM +0200, Arnd Bergmann wrote: > > On Monday 19 May 2014 22:59:46 Thierry Reding wrote: > > > On Mon, May 19, 2014 at 08:34:07PM +0200, Arnd Bergmann wrote: > > > > On Monday 19 May 2014 14:53:37 Thierry Reding

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Thierry Reding
On Tue, May 20, 2014 at 12:04:54PM +0200, Arnd Bergmann wrote: > On Monday 19 May 2014 22:59:46 Thierry Reding wrote: > > On Mon, May 19, 2014 at 08:34:07PM +0200, Arnd Bergmann wrote: > > > On Monday 19 May 2014 14:53:37 Thierry Reding wrote: > > > > On Mon, May 19, 2014 at 12:26:35PM +0200, Arnd

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Monday 19 May 2014 22:32:33 Thierry Reding wrote: > On Mon, May 19, 2014 at 06:22:31PM +0100, Dave Martin wrote: > > On Mon, May 19, 2014 at 01:53:37PM +0100, Thierry Reding wrote: > [...] > > > My understanding here is mostly based on the OpenFirmware working group > > > proposal for the dma-ra

Re: [PATCH] devicetree: Add generic IOMMU device tree bindings

2014-05-20 Thread Arnd Bergmann
On Monday 19 May 2014 22:59:46 Thierry Reding wrote: > On Mon, May 19, 2014 at 08:34:07PM +0200, Arnd Bergmann wrote: > > On Monday 19 May 2014 14:53:37 Thierry Reding wrote: > > > On Mon, May 19, 2014 at 12:26:35PM +0200, Arnd Bergmann wrote: > > > > On Friday 16 May 2014 14:23:18 Thierry Reding w