[PATCH i-g-t v2 2/3] lib/amdgpu: Fix SDMA user queue submission by using hw_ip_info from ring context

Jesse.Zhang Jesse.Zhang at amd.com
Tue Jul 1 07:17:21 UTC 2025


This commit fixes SDMA user queue submission by properly utilizing the
hw_ip_info stored in the ring context structure rather than a local
variable. The changes:

1. Remove the local hw_ip_info variable and use ring_context->hw_ip_info
   consistently throughout the command submission flow
2. Ensure the hardware IP info is queried once and stored in the context
   for later use in user queue submission
3. Maintain the same ring detection logic but now using the context-stored
   hardware info

Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
---
 lib/amdgpu/amd_compute.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/amdgpu/amd_compute.c b/lib/amdgpu/amd_compute.c
index 87faf8333..d53df241c 100644
--- a/lib/amdgpu/amd_compute.c
+++ b/lib/amdgpu/amd_compute.c
@@ -42,7 +42,6 @@ void amdgpu_command_submission_nop(amdgpu_device_handle device, enum amd_ip_bloc
 	struct amdgpu_cs_request ibs_request;
 	struct amdgpu_cs_ib_info ib_info;
 	struct amdgpu_cs_fence fence_status;
-	struct drm_amdgpu_info_hw_ip info;
 	uint32_t *ptr;
 	uint32_t expired;
 	int r, instance;
@@ -54,7 +53,7 @@ void amdgpu_command_submission_nop(amdgpu_device_handle device, enum amd_ip_bloc
 	ring_context = calloc(1, sizeof(*ring_context));
 	igt_assert(ring_context);
 
-	r = amdgpu_query_hw_ip_info(device, type, 0, &info);
+	r = amdgpu_query_hw_ip_info(device, type, 0, &ring_context->hw_ip_info);
 	igt_assert_eq(r, 0);
 
 	if (user_queue) {
@@ -64,7 +63,7 @@ void amdgpu_command_submission_nop(amdgpu_device_handle device, enum amd_ip_bloc
 		igt_assert_eq(r, 0);
 	}
 
-	for (instance = 0; info.available_rings & (1 << instance); instance++) {
+	for (instance = 0; ring_context->hw_ip_info.available_rings & (1 << instance); instance++) {
 		r = amdgpu_bo_alloc_and_map_sync(device, 4096, 4096,
 						 AMDGPU_GEM_DOMAIN_GTT, 0,
 						 AMDGPU_VM_MTYPE_UC,
-- 
2.49.0



More information about the igt-dev mailing list