drm/i915/guc: Fix missing ecodes
authorjsg <jsg@openbsd.org>
Fri, 31 Mar 2023 01:44:03 +0000 (01:44 +0000)
committerjsg <jsg@openbsd.org>
Fri, 31 Mar 2023 01:44:03 +0000 (01:44 +0000)
From John Harrison
be8c6ad6b16e6181510e35c53928381f0f39640a in linux-6.1.y/6.1.22
8df23e4c4f72f4e201c28e6fb0a67e2dbf30628a in mainline linux

sys/dev/pci/drm/i915/gt/uc/intel_guc_capture.c

index 1311860..1e1fa20 100644 (file)
@@ -1556,6 +1556,27 @@ int intel_guc_capture_print_engine_node(struct drm_i915_error_state_buf *ebuf,
 
 #endif //CONFIG_DRM_I915_CAPTURE_ERROR
 
+static void guc_capture_find_ecode(struct intel_engine_coredump *ee)
+{
+       struct gcap_reg_list_info *reginfo;
+       struct guc_mmio_reg *regs;
+       i915_reg_t reg_ipehr = RING_IPEHR(0);
+       i915_reg_t reg_instdone = RING_INSTDONE(0);
+       int i;
+
+       if (!ee->guc_capture_node)
+               return;
+
+       reginfo = ee->guc_capture_node->reginfo + GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE;
+       regs = reginfo->regs;
+       for (i = 0; i < reginfo->num_regs; i++) {
+               if (regs[i].offset == reg_ipehr.reg)
+                       ee->ipehr = regs[i].value;
+               else if (regs[i].offset == reg_instdone.reg)
+                       ee->instdone.instdone = regs[i].value;
+       }
+}
+
 void intel_guc_capture_free_node(struct intel_engine_coredump *ee)
 {
        if (!ee || !ee->guc_capture_node)
@@ -1597,6 +1618,7 @@ void intel_guc_capture_get_matching_node(struct intel_gt *gt,
                        list_del(&n->link);
                        ee->guc_capture_node = n;
                        ee->guc_capture = guc->capture;
+                       guc_capture_find_ecode(ee);
                        return;
                }
        }