]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/etnaviv: Request pages from DMA32 zone on addressing_limited
authorXiaolei Wang <xiaolei.wang@windriver.com>
Tue, 1 Oct 2024 23:34:30 +0000 (07:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:50:56 +0000 (19:50 +0100)
[ Upstream commit 13c96ac9a3f0f1c7ba1ff0656ea508e7fa065e7e ]

Remove __GFP_HIGHMEM when requesting a page from DMA32 zone,
and since all vivante GPUs in the system will share the same
DMA constraints, move the check of whether to get a page from
DMA32 to etnaviv_bind().

Fixes: b72af445cd38 ("drm/etnaviv: request pages from DMA32 zone when needed")
Suggested-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/etnaviv/etnaviv_drv.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.c

index c45e5158fdff9609e86eea5e69dfdde8c8a2bb63..a547af3cf2e1070f8d625588cfbe20b8e43a7595 100644 (file)
@@ -519,6 +519,16 @@ static int etnaviv_bind(struct device *dev)
        priv->num_gpus = 0;
        priv->shm_gfp_mask = GFP_HIGHUSER | __GFP_RETRY_MAYFAIL | __GFP_NOWARN;
 
+       /*
+        * If the GPU is part of a system with DMA addressing limitations,
+        * request pages for our SHM backend buffers from the DMA32 zone to
+        * hopefully avoid performance killing SWIOTLB bounce buffering.
+        */
+       if (dma_addressing_limited(dev)) {
+               priv->shm_gfp_mask |= GFP_DMA32;
+               priv->shm_gfp_mask &= ~__GFP_HIGHMEM;
+       }
+
        priv->cmdbuf_suballoc = etnaviv_cmdbuf_suballoc_new(drm->dev);
        if (IS_ERR(priv->cmdbuf_suballoc)) {
                dev_err(drm->dev, "Failed to create cmdbuf suballocator\n");
index e8ff70be449acdbb520fe837e58f3f9f3f6d9689..123c8263d27fd050944e8628ea38ea5ae0fe5c6b 100644 (file)
@@ -798,14 +798,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
        if (ret)
                goto fail;
 
-       /*
-        * If the GPU is part of a system with DMA addressing limitations,
-        * request pages for our SHM backend buffers from the DMA32 zone to
-        * hopefully avoid performance killing SWIOTLB bounce buffering.
-        */
-       if (dma_addressing_limited(gpu->dev))
-               priv->shm_gfp_mask |= GFP_DMA32;
-
        /* Create buffer: */
        ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer,
                                  PAGE_SIZE);