[PATCH 7/8] drm/amdgpu: DO-NOT-MERGE add busy-waiting delay

Shashank Sharma shashank.sharma at amd.com
Fri Feb 3 21:54:08 UTC 2023


From: Arvind Yadav <arvind.yadav at amd.com>

This patch adds 20 ms of busy-waiting delay after mapping the
usermode queue in MES HW. It was observed during the testing that
this delay is required for expected results.

Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian König <christian.koenig at amd.com>
Cc: Shashank Sharma <shashank.sharma at amd.com>

Signed-off-by: Arvind Yadav <arvind.yadav at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
index cbfe2608c040..a28ed8e98f7b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
@@ -24,6 +24,15 @@
 #include "amdgpu.h"
 #include "amdgpu_vm.h"
 
+static inline void userqueue_busy_wait(unsigned long ms)
+{
+   unsigned long start = jiffies;
+   unsigned long timeout = start + ms;
+   while(time_before(jiffies, timeout)) {
+
+   }
+}
+
 static inline int
 amdgpu_userqueue_index(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_usermode_queue *queue)
 {
@@ -85,6 +94,7 @@ amdgpu_userqueue_map(struct amdgpu_userq_mgr *uq_mgr,
         return r;
     }
 
+    userqueue_busy_wait(20);
     DRM_DEBUG_DRIVER("Queue %d mapped successfully\n", queue->queue_id);
     return 0;
 }
-- 
2.34.1



More information about the amd-gfx mailing list