Skip to contentSkip to conversation

lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues

PATCH Superseded [email protected] 2 participants 5 messages Apr 9, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues

From: "[email protected]" <[email protected]>

Detect whether libdrm provides amdgpu_create_userqueue() and define AMDGPU_USERQ_ENABLED if available. This enables user queue support when building against newer libdrm while maintaining compatibility with older versions that lack this function.

---
 lib/meson.build | 5 +++++
 1 file changed, 5 insertions(+)
lib/meson.build +5 -0
index d7bb72c57..8517cd540 100644
@@ -172,6 +172,11 @@ if libdrm_amdgpu.found()
 		lib_sources +=[ 'amdgpu/amd_dispatch.c',]
 	else
 		warning('libdrm <= 2.4.99 found, amdgpu_cs_query_reset_state2 not applicable')
+	endif
+
+	if cc.has_function('amdgpu_create_userqueue', dependencies: libdrm_amdgpu)
+		add_project_arguments('-DAMDGPU_USERQ_ENABLED=1', language: 'c')
+		#conf.set('AMDGPU_USERQ_ENABLED', 1)
 	endif	
 endif
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 tests/amdgpu: Add secure UMQ tests for GFX and compute

From: "[email protected]" <[email protected]>

Add new subtests for secure user-mode queue (UMQ) validation:
- gfx-write-linear-helper-secure-umq
- compute-write-linear-helper-secure-umq

---
 tests/amdgpu/amd_security.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tests/amdgpu/amd_security.c +12 -0
index 19baaaea0..737e6201a 100644
@@ -354,6 +354,18 @@ igt_main
 	amdgpu_secure_bounce(device, fd, &sdma_info, get_ip_block(device,
 			AMDGPU_HW_IP_DMA), is_secure);
 
+#ifdef AMDGPU_USERQ_ENABLED
+	igt_describe("amdgpu gfx command submission write linear helper");
+	igt_subtest("gfx-write-linear-helper-secure-umq")
+	 amdgpu_command_submission_write_linear_helper(device,
+			get_ip_block(device, AMDGPU_HW_IP_GFX), is_secure, true);
+
+	igt_describe("amdgpu compute command submission write linear helper");
+	igt_subtest("compute-write-linear-helper-secure-umq")
+	 amdgpu_command_submission_write_linear_helper(device,
+			get_ip_block(device, AMDGPU_HW_IP_GFX), is_secure, true);
+#endif
+
 	igt_fixture {
 		amdgpu_device_deinitialize(device);
 		drm_close_driver(fd);
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/3 lib/amdgpu: Add encrypted flag for secure user queues

In reply to [email protected]

From: "[email protected]" <[email protected]>

When creating secure user queues, set the AMDGPU_GEM_CREATE_ENCRYPTED flag for the GTT allocation if the queue context is marked as secure. This ensures proper memory protection for secure command submissions through user queues.

---
 lib/amdgpu/amd_user_queue.c |  2 ++
 tests/amdgpu/amd_security.c | 10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
lib/amdgpu/amd_user_queue.c +2 -0
index 361f5acc6..0cdd0c4f9 100644
@@ -281,6 +281,8 @@ void amdgpu_user_queue_create(amdgpu_device_handle device_handle, struct amdgpu_
 		return;
 	}
 
+	if (ctxt->secure)
+		gtt_flags |= AMDGPU_GEM_CREATE_ENCRYPTED;
 	r = amdgpu_query_uq_fw_area_info(device_handle, AMD_IP_GFX, 0, &ctxt->info);
 	igt_assert_eq(r, 0);
 
tests/amdgpu/amd_security.c +5 -5
index 737e6201a..1c880c11f 100644
@@ -355,15 +355,15 @@ igt_main
 			AMDGPU_HW_IP_DMA), is_secure);
 
 #ifdef AMDGPU_USERQ_ENABLED
-	igt_describe("amdgpu gfx command submission write linear helper");
+	igt_describe("amdgpu gfx command submission write linear helper with user queue");
 	igt_subtest("gfx-write-linear-helper-secure-umq")
-	 amdgpu_command_submission_write_linear_helper(device,
+	amdgpu_command_submission_write_linear_helper(device,
 			get_ip_block(device, AMDGPU_HW_IP_GFX), is_secure, true);
 
-	igt_describe("amdgpu compute command submission write linear helper");
+	igt_describe("amdgpu compute command submission write linear helper with user queue");
 	igt_subtest("compute-write-linear-helper-secure-umq")
-	 amdgpu_command_submission_write_linear_helper(device,
-			get_ip_block(device, AMDGPU_HW_IP_GFX), is_secure, true);
+	amdgpu_command_submission_write_linear_helper(device,
+			get_ip_block(device, AMDGPU_HW_IP_COMPUTE), is_secure, true);
 #endif
 
 	igt_fixture {
Signature · 1 line
2.25.1
#3 lore raw
In reply to [email protected]

[AMD Official Use Only - AMD Internal Distribution Only]

Please ignore these series, will update new versions.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, April 9, 2025 3:50 PM
To: [email protected]
Cc: Prosyak, Vitaly <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>; Liang, Prike <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH i-g-t 1/3] lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues

From: "[email protected]" <[email protected]>

Detect whether libdrm provides amdgpu_create_userqueue() and define AMDGPU_USERQ_ENABLED if available. This enables user queue support when building against newer libdrm while maintaining compatibility with older versions that lack this function.

---
 lib/meson.build | 5 +++++
 1 file changed, 5 insertions(+)
lib/meson.build +5 -0
@@ -172,6 +172,11 @@ if libdrm_amdgpu.found()
                lib_sources +=[ 'amdgpu/amd_dispatch.c',]
        else
                warning('libdrm <= 2.4.99 found, amdgpu_cs_query_reset_state2 not applicable')
+       endif
+
+       if cc.has_function('amdgpu_create_userqueue', dependencies: libdrm_amdgpu)
+               add_project_arguments('-DAMDGPU_USERQ_ENABLED=1', language: 'c')
+               #conf.set('AMDGPU_USERQ_ENABLED', 1)
        endif
 endif
 

--
2.25.1

#4 lore raw

✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/3] lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues (rev2)

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/3] lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues (rev2)
URL : https://patchwork.freedesktop.org/series/147449/
State : failure

== Summary ==

Applying: lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues Patch failed at 0001 lib/meson.build: Add AMDGPU_USERQ_ENABLED check for user queues When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".