summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
diff options
context:
space:
mode:
authorJonathan Kim <jonathan.kim@amd.com>2023-05-23 11:57:27 -0400
committerAlex Deucher <alexander.deucher@amd.com>2023-06-09 12:48:19 -0400
commit09d49e14ea6fd125a21f89b80f888c09be32a174 (patch)
treeb79f2e96444da3b8b2d1f9ed03b9537323e1bd1e /drivers/gpu/drm/amd/amdkfd/kfd_debug.c
parentfe56c6ee0457035ae8fbbc2aa5ddfcfac6ded787 (diff)
downloadlwn-09d49e14ea6fd125a21f89b80f888c09be32a174.tar.gz
lwn-09d49e14ea6fd125a21f89b80f888c09be32a174.zip
drm/amdkfd: fix and enable debugging for gfx11
There are a couple of fixes required to enable gfx11 debugging. First, ADD_QUEUE.trap_en is an inappropriate place to toggle a per-process register so move it to SET_SHADER_DEBUGGER.trap_en. When ADD_QUEUE.skip_process_ctx_clear is set, MES will prioritize the SET_SHADER_DEBUGGER.trap_en setting. Second, to preserve correct save/restore priviledged wave states in coordination with the trap enablement setting, resume suspended waves early in the disable call. Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_debug.c')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_debug.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
index 125274445f43..cd34e7aaead4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug.c
@@ -349,12 +349,13 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd)
{
uint32_t spi_dbg_cntl = pdd->spi_dbg_override | pdd->spi_dbg_launch_mode;
uint32_t flags = pdd->process->dbg_flags;
+ bool sq_trap_en = !!spi_dbg_cntl;
if (!kfd_dbg_is_per_vmid_supported(pdd->dev))
return 0;
return amdgpu_mes_set_shader_debugger(pdd->dev->adev, pdd->proc_ctx_gpu_addr, spi_dbg_cntl,
- pdd->watch_points, flags);
+ pdd->watch_points, flags, sq_trap_en);
}
#define KFD_DEBUGGER_INVALID_WATCH_POINT_ID -1
@@ -557,6 +558,10 @@ void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind
if (!unwind) {
uint32_t flags = 0;
+ int resume_count = resume_queues(target, 0, NULL);
+
+ if (resume_count)
+ pr_debug("Resumed %d queues\n", resume_count);
cancel_work_sync(&target->debug_event_workarea);
kfd_dbg_clear_process_address_watch(target);
@@ -598,13 +603,6 @@ void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind
}
kfd_dbg_set_workaround(target, false);
-
- if (!unwind) {
- int resume_count = resume_queues(target, 0, NULL);
-
- if (resume_count)
- pr_debug("Resumed %d queues\n", resume_count);
- }
}
static void kfd_dbg_clean_exception_status(struct kfd_process *target)