]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/guc: Handle context reset notification
authorMatthew Brost <matthew.brost@intel.com>
Tue, 27 Jul 2021 00:23:27 +0000 (17:23 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Wed, 28 Jul 2021 00:31:50 +0000 (17:31 -0700)
GuC will issue a reset on detecting an engine hang and will notify
the driver via a G2H message. The driver will service the notification
by resetting the guilty context to a simple state or banning it
completely.

v2:
 (John Harrison)
  - Move msg[0] lookup after length check
v3:
 (John Harrison)
  - s/drm_dbg/drm_err

Cc: Matthew Brost <matthew.brost@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-13-matthew.brost@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc.h
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
drivers/gpu/drm/i915/i915_trace.h

index 7b871f675e48c7f40e9b9682a8fb62ad27e63f2f..c79da154c16ddcca1d810598a7a87a6b458d377c 100644 (file)
@@ -269,6 +269,8 @@ int intel_guc_deregister_done_process_msg(struct intel_guc *guc,
                                          const u32 *msg, u32 len);
 int intel_guc_sched_done_process_msg(struct intel_guc *guc,
                                     const u32 *msg, u32 len);
+int intel_guc_context_reset_process_msg(struct intel_guc *guc,
+                                       const u32 *msg, u32 len);
 
 void intel_guc_submission_reset_prepare(struct intel_guc *guc);
 void intel_guc_submission_reset(struct intel_guc *guc, bool stalled);
index 8bb6b1bbcea1845c1e301947e32af20c53c6e6bb..231a428876758fc5b33c62398e8d7b705d1b27b9 100644 (file)
@@ -984,6 +984,9 @@ static int ct_process_request(struct intel_guc_ct *ct, struct ct_incoming_msg *r
        case INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE:
                ret = intel_guc_sched_done_process_msg(guc, payload, len);
                break;
+       case INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION:
+               ret = intel_guc_context_reset_process_msg(guc, payload, len);
+               break;
        default:
                ret = -EOPNOTSUPP;
                break;
index d39a312e980a26149e78bbeccc0c72fca50e95dd..7be84b0761b526371c8892a3f0fdb7c1278d18f4 100644 (file)
@@ -2201,6 +2201,42 @@ int intel_guc_sched_done_process_msg(struct intel_guc *guc,
        return 0;
 }
 
+static void guc_context_replay(struct intel_context *ce)
+{
+       struct i915_sched_engine *sched_engine = ce->engine->sched_engine;
+
+       __guc_reset_context(ce, true);
+       tasklet_hi_schedule(&sched_engine->tasklet);
+}
+
+static void guc_handle_context_reset(struct intel_guc *guc,
+                                    struct intel_context *ce)
+{
+       trace_intel_context_reset(ce);
+       guc_context_replay(ce);
+}
+
+int intel_guc_context_reset_process_msg(struct intel_guc *guc,
+                                       const u32 *msg, u32 len)
+{
+       struct intel_context *ce;
+       int desc_idx;
+
+       if (unlikely(len != 1)) {
+               drm_err(&guc_to_gt(guc)->i915->drm, "Invalid length %u", len);
+               return -EPROTO;
+       }
+
+       desc_idx = msg[0];
+       ce = g2h_context_lookup(guc, desc_idx);
+       if (unlikely(!ce))
+               return -EPROTO;
+
+       guc_handle_context_reset(guc, ce);
+
+       return 0;
+}
+
 void intel_guc_submission_print_info(struct intel_guc *guc,
                                     struct drm_printer *p)
 {
index 68b70626c3e28e3d9e3e267a8e0ffe35db668927..3f43d904f043ae60c093794e1ab2a1d3d0490566 100644 (file)
@@ -920,6 +920,11 @@ DECLARE_EVENT_CLASS(intel_context,
                              __entry->guc_sched_state_no_lock)
 );
 
+DEFINE_EVENT(intel_context, intel_context_reset,
+            TP_PROTO(struct intel_context *ce),
+            TP_ARGS(ce)
+);
+
 DEFINE_EVENT(intel_context, intel_context_register,
             TP_PROTO(struct intel_context *ce),
             TP_ARGS(ce)
@@ -1007,6 +1012,11 @@ trace_i915_request_out(struct i915_request *rq)
 {
 }
 
+static inline void
+trace_intel_context_reset(struct intel_context *ce)
+{
+}
+
 static inline void
 trace_intel_context_register(struct intel_context *ce)
 {