mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH drm-misc-fixes] accel/qaic: Use dma_buf_{map,unmap}_attachment_unlocked()
@ 2026-12-06  3:16 Li Sheng
  0 siblings, 0 replies; only message in thread
From: Li Sheng @ 2026-12-06  3:16 UTC (permalink / raw)
  To: jeff.hugo, carl.vanderlip, ogabbay
  Cc: dri-devel, linux-arm-msm, linux-kernel, Li Sheng

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@vger.kernel.org
Signed-off-by: Li Sheng <wirsbf@gmail.com>
---
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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-06  3:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-06  3:16 [PATCH drm-misc-fixes] accel/qaic: Use dma_buf_{map,unmap}_attachment_unlocked() Li Sheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®