diff mbox

[5/5] powerpc: Add 86xx support for SWIOTLB

Message ID 1240244810-32193-8-git-send-email-beckyb@kernel.crashing.org (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Becky Bruce April 20, 2009, 4:26 p.m. UTC
Minor code to allow enabling swiotlb on mpc86xx, including
Kconfig addition for SWIOTLB.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/Kconfig                       |   10 ++++++++++
 arch/powerpc/kernel/dma-swiotlb.c          |    2 ++
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +++
 3 files changed, 15 insertions(+), 0 deletions(-)

Comments

Kumar Gala April 20, 2009, 5 p.m. UTC | #1
On Apr 20, 2009, at 11:26 AM, Becky Bruce wrote:

> Minor code to allow enabling swiotlb on mpc86xx, including
> Kconfig addition for SWIOTLB.
>
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> arch/powerpc/Kconfig                       |   10 ++++++++++
> arch/powerpc/kernel/dma-swiotlb.c          |    2 ++
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +++
> 3 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 197f6a3..e47c81d 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -292,6 +292,16 @@ config IOMMU_VMERGE
> config IOMMU_HELPER
> 	def_bool PPC64
>
> +config SWIOTLB
> +	bool "SWIOTLB support"
> +	depends on PPC_86xx
> +	select IOMMU_HELPER
> +	---help---
> +	  Support for IO bounce buffering for systems without an IOMMU.
> +	  This allows us to DMA to the full physical address space on
> +	  platforms where the size of a physical address is larger
> +	  than the bus address.
> +

As stated on previous patch, move the bulk of this into 4/5.

>
> config PPC_NEED_DMA_SYNC_OPS
> 	def_bool y
> 	depends on (NOT_COHERENT_CACHE || SWIOTLB)
> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/ 
> dma-swiotlb.c
> index 29a68e6..3065d03 100644
> --- a/arch/powerpc/kernel/dma-swiotlb.c
> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> @@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
>
> 	return 0;
> }
> +
> +machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);

Hmm, not sure what we chatted about here, but I don't want to have to  
add every board into this file to register the bus notifiers.

>
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/ 
> powerpc/platforms/86xx/mpc86xx_hpcn.c
> index c4ec49b..f7b88b9 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -88,6 +88,9 @@ mpc86xx_hpcn_setup_arch(void)
>
> 	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
>
> +#ifdef CONFIG_SWIOTLB
> +	set_pci_dma_ops(&swiotlb_pci_dma_ops);
> +#endif
> #endif
>
> 	printk("MPC86xx HPCN board from Freescale Semiconductor\n");
> -- 
> 1.6.0.6
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
Becky Bruce April 20, 2009, 5:58 p.m. UTC | #2
On Apr 20, 2009, at 12:00 PM, Kumar Gala wrote:

>
> On Apr 20, 2009, at 11:26 AM, Becky Bruce wrote:
>
>> Minor code to allow enabling swiotlb on mpc86xx, including
>> Kconfig addition for SWIOTLB.
>>
>> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
>> ---
>> arch/powerpc/Kconfig                       |   10 ++++++++++
>> arch/powerpc/kernel/dma-swiotlb.c          |    2 ++
>> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +++
>> 3 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> index 197f6a3..e47c81d 100644
>> --- a/arch/powerpc/Kconfig
>> +++ b/arch/powerpc/Kconfig
>> @@ -292,6 +292,16 @@ config IOMMU_VMERGE
>> config IOMMU_HELPER
>> 	def_bool PPC64
>>
>> +config SWIOTLB
>> +	bool "SWIOTLB support"
>> +	depends on PPC_86xx
>> +	select IOMMU_HELPER
>> +	---help---
>> +	  Support for IO bounce buffering for systems without an IOMMU.
>> +	  This allows us to DMA to the full physical address space on
>> +	  platforms where the size of a physical address is larger
>> +	  than the bus address.
>> +
>
> As stated on previous patch, move the bulk of this into 4/5.

Yep.

>
>
>>
>> config PPC_NEED_DMA_SYNC_OPS
>> 	def_bool y
>> 	depends on (NOT_COHERENT_CACHE || SWIOTLB)
>> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/ 
>> kernel/dma-swiotlb.c
>> index 29a68e6..3065d03 100644
>> --- a/arch/powerpc/kernel/dma-swiotlb.c
>> +++ b/arch/powerpc/kernel/dma-swiotlb.c
>> @@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
>>
>> 	return 0;
>> }
>> +
>> +machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);
>
> Hmm, not sure what we chatted about here, but I don't want to have  
> to add every board into this file to register the bus notifiers.

We talked about this, and this was what we decided on - I don't really  
like the idea, either, but there's a lot of precedent for it.  I'd  
like to do this differently, but I"m not sure what the solution is -  
we'd need to look into that more (or perhaps someone here will have  
some sage advice).

Cheers,
B
Michael Ellerman April 21, 2009, 2:14 a.m. UTC | #3
On Mon, 2009-04-20 at 12:58 -0500, Becky Bruce wrote:
> On Apr 20, 2009, at 12:00 PM, Kumar Gala wrote:
> > On Apr 20, 2009, at 11:26 AM, Becky Bruce wrote:
> >>
> >> config PPC_NEED_DMA_SYNC_OPS
> >> 	def_bool y
> >> 	depends on (NOT_COHERENT_CACHE || SWIOTLB)
> >> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/ 
> >> kernel/dma-swiotlb.c
> >> index 29a68e6..3065d03 100644
> >> --- a/arch/powerpc/kernel/dma-swiotlb.c
> >> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> >> @@ -159,3 +159,5 @@ static int __init setup_bus_notifier(void)
> >>
> >> 	return 0;
> >> }
> >> +
> >> +machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);
> >
> > Hmm, not sure what we chatted about here, but I don't want to have  
> > to add every board into this file to register the bus notifiers.
> 
> We talked about this, and this was what we decided on - I don't really  
> like the idea, either, but there's a lot of precedent for it.  I'd  
> like to do this differently, but I"m not sure what the solution is -  
> we'd need to look into that more (or perhaps someone here will have  
> some sage advice).

Give it a better name, export it, and call it from the board setup file?

Actually what depends on the board anyway? It's just the dma window
config in the pci_controller isn't it? So maybe you can always call the
notifier, and if the dma mask isn't 36 bits, and the controller has the
window configured then you use swiotlb?

cheers
diff mbox

Patch

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 197f6a3..e47c81d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -292,6 +292,16 @@  config IOMMU_VMERGE
 config IOMMU_HELPER
 	def_bool PPC64
 
+config SWIOTLB
+	bool "SWIOTLB support"
+	depends on PPC_86xx
+	select IOMMU_HELPER
+	---help---
+	  Support for IO bounce buffering for systems without an IOMMU.
+	  This allows us to DMA to the full physical address space on
+	  platforms where the size of a physical address is larger
+	  than the bus address.
+
 config PPC_NEED_DMA_SYNC_OPS
 	def_bool y
 	depends on (NOT_COHERENT_CACHE || SWIOTLB)
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 29a68e6..3065d03 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -159,3 +159,5 @@  static int __init setup_bus_notifier(void)
 
 	return 0;
 }
+
+machine_arch_initcall(mpc86xx_hpcn, setup_bus_notifier);
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index c4ec49b..f7b88b9 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -88,6 +88,9 @@  mpc86xx_hpcn_setup_arch(void)
 
 	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
 
+#ifdef CONFIG_SWIOTLB
+	set_pci_dma_ops(&swiotlb_pci_dma_ops);
+#endif
 #endif
 
 	printk("MPC86xx HPCN board from Freescale Semiconductor\n");