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

drm/{i915,xe}/display: Block hpd during suspend

It has been observed that during `xe_display_pm_suspend()` execution,
an HPD interrupt can still be triggered, resulting in `dig_port_work`
being scheduled. The issue arises when this work executes after
`xe_display_pm_suspend_late()`, by which time the display is fully
suspended.

This can lead to errors such as "DC state mismatch", as the dig_port
work accesses display resources that are no longer available or
powered.

To address this, introduce 'intel_encoder_block_all_hpds' and
'intel_encoder_unblock_all_hpds' functions, which iterate over all
encoders and block/unblock HPD respectively.

These are used to:
- Block HPD IRQs before calling 'intel_hpd_cancel_work' in suspend
and shutdown
- Unblock HPD IRQs after 'intel_hpd_init' in resume

This will prevent 'dig_port_work' being scheduled during display
suspend.

Continuation of previous patch discussion:
https://patchwork.freedesktop.org/patch/663964/

Changes in v2:
- Add 'intel_encoder_block_all_hpds' to 'xe_display_pm_shutdown'.(Imre
Deak)
- Add 'intel_hpd_cancel_work' to 'xe_display_fini_early' to cancel
any HPD pending work at late driver removal. (Imre Deak)

Changes in v3:
- Move 'intel_encoder_block_all_hpds' after intel_dp_mst_suspend
in 'xe_display_pm_shutdown'.(Imre Deak)

Signed-off-by: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20250724083928.2298199-1-dibin.moolakadan.subrahmanian@intel.com

authored by

Dibin Moolakadan Subrahmanian and committed by
Imre Deak
6e2c8fbc 7b410651

+32 -2
+23
drivers/gpu/drm/i915/display/intel_encoder.c
··· 8 8 #include "intel_display_core.h" 9 9 #include "intel_display_types.h" 10 10 #include "intel_encoder.h" 11 + #include "intel_hotplug.h" 11 12 12 13 static void intel_encoder_link_check_work_fn(struct work_struct *work) 13 14 { ··· 36 35 37 36 mod_delayed_work(display->wq.unordered, 38 37 &encoder->link_check_work, msecs_to_jiffies(delay_ms)); 38 + } 39 + 40 + void intel_encoder_unblock_all_hpds(struct intel_display *display) 41 + { 42 + struct intel_encoder *encoder; 43 + 44 + if (!HAS_DISPLAY(display)) 45 + return; 46 + 47 + for_each_intel_encoder(display->drm, encoder) 48 + intel_hpd_unblock(encoder); 49 + } 50 + 51 + void intel_encoder_block_all_hpds(struct intel_display *display) 52 + { 53 + struct intel_encoder *encoder; 54 + 55 + if (!HAS_DISPLAY(display)) 56 + return; 57 + 58 + for_each_intel_encoder(display->drm, encoder) 59 + intel_hpd_block(encoder); 39 60 } 40 61 41 62 void intel_encoder_suspend_all(struct intel_display *display)
+3
drivers/gpu/drm/i915/display/intel_encoder.h
··· 17 17 void intel_encoder_suspend_all(struct intel_display *display); 18 18 void intel_encoder_shutdown_all(struct intel_display *display); 19 19 20 + void intel_encoder_block_all_hpds(struct intel_display *display); 21 + void intel_encoder_unblock_all_hpds(struct intel_display *display); 22 + 20 23 #endif /* __INTEL_ENCODER_H__ */
-2
drivers/gpu/drm/i915/display/intel_hotplug.c
··· 972 972 973 973 spin_lock_irq(&display->irq.lock); 974 974 975 - drm_WARN_ON(display->drm, get_blocked_hpd_pin_mask(display)); 976 - 977 975 display->hotplug.long_hpd_pin_mask = 0; 978 976 display->hotplug.short_hpd_pin_mask = 0; 979 977 display->hotplug.event_bits = 0;
+6
drivers/gpu/drm/xe/display/xe_display.c
··· 96 96 if (!xe->info.probe_display) 97 97 return; 98 98 99 + intel_hpd_cancel_work(display); 99 100 intel_display_driver_remove_nogem(display); 100 101 intel_display_driver_remove_noirq(display); 101 102 intel_opregion_cleanup(display); ··· 341 340 342 341 xe_display_flush_cleanup_work(xe); 343 342 343 + intel_encoder_block_all_hpds(display); 344 + 344 345 intel_hpd_cancel_work(display); 345 346 346 347 if (has_display(xe)) { ··· 373 370 374 371 xe_display_flush_cleanup_work(xe); 375 372 intel_dp_mst_suspend(display); 373 + intel_encoder_block_all_hpds(display); 376 374 intel_hpd_cancel_work(display); 377 375 378 376 if (has_display(xe)) ··· 474 470 intel_display_driver_resume_access(display); 475 471 476 472 intel_hpd_init(display); 473 + 474 + intel_encoder_unblock_all_hpds(display); 477 475 478 476 if (has_display(xe)) { 479 477 intel_display_driver_resume(display);