Re: Tegra-DRM: Tegra30: DMA mapping API

2012-07-11 Thread markz
On Thu, 2012-07-12 at 11:33 +0800, Hiroshi Doyu wrote: > On Thu, 12 Jul 2012 05:04:33 +0200 > markz wrote: > > > On Wed, 2012-07-11 at 19:42 +0800, Hiroshi Doyu wrote: > > > Hi Joerg, > > > > > > On Wed, 11 Jul 2012 12:58:27 +0200 > > > Joerg Roedel wrote: > > > > > > > Hi, > > > > > > > > On

Re: Tegra-DRM: Tegra30: DMA mapping API

2012-07-11 Thread Hiroshi Doyu
On Thu, 12 Jul 2012 05:04:33 +0200 markz wrote: > On Wed, 2012-07-11 at 19:42 +0800, Hiroshi Doyu wrote: > > Hi Joerg, > > > > On Wed, 11 Jul 2012 12:58:27 +0200 > > Joerg Roedel wrote: > > > > > Hi, > > > > > > On Tue, Jul 10, 2012 at 01:26:39PM +0300, Hiroshi Doyu wrote: > > > > > http://li

Re: Tegra-DRM: Tegra30: DMA mapping API

2012-07-11 Thread markz
On Wed, 2012-07-11 at 19:42 +0800, Hiroshi Doyu wrote: > Hi Joerg, > > On Wed, 11 Jul 2012 12:58:27 +0200 > Joerg Roedel wrote: > > > Hi, > > > > On Tue, Jul 10, 2012 at 01:26:39PM +0300, Hiroshi Doyu wrote: > > > > http://lists.linuxfoundation.org/pipermail/iommu/2012-January/003531.html > > >

Re: [PATCH 01/27] x86/irq: Add data structure to keep AMD specific irq remapping information

2012-07-11 Thread Yinghai Lu
On Wed, Jul 11, 2012 at 6:38 AM, Joerg Roedel wrote: > Add a data structure to store information the IOMMU driver > can use to get from a 'struct irq_cfg' to the remapping > entry. > > Cc: x...@kernel.org > Cc: Yinghai Lu > Cc: Suresh Siddha > Signed-off-by: Joerg Roedel > --- > arch/x86/inclu

RE: [PATCH 2/7] iommu/amd: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Sethi Varun-B16395
> -Original Message- > From: Joerg Roedel [mailto:joerg.roe...@amd.com] > Sent: Wednesday, July 11, 2012 5:47 PM > To: Sethi Varun-B16395 > Cc: iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org > Subject: Re: [PATCH 2/7] iommu/amd: Implement DOMAIN_ATTR_GEOMETRY > attribute >

[PATCH 13/27] iommu/amd: Add slab-cache for irq remapping tables

2012-07-11 Thread Joerg Roedel
The irq remapping tables for the AMD IOMMU need to be aligned on a 128 byte boundary. Create a seperate slab-cache to guarantee this alignment. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |2 ++ drivers/iommu/amd_iommu_init.c | 23 +++ drivers/iommu

[PATCH 27/27] iommu/amd: Report irq remapping through IOMMU-API

2012-07-11 Thread Joerg Roedel
Report the availability of irq remapping through the IOMMU-API to allow KVM device passthrough again without additional module parameter overrides. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drive

[PATCH 19/27] iommu/amd: Add routines to manage irq remapping tables

2012-07-11 Thread Joerg Roedel
Add routines to: * Alloc remapping tables and single entries from these tables * Change entries in the tables * Free entries in the table Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 230 + 1 file changed, 230 insertions(+) diff --g

[PATCH 17/27] iommu/amd: Make sure IOMMU is not considered to translate itself

2012-07-11 Thread Joerg Roedel
The IVRS table usually includes the IOMMU device. But the IOMMU does never translate itself, so make sure the IOMMU driver knows this. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/dri

[PATCH 24/27] iommu/amd: Make sure irq remapping still works on dma init failure

2012-07-11 Thread Joerg Roedel
Do not deinitialize the AMD IOMMU driver completly when interrupt remapping is already in use but the initialization of the DMA layer fails for some reason. Make sure the IOMMU can still be used to remap interrupts. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c | 40 ++

[PATCH 20/27] iommu/amd: Add IOAPIC remapping routines

2012-07-11 Thread Joerg Roedel
Add the routine to setup interrupt remapping for ioapic interrupts. Also add a routine to change the affinity of an irq and to free an irq allocation for interrupt remapping. The last two functions will also be used for MSI interrupts. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |

[PATCH 21/27] iommu/amd: Implement MSI routines for interrupt remapping

2012-07-11 Thread Joerg Roedel
Add routines to setup interrupt remapping for MSI interrupts. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 74 + 1 file changed, 74 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 713f84c..9a24a1

[PATCH 26/27] iommu/amd: Print message to system log when irq remapping is enabled

2012-07-11 Thread Joerg Roedel
Print an indicator to dmesg to easily find out if interrupt remapping is enabled of a given system. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 8140fd

[PATCH 18/27] iommu/amd: Add IRTE invalidation routine

2012-07-11 Thread Joerg Roedel
Add routine to invalidate the IOMMU cache for interupt translations. Also include the IRTE caches when flushing all IOMMU caches. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 27 +++ drivers/iommu/amd_iommu_types.h |1 + 2 files changed, 28 inse

[PATCH 05/27] iommu/amd: Split out PCI related parts of IOMMU initialization

2012-07-11 Thread Joerg Roedel
For interrupt remapping the relevant IOMMU initialization needs to run earlier at boot when the PCI subsystem is not yet initialized. To support that this patch splits the parts of IOMMU initialization which need PCI accesses out of the initial setup path so that this can be done later. Signed-off

[PATCH 22/27] iommu/amd: Add call-back routine for HPET MSI

2012-07-11 Thread Joerg Roedel
Add a routine to setup a HPET MSI interrupt for remapping. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 9a24a1b..ac6e731 100644 --- a/drivers

[PATCH 11/27] iommu/amd: Convert iommu initialization to state machine

2012-07-11 Thread Joerg Roedel
This step makes it very easy to keep track about the current intialization state of the iommu driver. With this change we can initialize the IOMMU hardware to a point where it can remap interrupts and later resume the initializion to enable dma remapping. Signed-off-by: Joerg Roedel --- drivers/

[PATCH 15/27] iommu/amd: Check if IOAPIC information is correct

2012-07-11 Thread Joerg Roedel
When the IOAPIC information provided in the IVRS table is not correct or not complete the system may not boot at all when interrupt remapping is enabled. So check if this information is correct and print out a firmware bug message when it is not. Signed-off-by: Joerg Roedel --- drivers/iommu/Kco

[PATCH 12/27] iommu/amd: Keep track of HPET and IOAPIC device ids

2012-07-11 Thread Joerg Roedel
The IVRS ACPI table provides information about the IOAPICs and the HPETs available in the system and which PCI device ID they use in transactions. Save that information for later usage in interrupt remapping. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |3 ++ drivers/iomm

[PATCH 16/27] iommu/amd: Split device table initialization into irq and dma part

2012-07-11 Thread Joerg Roedel
When the IOMMU is enabled very early (as with irq-remapping) some devices are still in BIOS hand. When dma is blocked early this can cause lots of IO_PAGE_FAULTs. So delay the DMA initialization and do it right before the dma_ops are initialized. To be secure, block all interrupts by default when i

[PATCH 08/27] iommu/amd: Split enable_iommus() routine

2012-07-11 Thread Joerg Roedel
Split the enable_iommus() routine so that a part of it can run in early code. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.

[PATCH 23/27] iommu/amd: Add initialization routines for AMD interrupt remapping

2012-07-11 Thread Joerg Roedel
Add the six routines required to setup interrupt remapping with the AMD IOMMU. Also put it all together into the AMD specific irq_remap_ops. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 18 + drivers/iommu/amd_iommu_init.c | 42 ++

[PATCH 10/27] iommu/amd: Introduce amd_iommu_init_dma routine

2012-07-11 Thread Joerg Roedel
This function will initialize everthing necessary so that devices can do DMA. This includes dma_ops and iommu_ops. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd_i

[PATCH 07/27] iommu/amd: Introduce early_amd_iommu_init routine

2012-07-11 Thread Joerg Roedel
Split out the code to parse the ACPI table and setup relevant data structures into a new function. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |1 - drivers/iommu/amd_iommu_init.c | 38 +++--- 2 files changed, 23 insertions(+), 16 deletion

[PATCH 25/27] iommu/irq: Use amd_iommu_irq_ops if supported

2012-07-11 Thread Joerg Roedel
Finally enable interrupt remapping for AMD systems. Signed-off-by: Joerg Roedel --- drivers/iommu/irq_remapping.c |5 + 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c index 9276996..92ce0c7 100644 --- a/drivers/iommu/irq_remapp

[PATCH 04/27] iommu/amd: Use acpi_get_table instead of acpi_table_parse

2012-07-11 Thread Joerg Roedel
This makes it easier to propagate errors while parsing the IVRS table and makes the amd_iommu_init_err hack obsolete. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c | 118 ++-- 1 file changed, 66 insertions(+), 52 deletions(-) diff --git a/dr

[PATCH 02/27] x86/irq: Introduce irq_cfg->remapped

2012-07-11 Thread Joerg Roedel
This flag will show whether the interrupt is remapped in a way that works for VT-d and AMD-Vi. Cc: x...@kernel.org Cc: Yinghai Lu Cc: Suresh Siddha Signed-off-by: Joerg Roedel --- arch/x86/include/asm/hw_irq.h |1 + arch/x86/kernel/apic/io_apic.c |2 +- drivers/iommu/intel_i

[PATCH 09/27] iommu/amd: Move unmap_flush message to amd_iommu_init_dma_ops()

2012-07-11 Thread Joerg Roedel
The message belongs there anyway, so move it to that function. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |5 + drivers/iommu/amd_iommu_init.c |8 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd

[PATCH 14/27] iommu/amd: Allocate data structures to keep track of irq remapping tables

2012-07-11 Thread Joerg Roedel
To easily map device ids to interrupt remapping table entries a new lookup table is necessary. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu_init.c | 16 drivers/iommu/amd_iommu_types.h |9 + 2 files changed, 25 insertions(+) diff --git a/drivers/iommu/

[PATCH 03/27] iommu/amd: Fix sparse warnings

2012-07-11 Thread Joerg Roedel
A few sparse warnings fire in drivers/iommu/amd_iommu_init.c. Fix most of them with this patch. Also fix the sparse warnings in drivers/iommu/irq_remapping.c while at it. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |2 +- drivers/iommu/amd_iommu_init.c | 16 +--

[PATCH 06/27] iommu/amd: Move informational prinks out of iommu_enable

2012-07-11 Thread Joerg Roedel
This function will be called before the PCI subsystem is initialized. Therefore dev_name doen't work and IOMMU information can't be printed to the klog as before. Move the code to print that information to a later point where PCI initializtion has already happened. Signed-off-by: Joerg Roedel ---

[PATCH 01/27] x86/irq: Add data structure to keep AMD specific irq remapping information

2012-07-11 Thread Joerg Roedel
Add a data structure to store information the IOMMU driver can use to get from a 'struct irq_cfg' to the remapping entry. Cc: x...@kernel.org Cc: Yinghai Lu Cc: Suresh Siddha Signed-off-by: Joerg Roedel --- arch/x86/include/asm/hw_irq.h | 14 +- arch/x86/kernel/apic/io_apic

[PATCH 0/27] AMD IOMMU interrupt remapping support v2

2012-07-11 Thread Joerg Roedel
Hi, here is the second and revised patch-set to add interrupt remapping support to the AMD IOMMU driver. Changes v1->v2: * Improved print_iommu_info() function as suggested by Joe Perches * Fixed all five problems reported by Fengguang Wu from Intel, thanks ag

Re: [PATCH 2/7] iommu/amd: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
Hi Sethi, On Wed, Jul 11, 2012 at 11:47:39AM +, Sethi Varun-B16395 wrote: > I am currently working on upstreaming the Freescale IOMMU driver. As > discussed (with Scott Wood) a while back, this representation of the > GEOMETRY attribute doesn't go well with our IOMMU implementation. Our > repr

RE: [PATCH 2/7] iommu/amd: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Sethi Varun-B16395
> -Original Message- > From: iommu-boun...@lists.linux-foundation.org [mailto:iommu- > boun...@lists.linux-foundation.org] On Behalf Of Joerg Roedel > Sent: Wednesday, July 11, 2012 4:19 PM > To: iommu@lists.linux-foundation.org > Cc: linux-ker...@vger.kernel.org > Subject: [PATCH 2/7] io

Re: Tegra-DRM: Tegra30: DMA mapping API

2012-07-11 Thread Hiroshi Doyu
Hi Joerg, On Wed, 11 Jul 2012 12:58:27 +0200 Joerg Roedel wrote: > Hi, > > On Tue, Jul 10, 2012 at 01:26:39PM +0300, Hiroshi Doyu wrote: > > > http://lists.linuxfoundation.org/pipermail/iommu/2012-January/003531.html > > > > Do you have any plan to merge the above "IOMMU: Make IOMMU-API ready

Re: Tegra-DRM: Tegra30: DMA mapping API

2012-07-11 Thread Joerg Roedel
Hi, On Tue, Jul 10, 2012 at 01:26:39PM +0300, Hiroshi Doyu wrote: > > http://lists.linuxfoundation.org/pipermail/iommu/2012-January/003531.html > > Do you have any plan to merge the above "IOMMU: Make IOMMU-API ready > for GART-like hardware"? > > Tegra DRM seems to need that feature eventually.

[PATCH 7/7] iommu/exynos: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
Implement the attribute for the Samsung Exynos IOMMU driver. Signed-off-by: Joerg Roedel --- drivers/iommu/exynos-iommu.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 9a114b9..5c40937 100644 --- a/drivers/iommu/exyno

[PATCH 6/7] iommu/tegra: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
From: Hiroshi DOYU Implement the attribute for the Tegra IOMMU drivers. Signed-off-by: Hiroshi DOYU Signed-off-by: Joerg Roedel --- drivers/iommu/tegra-gart.c |5 + drivers/iommu/tegra-smmu.c |5 + 2 files changed, 10 insertions(+) diff --git a/drivers/iommu/tegra-gart.c b/dr

[PATCH 4/7] iommu/omap: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
Implement the attribute for the OMAP IOMMU driver. Signed-off-by: Joerg Roedel --- drivers/iommu/omap-iommu.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index e70ee2b..d0b1234 100644 --- a/drivers/iommu/omap-iommu.c +++ b/dr

[PATCH 2/7] iommu/amd: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
Implement the attribute itself and add the code for the AMD IOMMU driver. Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c |4 drivers/iommu/iommu.c | 19 --- include/linux/iommu.h |8 3 files changed, 28 insertions(+), 3 deletions(-) dif

[PATCH 3/7] iommu/vt-d: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
Implement the attribute for the Intel IOMMU driver. Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index b12af2f..6cb0791 100644 --- a/drivers/iommu/intel-iommu.c +++

[PATCH 5/7] iommu/msm: Implement DOMAIN_ATTR_GEOMETRY attribute

2012-07-11 Thread Joerg Roedel
Implement the attribute for the MSM IOMMU driver. Acked-by: David Brown Signed-off-by: Joerg Roedel --- drivers/iommu/msm_iommu.c |5 + 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index cee307e..6a8870a 100644 --- a/drivers/iommu/m

[PATCH 1/7] iommu: Add domain-attribute handlers

2012-07-11 Thread Joerg Roedel
This patch introduces an extension to the iommu-api to get and set attributes for an iommu_domain. Two functions are introduced for this: * iommu_domain_get_attr() * iommu_domain_set_attr() These functions will be used to make the iommu-api suitable for GART-like IOMMUs and to imp

[PATCH 0/7] Make IOMMU-API ready for GART-like hardware

2012-07-11 Thread Joerg Roedel
Hi, here is finally a new version of this patch-set. Changes to the previous version include: * Rebased to v3.5-rc6 * Added missing Acked-by's The potential issue with type-safety still exists. But since people are desperatly waiting for the functionality of this patch-set I thin