gpu: ipu-v3: don't use GFP_DMA when calling dma_alloc_coherent()

Patch series "Don't use GFP_DMA when calling dma_alloc_coherent".

This series picks up the first part of an earlier cleanup series [1] that
was prepared back in the year of 2022, but for various reasons never made
it merged and has been sitting in a local tree since then.  This subset
only touches the call sites where GFP_DMA is passed to
dma_alloc_coherent() (and its dma_alloc_wc()/dmam_alloc_coherent()
variants), which is the most self-contained and least risky slice of that
work.

That GFP_DMA is simply redundant here: the DMA API derives the allocation
zone from the device's coherent_dma_mask (together with bus_dma_limit) and
ignores the GFP_DMA flag passed by the caller.  

Removing the redundant GFP_DMA won't harm anything, while keeps it from
being blindly copied into new code.


This patch (of 12):

dma_alloc_coherent() allocates the DMA buffer with the device's addressing
limitation in mind; the DMA core picks the zone from the device's coherent
DMA mask and ignores GFP_DMA passed by the caller.  Remove the redundant
GFP_DMA flag.

Link: https://lore.kernel.org/20260903111836.1777265-1-hebaoquan@kylinos.cn
Link: https://lore.kernel.org/20260903111836.1777265-2-hebaoquan@kylinos.cn
Link: https://lore.kernel.org/all/20220219005221.634-1-bhe@redhat.com/T/#u [1]
Signed-off-by: Baoquan He <hebaoquan@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Harry Yoo <harry@kernel.org>
This commit is contained in:
Baoquan He 2026-09-03 19:18:24 +08:00 committed by Andrew Morton
parent 4b52da0120
commit 8907307760

View File

@ -371,7 +371,7 @@ static int alloc_dma_buf(struct ipu_image_convert_priv *priv,
{
buf->len = PAGE_ALIGN(size);
buf->virt = dma_alloc_coherent(priv->ipu->dev, buf->len, &buf->phys,
GFP_DMA | GFP_KERNEL);
GFP_KERNEL);
if (!buf->virt) {
dev_err(priv->ipu->dev, "failed to alloc dma buffer\n");
return -ENOMEM;