[PATCH] dma-direct: Skip cache prep for HighMem coherent allocations

From: Aneesh Kumar K.V (Arm)
Date: Fri Jan 02 2026 - 10:51:47 EST


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@xxxxxxxxxx>
---
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