drm/etnaviv: Request pages from DMA32 zone on addressing_limited
Subsystems (2)
PATCH v4 1/1 drm/etnaviv: Request pages from DMA32 zone on addressing_limited
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().
---
v1:
https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/
v2:
Modify the issue of not retaining GFP_USER in v1 and update the commit log.
v3:
Use "priv->shm_gfp_mask = GFP_USER | __GFP_RETRY_MAYFAIL | __GFP_NOWARN;"
instead of
"priv->shm_gfp_mask = GFP_HIGHUSER | __GFP_RETRY_MAYFAIL | __GFP_NOWARN;"
v4:
drop the HIGHMEM bit only if dma addressing is limited.
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 10 ++++++++++ drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_drv.c +10 -0
@@ -538,6 +538,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" );
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0 -8
@@ -839,14 +839,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 );
Signature · 1 line
2.25.1
Am Mittwoch, dem 02.10.2024 um 07:34 +0800 schrieb Xiaolei Wang:
Quoted 9 lines
Remove
__GFP_HIGHMEMwhen 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 toetnaviv_bind().Fixes b72af445cd38 ("drm/etnaviv: request pages from DMA32 zone when needed")Suggested-by Sui Jingfeng <[email protected]>Signed-off-by Xiaolei Wang <[email protected]>Reviewed-by Christian Gmeiner <[email protected]>
Thanks, applied to etnaviv/next.
Quoted 59 lines
---
v1:
https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/v2:
Modify the issue of not retainingGFP_USERin v1 and update the commit log.v3:
Use "priv->shm_gfp_mask=GFP_USER|__GFP_RETRY_MAYFAIL|__GFP_NOWARN;"
instead of
"priv->shm_gfp_mask=GFP_HIGHUSER|__GFP_RETRY_MAYFAIL|__GFP_NOWARN;"v4:
drop the HIGHMEM bit only if dma addressing is limited.drivers/gpu/drm/etnaviv/etnaviv_drv.c | 10 ++++++++++ drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_drv.c +10
-0@@ -538,6 +538,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" );drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0
-8@@ -839,14 +839,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 );