RE: [PATCH 2/3] Docs: dt: Add PCI MSI map bindings

2015-08-05 Thread Stuart Yoder
> From: Mark Rutland > Date: Thu, Jul 23, 2015 at 11:52 AM [cut] > diff --git a/Documentation/devicetree/bindings/pci/pci-msi.txt > b/Documentation/devicetree/bindings/pci/pci-msi.txt > new file mode 100644 > index 000..9b3cc81 > --- /dev/null > +++ b/Documentation/devicetree/bindings/pci/pc

[PATCH V2] iommu/arm-smmu-v2: ThunderX mis-extends 64bit registers

2015-08-05 Thread Tirumalesh Chalamarla
The SMMU architecture defines two different behaviors when 64-bit registers are written with 32-bit writes. The first behavior causes zero extension into the upper 32-bits. The second behavior splits a 64-bit register into "normal" 32-bit register pairs. On some buggy implementations, registers

Re: [PATCH 1/3] Docs: dt: add generic MSI bindings

2015-08-05 Thread Mark Rutland
Rob, Do you have any objections to this, or are you happy to take this patch? There's a user of this binding (the GICv3 ITS) queued for v4.3 already in the tip tree, so either we either need to be ok with this binding or we need to rework that before v4.3. Marc, can I take it from your use of th

RE: [PATCH 2/3] Docs: dt: Add PCI MSI map bindings

2015-08-05 Thread Varun Sethi
Hi Mark Thanks for the patch. Please find my comment inline. Regards Varun > -Original Message- > From: iommu-boun...@lists.linux-foundation.org [mailto:iommu- > boun...@lists.linux-foundation.org] On Behalf Of Mark Rutland > Sent: Thursday, July 23, 2015 10:23 PM > To: devicet...@vger.ke

Re: [PATCH 05/13] iommu/io-pgtable-arm: Allow appropriate DMA API use

2015-08-05 Thread Will Deacon
Hi Laurent, On Tue, Aug 04, 2015 at 09:54:27PM +0100, Laurent Pinchart wrote: > On Tuesday 04 August 2015 15:56:42 Russell King - ARM Linux wrote: > > On Tue, Aug 04, 2015 at 03:47:13PM +0100, Robin Murphy wrote: > > > On 04/08/15 14:16, Laurent Pinchart wrote: > > >> This is what I believe to be

[PATCH 03/26] iommu/vt-d: Split up iommu->domains array

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This array is indexed by the domain-id and contains the pointers to the domains attached to this iommu. Modern systems support 65536 domain ids, so that this array has a size of 512kb, per iommu. This is a huge waste of space, as the array is usually sparsely populated. This p

[PATCH 12/26] iommu/vt-d: Simplify domain_remove_one_dev_info()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Simplify this function as much as possible with the new iommu_refcnt field. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 50 +++-- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/drivers/iommu/intel-iom

[PATCH 02/26] iommu/vt-d: Add access functions for iommu->domains

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This makes it easier to change the layout of the data structure later. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-io

[PATCH 24/26] iommu/vt-d: Pass device_domain_info to __dmar_remove_one_dev_info

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This struct contains all necessary information for the function already. Also handle the info->dev == NULL case while at it. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-)

[PATCH 25/26] iommu/vt-d: Only insert alias dev_info if there is an alias

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel For devices without an PCI alias there will be two device_domain_info structures added. Prevent that by checking if the alias is different from the device. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-)

[PATCH 26/26] iommu/vt-d: Avoid duplicate device_domain_info structures

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel When a 'struct device_domain_info' is created as an alias for another device, this struct will not be re-used when the real device is encountered. Fix that to avoid duplicate device_domain_info structures being added. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu

[PATCH 19/26] iommu/vt-d: Establish domain<->iommu link in dmar_insert_one_dev_info

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This makes domain attachment more synchronous with domain deattachment. The domain<->iommu link is released in dmar_remove_one_dev_info. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 28 +++- 1 file changed, 11 insertions(+), 17 deleti

[PATCH 14/26] iommu/vt-d: Move context-mapping into dmar_insert_dev_info

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Do the context-mapping of devices from a single place in the call-path and clean up the other call-sites. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 33 - 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/driver

[PATCH 23/26] iommu/vt-d: Remove dmar_global_lock from device_notifier

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel The code in the locked section does not touch anything protected by the dmar_global_lock. Remove it from there. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-

[PATCH 20/26] iommu/vt-d: Unify domain->iommu attach/detachment

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Move the code to attach/detach domains to iommus and vice verce into a single function to make sure there are no dangling references. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 124 +--- 1 file changed, 49 insertions

[PATCH 00/26] iommu/vt-d: Clean up device<->domain attachment

2015-08-05 Thread Joerg Roedel
Hi, here is a (bigger than I expected) patch-set which cleans up the code to attach and detach domains to iommus in the Intel VT-d driver. In particular, the patch-set does: * Remove special cases around the handling of various domain types and align their handling wh

[PATCH 17/26] iommu/vt-d: Rename iommu_detach_dependent_devices()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Rename this function and the ones further down its call-chain to domain_context_clear_*. In particular this means: iommu_detach_dependent_devices -> domain_context_clear iommu_detach_dev_cb -> domain_context_clear_one_cb iommu_d

[PATCH 21/26] iommu/vt-d: Only call domain_remove_one_dev_info to detach old domain

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel There is no need to make a difference here between VM and non-VM domains, so simplify this code here. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iom

[PATCH 11/26] iommu/vt-d: Simplify io/tlb flushing in intel_iommu_unmap

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel We don't need to do an expensive search for domain-ids anymore, as we keep track of per-iommu domain-ids. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/iommu/intel-iomm

[PATCH 13/26] iommu/vt-d: Simplify domain_remove_dev_info()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Just call domain_remove_one_dev_info() for all devices in the domain instead of reimplementing the functionality. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 20 ++-- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/iom

[PATCH 10/26] iommu/vt-d: Replace iommu_bmp with a refcount

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This replaces the dmar_domain->iommu_bmp with a similar reference count array. This allows us to keep track of how many devices behind each iommu are attached to the domain. This is necessary for further simplifications and optimizations to the iommu<->domain attachment code.

[PATCH 22/26] iommu/vt-d: Get rid of domain->iommu_lock

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel When this lock is held the device_domain_lock is also required to make sure the device_domain_info does not vanish while in use. So this lock can be removed as it gives no additional protection. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 87 +++

[PATCH 09/26] iommu/vt-d: Kill dmar_domain->id

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This field is now obsolete because all places use the per-iommu domain-ids. Kill the remaining uses of this field and remove it. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/driver

[PATCH 15/26] iommu/vt-d: Rename dmar_insert_dev_info()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Rename this function to dmar_insert_one_dev_info() to match the name better with its counter part function domain_remove_one_dev_info(). Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff -

[PATCH 18/26] iommu/vt-d: Pass an iommu pointer to domain_init()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This allows to do domain->iommu attachment after domain_init has run. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 08391a

[PATCH 16/26] iommu/vt-d: Rename domain_remove_one_dev_info()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Rename the function to dmar_remove_one_dev_info to match is name better with its dmar_insert_one_dev_info counterpart. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dri

[PATCH 07/26] iommu/vt-d: Pass dmar_domain directly into iommu_flush_iotlb_psi

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel This function can figure out the domain-id to use itself from the iommu_did array. This is more reliable over different domain types and brings us one step further to remove the domain->id field. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 42 ++

[PATCH 06/26] iommu/vt-d: Simplify domain_context_mapping_one

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Get rid of the special cases for VM domains vs. non-VM domains and simplify the code further to just handle the hardware passthrough vs. page-table case. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 60 - 1 file ch

[PATCH 01/26] iommu/vt-d: Keep track of per-iommu domain ids

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel Instead of searching in the domain array for already allocated domain ids, keep track of them explicitly. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 51 +++-- 1 file changed, 26 insertions(+), 25 deletions(-) diff -

[PATCH 05/26] iommu/vt-d: Calculate translation in domain_context_mapping_one

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel There is no reason to pass the translation type through multiple layers. It can also be determined in the domain_context_mapping_one function directly. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 50 ++--- 1 file chan

[PATCH 04/26] iommu/vt-d: Get rid of iommu_attach_vm_domain()

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel The special case for VM domains is not needed, as other domains could be attached to the iommu in the same way. So get rid of this special case. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 26 ++ 1 file changed, 10 insertions(+), 16

[PATCH 08/26] iommu/vt-d: Don't pre-allocate domain ids for si_domain

2015-08-05 Thread Joerg Roedel
From: Joerg Roedel There is no reason for this special handling of the si_domain. The per-iommu domain-id can be allocated on-demand like for any other domain. So remove the pre-allocation code. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 28 +--- 1 fi

Re: [PATCH v3 0/5] iommu/arm-smmu: add support for non-pci devices

2015-08-05 Thread Laurent Pinchart
Hi Will, On Wednesday 05 August 2015 11:45:24 Will Deacon wrote: > On Tue, Aug 04, 2015 at 11:50:45PM +0100, Laurent Pinchart wrote: > > On Tuesday 28 July 2015 13:48:47 Will Deacon wrote: > >> On Tue, Jul 21, 2015 at 11:30:07AM +0100, Robin Murphy wrote: > >>> On 21/07/15 08:30, Zhen Lei wrote: >

Re: [PATCH v3 0/5] iommu/arm-smmu: add support for non-pci devices

2015-08-05 Thread Will Deacon
On Tue, Aug 04, 2015 at 11:50:45PM +0100, Laurent Pinchart wrote: > Hi Will, Hi Laurent, > On Tuesday 28 July 2015 13:48:47 Will Deacon wrote: > > On Tue, Jul 21, 2015 at 11:30:07AM +0100, Robin Murphy wrote: > > > On 21/07/15 08:30, Zhen Lei wrote: > > > > Changelog: > > > > v2 -> v3: > > > > 1.

Re: IVDB DTE_ALL Settings

2015-08-05 Thread Valentine Sinitsyn
Hi Joerg, On 05.08.2015 14:48, Joerg Roedel wrote: On Tue, Aug 04, 2015 at 10:05:45PM +0500, Valentine Sinitsyn wrote: Not directly related to the issue David discovered, but as we discuss IVRS handling: the specification says that ACPI tables data overrides what's in hardware registers (Sect.

Re: IVDB DTE_ALL Settings

2015-08-05 Thread Joerg Roedel
On Tue, Aug 04, 2015 at 10:05:45PM +0500, Valentine Sinitsyn wrote: > Not directly related to the issue David discovered, but as we > discuss IVRS handling: the specification says that ACPI tables data > overrides what's in hardware registers (Sect. 5). To the best of my > understanding, this means