drm/amdgpu: add mes_dbgext core support
Subsystems (2)
PATCH 2/3 drm/amdgpu: add mes_dbgext core support
Add the core MES debug-extension logging layer in amdgpu_mes: allocate and initialize the firmware log buffer, parse it (both the gfx11 flat circular buffer and the gfx12/mes_aux zone-partitioned layout), and print messages to dmesg via interrupt or polling collection modes, with start/stop/notify and an amdgpu_mes_dbgext debugfs control.
Expose the mes_dbgext_buffer_size and mes_dbgext_options module parameters to configure the buffer size and collection mode, and wire the debugfs init (amdgpu_debugfs_mes_init).
Signed-off-by Yongqiang Sun <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 31 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 743 +++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 43 +- 6 files changed, 815 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -217,6 +217,8 @@ extern int amdgpu_async_gfx_ring;extern int amdgpu_mcbp;extern int amdgpu_discovery;extern int amdgpu_mes_log_enable; +extern int amdgpu_mes_dbgext_buffer_size; +extern int amdgpu_mes_dbgext_options;extern int amdgpu_uni_mes;extern int amdgpu_noretry;extern int amdgpu_force_asic_type;
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -1
@@ -2178,7 +2178,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)amdgpu_debugfs_firmware_init (adev);amdgpu_ta_if_debugfs_init (adev); -amdgpu_debugfs_mes_event_log_init (adev); +amdgpu_debugfs_mes_init (adev);#if defined(CONFIG_DRM_AMD_DC )if (adev->dc_enabled)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h +1 -1
@@ -33,7 +33,7 @@ void amdgpu_debugfs_fini(struct amdgpu_device *adev);void amdgpu_debugfs_fence_init (struct amdgpu_device *adev);void amdgpu_debugfs_firmware_init (struct amdgpu_device *adev);void amdgpu_debugfs_gem_init (struct amdgpu_device *adev); -void amdgpu_debugfs_mes_event_log_init (struct amdgpu_device *adev); +void amdgpu_debugfs_mes_init (struct amdgpu_device *adev);void amdgpu_debugfs_vm_init (struct drm_file *file); void amdgpu_debugfs_userq_init(struct drm_file *file, struct amdgpu_usermode_queue *queue,
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +30 -1
@@ -227,7 +227,9 @@ uint amdgpu_dc_visual_confirm;int amdgpu_async_gfx_ring =1 ;int amdgpu_mcbp =-1 ;int amdgpu_discovery =-1 ; -int amdgpu_mes_log_enable =0 ; +int amdgpu_mes_log_enable; +int amdgpu_mes_dbgext_buffer_size; +int amdgpu_mes_dbgext_options =1 ;int amdgpu_uni_mes =1 ;int amdgpu_noretry =-1 ;int amdgpu_force_asic_type =-1 ;
@@ -700,6 +702,33 @@ MODULE_PARM_DESC(mes_log_enable, "Enable Micro Engine Scheduler log (0 = disabled (default), 1 = enabled)");module_param_named (mes_log_enable, amdgpu_mes_log_enable, int,0444 ); +/** +* DOC: mes_dbgext_buffer_size (int) +* Size in KB of the MES firmware debug-extension log buffer. The MES firmware +* writes log messages into this buffer and the driver drains and prints them to +* dmesg. Requires an MES firmware image built with debug extension support. +* (0 = disabled at boot (default)) +* +* The feature can also be toggled at runtime via the per-device debugfs file +* <debugfs>/dri/N/amdgpu_mes_dbgext (echo 1/0 to enable/disable); when enabled +* at runtime with this parameter left at 0, a small default buffer is used. +*/ +MODULE_PARM_DESC (mes_dbgext_buffer_size, +"MES firmware debug-extension log buffer size in KB (0 = disabled (default))" ); +module_param_named (mes_dbgext_buffer_size, amdgpu_mes_dbgext_buffer_size, int,0444 ); + +/** +* DOC: mes_dbgext_options (int) +* MES firmware debug-extension option bits sent to the firmware (u64_all). +* bit0 = trigger_interrupt_per_new_msg: when set, the firmware raises an +* interrupt per message and the driver collects them via the interrupt path; +* when clear, the driver polls the log buffer with a kthread instead. +* (default 1 = interrupt driven) +*/ +MODULE_PARM_DESC (mes_dbgext_options, +"MES debug-extension option bits (bit0: 1 = interrupt (default), 0 = polling)" ); +module_param_named (mes_dbgext_options, amdgpu_mes_dbgext_options, int,0444 ); +/** * DOC: uni_mes (int) * Enable Unified Micro Engine Scheduler. This is a new engine pipe for unified scheduler.
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +739 -4
781 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h +42 -1
73 lines not on this page · raw message
Signature · 1 line
2.43.0