[PATCH 4/4] accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()
From: Sidong Yang
Date: Sat Nov 28 2026 - 01:39:21 EST
DRM_IOCTL_ROCKET_PREP_BO begins CPU ownership of a BO and has no
read/write direction flag: userspace calls it before reading an output
buffer as well as before overwriting an input buffer for reuse.
Since commit 4d8cb7be620e ("accel/rocket: publish read fences for input
buffers"), in-flight jobs attach DMA_RESV_USAGE_READ fences to their
input BOs. Waiting only for DMA_RESV_USAGE_WRITE therefore returns
immediately while an NPU job is still reading the buffer.
Wait for DMA_RESV_USAGE_READ so PREP_BO waits for both write and read
fences before transferring ownership back to the CPU.
Fixes: 4d8cb7be620e ("accel/rocket: publish read fences for input buffers")
Signed-off-by: Sidong Yang <sidong.yang@xxxxxxxxxx>
---
drivers/accel/rocket/rocket_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index dddaf9d2fbc8..c5c08da72f76 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -165,7 +165,7 @@ int rocket_ioctl_prep_bo(struct drm_device *dev, void *data, struct drm_file *fi
if (!gem_obj)
return -ENOENT;
- ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_WRITE, true, timeout);
+ ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_READ, true, timeout);
if (!ret)
ret = timeout ? -ETIMEDOUT : -EBUSY;
else if (ret > 0)
--
2.53.0