amdgpu: Add amdgpu profiler IOCTL functions
Subsystems (2)
PATCH 1/1 amdgpu: Add amdgpu profiler IOCTL functions
to support PMC, PCSampling, SPM etc.
Signed-off-by James Zhu <[email protected]>
--- amdgpu/amdgpu.h | 6 ++++++ amdgpu/amdgpu_profiler.c | 46 ++++++++++++++++++++++++++++++++++++++++ amdgpu/meson.build | 2 +- include/drm/amdgpu_drm.h | 19 +++++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 amdgpu/amdgpu_profiler.c
amdgpu/amdgpu.h +6 -0
@@ -2072,6 +2072,12 @@ int amdgpu_userq_signal(amdgpu_device_handle dev,int amdgpu_userq_wait (amdgpu_device_handle dev,struct drm_amdgpu_userq_wait *wait_data); +/** +* Acquire profiler version +* \param dev - \c [in] device handle +*/ +int amdgpu_profiler_version (amdgpu_device_handle dev); + #ifdef __cplusplus }#endif
amdgpu/amdgpu_profiler.c new file +46 -0
46 lines not on this page · raw message
amdgpu/meson.build +1 -1
@@ -27,7 +27,7 @@ libdrm_amdgpu = library( files( 'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c', 'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'handle_table.c', - 'amdgpu_userq.c', + 'amdgpu_userq.c', 'amdgpu_profiler.c', ), config_file, ],
include/drm/amdgpu_drm.h +19 -0
@@ -57,6 +57,7 @@ extern "C" {#define DRM_AMDGPU_USERQ 0x16#define DRM_AMDGPU_USERQ_SIGNAL 0x17#define DRM_AMDGPU_USERQ_WAIT 0x18 +#define DRM_AMDGPU_PROFILER 0x20#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -77,6 +78,7 @@ extern "C" {#define DRM_IOCTL_AMDGPU_USERQ DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ, union drm_amdgpu_userq)#define DRM_IOCTL_AMDGPU_USERQ_SIGNAL DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_SIGNAL, struct drm_amdgpu_userq_signal)#define DRM_IOCTL_AMDGPU_USERQ_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_WAIT, struct drm_amdgpu_userq_wait) +#define DRM_IOCTL_AMDGPU_PROFILER DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_PROFILER, struct drm_amdgpu_profiler_args)/** * DOC: memory domains
@@ -1616,6 +1618,23 @@ struct drm_amdgpu_info_gpuvm_fault {#define AMDGPU_FAMILY_GC_11_5_0 150/* GC 11.5.0 */ #define AMDGPU_FAMILY_GC_12_0_0 152/* GC 12.0.0 */ +/* +* Supported Profiler Operations +*/ +enum drm_amdgpu_profiler_ops { +AMDGPU_PROFILER_VERSION =0 , +}; + +struct drm_amdgpu_profiler_args { +__u32 op;/* amdgpu_profiler_op */ +union { +__u32 version;/* AMDGPU_PROFILER_VERSION_NUM +* lower 16 bit: minor +* higher 16 bit: major +*/ + }; +}; +#if defined(__cplusplus) }#endif
Signature · 1 line
2.34.1