Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information pointer in archdata.

2013-02-28 Thread Alexey Kardashevskiy

Hi!

On POWERNV we use only the part of IOMMU API which handles devices and 
groups. We do not use IOMMU domains as VFIO containers do everything we 
need for VFIO and we do not implement iommu_ops as it is not very relevant 
to our architecture (does not give dma window properties, etc).


So your work does not overlap with my work :)


On 01/03/13 02:51, Kumar Gala wrote:


On Feb 27, 2013, at 6:04 AM, Sethi Varun-B16395 wrote:


Hi Kumar,Ben,
I am implementing the Freescale PAMU (IOMMU) driver using the Linux IOMMU API. 
In this particular patch, I have added a new field to dev_archdata structure to 
store the dma domain information.
This field is updated whenever we attach a device to an iommu domain.

Regards
Varun


Would be good to see if this overlaps with Alexey's work for IOMMU driver for 
powernv.

- k




-Original Message-
From: Joerg Roedel [mailto:j...@8bytes.org]
Sent: Wednesday, February 27, 2013 5:01 PM
To: Sethi Varun-B16395
Cc: iommu@lists.linux-foundation.org; linuxppc-...@lists.ozlabs.org;
linux-ker...@vger.kernel.org; Wood Scott-B07421; Yoder Stuart-B08248
Subject: Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information
pointer in archdata.

On Mon, Feb 18, 2013 at 06:22:14PM +0530, Varun Sethi wrote:

Add a new field in the device (powerpc) archdata structure for storing
iommu domain information pointer. This pointer is stored when the
device is attached to a particular domain.


Signed-off-by: Varun Sethi 
---
- no change.
arch/powerpc/include/asm/device.h |4 
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h
b/arch/powerpc/include/asm/device.h
index 77e97dd..6dc79fe 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -28,6 +28,10 @@ struct dev_archdata {
void*iommu_table_base;
} dma_data;

+   /* IOMMU domain information pointer. This would be set
+* when this device is attached to an iommu_domain.
+*/
+   void*iommu_domain;


Please Cc the PowerPC Maintainers on this, so that they can have a look
at it. This also must be put this into an #ifdef CONFIG_IOMMU_API.



--
Alexey  
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 3.4] iommu/amd: Initialize device table after dma_ops

2013-02-28 Thread Luis Henriques
Hi Shuah,

On Thu, Feb 28, 2013 at 12:52:00PM -0700, Shuah Khan wrote:
> On Tue, 2013-02-26 at 16:49 -0700, Shuah Khan wrote:
> > When dma_ops are initialized the unity mappings are created. The
> > init_device_table_dma() function makes sure DMA from all devices is
> > blocked by default. This opens a short window in time where DMA to
> > unity mapped regions is blocked by the IOMMU. Make sure this does not
> > happen by initializing the device table after dma_ops.
> > 
> > Back-port upstream commit: f528d980c17b8714aedc918ba86e058af914d66b
> > 
> > Signed-off-by: Joerg Roedel 
> > Signed-off-by: Shuah Khan 
> > CC: sta...@vger.kernel.org 3.4
> 
> Please consider this for 3.5 as well.

Thank you, I will queue this for the 3.5 kernel.

Cheers,
--
Luis

> 
> -- Shuah
> > ---
> >  drivers/iommu/amd_iommu_init.c |9 +++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
> > index ef0ae93..b573f80 100644
> > --- a/drivers/iommu/amd_iommu_init.c
> > +++ b/drivers/iommu/amd_iommu_init.c
> > @@ -1572,8 +1572,6 @@ int __init amd_iommu_init_hardware(void)
> > if (amd_iommu_pd_alloc_bitmap == NULL)
> > goto free;
> >  
> > -   /* init the device table */
> > -   init_device_table();
> >  
> > /*
> >  * let all alias entries point to itself
> > @@ -1655,6 +1653,7 @@ out:
> >   */
> >  static int __init amd_iommu_init(void)
> >  {
> > +   struct amd_iommu *iommu;
> > int ret = 0;
> >  
> > ret = amd_iommu_init_hardware();
> > @@ -1673,6 +1672,12 @@ static int __init amd_iommu_init(void)
> > if (ret)
> > goto free;
> >  
> > +   /* init the device table */
> > +   init_device_table();
> > +
> > +   for_each_iommu(iommu)
> > +   iommu_flush_all_caches(iommu);
> > +
> > amd_iommu_init_api();
> >  
> > x86_platform.iommu_shutdown = disable_iommus;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 3.2] iommu/amd: Initialize device table after dma_ops

2013-02-28 Thread Shuah Khan
When dma_ops are initialized the unity mappings are created. The
init_device_table_dma() function makes sure DMA from all devices is
blocked by default. This opens a short window in time where DMA to
unity mapped regions is blocked by the IOMMU. Make sure this does not
happen by initializing the device table after dma_ops.

Back-port upstream commit: f528d980c17b8714aedc918ba86e058af914d66b
Tested on 3.2.38

Signed-off-by: Joerg Roedel 
Signed-off-by: Shuah Khan 
CC: sta...@vger.kernel.org 3.2
---
 drivers/iommu/amd_iommu_init.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 62a4d5c..b7d1cdd 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1396,6 +1396,7 @@ static struct syscore_ops amd_iommu_syscore_ops = {
  */
 static int __init amd_iommu_init(void)
 {
+   struct amd_iommu *iommu;
int i, ret = 0;
 
/*
@@ -1444,9 +1445,6 @@ static int __init amd_iommu_init(void)
if (amd_iommu_pd_alloc_bitmap == NULL)
goto free;
 
-   /* init the device table */
-   init_device_table();
-
/*
 * let all alias entries point to itself
 */
@@ -1496,6 +1494,12 @@ static int __init amd_iommu_init(void)
if (ret)
goto free_disable;
 
+   /* init the device table */
+   init_device_table();
+
+   for_each_iommu(iommu)
+   iommu_flush_all_caches(iommu);
+
amd_iommu_init_api();
 
amd_iommu_init_notifier();
-- 
1.7.10.4



___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 3.4] iommu/amd: Initialize device table after dma_ops

2013-02-28 Thread Shuah Khan
On Thu, 2013-02-28 at 12:52 -0700, Shuah Khan wrote:
> On Tue, 2013-02-26 at 16:49 -0700, Shuah Khan wrote:
> > When dma_ops are initialized the unity mappings are created. The
> > init_device_table_dma() function makes sure DMA from all devices is
> > blocked by default. This opens a short window in time where DMA to
> > unity mapped regions is blocked by the IOMMU. Make sure this does not
> > happen by initializing the device table after dma_ops.
> > 
> > Back-port upstream commit: f528d980c17b8714aedc918ba86e058af914d66b
> > 
> > Signed-off-by: Joerg Roedel 
> > Signed-off-by: Shuah Khan 
> > CC: sta...@vger.kernel.org 3.4
> 
> Please consider this for 3.5 as well.
> 
> -- Shuah

Please consider this for 3.5. Patch applies and fix works on 3.5.7. My
previous reply to Herton Ronaldo Krzesinski bounced. Including Luis
Henriques on this one.

-- Shuah

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 3.4] iommu/amd: Initialize device table after dma_ops

2013-02-28 Thread Shuah Khan
On Tue, 2013-02-26 at 16:49 -0700, Shuah Khan wrote:
> When dma_ops are initialized the unity mappings are created. The
> init_device_table_dma() function makes sure DMA from all devices is
> blocked by default. This opens a short window in time where DMA to
> unity mapped regions is blocked by the IOMMU. Make sure this does not
> happen by initializing the device table after dma_ops.
> 
> Back-port upstream commit: f528d980c17b8714aedc918ba86e058af914d66b
> 
> Signed-off-by: Joerg Roedel 
> Signed-off-by: Shuah Khan 
> CC: sta...@vger.kernel.org 3.4

Please consider this for 3.5 as well.

-- Shuah
> ---
>  drivers/iommu/amd_iommu_init.c |9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
> index ef0ae93..b573f80 100644
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@ -1572,8 +1572,6 @@ int __init amd_iommu_init_hardware(void)
>   if (amd_iommu_pd_alloc_bitmap == NULL)
>   goto free;
>  
> - /* init the device table */
> - init_device_table();
>  
>   /*
>* let all alias entries point to itself
> @@ -1655,6 +1653,7 @@ out:
>   */
>  static int __init amd_iommu_init(void)
>  {
> + struct amd_iommu *iommu;
>   int ret = 0;
>  
>   ret = amd_iommu_init_hardware();
> @@ -1673,6 +1672,12 @@ static int __init amd_iommu_init(void)
>   if (ret)
>   goto free;
>  
> + /* init the device table */
> + init_device_table();
> +
> + for_each_iommu(iommu)
> + iommu_flush_all_caches(iommu);
> +
>   amd_iommu_init_api();
>  
>   x86_platform.iommu_shutdown = disable_iommus;


___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 2/6] powerpc/fsl_pci: Store the platform device information corresponding to the pci controller.

2013-02-28 Thread Kumar Gala

On Feb 27, 2013, at 4:56 AM, Sethi Varun-B16395 wrote:

> This patch is present in the "next branch" of linux ppc tree maintained by 
> Kumar Gala.
> Following is the commit id:
> 52c5affc545053d37c0b05224bbf70f5336caa20
> 
> I am not sure if this would be part of 3.9-rc1.
> 
> Regards
> varun

This is now in Linus's tree so will be in 3.9-rc1

- k

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 3/6] powerpc/fsl_pci: Added defines for the FSL PCI controller BRR1 register.

2013-02-28 Thread Kumar Gala

On Feb 27, 2013, at 5:33 AM, Joerg Roedel wrote:

> On Mon, Feb 18, 2013 at 06:22:16PM +0530, Varun Sethi wrote:
>> Macros for checking FSL PCI controller version.
>> 
>> Signed-off-by: Varun Sethi 
>> ---
>> arch/powerpc/include/asm/pci-bridge.h |4 
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>> 
>> diff --git a/arch/powerpc/include/asm/pci-bridge.h 
>> b/arch/powerpc/include/asm/pci-bridge.h
>> index 025a130..c12ed78 100644
>> --- a/arch/powerpc/include/asm/pci-bridge.h
>> +++ b/arch/powerpc/include/asm/pci-bridge.h
>> @@ -14,6 +14,10 @@
>> 
>> struct device_node;
>> 
>> +/* FSL PCI controller BRR1 register */
>> +#define PCI_FSL_BRR1  0xbf8
>> +#define PCI_FSL_BRR1_VER 0x
>> +
> 
> 
> Please merge this patch with the one where you actually make use of
> these defines for the first time.
> 
> 
>   Joerg

This also seems an odd place for these defines.

- k
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information pointer in archdata.

2013-02-28 Thread Kumar Gala

On Feb 27, 2013, at 6:04 AM, Sethi Varun-B16395 wrote:

> Hi Kumar,Ben,
> I am implementing the Freescale PAMU (IOMMU) driver using the Linux IOMMU 
> API. In this particular patch, I have added a new field to dev_archdata 
> structure to store the dma domain information.
> This field is updated whenever we attach a device to an iommu domain.
> 
> Regards
> Varun

Would be good to see if this overlaps with Alexey's work for IOMMU driver for 
powernv.

- k

> 
>> -Original Message-
>> From: Joerg Roedel [mailto:j...@8bytes.org]
>> Sent: Wednesday, February 27, 2013 5:01 PM
>> To: Sethi Varun-B16395
>> Cc: iommu@lists.linux-foundation.org; linuxppc-...@lists.ozlabs.org;
>> linux-ker...@vger.kernel.org; Wood Scott-B07421; Yoder Stuart-B08248
>> Subject: Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information
>> pointer in archdata.
>> 
>> On Mon, Feb 18, 2013 at 06:22:14PM +0530, Varun Sethi wrote:
>>> Add a new field in the device (powerpc) archdata structure for storing
>>> iommu domain information pointer. This pointer is stored when the
>>> device is attached to a particular domain.
>>> 
>>> 
>>> Signed-off-by: Varun Sethi 
>>> ---
>>> - no change.
>>> arch/powerpc/include/asm/device.h |4 
>>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>> 
>>> diff --git a/arch/powerpc/include/asm/device.h
>>> b/arch/powerpc/include/asm/device.h
>>> index 77e97dd..6dc79fe 100644
>>> --- a/arch/powerpc/include/asm/device.h
>>> +++ b/arch/powerpc/include/asm/device.h
>>> @@ -28,6 +28,10 @@ struct dev_archdata {
>>> void*iommu_table_base;
>>> } dma_data;
>>> 
>>> +   /* IOMMU domain information pointer. This would be set
>>> +* when this device is attached to an iommu_domain.
>>> +*/
>>> +   void*iommu_domain;
>> 
>> Please Cc the PowerPC Maintainers on this, so that they can have a look
>> at it. This also must be put this into an #ifdef CONFIG_IOMMU_API.
>> 
>> 
>>  Joerg
>> 
>> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu