]> www.infradead.org Git - users/willy/xarray.git/commitdiff
drm/{i915,xe}/display: Block hpd during suspend
authorDibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com>
Thu, 24 Jul 2025 08:39:27 +0000 (14:09 +0530)
committerImre Deak <imre.deak@intel.com>
Mon, 4 Aug 2025 11:34:52 +0000 (14:34 +0300)
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
drivers/gpu/drm/i915/display/intel_encoder.c
drivers/gpu/drm/i915/display/intel_encoder.h
drivers/gpu/drm/i915/display/intel_hotplug.c
drivers/gpu/drm/xe/display/xe_display.c

index 0b7bd26f4339a609616a046728ab05ed89de3639..4e2b77b8767890e11245103346635edb64a5e78b 100644 (file)
@@ -8,6 +8,7 @@
 #include "intel_display_core.h"
 #include "intel_display_types.h"
 #include "intel_encoder.h"
+#include "intel_hotplug.h"
 
 static void intel_encoder_link_check_work_fn(struct work_struct *work)
 {
@@ -37,6 +38,28 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela
                         &encoder->link_check_work, msecs_to_jiffies(delay_ms));
 }
 
+void intel_encoder_unblock_all_hpds(struct intel_display *display)
+{
+       struct intel_encoder *encoder;
+
+       if (!HAS_DISPLAY(display))
+               return;
+
+       for_each_intel_encoder(display->drm, encoder)
+               intel_hpd_unblock(encoder);
+}
+
+void intel_encoder_block_all_hpds(struct intel_display *display)
+{
+       struct intel_encoder *encoder;
+
+       if (!HAS_DISPLAY(display))
+               return;
+
+       for_each_intel_encoder(display->drm, encoder)
+               intel_hpd_block(encoder);
+}
+
 void intel_encoder_suspend_all(struct intel_display *display)
 {
        struct intel_encoder *encoder;
index 3fa5589f0b1ce97a4946563b8b9c1605f585ce48..e1d3aeab7c00f56c9db6ebff956f3f2e421c6cb6 100644 (file)
@@ -17,4 +17,7 @@ void intel_encoder_link_check_flush_work(struct intel_encoder *encoder);
 void intel_encoder_suspend_all(struct intel_display *display);
 void intel_encoder_shutdown_all(struct intel_display *display);
 
+void intel_encoder_block_all_hpds(struct intel_display *display);
+void intel_encoder_unblock_all_hpds(struct intel_display *display);
+
 #endif /* __INTEL_ENCODER_H__ */
index 740e5c930521f6814858f562bae97b778cc05324..bd8851fd2ee9ca81cf411f8d8490bbd69485159c 100644 (file)
@@ -972,8 +972,6 @@ void intel_hpd_cancel_work(struct intel_display *display)
 
        spin_lock_irq(&display->irq.lock);
 
-       drm_WARN_ON(display->drm, get_blocked_hpd_pin_mask(display));
-
        display->hotplug.long_hpd_pin_mask = 0;
        display->hotplug.short_hpd_pin_mask = 0;
        display->hotplug.event_bits = 0;
index e2e0771cf274997408a3f5b6ac79e17c0d507446..8b68d70db6c8795436d23883a50d384c3351afe6 100644 (file)
@@ -96,6 +96,7 @@ static void xe_display_fini_early(void *arg)
        if (!xe->info.probe_display)
                return;
 
+       intel_hpd_cancel_work(display);
        intel_display_driver_remove_nogem(display);
        intel_display_driver_remove_noirq(display);
        intel_opregion_cleanup(display);
@@ -340,6 +341,8 @@ void xe_display_pm_suspend(struct xe_device *xe)
 
        xe_display_flush_cleanup_work(xe);
 
+       intel_encoder_block_all_hpds(display);
+
        intel_hpd_cancel_work(display);
 
        if (has_display(xe)) {
@@ -370,6 +373,7 @@ void xe_display_pm_shutdown(struct xe_device *xe)
 
        xe_display_flush_cleanup_work(xe);
        intel_dp_mst_suspend(display);
+       intel_encoder_block_all_hpds(display);
        intel_hpd_cancel_work(display);
 
        if (has_display(xe))
@@ -471,6 +475,8 @@ void xe_display_pm_resume(struct xe_device *xe)
 
        intel_hpd_init(display);
 
+       intel_encoder_unblock_all_hpds(display);
+
        if (has_display(xe)) {
                intel_display_driver_resume(display);
                drm_kms_helper_poll_enable(&xe->drm);