introduce a new DRM ioctl DRM_AMDGPU_PROFILER as a unified entry point for GPU hardware profiling features. The ioctl takes a drm_amdgpu_profiler_args structure which carries an operation code and a per-operation payload union.
The initial operation defined is AMDGPU_PROFILER_VERSION, which allows user space to query the profiler UAPI version. The version field encodes the major version in the upper 16 bits and the minor version in the lower 16 bits. Subsequent patches will extend this ioctl to dispatch sub-operations for SPM (Stream Performance Monitor) and PCS (PC Sampling) profiling. Signed-off-by: James Zhu <[email protected]> --- include/uapi/drm/amdgpu_drm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 98528d81d3ec..2f9a5ddfe658 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -59,6 +59,7 @@ extern "C" { #define DRM_AMDGPU_USERQ_WAIT 0x18 #define DRM_AMDGPU_GEM_LIST_HANDLES 0x19 #define DRM_AMDGPU_CWSR 0x20 +#define DRM_AMDGPU_PROFILER 0x21 #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) @@ -82,6 +83,7 @@ extern "C" { #define DRM_IOCTL_AMDGPU_GEM_LIST_HANDLES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_LIST_HANDLES, struct drm_amdgpu_gem_list_handles) #define DRM_IOCTL_AMDGPU_CWSR \ DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CWSR, union drm_amdgpu_cwsr) +#define DRM_IOCTL_AMDGPU_PROFILER DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_PROFILER, struct drm_amdgpu_profiler_args) /** * DOC: memory domains @@ -1795,6 +1797,21 @@ struct drm_color_ctm_3x4 { __u64 matrix[12]; }; +/* + * Supported Profiler Operations + */ +enum drm_amdgpu_profiler_ops { + AMDGPU_PROFILER_VERSION = 0, +}; + +struct drm_amdgpu_profiler_args { + __u32 op; /* drm_amdgpu_profiler_ops */ + __u32 pad; + union { + __u32 version; /* lower 16 bit: minor. higher 16 bit: major */ + }; +}; + #if defined(__cplusplus) } #endif -- 2.34.1
