All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Arnd Bergmann <arnd@kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	"Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
Subject: [PATCH] dma-direct: Skip cache prep for HighMem coherent allocations
Date: Fri,  2 Jan 2026 21:21:18 +0530	[thread overview]
Message-ID: <20260102155118.2551804-1-aneesh.kumar@kernel.org> (raw)

dma_direct_alloc() calls arch_dma_prep_coherent() to clean any dirty
cache lines from the kernel linear alias before creating a coherent
remapping.

HighMem pages have no kernel alias mapping, so there are no alias cache
lines to clean. Skip arch_dma_prep_coherent() for HighMem allocations.

Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
---
 kernel/dma/direct.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 50c3fe2a1d55..ffa267020a1e 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -272,7 +272,8 @@ void *dma_direct_alloc(struct device *dev, size_t size,
 			prot = pgprot_decrypted(prot);
 
 		/* remove any dirty cache lines on the kernel alias */
-		arch_dma_prep_coherent(page, size);
+		if (!PageHighMem(page))
+			arch_dma_prep_coherent(page, size);
 
 		/* create a coherent mapping */
 		ret = dma_common_contiguous_remap(page, size, prot,
-- 
2.43.0


             reply	other threads:[~2026-01-02 15:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260102155138eucas1p1563e460256561f6974079d3de733e895@eucas1p1.samsung.com>
2026-01-02 15:51 ` Aneesh Kumar K.V (Arm) [this message]
2026-01-08  8:38   ` [PATCH] dma-direct: Skip cache prep for HighMem coherent allocations Marek Szyprowski
2026-01-08  9:55     ` Arnd Bergmann
2026-01-08 10:18       ` Marek Szyprowski
2026-01-08 10:50   ` Robin Murphy
2026-01-08 12:41     ` Marek Szyprowski
2026-01-08 12:59       ` Robin Murphy
2026-01-09  3:15         ` Aneesh Kumar K.V
2026-01-12  9:08           ` Marek Szyprowski
2026-01-12 12:22             ` Aneesh Kumar K.V
2026-01-16 10:29               ` Marek Szyprowski
2026-01-19  4:13                 ` Aneesh Kumar K.V
2026-01-19  9:18                   ` Marek Szyprowski
2026-01-20  9:49                     ` Aneesh Kumar K.V

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=20260102155118.2551804-1-aneesh.kumar@kernel.org \
    --to=aneesh.kumar@kernel.org \
    --cc=arnd@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=willy@infradead.org \
    /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.