drm/xe/guc: Support crash dump notification from GuC
authorJohn Harrison <John.C.Harrison@Intel.com>
Fri, 8 Nov 2024 21:27:37 +0000 (13:27 -0800)
committerJohn Harrison <John.C.Harrison@Intel.com>
Tue, 12 Nov 2024 19:42:13 +0000 (11:42 -0800)
Add support for the two crash dump notifications from GuC. Either one
means GuC is toast, so just capture state trigger a reset.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241108212737.2044007-3-John.C.Harrison@Intel.com
drivers/gpu/drm/xe/xe_guc_ct.c

index 63bd919..7eb175a 100644 (file)
@@ -54,6 +54,7 @@ enum {
        CT_DEAD_PARSE_G2H_UNKNOWN,              /* 0x1000 */
        CT_DEAD_PARSE_G2H_ORIGIN,               /* 0x2000 */
        CT_DEAD_PARSE_G2H_TYPE,                 /* 0x4000 */
+       CT_DEAD_CRASH,                          /* 0x8000 */
 };
 
 static void ct_dead_worker_func(struct work_struct *w);
@@ -1120,6 +1121,24 @@ static int parse_g2h_event(struct xe_guc_ct *ct, u32 *msg, u32 len)
        return 0;
 }
 
+static int guc_crash_process_msg(struct xe_guc_ct *ct, u32 action)
+{
+       struct xe_gt *gt = ct_to_gt(ct);
+
+       if (action == XE_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED)
+               xe_gt_err(gt, "GuC Crash dump notification\n");
+       else if (action == XE_GUC_ACTION_NOTIFY_EXCEPTION)
+               xe_gt_err(gt, "GuC Exception notification\n");
+       else
+               xe_gt_err(gt, "Unknown GuC crash notification: 0x%04X\n", action);
+
+       CT_DEAD(ct, NULL, CRASH);
+
+       kick_reset(ct);
+
+       return 0;
+}
+
 static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
 {
        struct xe_gt *gt =  ct_to_gt(ct);
@@ -1294,6 +1313,10 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
        case GUC_ACTION_GUC2PF_ADVERSE_EVENT:
                ret = xe_gt_sriov_pf_monitor_process_guc2pf(gt, hxg, hxg_len);
                break;
+       case XE_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED:
+       case XE_GUC_ACTION_NOTIFY_EXCEPTION:
+               ret = guc_crash_process_msg(ct, action);
+               break;
        default:
                xe_gt_err(gt, "unexpected G2H action 0x%04x\n", action);
        }