All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
	Christoph Hellwig <hch@lst.de>,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	linuxppc-dev@lists.ozlabs.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BISECTED REGRESSION] b43legacy broken on G4 PowerBook
Date: Thu, 6 Jun 2019 13:43:25 +0200	[thread overview]
Message-ID: <20190606114325.GA7497@lst.de> (raw)
In-Reply-To: <f8df19ffe5b75537045119037459ae9ad4a1de39.camel@kernel.crashing.org>

On Thu, Jun 06, 2019 at 08:57:49PM +1000, Benjamin Herrenschmidt wrote:
> > Wow... that's an odd amount. One thing we could possibly do is add code
> > to limit the amount of RAM when we detect that device....
> 
> Sent too quickly... I mean that *or* force swiotlb at 30-bits on those systems based
> on detecting the presence of that device in the device-tree.

swiotlb doesn't really help you, as these days swiotlb on matters for
the dma_map* case.  What would help is a ZONE_DMA that covers these
devices.  No need to do the 24-bit x86 does, but 30-bit would do it.

WIP patch for testing below:

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index b8286a2013b4..7a367ce87c41 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -319,6 +319,10 @@ struct vm_area_struct;
 #endif /* __ASSEMBLY__ */
 #include <asm/slice.h>
 
+#if 1 /* XXX: pmac?  dynamic discovery? */
+#define ARCH_ZONE_DMA_BITS 30
+#else
 #define ARCH_ZONE_DMA_BITS 31
+#endif
 
 #endif /* _ASM_POWERPC_PAGE_H */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index cba29131bccc..2540d3b2588c 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -248,7 +248,8 @@ void __init paging_init(void)
 	       (long int)((top_of_ram - total_ram) >> 20));
 
 #ifdef CONFIG_ZONE_DMA
-	max_zone_pfns[ZONE_DMA]	= min(max_low_pfn, 0x7fffffffUL >> PAGE_SHIFT);
+	max_zone_pfns[ZONE_DMA]	= min(max_low_pfn,
+			((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT);
 #endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	linuxppc-dev@lists.ozlabs.org, Christoph Hellwig <hch@lst.de>,
	Larry Finger <Larry.Finger@lwfinger.net>
Subject: Re: [BISECTED REGRESSION] b43legacy broken on G4 PowerBook
Date: Thu, 6 Jun 2019 13:43:25 +0200	[thread overview]
Message-ID: <20190606114325.GA7497@lst.de> (raw)
In-Reply-To: <f8df19ffe5b75537045119037459ae9ad4a1de39.camel@kernel.crashing.org>

On Thu, Jun 06, 2019 at 08:57:49PM +1000, Benjamin Herrenschmidt wrote:
> > Wow... that's an odd amount. One thing we could possibly do is add code
> > to limit the amount of RAM when we detect that device....
> 
> Sent too quickly... I mean that *or* force swiotlb at 30-bits on those systems based
> on detecting the presence of that device in the device-tree.

swiotlb doesn't really help you, as these days swiotlb on matters for
the dma_map* case.  What would help is a ZONE_DMA that covers these
devices.  No need to do the 24-bit x86 does, but 30-bit would do it.

WIP patch for testing below:

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index b8286a2013b4..7a367ce87c41 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -319,6 +319,10 @@ struct vm_area_struct;
 #endif /* __ASSEMBLY__ */
 #include <asm/slice.h>
 
+#if 1 /* XXX: pmac?  dynamic discovery? */
+#define ARCH_ZONE_DMA_BITS 30
+#else
 #define ARCH_ZONE_DMA_BITS 31
+#endif
 
 #endif /* _ASM_POWERPC_PAGE_H */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index cba29131bccc..2540d3b2588c 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -248,7 +248,8 @@ void __init paging_init(void)
 	       (long int)((top_of_ram - total_ram) >> 20));
 
 #ifdef CONFIG_ZONE_DMA
-	max_zone_pfns[ZONE_DMA]	= min(max_low_pfn, 0x7fffffffUL >> PAGE_SHIFT);
+	max_zone_pfns[ZONE_DMA]	= min(max_low_pfn,
+			((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT);
 #endif
 	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM

  reply	other threads:[~2019-06-06 11:44 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 22:50 [BISECTED REGRESSION] b43legacy broken on G4 PowerBook Aaro Koskinen
2019-06-05 22:50 ` Aaro Koskinen
2019-06-06  0:54 ` Benjamin Herrenschmidt
2019-06-06  0:54   ` Benjamin Herrenschmidt
2019-06-06  9:31   ` Aaro Koskinen
2019-06-06  9:31     ` Aaro Koskinen
2019-06-06 10:56     ` Benjamin Herrenschmidt
2019-06-06 10:56       ` Benjamin Herrenschmidt
2019-06-06 10:57       ` Benjamin Herrenschmidt
2019-06-06 10:57         ` Benjamin Herrenschmidt
2019-06-06 11:43         ` Christoph Hellwig [this message]
2019-06-06 11:43           ` Christoph Hellwig
2019-06-06 19:26           ` Larry Finger
2019-06-06 19:26             ` Larry Finger
2019-06-06 20:11           ` Larry Finger
2019-06-06 20:11             ` Larry Finger
2019-06-06  3:06 ` Larry Finger
2019-06-06  3:06   ` Larry Finger
2019-06-06  6:40   ` Christoph Hellwig
2019-06-06  6:40     ` Christoph Hellwig
2019-06-07 17:25 ` Larry Finger
2019-06-07 17:25   ` Larry Finger
2019-06-07 17:29   ` Christoph Hellwig
2019-06-07 17:29     ` Christoph Hellwig
2019-06-07 18:50     ` Larry Finger
2019-06-07 18:50       ` Larry Finger
2019-06-08 21:52     ` Larry Finger
2019-06-08 21:52       ` Larry Finger
2019-06-10  8:18       ` Christoph Hellwig
2019-06-10  8:18         ` Christoph Hellwig
2019-06-10 16:09         ` Larry Finger
2019-06-10 16:09           ` Larry Finger
2019-06-11  6:05           ` Christoph Hellwig
2019-06-11  6:05             ` Christoph Hellwig
2019-06-11 22:20             ` Larry Finger
2019-06-11 22:20               ` Larry Finger
2019-06-11 22:46               ` Aaro Koskinen
2019-06-11 22:46                 ` Aaro Koskinen
2019-06-12  1:57                 ` Larry Finger
2019-06-12  1:57                   ` Larry Finger
2019-06-11 22:46               ` Benjamin Herrenschmidt
2019-06-11 22:46                 ` Benjamin Herrenschmidt
2019-06-12  1:52                 ` Larry Finger
2019-06-12  1:52                   ` Larry Finger
2019-06-12  3:32                   ` Benjamin Herrenschmidt
2019-06-12  3:32                     ` Benjamin Herrenschmidt
2019-06-12  6:55               ` Christoph Hellwig
2019-06-12  6:55                 ` Christoph Hellwig
2019-06-12 19:41                 ` Larry Finger
2019-06-12 19:41                   ` Larry Finger
2019-06-12 21:59                   ` Benjamin Herrenschmidt
2019-06-12 21:59                     ` Benjamin Herrenschmidt
2019-06-13  7:29                     ` Christoph Hellwig
2019-06-13  7:29                       ` Christoph Hellwig
2019-06-11 17:48           ` Andreas Schwab
2019-06-11 17:48             ` Andreas Schwab
2019-06-08  4:21   ` Benjamin Herrenschmidt
2019-06-08  4:21     ` Benjamin Herrenschmidt
2019-06-08  7:23     ` Christoph Hellwig
2019-06-08  7:23       ` Christoph Hellwig
2019-06-10 18:44     ` Larry Finger
2019-06-10 18:44       ` Larry Finger
2019-06-11  5:56       ` Benjamin Herrenschmidt
2019-06-11  5:56         ` Benjamin Herrenschmidt
2019-06-11  6:08         ` Christoph Hellwig
2019-06-11  6:08           ` Christoph Hellwig
2019-06-11  6:58           ` Benjamin Herrenschmidt
2019-06-11  6:58             ` Benjamin Herrenschmidt
2019-06-11  6:59             ` Benjamin Herrenschmidt
2019-06-11  6:59               ` Benjamin Herrenschmidt
2019-06-11  7:54               ` Christoph Hellwig
2019-06-11  7:54                 ` Christoph Hellwig
2019-06-11  9:04                 ` Benjamin Herrenschmidt
2019-06-11  9:04                   ` Benjamin Herrenschmidt
2019-06-11  7:53             ` Christoph Hellwig
2019-06-11  7:53               ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190606114325.GA7497@lst.de \
    --to=hch@lst.de \
    --cc=Larry.Finger@lwfinger.net \
    --cc=aaro.koskinen@iki.fi \
    --cc=benh@kernel.crashing.org \
    --cc=chzigotzky@xenosoft.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.