]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/shmem-helper: Import dmabuf without mapping its sg_table
authorShixiong Ou <oushixiong@kylinos.cn>
Thu, 22 May 2025 07:07:12 +0000 (15:07 +0800)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 3 Jun 2025 07:21:01 +0000 (09:21 +0200)
commit660cd44659a05c5fbfce6d2bb1ce448aa0f35594
tree0f69608e085745b2ee892d02e7b5de63621ef372
parent6048f5587614bb4919c54966913452c1a0a43138
drm/shmem-helper: Import dmabuf without mapping its sg_table

[WHY]
1. Drivers using DRM_GEM_SHADOW_PLANE_HELPER_FUNCS and
   DRM_GEM_SHMEM_DRIVER_OPS (e.g., udl, ast) do not require
   sg_table import.
   They only need dma_buf_vmap() to access the shared buffer's
   kernel virtual address.

2. On certain Aspeed-based boards, a dma_mask of 0xffff_ffff may
   trigger SWIOTLB during dmabuf import. However, IO_TLB_SEGSIZE
   restricts the maximum DMA streaming mapping memory, resulting in
   errors like:

   ast 0000:07:00.0: swiotlb buffer is full (sz: 3145728 bytes), total 32768 (slots), used 0 (slots)

[HOW]
Provide a gem_prime_import implementation without sg_table mapping
to avoid issues (e.g., "swiotlb buffer is full"). Drivers that do not
require sg_table can adopt this.

Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20250522070714.439824-1-oushixiong1025@163.com
drivers/gpu/drm/drm_gem_shmem_helper.c
drivers/gpu/drm/drm_prime.c
include/drm/drm_gem_shmem_helper.h
include/drm/drm_prime.h