Message ID | 6A3DF150A5B70D4F9B66A25E3F7C888D0710DCBF@039-SN2MPN1-013.039d.mgd.msft.net (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: > And this simple fix work for me > diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c > index b20ff17..8869b0d 100644 > --- a/arch/powerpc/kernel/iommu.c > +++ b/arch/powerpc/kernel/iommu.c > @@ -48,6 +48,8 @@ > #include <asm/vio.h> > #include <asm/tce.h> > > +#define DEBUG > + > #define DBG(...) > > static int novmerge; > @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size, > } > } > > -#ifdef CONFIG_IOMMU_API > +#ifdef SPAPR_TCE_IOMMU > /* > * SPAPR TCE API > */ > ---------------------- And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print?
> -----Original Message----- > From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru] > Sent: Monday, August 12, 2013 7:44 PM > To: Bhushan Bharat-R65777 > Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org > Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API > > On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: > > And this simple fix work for me > > diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c > > index b20ff17..8869b0d 100644 > > --- a/arch/powerpc/kernel/iommu.c > > +++ b/arch/powerpc/kernel/iommu.c > > @@ -48,6 +48,8 @@ > > #include <asm/vio.h> > > #include <asm/tce.h> > > > > +#define DEBUG > > + > > #define DBG(...) > > > > static int novmerge; > > @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t > size, > > } > > } > > > > -#ifdef CONFIG_IOMMU_API > > +#ifdef SPAPR_TCE_IOMMU > > /* > > * SPAPR TCE API > > */ > > ---------------------- > > > And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print? It shows the list of group id and respective devices: root@p5040ds:~# ls -laR /sys/kernel/iommu_groups/ /sys/kernel/iommu_groups/: total 0 drwxr-xr-x 15 root root 0 Sep 6 01:42 . drwxr-xr-x 6 root root 0 Jan 1 1970 .. drwxr-xr-x 3 root root 0 Sep 6 01:43 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 1 drwxr-xr-x 3 root root 0 Sep 6 01:43 10 drwxr-xr-x 3 root root 0 Sep 6 01:43 11 drwxr-xr-x 3 root root 0 Sep 6 01:43 12 drwxr-xr-x 3 root root 0 Sep 6 01:43 2 drwxr-xr-x 3 root root 0 Sep 6 01:43 3 drwxr-xr-x 3 root root 0 Sep 6 01:43 4 drwxr-xr-x 3 root root 0 Sep 6 01:43 5 drwxr-xr-x 3 root root 0 Sep 6 01:43 6 drwxr-xr-x 3 root root 0 Sep 6 01:43 7 drwxr-xr-x 3 root root 0 Sep 6 01:43 8 drwxr-xr-x 3 root root 0 Sep 6 01:43 9 /sys/kernel/iommu_groups/0: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/0/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe100300.dma -> ../../../../devices/ffe000000.soc/ffe100300.dma /sys/kernel/iommu_groups/1: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/1/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe101300.dma -> ../../../../devices/ffe000000.soc/ffe101300.dma /sys/kernel/iommu_groups/10: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/10/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe302000.jr -> ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe302000.jr /sys/kernel/iommu_groups/11: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/11/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe303000.jr -> ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe303000.jr /sys/kernel/iommu_groups/12: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/12/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe304000.jr -> ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe304000.jr /sys/kernel/iommu_groups/2: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/2/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe114000.sdhc -> ../../../../devices/ffe000000.soc/ffe114000.sdhc /sys/kernel/iommu_groups/3: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/3/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe210000.usb -> ../../../../devices/ffe000000.soc/ffe210000.usb /sys/kernel/iommu_groups/4: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/4/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe211000.usb -> ../../../../devices/ffe000000.soc/ffe211000.usb /sys/kernel/iommu_groups/5: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/5/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe220000.sata -> ../../../../devices/ffe000000.soc/ffe220000.sata /sys/kernel/iommu_groups/6: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/6/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe221000.sata -> ../../../../devices/ffe000000.soc/ffe221000.sata /sys/kernel/iommu_groups/7: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/7/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 0001:00:00.0 -> ../../../../devices/ffe201000.pcie/pci0001:00/0001:00:00.0 lrwxrwxrwx 1 root root 0 Sep 6 01:43 0001:01:00.0 -> ../../../../devices/ffe201000.pcie/pci0001:00/0001:00:00.0/0001:01:00.0 /sys/kernel/iommu_groups/8: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/8/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe301000.jr -> ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe301000.jr /sys/kernel/iommu_groups/9: total 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 . drwxr-xr-x 15 root root 0 Sep 6 01:42 .. drwxr-xr-x 2 root root 0 Sep 6 01:43 devices /sys/kernel/iommu_groups/9/devices: total 0 drwxr-xr-x 2 root root 0 Sep 6 01:43 . drwxr-xr-x 3 root root 0 Sep 6 01:43 .. lrwxrwxrwx 1 root root 0 Sep 6 01:43 0000:00:00.0 -> ../../../../devices/ffe200000.pcie/pci0000:00/0000:00:00.0 lrwxrwxrwx 1 root root 0 Sep 6 01:43 0000:01:00.0 -> ../../../../devices/ffe200000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0 -Bharat > > > > -- > Alexey
> -----Original Message----- > From: Bhushan Bharat-R65777 > Sent: Monday, August 12, 2013 9:45 PM > To: 'Alexey Kardashevskiy' > Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org > Subject: RE: Powerpc: Kernel warn_on when enabling IOMMU_API > > > > > -----Original Message----- > > From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru] > > Sent: Monday, August 12, 2013 7:44 PM > > To: Bhushan Bharat-R65777 > > Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org > > Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API > > > > On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: > > > And this simple fix work for me > > > diff --git a/arch/powerpc/kernel/iommu.c > > > b/arch/powerpc/kernel/iommu.c index b20ff17..8869b0d 100644 > > > --- a/arch/powerpc/kernel/iommu.c > > > +++ b/arch/powerpc/kernel/iommu.c > > > @@ -48,6 +48,8 @@ > > > #include <asm/vio.h> > > > #include <asm/tce.h> > > > > > > +#define DEBUG > > > + > > > #define DBG(...) > > > > > > static int novmerge; > > > @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table > > > *tbl, size_t > > size, > > > } > > > } > > > > > > -#ifdef CONFIG_IOMMU_API > > > +#ifdef SPAPR_TCE_IOMMU > > > /* > > > * SPAPR TCE API > > > */ > > > ---------------------- > > > > > > And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print? > > It shows the list of group id and respective devices: We uses the common iommu code to add a device with iommu_group (drivers/iommu/iommu.c) using bus_set_iommu(). Also this have notifier to support hotplug-able device. So when this initcall (in arch/powerpc/kernel/iommu.c) is called, iommu group is already setup. So we do not this piece of code for powerpc. BTW why we need this with Power/TCE, does not the code in driver/iommu/iommu.c serve the purpose? -Bharat > > root@p5040ds:~# ls -laR /sys/kernel/iommu_groups/ > /sys/kernel/iommu_groups/: > total 0 > drwxr-xr-x 15 root root 0 Sep 6 01:42 . > drwxr-xr-x 6 root root 0 Jan 1 1970 .. > drwxr-xr-x 3 root root 0 Sep 6 01:43 0 drwxr-xr-x 3 root root 0 Sep 6 01:43 > 1 drwxr-xr-x 3 root root 0 Sep 6 01:43 10 drwxr-xr-x 3 root root 0 Sep 6 > 01:43 11 drwxr-xr-x 3 root root 0 Sep 6 01:43 12 drwxr-xr-x 3 root root 0 Sep > 6 01:43 2 drwxr-xr-x 3 root root 0 Sep 6 01:43 3 drwxr-xr-x 3 root root 0 Sep > 6 01:43 4 drwxr-xr-x 3 root root 0 Sep 6 01:43 5 drwxr-xr-x 3 root root 0 Sep > 6 01:43 6 drwxr-xr-x 3 root root 0 Sep 6 01:43 7 drwxr-xr-x 3 root root 0 Sep > 6 01:43 8 drwxr-xr-x 3 root root 0 Sep 6 01:43 9 > > /sys/kernel/iommu_groups/0: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/0/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe100300.dma -> > ../../../../devices/ffe000000.soc/ffe100300.dma > > /sys/kernel/iommu_groups/1: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/1/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe101300.dma -> > ../../../../devices/ffe000000.soc/ffe101300.dma > > /sys/kernel/iommu_groups/10: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/10/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe302000.jr -> > ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe302000.jr > > /sys/kernel/iommu_groups/11: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/11/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe303000.jr -> > ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe303000.jr > > /sys/kernel/iommu_groups/12: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/12/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe304000.jr -> > ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe304000.jr > > /sys/kernel/iommu_groups/2: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/2/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe114000.sdhc -> > ../../../../devices/ffe000000.soc/ffe114000.sdhc > > /sys/kernel/iommu_groups/3: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/3/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe210000.usb -> > ../../../../devices/ffe000000.soc/ffe210000.usb > > /sys/kernel/iommu_groups/4: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/4/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe211000.usb -> > ../../../../devices/ffe000000.soc/ffe211000.usb > > /sys/kernel/iommu_groups/5: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/5/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe220000.sata -> > ../../../../devices/ffe000000.soc/ffe220000.sata > > /sys/kernel/iommu_groups/6: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/6/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe221000.sata -> > ../../../../devices/ffe000000.soc/ffe221000.sata > > /sys/kernel/iommu_groups/7: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/7/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 0001:00:00.0 -> > ../../../../devices/ffe201000.pcie/pci0001:00/0001:00:00.0 > lrwxrwxrwx 1 root root 0 Sep 6 01:43 0001:01:00.0 -> > ../../../../devices/ffe201000.pcie/pci0001:00/0001:00:00.0/0001:01:00.0 > > /sys/kernel/iommu_groups/8: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/8/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 ffe301000.jr -> > ../../../../devices/ffe000000.soc/ffe300000.crypto/ffe301000.jr > > /sys/kernel/iommu_groups/9: > total 0 > drwxr-xr-x 3 root root 0 Sep 6 01:43 . > drwxr-xr-x 15 root root 0 Sep 6 01:42 .. > drwxr-xr-x 2 root root 0 Sep 6 01:43 devices > > /sys/kernel/iommu_groups/9/devices: > total 0 > drwxr-xr-x 2 root root 0 Sep 6 01:43 . > drwxr-xr-x 3 root root 0 Sep 6 01:43 .. > lrwxrwxrwx 1 root root 0 Sep 6 01:43 0000:00:00.0 -> > ../../../../devices/ffe200000.pcie/pci0000:00/0000:00:00.0 > lrwxrwxrwx 1 root root 0 Sep 6 01:43 0000:01:00.0 -> > ../../../../devices/ffe200000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0 > > -Bharat > > > > > > > > -- > > Alexey
On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote: > > >> -----Original Message----- >> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru] >> Sent: Monday, August 12, 2013 7:44 PM >> To: Bhushan Bharat-R65777 >> Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org >> Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API >> >> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: >>> And this simple fix work for me >>> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c >>> index b20ff17..8869b0d 100644 >>> --- a/arch/powerpc/kernel/iommu.c >>> +++ b/arch/powerpc/kernel/iommu.c >>> @@ -48,6 +48,8 @@ >>> #include <asm/vio.h> >>> #include <asm/tce.h> >>> >>> +#define DEBUG >>> + >>> #define DBG(...) >>> >>> static int novmerge; >>> @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t >> size, >>> } >>> } >>> >>> -#ifdef CONFIG_IOMMU_API >>> +#ifdef SPAPR_TCE_IOMMU >>> /* >>> * SPAPR TCE API >>> */ >>> ---------------------- >> >> >> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print? > > It shows the list of group id and respective devices: > Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there?
> -----Original Message----- > From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru] > Sent: Tuesday, August 13, 2013 5:41 AM > To: Bhushan Bharat-R65777 > Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org > Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API > > On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote: > > > > > >> -----Original Message----- > >> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru] > >> Sent: Monday, August 12, 2013 7:44 PM > >> To: Bhushan Bharat-R65777 > >> Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org > >> Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API > >> > >> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: > >>> And this simple fix work for me > >>> diff --git a/arch/powerpc/kernel/iommu.c > >>> b/arch/powerpc/kernel/iommu.c index b20ff17..8869b0d 100644 > >>> --- a/arch/powerpc/kernel/iommu.c > >>> +++ b/arch/powerpc/kernel/iommu.c > >>> @@ -48,6 +48,8 @@ > >>> #include <asm/vio.h> > >>> #include <asm/tce.h> > >>> > >>> +#define DEBUG > >>> + > >>> #define DBG(...) > >>> > >>> static int novmerge; > >>> @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table > >>> *tbl, size_t > >> size, > >>> } > >>> } > >>> > >>> -#ifdef CONFIG_IOMMU_API > >>> +#ifdef SPAPR_TCE_IOMMU > >>> /* > >>> * SPAPR TCE API > >>> */ > >>> ---------------------- > >> > >> > >> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" print? > > > > It shows the list of group id and respective devices: > > > > Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there? It is 3.11-rc1 + (FSL_IOMMU + VFIO-PCI : local changes). root@p5040ds:~# lspci 00:00.0 Class 0604: 1957:0450 01:00.0 Class 0200: 8086:10fb 00:00.0 Class 0604: 1957:0450 01:00.0 Class 0200: 8086:10d3 We uses the bus_set_iommu(), generic iommu api, which creates a iommu_group for a device (drivers/iommu/iommu.c) using. Also this have notifier to support hotplug-able device. So when this initcall (in arch/powerpc/kernel/iommu.c) is called, iommu group is already setup for the device/s. I think we do not need this piece of code for powerpc. So what is the best way to stub this out for FSL PowerPC/IOMMU? Will the above #ifdef SPAPR_TCE_IOMMU work? Other way can be selecting iommu.c and dma-iommu.c in Makefile if SPAPR_TCE_IOMMU defined and not if CONFIG_64BIT. -Bharat > > > -- > Alexey
On 08/13/2013 08:44 PM, Bhushan Bharat-R65777 wrote: > > >> -----Original Message----- From: Alexey Kardashevskiy >> [mailto:aik@ozlabs.ru] Sent: Tuesday, August 13, 2013 5:41 AM To: >> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org; >> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on >> when enabling IOMMU_API >> >> On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote: >>> >>> >>>> -----Original Message----- From: Alexey Kardashevskiy >>>> [mailto:aik@ozlabs.ru] Sent: Monday, August 12, 2013 7:44 PM To: >>>> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org; >>>> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on >>>> when enabling IOMMU_API >>>> >>>> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: >>>>> And this simple fix work for me diff --git >>>>> a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c >>>>> index b20ff17..8869b0d 100644 --- a/arch/powerpc/kernel/iommu.c >>>>> +++ b/arch/powerpc/kernel/iommu.c @@ -48,6 +48,8 @@ #include >>>>> <asm/vio.h> #include <asm/tce.h> >>>>> >>>>> +#define DEBUG + #define DBG(...) >>>>> >>>>> static int novmerge; @@ -871,7 +873,7 @@ void >>>>> iommu_free_coherent(struct iommu_table *tbl, size_t >>>> size, >>>>> } } >>>>> >>>>> -#ifdef CONFIG_IOMMU_API +#ifdef SPAPR_TCE_IOMMU /* * SPAPR TCE >>>>> API */ ---------------------- >>>> >>>> >>>> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" >>>> print? >>> >>> It shows the list of group id and respective devices: >>> >> >> Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there? > > It is 3.11-rc1 + (FSL_IOMMU + VFIO-PCI : local changes). > > root@p5040ds:~# lspci 00:00.0 Class 0604: 1957:0450 01:00.0 Class 0200: 8086:10fb 00:00.0 Class 0604: 1957:0450 01:00.0 Class 0200: 8086:10d3 Is it one PCI domain or two PCI domains? Hm. > We uses the bus_set_iommu(), generic iommu api, which creates a > iommu_group for a device (drivers/iommu/iommu.c) using. Also this have > notifier to support hotplug-able device. So when this initcall (in > arch/powerpc/kernel/iommu.c) is called, iommu group is already setup for > the device/s. > I think we do not need this piece of code for powerpc. So what is the > best way to stub this out for FSL PowerPC/IOMMU? So you implemented iommu_ops? Can you share your code somewhere, just to have a look? > Will the above #ifdef SPAPR_TCE_IOMMU work? Other way can be selecting > iommu.c and dma-iommu.c in Makefile if SPAPR_TCE_IOMMU defined and not > if CONFIG_64BIT. If SPAPR_TCE_IOMMU is enabled, the code would compile and the subsys_init would be called anyway, so normal production kernel will fail anyway.
> -----Original Message----- > From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru] > Sent: Tuesday, August 13, 2013 6:25 PM > To: Bhushan Bharat-R65777 > Cc: benh@kernel.crashing.org; linuxppc-dev@lists.ozlabs.org > Subject: Re: Powerpc: Kernel warn_on when enabling IOMMU_API > > On 08/13/2013 08:44 PM, Bhushan Bharat-R65777 wrote: > > > > > >> -----Original Message----- From: Alexey Kardashevskiy > >> [mailto:aik@ozlabs.ru] Sent: Tuesday, August 13, 2013 5:41 AM To: > >> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org; > >> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on > >> when enabling IOMMU_API > >> > >> On 08/13/2013 02:14 AM, Bhushan Bharat-R65777 wrote: > >>> > >>> > >>>> -----Original Message----- From: Alexey Kardashevskiy > >>>> [mailto:aik@ozlabs.ru] Sent: Monday, August 12, 2013 7:44 PM To: > >>>> Bhushan Bharat-R65777 Cc: benh@kernel.crashing.org; > >>>> linuxppc-dev@lists.ozlabs.org Subject: Re: Powerpc: Kernel warn_on > >>>> when enabling IOMMU_API > >>>> > >>>> On 08/12/2013 08:20 PM, Bhushan Bharat-R65777 wrote: > >>>>> And this simple fix work for me diff --git > >>>>> a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index > >>>>> b20ff17..8869b0d 100644 --- a/arch/powerpc/kernel/iommu.c > >>>>> +++ b/arch/powerpc/kernel/iommu.c @@ -48,6 +48,8 @@ #include > >>>>> <asm/vio.h> #include <asm/tce.h> > >>>>> > >>>>> +#define DEBUG + #define DBG(...) > >>>>> > >>>>> static int novmerge; @@ -871,7 +873,7 @@ void > >>>>> iommu_free_coherent(struct iommu_table *tbl, size_t > >>>> size, > >>>>> } } > >>>>> > >>>>> -#ifdef CONFIG_IOMMU_API +#ifdef SPAPR_TCE_IOMMU /* * SPAPR TCE > >>>>> API */ ---------------------- > >>>> > >>>> > >>>> And with this fix, what does "ls -laR /sys/kernel/iommu_groups/" > >>>> print? > >>> > >>> It shows the list of group id and respective devices: > >>> > >> > >> Is it vanilla 3.11-rc1 kernel? Wow. What does "lspci" show there? > > > > It is 3.11-rc1 + (FSL_IOMMU + VFIO-PCI : local changes). > > > > root@p5040ds:~# lspci > 00:00.0 Class 0604: 1957:0450 > 01:00.0 Class 0200: 8086:10fb > 00:00.0 Class 0604: 1957:0450 > 01:00.0 Class 0200: 8086:10d3 > > > Is it one PCI domain or two PCI domains? Hm. > > > We uses the bus_set_iommu(), generic iommu api, which creates a > > iommu_group for a device (drivers/iommu/iommu.c) using. Also this have > > notifier to support hotplug-able device. So when this initcall (in > > arch/powerpc/kernel/iommu.c) is called, iommu group is already setup > > for the device/s. > > > I think we do not need this piece of code for powerpc. So what is the > > best way to stub this out for FSL PowerPC/IOMMU? > > > So you implemented iommu_ops? Can you share your code somewhere, just to have a > look? https://lkml.org/lkml/2013/7/1/158 > > > > Will the above #ifdef SPAPR_TCE_IOMMU work? Other way can be selecting > > iommu.c and dma-iommu.c in Makefile if SPAPR_TCE_IOMMU defined and not > > if CONFIG_64BIT. > > If SPAPR_TCE_IOMMU is enabled, the code would compile and the subsys_init would > be called anyway, so normal production kernel will fail anyway. We will not enable this on FSL powerpc, -Bharat > > > > -- > Alexey
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index b20ff17..8869b0d 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -48,6 +48,8 @@ #include <asm/vio.h> #include <asm/tce.h> +#define DEBUG + #define DBG(...) static int novmerge; @@ -871,7 +873,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size, } } -#ifdef CONFIG_IOMMU_API +#ifdef SPAPR_TCE_IOMMU /* * SPAPR TCE API */