drm/i915: Only access SFC_DONE when media domain is not fused off
authorjsg <jsg@openbsd.org>
Wed, 18 Aug 2021 10:02:49 +0000 (10:02 +0000)
committerjsg <jsg@openbsd.org>
Wed, 18 Aug 2021 10:02:49 +0000 (10:02 +0000)
From Matt Roper
65395b053d03cb662e63cbf2c7e0faef8c15cb8c in linux 5.10.y/5.10.60
24d032e2359e3abc926b3d423f49a7c33e0b7836 in mainline linux

sys/dev/pci/drm/i915/i915_gpu_error.c

index 148afc6..f6ed1bc 100644 (file)
@@ -750,9 +750,18 @@ static void err_print_gt(struct drm_i915_error_state_buf *m,
        if (INTEL_GEN(m->i915) >= 12) {
                int i;
 
-               for (i = 0; i < GEN12_SFC_DONE_MAX; i++)
+               for (i = 0; i < GEN12_SFC_DONE_MAX; i++) {
+                       /*
+                        * SFC_DONE resides in the VD forcewake domain, so it
+                        * only exists if the corresponding VCS engine is
+                        * present.
+                        */
+                       if (!HAS_ENGINE(gt->_gt, _VCS(i * 2)))
+                               continue;
+
                        err_printf(m, "  SFC_DONE[%d]: 0x%08x\n", i,
                                   gt->sfc_done[i]);
+               }
 
                err_printf(m, "  GAM_DONE: 0x%08x\n", gt->gam_done);
        }
@@ -1638,6 +1647,14 @@ static void gt_record_regs(struct intel_gt_coredump *gt)
 
        if (INTEL_GEN(i915) >= 12) {
                for (i = 0; i < GEN12_SFC_DONE_MAX; i++) {
+                       /*
+                        * SFC_DONE resides in the VD forcewake domain, so it
+                        * only exists if the corresponding VCS engine is
+                        * present.
+                        */
+                       if (!HAS_ENGINE(gt->_gt, _VCS(i * 2)))
+                               continue;
+
                        gt->sfc_done[i] =
                                intel_uncore_read(uncore, GEN12_SFC_DONE(i));
                }