linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc/dma: Always configure ZONE_DMA32 correctly
@ 2015-02-20  8:35 Benjamin Herrenschmidt
  2015-02-21 11:26 ` Kevin Hao
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2015-02-20  8:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Anton Blanchard, Brian J King

We do this for consistency and also in order to support the use of a
consistent mask smaller than the dma mask in subsequent patches.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/kernel/dma-swiotlb.c | 3 ---
 arch/powerpc/mm/mem.c             | 6 ++++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 7359797..cb92f94 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -110,9 +110,6 @@ void __init swiotlb_detect_4g(void)
 {
 	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
 		ppc_swiotlb_enable = 1;
-#ifdef CONFIG_ZONE_DMA32
-		limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
-#endif
 	}
 }
 
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index b7285a5..f146ef0 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -307,6 +307,12 @@ void __init paging_init(void)
 	printk(KERN_DEBUG "Memory hole size: %ldMB\n",
 	       (long int)((top_of_ram - total_ram) >> 20));
 
+#ifdef CONFIG_ZONE_DMA32
+	/* Default limit for ZONE_DMA32, platform might limit it
+	 * further due to PCI bridge addressing limitations
+	 */
+	limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
+#endif
 #ifdef CONFIG_HIGHMEM
 	top_zone = ZONE_HIGHMEM;
 	limit_zone_pfn(ZONE_NORMAL, lowmem_end_addr >> PAGE_SHIFT);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] powerpc/dma: Always configure ZONE_DMA32 correctly
  2015-02-20  8:35 [PATCH 1/3] powerpc/dma: Always configure ZONE_DMA32 correctly Benjamin Herrenschmidt
@ 2015-02-21 11:26 ` Kevin Hao
  2015-02-21 22:23   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hao @ 2015-02-21 11:26 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Scott Wood, linuxppc-dev, Anton Blanchard, Brian J King

[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]

On Fri, Feb 20, 2015 at 07:35:25PM +1100, Benjamin Herrenschmidt wrote:
> We do this for consistency and also in order to support the use of a
> consistent mask smaller than the dma mask in subsequent patches.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  arch/powerpc/kernel/dma-swiotlb.c | 3 ---
>  arch/powerpc/mm/mem.c             | 6 ++++++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
> index 7359797..cb92f94 100644
> --- a/arch/powerpc/kernel/dma-swiotlb.c
> +++ b/arch/powerpc/kernel/dma-swiotlb.c
> @@ -110,9 +110,6 @@ void __init swiotlb_detect_4g(void)
>  {
>  	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
>  		ppc_swiotlb_enable = 1;
> -#ifdef CONFIG_ZONE_DMA32
> -		limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
> -#endif
>  	}
>  }
>  
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index b7285a5..f146ef0 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -307,6 +307,12 @@ void __init paging_init(void)
>  	printk(KERN_DEBUG "Memory hole size: %ldMB\n",
>  	       (long int)((top_of_ram - total_ram) >> 20));
>  
> +#ifdef CONFIG_ZONE_DMA32
> +	/* Default limit for ZONE_DMA32, platform might limit it
> +	 * further due to PCI bridge addressing limitations
> +	 */
> +	limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
> +#endif
>  #ifdef CONFIG_HIGHMEM

Hmm, won't this break the PCI on the fsl SoCs? The ZONE_DMA32 is set to
2GB due to the PCI inbound window limitation on fsl SoCs. This will override
that unconditionally. Please see the commit 84f44cc56c09 ("powerpc/fsl-pci:
Limit ZONE_DMA32 to 2GiB on 64-bit platforms") for more detail.

Thanks,
Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] powerpc/dma: Always configure ZONE_DMA32 correctly
  2015-02-21 11:26 ` Kevin Hao
@ 2015-02-21 22:23   ` Benjamin Herrenschmidt
  2015-02-21 23:17     ` Kevin Hao
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2015-02-21 22:23 UTC (permalink / raw)
  To: Kevin Hao; +Cc: Scott Wood, linuxppc-dev, Anton Blanchard, Brian J King

On Sat, 2015-02-21 at 19:26 +0800, Kevin Hao wrote:
> On Fri, Feb 20, 2015 at 07:35:25PM +1100, Benjamin Herrenschmidt wrote:
> > We do this for consistency and also in order to support the use of a
> > consistent mask smaller than the dma mask in subsequent patches.
> > 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > ---
> >  arch/powerpc/kernel/dma-swiotlb.c | 3 ---
> >  arch/powerpc/mm/mem.c             | 6 ++++++
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
> > index 7359797..cb92f94 100644
> > --- a/arch/powerpc/kernel/dma-swiotlb.c
> > +++ b/arch/powerpc/kernel/dma-swiotlb.c
> > @@ -110,9 +110,6 @@ void __init swiotlb_detect_4g(void)
> >  {
> >  	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
> >  		ppc_swiotlb_enable = 1;
> > -#ifdef CONFIG_ZONE_DMA32
> > -		limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
> > -#endif
> >  	}
> >  }
> >  
> > diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> > index b7285a5..f146ef0 100644
> > --- a/arch/powerpc/mm/mem.c
> > +++ b/arch/powerpc/mm/mem.c
> > @@ -307,6 +307,12 @@ void __init paging_init(void)
> >  	printk(KERN_DEBUG "Memory hole size: %ldMB\n",
> >  	       (long int)((top_of_ram - total_ram) >> 20));
> >  
> > +#ifdef CONFIG_ZONE_DMA32
> > +	/* Default limit for ZONE_DMA32, platform might limit it
> > +	 * further due to PCI bridge addressing limitations
> > +	 */
> > +	limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
> > +#endif
> >  #ifdef CONFIG_HIGHMEM
> 
> Hmm, won't this break the PCI on the fsl SoCs? The ZONE_DMA32 is set to
> 2GB due to the PCI inbound window limitation on fsl SoCs. This will override
> that unconditionally. Please see the commit 84f44cc56c09 ("powerpc/fsl-pci:
> Limit ZONE_DMA32 to 2GiB on 64-bit platforms") for more detail.

No it won't, or am I missing something ? Ie, limit_zone_pfn() will only
reduce the size of the window, never increase it.

Cheers,
Ben.

> Thanks,
> Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] powerpc/dma: Always configure ZONE_DMA32 correctly
  2015-02-21 22:23   ` Benjamin Herrenschmidt
@ 2015-02-21 23:17     ` Kevin Hao
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hao @ 2015-02-21 23:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Scott Wood, linuxppc-dev, Anton Blanchard, Brian J King

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

On Sun, Feb 22, 2015 at 09:23:51AM +1100, Benjamin Herrenschmidt wrote:
> No it won't, or am I missing something ? Ie, limit_zone_pfn() will only
> reduce the size of the window, never increase it.

Yes, you are right. Just overlook this. Sorry for the noise.

Thanks,
Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-21 23:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20  8:35 [PATCH 1/3] powerpc/dma: Always configure ZONE_DMA32 correctly Benjamin Herrenschmidt
2015-02-21 11:26 ` Kevin Hao
2015-02-21 22:23   ` Benjamin Herrenschmidt
2015-02-21 23:17     ` Kevin Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).