From: Paul Walmsley <pjw@kernel.org>
To: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>,
Troy Mitchell <troy.mitchell@linux.dev>
Cc: Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
spacemit@lists.linux.dev
Subject: Re: [PATCH v2] riscv: mm: fix SWIOTLB initialization for systems with DRAM above 4GB
Date: Sun, 19 Jul 2026 18:55:19 -0600 (MDT) [thread overview]
Message-ID: <57a24fb1-1ca6-3bb5-1c1e-bdcb50ce2b7e@kernel.org> (raw)
In-Reply-To: <k55h7j5qnn3dryqro2oof7kgjcdhyoarvg7uvtm6sbrgdtnfzy@br6areeqp4ng>
Hi Troy, Anirudh,
a few questions -
On Tue, 14 Jul 2026, Anirudh Srinivasan wrote:
> On Wed, Apr 29, 2026 at 07:41:54PM +0800, Troy Mitchell wrote:
> > On RISC-V platforms where the entire physical memory (DRAM) resides
> > above the 32-bit address space (i.e., above dma32_phys_limit), the
> > current SWIOTLB initialization logic fails.
Is this primarily for the SpacemiT K3? Or are there other
platforms that this fixes?
> > This patch addresses two interconnected issues on such platforms:
> >
> > 1. Incorrect 32-bit DMA bounce assumption:
> > The existing condition `max_pfn > PFN_DOWN(dma32_phys_limit)` assumes
> > that a 32-bit DMA bounce buffer is required simply because the maximum
> > PFN exceeds the 32-bit limit. However, if all DRAM starts above 4GB,
> > no memory exists below the limit to satisfy this allocation. Fix
> > this by adding a check to ensure `memblock_start_of_DRAM()` is actually
> > below the 32-bit limit before enforcing 32-bit SWIOTLB.
> >
> > 2. kmalloc() bounce buffer allocation failure on non-coherent systems:
> > For non-coherent hardware, a bounce buffer is still mandatory for
> > cache-line-aligned kmalloc(), even if 32-bit DMA bouncing is skipped.
I'm not sure I'm parsing this correctly. Shouldn't this read "for
*non*-cache-aligned kmalloc()" ? Or am I missing the point?
- Paul
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Paul Walmsley <pjw@kernel.org>
To: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>,
Troy Mitchell <troy.mitchell@linux.dev>
Cc: Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
spacemit@lists.linux.dev
Subject: Re: [PATCH v2] riscv: mm: fix SWIOTLB initialization for systems with DRAM above 4GB
Date: Sun, 19 Jul 2026 18:55:19 -0600 (MDT) [thread overview]
Message-ID: <57a24fb1-1ca6-3bb5-1c1e-bdcb50ce2b7e@kernel.org> (raw)
In-Reply-To: <k55h7j5qnn3dryqro2oof7kgjcdhyoarvg7uvtm6sbrgdtnfzy@br6areeqp4ng>
Hi Troy, Anirudh,
a few questions -
On Tue, 14 Jul 2026, Anirudh Srinivasan wrote:
> On Wed, Apr 29, 2026 at 07:41:54PM +0800, Troy Mitchell wrote:
> > On RISC-V platforms where the entire physical memory (DRAM) resides
> > above the 32-bit address space (i.e., above dma32_phys_limit), the
> > current SWIOTLB initialization logic fails.
Is this primarily for the SpacemiT K3? Or are there other
platforms that this fixes?
> > This patch addresses two interconnected issues on such platforms:
> >
> > 1. Incorrect 32-bit DMA bounce assumption:
> > The existing condition `max_pfn > PFN_DOWN(dma32_phys_limit)` assumes
> > that a 32-bit DMA bounce buffer is required simply because the maximum
> > PFN exceeds the 32-bit limit. However, if all DRAM starts above 4GB,
> > no memory exists below the limit to satisfy this allocation. Fix
> > this by adding a check to ensure `memblock_start_of_DRAM()` is actually
> > below the 32-bit limit before enforcing 32-bit SWIOTLB.
> >
> > 2. kmalloc() bounce buffer allocation failure on non-coherent systems:
> > For non-coherent hardware, a bounce buffer is still mandatory for
> > cache-line-aligned kmalloc(), even if 32-bit DMA bouncing is skipped.
I'm not sure I'm parsing this correctly. Shouldn't this read "for
*non*-cache-aligned kmalloc()" ? Or am I missing the point?
- Paul
next prev parent reply other threads:[~2026-07-20 0:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 11:41 [PATCH v2] riscv: mm: fix SWIOTLB initialization for systems with DRAM above 4GB Troy Mitchell
2026-04-29 11:41 ` Troy Mitchell
2026-06-08 1:22 ` Troy Mitchell
2026-06-08 1:22 ` Troy Mitchell
2026-07-14 15:37 ` Anirudh Srinivasan
2026-07-14 15:37 ` Anirudh Srinivasan
2026-07-20 0:55 ` Paul Walmsley [this message]
2026-07-20 0:55 ` Paul Walmsley
2026-07-20 14:54 ` Anirudh Srinivasan
2026-07-20 14:54 ` Anirudh Srinivasan
2026-07-27 7:12 ` Troy Mitchell
2026-07-27 7:12 ` Troy Mitchell
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=57a24fb1-1ca6-3bb5-1c1e-bdcb50ce2b7e@kernel.org \
--to=pjw@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=asrinivasan@oss.tenstorrent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=spacemit@lists.linux.dev \
--cc=troy.mitchell@linux.dev \
/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.