[PATCH drm-misc-fixes] accel/qaic: Use dma_buf_{map,unmap}_attachment_unlocked()
From: Li Sheng
Date: Sat Dec 05 2026 - 22:16:46 EST
qaic_prepare_import_bo() and qaic_unprepare_import_bo() call
dma_buf_map_attachment() and dma_buf_unmap_attachment() without holding
the dma_buf reservation lock. Since commit 47e982d5195d ("dma-buf: Move
dma_buf_map_attachment() to dynamic locking specification"), both helpers
assert dma_resv_assert_held(attach->dmabuf->resv). Calling them unlocked
triggers lockdep warnings and risks racing with dynamic dma-buf exporters
during buffer migration or teardown.
All callers (qaic_attach_slice_bo_ioctl(), qaic_detach_slice_bo_ioctl(),
and release_dbc()) execute in sleepable context without holding spinlocks
or the dma_buf reservation lock. Switch both call sites to
dma_buf_map_attachment_unlocked() and dma_buf_unmap_attachment_unlocked().
Compile-tested only (no QAIC hardware available).
Fixes: ff13be830333 ("accel/qaic: Add datapath")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Li Sheng <wirsbf@xxxxxxxxx>
---
Note: commit 77e0b2d2f4f3 in drm-misc-next renamed these helpers to
dma_buf_{map,unmap}_sgt_unlocked(); please adjust accordingly when
merging drm-misc-fixes into drm-misc-next.
drivers/accel/qaic/qaic_data.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index be3ceb8c5..988b8464e 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -895,7 +895,7 @@ static int qaic_prepare_import_bo(struct qaic_bo *bo, struct qaic_attach_slice_h
struct sg_table *sgt;
int ret;
- sgt = dma_buf_map_attachment(obj->import_attach, hdr->dir);
+ sgt = dma_buf_map_attachment_unlocked(obj->import_attach, hdr->dir);
if (IS_ERR(sgt)) {
ret = PTR_ERR(sgt);
return ret;
@@ -936,7 +936,7 @@ static int qaic_prepare_bo(struct qaic_device *qdev, struct qaic_bo *bo,
static void qaic_unprepare_import_bo(struct qaic_bo *bo)
{
- dma_buf_unmap_attachment(bo->base.import_attach, bo->sgt, bo->dir);
+ dma_buf_unmap_attachment_unlocked(bo->base.import_attach, bo->sgt, bo->dir);
bo->sgt = NULL;
}
--
2.56.1