Skip to contentSkip to conversation

drm/amdgpu: Add pci_domain to struct kfd_dbg_device_info_entry

PATCH In review Lancelot SIX 2 participants 2 messages Sep 28 – Nov 9

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Add pci_domain to struct kfd_dbg_device_info_entry

The device info structure returned to the debugger via the KFD_IOC_DBG_TRAP_GET_DEVICE_SNAPSHOT ioctl contain location of the device on PCI (bus, device, function), but is missing the domain this location belongs to.

This patch adds this information to the snapshot structure. The overall size of the kfd_dbg_device_info_entry structure structure, this new field is placed in preexisting padding.

Tested using the following topic branch for ROCdbgapi:
users/lancesix/read-pci-domain
(https://github.com/ROCm/rocm-systems/tree/users/lancesix/read-pci-domain) and the regular ROCgdb testsuite (https://github.com/ROCm/ROCgdb).

V2: Add reference to the userspace code making use of the new field in
the public interface.

---
 drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 +
 include/uapi/linux/kfd_ioctl.h         | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1 -0
index 0dd1fd448059b..2c14b03df0781 100644
@@ -1129,6 +1129,7 @@ int kfd_dbg_trap_device_snapshot(struct kfd_process *target,
 		device_info.capability = topo_dev->node_props.capability;
 		device_info.debug_prop = topo_dev->node_props.debug_prop;
 		device_info.capability2 = topo_dev->node_props.capability2;
+		device_info.pci_domain = topo_dev->node_props.domain;
 
 		if (exception_clear_mask)
 			pdd->exception_status &= ~exception_clear_mask;
include/uapi/linux/kfd_ioctl.h +3 -2
index 749d196e2114b..e7908a068d3d1 100644
@@ -49,9 +49,10 @@
  * - 1.21 - Debugger support to subscribe to LDS out-of-address exceptions
  * - 1.22 - Add queue creation with metadata ring base address
  * - 1.23 - Add profiler control ioctl to enable/disable profiler on a process
+ * - 1.24 - Add  PCI domain in kfd_dbg_device_info_entry
  */
 #define KFD_IOCTL_MAJOR_VERSION 1
-#define KFD_IOCTL_MINOR_VERSION 23
+#define KFD_IOCTL_MINOR_VERSION 24
 
 struct kfd_ioctl_get_version_args {
 	__u32 major_version;	/* from KFD */
@@ -151,7 +152,7 @@ struct kfd_dbg_device_info_entry {
 	__u32 capability;
 	__u32 debug_prop;
 	__u32 capability2;
-	__u32 pad;
+	__u32 pci_domain;
 };
 
 /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */
Signature · 1 line
2.43.0
maintainer Acked-by on v2 1/1
#1 lore raw

AMD General

Quoted 24 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lancelot SIX
Sent: Monday, September 28, 2026 9:35 AM
To: [email protected]
Cc: Six, Lancelot <[email protected]>; Samoylov, Alexander <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Add pci_domain to struct kfd_dbg_device_info_entry

The device info structure returned to the debugger via the KFD_IOC_DBG_TRAP_GET_DEVICE_SNAPSHOT ioctl contain location of the device on PCI (bus, device, function), but is missing the domain this location belongs to.

This patch adds this information to the snapshot structure. The overall size of the kfd_dbg_device_info_entry structure structure, this new field is placed in preexisting padding.

Tested using the following topic branch for ROCdbgapi:
users/lancesix/read-pci-domain
(https://github.com/ROCm/rocm-systems/tree/users/lancesix/read-pci-domain)
and the regular ROCgdb testsuite (https://github.com/ROCm/ROCgdb).

Quoted 6 lines

V2: Add reference to the userspace code making use of the new field in
the public interface.

Quoted 47 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 1 +
 include/uapi/linux/kfd_ioctl.h         | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +1 -0
index 0dd1fd448059b..2c14b03df0781 100644
@@ -1129,6 +1129,7 @@ int kfd_dbg_trap_device_snapshot(struct kfd_process
 *target,
              device_info.capability = topo_dev->node_props.capability;
              device_info.debug_prop = topo_dev->node_props.debug_prop;
              device_info.capability2 = topo_dev->node_props.capability2;
+             device_info.pci_domain = topo_dev->node_props.domain;
 
              if (exception_clear_mask)
                      pdd->exception_status &= ~exception_clear_mask; diff

--git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h index 749d196e2114b..e7908a068d3d1 100644

include/uapi/linux/kfd_ioctl.h +3 -2
@@ -49,9 +49,10 @@
  * - 1.21 - Debugger support to subscribe to LDS out-of-address exceptions
  * - 1.22 - Add queue creation with metadata ring base address
  * - 1.23 - Add profiler control ioctl to enable/disable profiler on a process
+ * - 1.24 - Add  PCI domain in kfd_dbg_device_info_entry
  */
 #define KFD_IOCTL_MAJOR_VERSION 1
-#define KFD_IOCTL_MINOR_VERSION 23
+#define KFD_IOCTL_MINOR_VERSION 24
 
 struct kfd_ioctl_get_version_args {
      __u32 major_version;    /* from KFD */
@@ -151,7 +152,7 @@ struct kfd_dbg_device_info_entry {
      __u32 capability;
      __u32 debug_prop;
      __u32 capability2;
-     __u32 pad;
+     __u32 pci_domain;
 };
 
 /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy

*/
--
2.43.0