From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Robin Murphy <robin.murphy@arm.com>,
Christoph Hellwig <hch@infradead.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Chris Zankel <chris@zankel.net>,
Max Filippov <jcmvbkbc@gmail.com>
Subject: Re: [PATCH v3 0/7] dma-mapping: DMA_ATTR_NO_KERNEL_MAPPING related fixes
Date: Thu, 19 Nov 2026 19:15:18 +0100 [thread overview]
Message-ID: <8cbec036-10ec-4fd4-81a7-2235260985a0@samsung.com> (raw)
In-Reply-To: <20261119151520.2383226-1-m.szyprowski@samsung.com>
On 19.11.2026 16:15, Marek Szyprowski wrote:
> arch_dma_prep_coherent() is called by the generic DMA code on pages
> which may be located in highmem: dma_direct_alloc() forces the remap
> path for a highmem page returned from CMA and calls this hook on it
> before creating the uncached mapping. However, the hook has never been
> documented and some implementations assume that the page has a kernel
> linear mapping. This issue affects MIPS, xtensa and PowerPC. It gets
> fixed by patches #2-#5.
>
> xtensa also only invalidates the cache, which discards the zeroes
> written by the dma_direct_alloc(). Patch #1 switches it to a
> writeback+invalidate.
>
> Patch #6 documents that arch_dma_prep_coherent() must write back dirty
> lines and must accept highmem pages. With that in place, patch #7 drops
> the PageHighMem() check in dma_direct_alloc_no_mapping(), which so far
> skipped cache maintenance for highmem CMA pages allocated with
> DMA_ATTR_NO_KERNEL_MAPPING.
>
> Patch #8 makes dma_direct_alloc_no_mapping() always return zeroed
> memory, like all other dma_alloc_* paths. Passing __GFP_ZERO is not
> enough there, because CMA ignores it.
>
> The analysis and the patchset was prepared with the help of an LLM. The
> code compiles fine, but it has not been runtime tested on any of the
> affected architectures yet. Testing on real hardware would be
> appreciated. I've reviewed the resulting changes.
>
> I plan to merge this via my dma-mapping tree, I can provide a tag if
> needed for merging it also to arch code.
>
> Best regards
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
Merged into dma-mapping-for-next, with Fixes tag dropped in patch #5
as requested by Ritesh. Here is a stable tag if one needs to merge
this patchset also to arch tree:
git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux.git tags/no_kernel_mapping_fixes
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
prev parent reply other threads:[~2026-11-19 18:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261119151527eucas1p16c69a0580b2caabe66f952572362021f@eucas1p1.samsung.com>
2026-11-19 15:15 ` Marek Szyprowski
[not found] ` <CGME20261119151528eucas1p133a01863b1cbf6d6b5e1361ba590ac69@eucas1p1.samsung.com>
2026-11-19 15:15 ` [PATCH v3 1/8] xtensa: write back dirty lines in arch_dma_prep_coherent() Marek Szyprowski
[not found] ` <CGME20261119151529eucas1p18e158b8528f576fc36ae5b743acf0098@eucas1p1.samsung.com>
2026-11-19 15:15 ` [PATCH v3 2/8] xtensa: handle highmem pages " Marek Szyprowski
[not found] ` <CGME20261119151530eucas1p1c9ea2bbd100b25bb9c3e442717068c01@eucas1p1.samsung.com>
2026-11-19 15:15 ` [PATCH v3 3/8] MIPS: mm: " Marek Szyprowski
[not found] ` <CGME20261119151530eucas1p1724ca5c2a4cb0e5a7d9ad91c936a2c6f@eucas1p1.samsung.com>
2026-11-19 15:15 ` [PATCH v3 4/8] powerpc/mm: skip kmap for lowmem pages in __dma_sync_page() Marek Szyprowski
2026-11-19 17:13 ` Ritesh Harjani
[not found] ` <CGME20261119151531eucas1p2be2ec1360d1d94c80b200c53b25f292c@eucas1p2.samsung.com>
2026-11-19 15:15 ` [PATCH v3 5/8] powerpc/mm: handle highmem pages in arch_dma_prep_coherent() Marek Szyprowski
2026-11-19 17:15 ` Ritesh Harjani
[not found] ` <CGME20261119151532eucas1p10487bf51eee4909dd4f76a53e298690c@eucas1p1.samsung.com>
2026-11-19 15:15 ` [PATCH v3 6/8] dma-mapping: document that arch_dma_prep_coherent() must handle highmem Marek Szyprowski
[not found] ` <CGME20261119151533eucas1p26a727ce85c6e07dad9cb117162de518e@eucas1p2.samsung.com>
2026-11-19 15:15 ` [PATCH v3 7/8] dma-direct: do not skip cache maintenance for highmem pages in no-mapping allocations Marek Szyprowski
[not found] ` <CGME20261119151534eucas1p2cf9d1d672e5ff9edc51fab8965a4cac9@eucas1p2.samsung.com>
2026-11-19 15:15 ` [PATCH v3 8/8] dma-direct: zero memory allocated with DMA_ATTR_NO_KERNEL_MAPPING Marek Szyprowski
2026-11-19 18:15 ` Marek Szyprowski [this message]
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=8cbec036-10ec-4fd4-81a7-2235260985a0@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=chleroy@kernel.org \
--cc=chris@zankel.net \
--cc=hch@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jcmvbkbc@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=robin.murphy@arm.com \
--cc=sshegde@linux.ibm.com \
--cc=tsbogend@alpha.franken.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®