Skip to contentSkip to conversation

drm/amdgpu: add UAPI to query if user queues are supported

PATCH In review Alex Deucher 4 participants 6 messages Mar 24, 2025 – Apr 8, 2025

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/2 drm/amdgpu: add UAPI to query if user queues are supported

Add an INFO query to check if user queues are supported.

v2: switch to a mask of IPs (Marek)
v3: move to drm_amdgpu_info_device (Marek)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 +++++++
 include/uapi/drm/amdgpu_drm.h           | 3 +++
 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +7 -0
index 3b7dfd56ccd0e..0ba3ef1e4a068 100644
@@ -1009,6 +1009,13 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			}
 		}
 
+		if (adev->userq_funcs[AMDGPU_HW_IP_GFX])
+			dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_GFX);
+		if (adev->userq_funcs[AMDGPU_HW_IP_COMPUTE])
+			dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_COMPUTE);
+		if (adev->userq_funcs[AMDGPU_HW_IP_DMA])
+			dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_DMA);
+
 		ret = copy_to_user(out, dev_info,
 				   min((size_t)size, sizeof(*dev_info))) ? -EFAULT : 0;
 		kfree(dev_info);
include/uapi/drm/amdgpu_drm.h +3 -0
index 5dbd9037afe75..ef97c0d78b8a0 100644
@@ -1453,6 +1453,9 @@ struct drm_amdgpu_info_device {
 	__u32 csa_size;
 	/* context save area base virtual alignment for gfx11 */
 	__u32 csa_alignment;
+	/* Userq IP mask (1 << AMDGPU_HW_IP_*) */
+	__u32 userq_ip_mask;
+	__u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
Signature · 1 line
2.49.0
author maintainer
#1 lore raw

PATCH 2/2 drm/amdgpu: bump version for user queue IP support query

Add the user queue IP support query to the drm_amdgpu_info_device query.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index b96d8c45312e6..4df11afe91252 100644
@@ -125,9 +125,10 @@
  * - 3.61.0 - Contains fix for RV/PCO compute queues
  * - 3.62.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT
  * - 3.63.0 - GFX12 display DCC supports 256B max compressed block size
+ * - 3.64.0 - Userq IP support query
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	63
+#define KMS_DRIVER_MINOR	64
 #define KMS_DRIVER_PATCHLEVEL	0
 
 /*
Signature · 1 line
2.49.0
Reviewed-by Sunil Khatri on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: bump version for user queue IP support query

Quoted 28 lines · Alex Deucher

Add the user queue IP support query to the drm_amdgpu_info_device query.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index b96d8c45312e6..4df11afe91252 100644
@@ -125,9 +125,10 @@
   * - 3.61.0 - Contains fix for RV/PCO compute queues
   * - 3.62.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT
   * - 3.63.0 - GFX12 display DCC supports 256B max compressed block size
+ * - 3.64.0 - Userq IP support query
   */
  #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	63
+#define KMS_DRIVER_MINOR	64
  #define KMS_DRIVER_PATCHLEVEL	0
 
  /*
Reviewed-by on v1 1/2
#3 lore raw
In reply to Alex Deucher

For both patches.

Marek

Quoted 55 lines · Alex Deucher

Add an INFO query to check if user queues are supported.

v2: switch to a mask of IPs (Marek)
v3: move to drm_amdgpu_info_device (Marek)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 +++++++
 include/uapi/drm/amdgpu_drm.h           | 3 +++
 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +7 -0
index 3b7dfd56ccd0e..0ba3ef1e4a068 100644
@@ -1009,6 +1009,13 @@ int amdgpu_info_ioctl(struct drm_device *dev, void
 *data, struct drm_file *filp)
                        }
                }
 
+               if (adev->userq_funcs[AMDGPU_HW_IP_GFX])
+                       dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_GFX);
+               if (adev->userq_funcs[AMDGPU_HW_IP_COMPUTE])
+                       dev_info->userq_ip_mask |= (1 <<
 AMDGPU_HW_IP_COMPUTE);
+               if (adev->userq_funcs[AMDGPU_HW_IP_DMA])
+                       dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_DMA);
+
                ret = copy_to_user(out, dev_info,
                                   min((size_t)size, sizeof(*dev_info))) ?
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -1
-EFAULT : 0;
                kfree(dev_info);
include/uapi/drm/amdgpu_drm.h +3 -1
index 5dbd9037afe75..ef97c0d78b8a0 100644
@@ -1453,6 +1453,9 @@ struct drm_amdgpu_info_device {
        __u32 csa_size;
        /* context save area base virtual alignment for gfx11 */
        __u32 csa_alignment;
+       /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
+       __u32 userq_ip_mask;
+       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.49.0

Reviewed-by Prike Liang Reviewed-by Marek Olšák
#4 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

It may be better to use the following alignment attribute rather than manually adding the padding.

__attribute__((packed, aligned()))

Anyway, the patch set is

Regards,
Prike

From: Marek Olšák <[email protected]>
Sent: Monday, April 7, 2025 1:40 PM
To: Deucher, Alexander <[email protected]>
Cc: [email protected]; Olsak, Marek <[email protected]>; Liang, Prike <[email protected]>; Khatri, Sunil <[email protected]>; Mohan Marimuthu, Yogesh <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: add UAPI to query if user queues are supported

For both patches.

Marek

On Mon, Mar 24, 2025 at 4:34 PM Alex Deucher <[email protected]<mailto:[email protected]>> wrote:
Add an INFO query to check if user queues are supported.

v2: switch to a mask of IPs (Marek)
v3: move to drm_amdgpu_info_device (Marek)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 +++++++
 include/uapi/drm/amdgpu_drm.h           | 3 +++
 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +7 -0
index 3b7dfd56ccd0e..0ba3ef1e4a068 100644
@@ -1009,6 +1009,13 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                        }
                }
 
+               if (adev->userq_funcs[AMDGPU_HW_IP_GFX])
+                       dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_GFX);
+               if (adev->userq_funcs[AMDGPU_HW_IP_COMPUTE])
+                       dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_COMPUTE);
+               if (adev->userq_funcs[AMDGPU_HW_IP_DMA])
+                       dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_DMA);
+
                ret = copy_to_user(out, dev_info,
                                   min((size_t)size, sizeof(*dev_info))) ? -EFAULT : 0;
                kfree(dev_info);
include/uapi/drm/amdgpu_drm.h +3 -0
index 5dbd9037afe75..ef97c0d78b8a0 100644
@@ -1453,6 +1453,9 @@ struct drm_amdgpu_info_device {
        __u32 csa_size;
        /* context save area base virtual alignment for gfx11 */
        __u32 csa_alignment;
+       /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
+       __u32 userq_ip_mask;
+       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {

--
2.49.0

Reviewed-by Sunil Khatri on v1 1/2
#5 lore raw
In reply to Alex Deucher
Quoted 47 lines · Alex Deucher

Add an INFO query to check if user queues are supported.

v2: switch to a mask of IPs (Marek)
v3: move to drm_amdgpu_info_device (Marek)

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 7 +++++++
  include/uapi/drm/amdgpu_drm.h           | 3 +++
  2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +7 -0
index 3b7dfd56ccd0e..0ba3ef1e4a068 100644
@@ -1009,6 +1009,13 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
  			}
  		}
 
+		if (adev->userq_funcs[AMDGPU_HW_IP_GFX])
+			dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_GFX);
+		if (adev->userq_funcs[AMDGPU_HW_IP_COMPUTE])
+			dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_COMPUTE);
+		if (adev->userq_funcs[AMDGPU_HW_IP_DMA])
+			dev_info->userq_ip_mask |= (1 << AMDGPU_HW_IP_DMA);
+
  		ret = copy_to_user(out, dev_info,
  				   min((size_t)size, sizeof(*dev_info))) ? -EFAULT : 0;
  		kfree(dev_info);
include/uapi/drm/amdgpu_drm.h +3 -0
index 5dbd9037afe75..ef97c0d78b8a0 100644
@@ -1453,6 +1453,9 @@ struct drm_amdgpu_info_device {
  	__u32 csa_size;
  	/* context save area base virtual alignment for gfx11 */
  	__u32 csa_alignment;
+	/* Userq IP mask (1 << AMDGPU_HW_IP_*) */
+	__u32 userq_ip_mask;
+	__u32 pad;
  };
 
  struct drm_amdgpu_info_hw_ip {