Skip to content

Commit e013aa9

Browse files
kwachowsStanislaw Gruszka
authored andcommitted
accel/ivpu: Print CMDQ errors after consumer timeout
Add checking of error reason bits in IVPU_MMU_CMDQ_CONS register when waiting for consumer timeout occurred. Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231028155936.1183342-6-stanislaw.gruszka@linux.intel.com
1 parent ba6b035 commit e013aa9

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

drivers/accel/ivpu/ivpu_mmu.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,12 @@
230230
(REG_FLD(IVPU_MMU_REG_GERROR, MSI_PRIQ_ABT)) | \
231231
(REG_FLD(IVPU_MMU_REG_GERROR, MSI_ABT)))
232232

233-
static char *ivpu_mmu_event_to_str(u32 cmd)
233+
#define IVPU_MMU_CERROR_NONE 0x0
234+
#define IVPU_MMU_CERROR_ILL 0x1
235+
#define IVPU_MMU_CERROR_ABT 0x2
236+
#define IVPU_MMU_CERROR_ATC_INV_SYNC 0x3
237+
238+
static const char *ivpu_mmu_event_to_str(u32 cmd)
234239
{
235240
switch (cmd) {
236241
case IVPU_MMU_EVT_F_UUT:
@@ -276,6 +281,22 @@ static char *ivpu_mmu_event_to_str(u32 cmd)
276281
}
277282
}
278283

284+
static const char *ivpu_mmu_cmdq_err_to_str(u32 err)
285+
{
286+
switch (err) {
287+
case IVPU_MMU_CERROR_NONE:
288+
return "No CMDQ Error";
289+
case IVPU_MMU_CERROR_ILL:
290+
return "Illegal command";
291+
case IVPU_MMU_CERROR_ABT:
292+
return "External abort on CMDQ read";
293+
case IVPU_MMU_CERROR_ATC_INV_SYNC:
294+
return "Sync failed to complete ATS invalidation";
295+
default:
296+
return "Unknown CMDQ Error";
297+
}
298+
}
299+
279300
static void ivpu_mmu_config_check(struct ivpu_device *vdev)
280301
{
281302
u32 val_ref;
@@ -492,8 +513,15 @@ static int ivpu_mmu_cmdq_sync(struct ivpu_device *vdev)
492513
REGV_WR32(IVPU_MMU_REG_CMDQ_PROD, q->prod);
493514

494515
ret = ivpu_mmu_cmdq_wait_for_cons(vdev);
495-
if (ret)
496-
ivpu_err(vdev, "Timed out waiting for consumer: %d\n", ret);
516+
if (ret) {
517+
u32 err;
518+
519+
val = REGV_RD32(IVPU_MMU_REG_CMDQ_CONS);
520+
err = REG_GET_FLD(IVPU_MMU_REG_CMDQ_CONS, ERR, val);
521+
522+
ivpu_err(vdev, "Timed out waiting for MMU consumer: %d, error: %s\n", ret,
523+
ivpu_mmu_cmdq_err_to_str(err));
524+
}
497525

498526
return ret;
499527
}

0 commit comments

Comments
 (0)