Skip to content

Commit 602816c

Browse files
jokim-amdalexdeucher
authored andcommitted
drm/amdkfd: fix trap handling work around for debugging
Update the list of devices that require the cwsr trap handling workaround for debugging use cases. Signed-off-by: Jonathan Kim <jonathan.kim@amd.com> Acked-by: Ruili Ji <ruili.ji@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 28801cc commit 602816c

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_debug.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ static int kfd_dbg_set_queue_workaround(struct queue *q, bool enable)
302302
if (!q)
303303
return 0;
304304

305-
if (KFD_GC_VERSION(q->device) < IP_VERSION(11, 0, 0) ||
306-
KFD_GC_VERSION(q->device) >= IP_VERSION(12, 0, 0))
305+
if (!kfd_dbg_has_cwsr_workaround(q->device))
307306
return 0;
308307

309308
if (enable && q->properties.is_user_cu_masked)
@@ -349,7 +348,7 @@ int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd)
349348
{
350349
uint32_t spi_dbg_cntl = pdd->spi_dbg_override | pdd->spi_dbg_launch_mode;
351350
uint32_t flags = pdd->process->dbg_flags;
352-
bool sq_trap_en = !!spi_dbg_cntl;
351+
bool sq_trap_en = !!spi_dbg_cntl || !kfd_dbg_has_cwsr_workaround(pdd->dev);
353352

354353
if (!kfd_dbg_is_per_vmid_supported(pdd->dev))
355354
return 0;

drivers/gpu/drm/amd/amdkfd/kfd_debug.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ static inline bool kfd_dbg_is_rlc_restore_supported(struct kfd_node *dev)
100100
KFD_GC_VERSION(dev) == IP_VERSION(10, 1, 1));
101101
}
102102

103+
static inline bool kfd_dbg_has_cwsr_workaround(struct kfd_node *dev)
104+
{
105+
return KFD_GC_VERSION(dev) >= IP_VERSION(11, 0, 0) &&
106+
KFD_GC_VERSION(dev) <= IP_VERSION(11, 0, 3);
107+
}
108+
103109
static inline bool kfd_dbg_has_gws_support(struct kfd_node *dev)
104110
{
105111
if ((KFD_GC_VERSION(dev) == IP_VERSION(9, 0, 1)

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
226226
queue_input.paging = false;
227227
queue_input.tba_addr = qpd->tba_addr;
228228
queue_input.tma_addr = qpd->tma_addr;
229-
queue_input.trap_en = KFD_GC_VERSION(q->device) < IP_VERSION(11, 0, 0) ||
230-
KFD_GC_VERSION(q->device) > IP_VERSION(11, 0, 3);
229+
queue_input.trap_en = !kfd_dbg_has_cwsr_workaround(q->device);
231230
queue_input.skip_process_ctx_clear = qpd->pqm->process->debug_trap_enabled;
232231

233232
queue_type = convert_to_mes_queue_type(q->properties.type);
@@ -1806,8 +1805,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
18061805
*/
18071806
q->properties.is_evicted = !!qpd->evicted;
18081807
q->properties.is_dbg_wa = qpd->pqm->process->debug_trap_enabled &&
1809-
KFD_GC_VERSION(q->device) >= IP_VERSION(11, 0, 0) &&
1810-
KFD_GC_VERSION(q->device) <= IP_VERSION(11, 0, 3);
1808+
kfd_dbg_has_cwsr_workaround(q->device);
18111809

18121810
if (qd)
18131811
mqd_mgr->restore_mqd(mqd_mgr, &q->mqd, q->mqd_mem_obj, &q->gart_mqd_addr,

0 commit comments

Comments
 (0)