[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94dae28d-82ae-4340-9abd-097e2d08fb9f@samsung.com>
Date: Thu, 8 Jan 2026 09:38:06 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org>,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org, Arnd Bergmann
<arnd@...nel.org>
Cc: Robin Murphy <robin.murphy@....com>, Linus Walleij <linusw@...nel.org>,
Matthew Wilcox <willy@...radead.org>, Suzuki K Poulose
<suzuki.poulose@....com>
Subject: Re: [PATCH] dma-direct: Skip cache prep for HighMem coherent
allocations
On 02.01.2026 16:51, Aneesh Kumar K.V (Arm) wrote:
> 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@...nel.org>
Indeed this is an overhead to call prep for HighMem pages, but on the
other hand highmem support is being phased out according to
https://lwn.net/ml/all/20251219161559.556737-1-arnd@kernel.org/ Does it
make sense to apply this assuming that it will be removed soon?
> ---
> 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,
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Powered by blists - more mailing lists