Re: [PATCH 1/7] powerpc: Add interface to get msi region information

2013-09-24 Thread Bjorn Helgaas
On Thu, Sep 19, 2013 at 12:59:17PM +0530, Bharat Bhushan wrote: > This patch adds interface to get following information > - Number of MSI regions (which is number of MSI banks for powerpc). > - Get the region address range: Physical page which have the > address/addresses used for generat

[PATCH v4 2/2] iommu: Change iommu driver to call io_page_fault trace event

2013-09-24 Thread Shuah Khan
Change iommu driver call io_page_fault trace event. This iommu_error class event can be enabled to trigger when an iommu error occurs. Trace information includes driver name, device name, iova, and flags. Testing: Added trace calls to iommu_prepare_identity_map() for testing some of the conditions

[PATCH v4 1/2] iommu: Add iommu_error class event to iommu trace

2013-09-24 Thread Shuah Khan
iommu_error class event can be enabled to trigger when an iommu error occurs. This trace event is intended to be called to report the error information. Trace information includes driver name, device name, iova, and flags. iommu_error:io_page_fault Signed-off-by: Shuah Khan --- drivers/iommu/io

[PATCH v4 0/2] iommu: Add iommu_error class event to iommu trace

2013-09-24 Thread Shuah Khan
This patch set adds iommu_error class event to iommu trace. iommu_error class event can be enabled to trigger when an iommu error occurs. This trace event is intended to be called to report the error information. Trace information includes driver name, device name, iova, and flags. iommu_error:io_

Re: [PATCH 7/7] iommu/arm-smmu: Clear global and context bank fault status and syndrome registers

2013-09-24 Thread Andreas Herrmann
On Tue, Sep 24, 2013 at 11:42:52AM -0400, Will Deacon wrote: > On Tue, Sep 24, 2013 at 04:07:01PM +0100, Andreas Herrmann wrote: > > Signed-off-by: Andreas Herrmann > > --- > > drivers/iommu/arm-smmu.c |9 + > > 1 file changed, 9 insertions(+) > > > > diff --git a/drivers/iommu/arm-s

Re: [PATCH 2/7] iommu/arm-smmu: Calculate SMMU_CB_BASE from smmu register values

2013-09-24 Thread Andreas Herrmann
On Tue, Sep 24, 2013 at 11:34:57AM -0400, Will Deacon wrote: > On Tue, Sep 24, 2013 at 04:06:56PM +0100, Andreas Herrmann wrote: > > Currently it is derived from smmu resource size. If the resource size > > is wrongly specified (e.g. too large) this leads to a miscalculation > > and can cause undef

Re: [PATCH 3/7] ARM: dma-mapping: Always pass proper prot flags to iommu_map()

2013-09-24 Thread Andreas Herrmann
On Tue, Sep 24, 2013 at 11:36:25AM -0400, Will Deacon wrote: > On Tue, Sep 24, 2013 at 04:06:57PM +0100, Andreas Herrmann wrote: > > ... otherwise it is impossible for the low level iommu driver to > > figure out which pte flags should be used. > > > > In __map_sg_chunk we can derive the flags fro

Re: [PATCH 7/7] iommu/arm-smmu: Clear global and context bank fault status and syndrome registers

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:07:01PM +0100, Andreas Herrmann wrote: > Signed-off-by: Andreas Herrmann > --- > drivers/iommu/arm-smmu.c |9 + > 1 file changed, 9 insertions(+) > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 251564e..a499146 100644 > --- a/dr

Re: [PATCH 6/7] iommu/arm-smmu: Add module parameter arm-smmu=off|force_isolation

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:07:00PM +0100, Andreas Herrmann wrote: > arm-smmu= arm-smmu driver option > > off Disable arm-smmu driver (ie. ignore available SMMUs) > > force_isolation > Try to attach each master device on every SMMU to a > separate io

Re: [PATCH 3/7] ARM: dma-mapping: Always pass proper prot flags to iommu_map()

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:06:57PM +0100, Andreas Herrmann wrote: > ... otherwise it is impossible for the low level iommu driver to > figure out which pte flags should be used. > > In __map_sg_chunk we can derive the flags from dma_data_direction. > > In __iommu_create_mapping we should treat th

Re: [PATCH 4/7] iommu/arm-smmu: Check for num_context_irqs > 0 to avoid divide by zero exception

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:06:58PM +0100, Andreas Herrmann wrote: > With the right (or wrong;-) definition of v1 SMMU node in DTB it is > possible to trigger a division by zero in arm_smmu_init_domain_context > (if number of context irqs is 0): > >if (smmu->version == 1) { >

Re: [PATCH 2/7] iommu/arm-smmu: Calculate SMMU_CB_BASE from smmu register values

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:06:56PM +0100, Andreas Herrmann wrote: > Currently it is derived from smmu resource size. If the resource size > is wrongly specified (e.g. too large) this leads to a miscalculation > and can cause undefined behaviour when context bank registers are > modified. > > Signe

Re: [PATCH 0/7]: iommu/arm-smmu: Misc fixes/adaptions

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:06:54PM +0100, Andreas Herrmann wrote: > Hi, Hi Andreas, > Following patches fix misc issues, that I've seen when using arm-smmu > driver with MMU-400. Thanks for the patches! I'll respond to each one in turn. Will ___ iommu

Re: [PATCH 1/7] iommu/arm-smmu: Switch to arch_initcall for driver registration

2013-09-24 Thread Andreas Herrmann
iommu/arm-smmu: Remove bogus semicolon from if conditions Those prevented proper registration of arm_smmu_ops. Signed-off-by: Andreas Herrmann --- drivers/iommu/arm-smmu.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Will, It seems that I've managed to exclude the very first p

Re: [PATCH 1/7] iommu/arm-smmu: Switch to arch_initcall for driver registration

2013-09-24 Thread Will Deacon
On Tue, Sep 24, 2013 at 04:14:30PM +0100, Andreas Herrmann wrote: > iommu/arm-smmu: Remove bogus semicolon from if conditions > > Those prevented proper registration of arm_smmu_ops. > > Signed-off-by: Andreas Herrmann > --- > drivers/iommu/arm-smmu.c |4 ++-- > 1 file changed, 2 insertions

[PATCH 0/7]: iommu/arm-smmu: Misc fixes/adaptions

2013-09-24 Thread Andreas Herrmann
Hi, Following patches fix misc issues, that I've seen when using arm-smmu driver with MMU-400. I also suggest to add an option to automatically create domains for each master of detected SMMUs. (Similar to what is available for other iommu driver(s).) Comments welcome. Regards, Andreas PS: P

[PATCH 2/7] iommu/arm-smmu: Calculate SMMU_CB_BASE from smmu register values

2013-09-24 Thread Andreas Herrmann
Currently it is derived from smmu resource size. If the resource size is wrongly specified (e.g. too large) this leads to a miscalculation and can cause undefined behaviour when context bank registers are modified. Signed-off-by: Andreas Herrmann --- drivers/iommu/arm-smmu.c |7 +-- 1 fi

[PATCH 1/7] iommu/arm-smmu: Switch to arch_initcall for driver registration

2013-09-24 Thread Andreas Herrmann
This should ensure that arm-smmu is initialized before other drivers start handling devices that propably need smmu support. Also remove module_exit function as we most likely never want to unload this driver. Signed-off-by: Andreas Herrmann --- drivers/iommu/arm-smmu.c |8 +--- 1 file

[PATCH 6/7] iommu/arm-smmu: Add module parameter arm-smmu=off|force_isolation

2013-09-24 Thread Andreas Herrmann
arm-smmu= arm-smmu driver option off Disable arm-smmu driver (ie. ignore available SMMUs) force_isolation Try to attach each master device on every SMMU to a separate iommu_domain. Default is that driver detects SMMUs but no translation i

[PATCH 3/7] ARM: dma-mapping: Always pass proper prot flags to iommu_map()

2013-09-24 Thread Andreas Herrmann
... otherwise it is impossible for the low level iommu driver to figure out which pte flags should be used. In __map_sg_chunk we can derive the flags from dma_data_direction. In __iommu_create_mapping we should treat the memory like DMA_BIDIRECTIONAL and pass both IOMMU_READ and IOMMU_WRITE to io

[PATCH 5/7] iommu/arm-smmu: Add function that isolates all masters for all SMMUs

2013-09-24 Thread Andreas Herrmann
Each device is put into its own protection domain (if possible). For configuration with one or just a view masters per SMMU that is easy to achieve. In case of many devices per SMMU (e.g. MMU-500 with it's distributed translation support) isolation of each device might not be possible -- depending

[PATCH 4/7] iommu/arm-smmu: Check for num_context_irqs > 0 to avoid divide by zero exception

2013-09-24 Thread Andreas Herrmann
With the right (or wrong;-) definition of v1 SMMU node in DTB it is possible to trigger a division by zero in arm_smmu_init_domain_context (if number of context irqs is 0): if (smmu->version == 1) { root_cfg->irptndx = atomic_inc_return(&smmu->irptndx); → root_cf

[PATCH 7/7] iommu/arm-smmu: Clear global and context bank fault status and syndrome registers

2013-09-24 Thread Andreas Herrmann
Signed-off-by: Andreas Herrmann --- drivers/iommu/arm-smmu.c |9 + 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 251564e..a499146 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -645,6 +645,10 @@ static

Re: [PATCH v2] intel-iommu: Quiesce devices before disabling IOMMU

2013-09-24 Thread David Woodhouse
On Tue, 2013-09-24 at 15:16 +0200, Joerg Roedel wrote: > > I am not convinced that this is the right approach. If a device wasn't > translated by VT-d in the old kernel doesn't mean it will not be > translated in the new kernel. How about unconditionally resetting all > PCI busses and/or functions

Re: [PATCH v2] intel-iommu: Quiesce devices before disabling IOMMU

2013-09-24 Thread Joerg Roedel
On Wed, Sep 18, 2013 at 03:09:01PM +0900, Takao Indoh wrote: > + /* > + * In the case of kdump, ioremap is needed because root-entry table > + * exists in first kernel's memory area which is not mapped in second > + * kernel > + */ > + root = (struct root_entry *)iore

Re: [PATCH 1/2] iommu: Add iommu_fault class event to iommu trace

2013-09-24 Thread Shuah Khan
On 09/24/2013 04:48 AM, Joerg Roedel wrote: On Fri, Aug 16, 2013 at 11:20:16AM -0600, Shuah Khan wrote: +DEFINE_EVENT(iommu_fault, report_fault, + + TP_PROTO(struct device *dev, unsigned long iova, int flags), + + TP_ARGS(dev, iova, flags) +); I am not entirely happy with the namin

Re: [PATCH 1/1] x86/iommu: correct ICS register offset

2013-09-24 Thread Joerg Roedel
On Tue, Sep 17, 2013 at 04:38:29PM +0800, ZhenHua wrote: > Hi Guys, > Though DMAR_ICS_REG is not used yet, I think this patch is > necessary. So please take a look at it. You are right, my Spec says the same. It doesn't matter much since the register seems to be unused in the VT-d driver. I a

Re: [PATCH 1/2] iommu: Add iommu_fault class event to iommu trace

2013-09-24 Thread Joerg Roedel
On Fri, Aug 16, 2013 at 11:20:16AM -0600, Shuah Khan wrote: > +DEFINE_EVENT(iommu_fault, report_fault, > + > + TP_PROTO(struct device *dev, unsigned long iova, int flags), > + > + TP_ARGS(dev, iova, flags) > +); I am not entirely happy with the naming. It is better to name the class iommu_

Re: [PATCH 0/7] iommu: Add event tracing feature to iommu

2013-09-24 Thread Joerg Roedel
On Thu, Aug 15, 2013 at 11:59:22AM -0600, Shuah Khan wrote: > Shuah Khan (7): > iommu: Add event tracing feature to iommu > iommu: Change iommu driver to call add_device_to_group trace event > iommu: Change iommu driver to call remove_device_to_group trace event > iommu: Change iommu driver

Re: [PATCH] MAINTAINERS: add overall IOMMU section

2013-09-24 Thread Joerg Roedel
On Fri, Sep 13, 2013 at 01:10:27PM -0600, Stephen Warren wrote: > I believe that Joerg Roedel is at least the path through which > drivers/iommu changes should be merged. Add a MAINTAINERS entry to > make this clear, so that he's Cd'd on all relevant patches. This is > relevant for non-AMD/Intel IO

Re: [GIT PULL] iommu/arm-smmu: fixes for 3.12

2013-09-24 Thread Joerg Roedel
On Tue, Sep 17, 2013 at 02:19:49PM +0100, Will Deacon wrote: > The following changes since commit 272b98c6455f00884f0350f775c5342358ebb73f: > > Linux 3.12-rc1 (2013-09-16 16:17:51 -0400) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.