Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: use display snapshot mechanism for display irq regs

Move more display specific parts of GPU error logging behind the display
snapshot interface.

With the display register capture reduced to just one register, DERRMR,
there's quite a bit of boilerplate here. However, it's still a nice
abstraction and removes a DISPLAY_VER() usage from core i915. With this
approach, it's also easy to add to xe as needed.

v2: Remove stale comment

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/13206969df04426d290d2863dc574e22ca45193a.1744630147.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Jani Nikula 737c725b 79cef515

+38 -20
+28
drivers/gpu/drm/i915/display/intel_display_irq.c
··· 2329 2329 2330 2330 INIT_WORK(&display->irq.vblank_dc_work, intel_display_vblank_dc_work); 2331 2331 } 2332 + 2333 + struct intel_display_irq_snapshot { 2334 + u32 derrmr; 2335 + }; 2336 + 2337 + struct intel_display_irq_snapshot * 2338 + intel_display_irq_snapshot_capture(struct intel_display *display) 2339 + { 2340 + struct intel_display_irq_snapshot *snapshot; 2341 + 2342 + snapshot = kzalloc(sizeof(*snapshot), GFP_ATOMIC); 2343 + if (!snapshot) 2344 + return NULL; 2345 + 2346 + if (DISPLAY_VER(display) >= 6 && DISPLAY_VER(display) < 20) 2347 + snapshot->derrmr = intel_de_read(display, DERRMR); 2348 + 2349 + return snapshot; 2350 + } 2351 + 2352 + void intel_display_irq_snapshot_print(const struct intel_display_irq_snapshot *snapshot, 2353 + struct drm_printer *p) 2354 + { 2355 + if (!snapshot) 2356 + return; 2357 + 2358 + drm_printf(p, "DERRMR: 0x%08x\n", snapshot->derrmr); 2359 + }
+5
drivers/gpu/drm/i915/display/intel_display_irq.h
··· 12 12 13 13 enum pipe; 14 14 struct drm_crtc; 15 + struct drm_printer; 15 16 struct intel_display; 17 + struct intel_display_irq_snapshot; 16 18 17 19 void valleyview_enable_display_irqs(struct intel_display *display); 18 20 void valleyview_disable_display_irqs(struct intel_display *display); ··· 83 81 void intel_display_irq_init(struct intel_display *display); 84 82 85 83 void i915gm_irq_cstate_wa(struct intel_display *display, bool enable); 84 + 85 + struct intel_display_irq_snapshot *intel_display_irq_snapshot_capture(struct intel_display *display); 86 + void intel_display_irq_snapshot_print(const struct intel_display_irq_snapshot *snapshot, struct drm_printer *p); 86 87 87 88 #endif /* __INTEL_DISPLAY_IRQ_H__ */
+5
drivers/gpu/drm/i915/display/intel_display_snapshot.c
··· 7 7 8 8 #include "intel_display_core.h" 9 9 #include "intel_display_device.h" 10 + #include "intel_display_irq.h" 10 11 #include "intel_display_params.h" 11 12 #include "intel_display_snapshot.h" 12 13 #include "intel_dmc.h" ··· 21 20 struct intel_display_params params; 22 21 struct intel_overlay_snapshot *overlay; 23 22 struct intel_dmc_snapshot *dmc; 23 + struct intel_display_irq_snapshot *irq; 24 24 }; 25 25 26 26 struct intel_display_snapshot *intel_display_snapshot_capture(struct intel_display *display) ··· 40 38 41 39 intel_display_params_copy(&snapshot->params); 42 40 41 + snapshot->irq = intel_display_irq_snapshot_capture(display); 43 42 snapshot->overlay = intel_overlay_snapshot_capture(display); 44 43 snapshot->dmc = intel_dmc_snapshot_capture(display); 45 44 ··· 60 57 intel_display_device_info_print(&snapshot->info, &snapshot->runtime_info, p); 61 58 intel_display_params_dump(&snapshot->params, display->drm->driver->name, p); 62 59 60 + intel_display_irq_snapshot_print(snapshot->irq, p); 63 61 intel_overlay_snapshot_print(snapshot->overlay, p); 64 62 intel_dmc_snapshot_print(snapshot->dmc, p); 65 63 } ··· 72 68 73 69 intel_display_params_free(&snapshot->params); 74 70 71 + kfree(snapshot->irq); 75 72 kfree(snapshot->overlay); 76 73 kfree(snapshot->dmc); 77 74 kfree(snapshot);
-18
drivers/gpu/drm/i915/i915_gpu_error.c
··· 726 726 intel_sseu_print_topology(gt->_gt->i915, &gt->info.sseu, &p); 727 727 } 728 728 729 - static void err_print_gt_display(struct drm_i915_error_state_buf *m, 730 - struct intel_gt_coredump *gt) 731 - { 732 - err_printf(m, "DERRMR: 0x%08x\n", gt->derrmr); 733 - } 734 - 735 729 static void err_print_gt_global_nonguc(struct drm_i915_error_state_buf *m, 736 730 struct intel_gt_coredump *gt) 737 731 { ··· 871 877 if (error->gt->uc && error->gt->uc->guc.is_guc_capture) 872 878 print_guc_capture = true; 873 879 874 - err_print_gt_display(m, error->gt); 875 880 err_print_gt_global_nonguc(m, error->gt); 876 881 err_print_gt_fences(m, error->gt); 877 882 ··· 1759 1766 return error_uc; 1760 1767 } 1761 1768 1762 - /* Capture display registers. */ 1763 - static void gt_record_display_regs(struct intel_gt_coredump *gt) 1764 - { 1765 - struct intel_uncore *uncore = gt->_gt->uncore; 1766 - struct drm_i915_private *i915 = uncore->i915; 1767 - 1768 - if (DISPLAY_VER(i915) >= 6 && DISPLAY_VER(i915) < 20) 1769 - gt->derrmr = intel_uncore_read(uncore, DERRMR); 1770 - } 1771 - 1772 1769 /* Capture all other registers that GuC doesn't capture. */ 1773 1770 static void gt_record_global_nonguc_regs(struct intel_gt_coredump *gt) 1774 1771 { ··· 2017 2034 gc->_gt = gt; 2018 2035 gc->awake = intel_gt_pm_is_awake(gt); 2019 2036 2020 - gt_record_display_regs(gc); 2021 2037 gt_record_global_nonguc_regs(gc); 2022 2038 2023 2039 /*
-2
drivers/gpu/drm/i915/i915_gpu_error.h
··· 163 163 u32 clock_frequency; 164 164 u32 clock_period_ns; 165 165 166 - /* Display related */ 167 - u32 derrmr; 168 166 u32 sfc_done[I915_MAX_SFC]; /* gen12 */ 169 167 170 168 u32 nfence;