Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Maarten Lankhorst <maarten@lankhorst.se>,
	Dibin Moolakadan Subrahmanian
	<dibin.moolakadan.subrahmanian@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>, <ankit.k.nautiyal@intel.com>,
	<uma.shankar@intel.com>
Subject: Re: [PATCH] drm/xe/display: Block hpd during suspend
Date: Fri, 18 Jul 2025 14:21:28 +0300	[thread overview]
Message-ID: <aHouONIZJ3cBHvl2@ideak-desk> (raw)
In-Reply-To: <47db7bc5-2e0c-4d64-8d74-db5d3f90fa78@lankhorst.se>

On Thu, Jul 17, 2025 at 01:54:49PM +0200, Maarten Lankhorst wrote:
> Hey,
> 
> When I looked at enabling -RT for Xe yesterday, I noticed this trace.
> 
> https://intel-gfx-ci.01.org/tree/intel-xe/xe-pw-151626v2/shard-bmg-6/igt@kms_cursor_crc@cursor-suspend@pipe-d-hdmi-a-3.html#dmesg-warnings488
> 
> I independently discovered the bug as a result, and sent this patch to actually disable the irqs.
> 
> https://patchwork.freedesktop.org/series/151728/

Display IRQs in general are still needed by the encoder suspend/shutdown
hooks, for things like DP AUX and I2C. So I'd only block the HPD IRQs
right before intel_hpd_cancel_work() and disable all the display IRQs
only after the encoder hooks.

> If you have a reproducer, can  you confirm this fixes it?
> 
> Kind regards,
> ~Maarten
> 
> Den 2025-07-17 kl. 10:54, skrev Dibin Moolakadan Subrahmanian:
> > 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_hpd_block_all_encoders()' and
> > 'intel_hpd_unblock_all_encoders()' 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
> > - 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/
> >
> > Signed-off-by: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_hotplug.c | 24 ++++++++++++++++++--
> >  drivers/gpu/drm/i915/display/intel_hotplug.h |  2 ++
> >  drivers/gpu/drm/xe/display/xe_display.c      |  4 ++++
> >  3 files changed, 28 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > index 265aa97fcc75..7ffd8ded1c26 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > @@ -223,6 +223,28 @@ queue_detection_work(struct intel_display *display, struct work_struct *work)
> >  	return queue_work(display->wq.unordered, work);
> >  }
> >  
> > +void intel_hpd_unblock_all_encoders(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_hpd_block_all_encoders(struct intel_display *display)
> > +{
> > +	struct intel_encoder *encoder;
> > +
> > +	if (!HAS_DISPLAY(display))
> > +		return;
> > +
> > +	for_each_intel_encoder(display->drm, encoder)
> > +		intel_hpd_block(encoder);
> > +}
> > +
> >  static void
> >  intel_hpd_irq_storm_switch_to_polling(struct intel_display *display)
> >  {
> > @@ -971,8 +993,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;
> > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.h b/drivers/gpu/drm/i915/display/intel_hotplug.h
> > index edc41c9d3d65..3938c93d2385 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hotplug.h
> > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.h
> > @@ -34,5 +34,7 @@ void intel_hpd_debugfs_register(struct intel_display *display);
> >  void intel_hpd_enable_detection_work(struct intel_display *display);
> >  void intel_hpd_disable_detection_work(struct intel_display *display);
> >  bool intel_hpd_schedule_detection(struct intel_display *display);
> > +void intel_hpd_block_all_encoders(struct intel_display *display);
> > +void intel_hpd_unblock_all_encoders(struct intel_display *display);
> >  
> >  #endif /* __INTEL_HOTPLUG_H__ */
> > diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> > index e2e0771cf274..51584ea3ed09 100644
> > --- a/drivers/gpu/drm/xe/display/xe_display.c
> > +++ b/drivers/gpu/drm/xe/display/xe_display.c
> > @@ -340,6 +340,8 @@ void xe_display_pm_suspend(struct xe_device *xe)
> >  
> >  	xe_display_flush_cleanup_work(xe);
> >  
> > +	intel_hpd_block_all_encoders(display);
> > +
> >  	intel_hpd_cancel_work(display);
> >  
> >  	if (has_display(xe)) {
> > @@ -471,6 +473,8 @@ void xe_display_pm_resume(struct xe_device *xe)
> >  
> >  	intel_hpd_init(display);
> >  
> > +	intel_hpd_unblock_all_encoders(display);
> > +
> >  	if (has_display(xe)) {
> >  		intel_display_driver_resume(display);
> >  		drm_kms_helper_poll_enable(&xe->drm);
> 

  parent reply	other threads:[~2025-07-18 11:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  8:54 [PATCH] drm/xe/display: Block hpd during suspend Dibin Moolakadan Subrahmanian
2025-07-17  9:46 ` ✓ CI.KUnit: success for " Patchwork
2025-07-17 10:24 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-17 11:54 ` [PATCH] " Maarten Lankhorst
2025-07-18  5:21   ` Dibin Moolakadan Subrahmanian
2025-07-18 11:31     ` Maarten Lankhorst
2025-07-18 11:21   ` Imre Deak [this message]
2025-07-18 13:54 ` ✗ Xe.CI.Full: failure for " Patchwork
2025-07-21 20:16 ` ✓ CI.KUnit: success for drm/xe/display: Block hpd during suspend (rev2) Patchwork
2025-07-21 21:37 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-22  0:01 ` ✗ Xe.CI.Full: failure " Patchwork
2025-07-22  5:00   ` Dibin Moolakadan Subrahmanian
2025-07-22 10:47 ` [PATCH] drm/xe/display: Block hpd during suspend Imre Deak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aHouONIZJ3cBHvl2@ideak-desk \
    --to=imre.deak@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=dibin.moolakadan.subrahmanian@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=maarten@lankhorst.se \
    --cc=uma.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox