Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Hogander, Jouni" <jouni.hogander@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Govindapillai, Vinod" <vinod.govindapillai@intel.com>
Subject: Re: [PATCH v8 1/5] drm/xe/pm: introduce PM PME support
Date: Wed, 16 Sep 2026 10:16:43 -0400	[thread overview]
Message-ID: <aqqky2AJ83MWU36q@intel.com> (raw)
In-Reply-To: <7f970736cd33b3bf749f538a6da927613d918369.camel@intel.com>

On Tue, Sep 15, 2026 at 12:27:11PM +0000, Hogander, Jouni wrote:
> On Tue, 2026-09-15 at 12:25 +0300, Vinod Govindapillai wrote:
> > Introduce PME support for PME capable devices. Whether device is
> > PME capable is assessed during PCI probe routine. And the whether
> > PME is enabled for a specific context is assessed during the PM
> > runtime suspend call if the device is PME capable.
> > 
> > If the PME is enabled, HPDs can generate PME which in turn call
> > the runtime resume call and do the wakeup routines. Till now
> > the driver was relying on HPD polling to wakeup in case of any
> > HPDs. HPD polling can be avoided in platforms with PME support
> > and instead rely on this PCI PME for HPD induced wakeup.
> > 
> > v2: access functions for xe.pme.enabled status and clear the pme.
> >     enabled in case of error in xe_pm_runtime_suspend()
> > 
> > v3: use the local pme_enabled flag to clear the device wakeup
> >     incase of error
> > 
> > v4: call the devm_device_init_wakeup() only if device is PME
> >     capable to avoid false wakeup capable reporting in platforms
> >     where PME is not supported.
> >     Squash the patch which handled the lockdep deadlock handling
> > 
> > Bspec: 52979, 52980, 68857, 68867, 68970
> > Assisted-by: GitHub_Copilot:claude-opus-5
> > Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> 
> Reviewed-by: Jouni Högander <jouni.hogander@intel.com>

pushed to drm-intel-next

Thanks for the patches and reviews

> > ---
> >  drivers/gpu/drm/xe/xe_device_types.h | 13 ++++++++
> >  drivers/gpu/drm/xe/xe_pci.c          | 22 +++++++++++++-
> >  drivers/gpu/drm/xe/xe_pm.c           | 45
> > ++++++++++++++++++++++++++++
> >  drivers/gpu/drm/xe/xe_pm.h           |  2 ++
> >  4 files changed, 81 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_device_types.h
> > b/drivers/gpu/drm/xe/xe_device_types.h
> > index 4661bfce2f4e..bb4234f00453 100644
> > --- a/drivers/gpu/drm/xe/xe_device_types.h
> > +++ b/drivers/gpu/drm/xe/xe_device_types.h
> > @@ -460,6 +460,19 @@ struct xe_device {
> >  		struct mutex lock;
> >  	} d3cold;
> >  
> > +	/** @pme: Encapsulate pme related stuff */
> > +	struct {
> > +		/** @pme.capable: Indicates if device is PME capable
> > */
> > +		bool capable;
> > +
> > +		/** @pme.enabled:
> > +		 *
> > +		 * Indicates if PME is enabled - depends on user
> > controllable
> > +		 * sysfs interface as well
> > +		 */
> > +		bool enabled;
> > +	} pme;
> > +
> >  	/** @pm_notifier: Our PM notifier to perform actions in
> > response to various PM events. */
> >  	struct notifier_block pm_notifier;
> >  	/** @pm_block: Completion to block validating tasks on
> > suspend / hibernate prepare */
> > diff --git a/drivers/gpu/drm/xe/xe_pci.c
> > b/drivers/gpu/drm/xe/xe_pci.c
> > index c401c8803796..d10633f74aa4 100644
> > --- a/drivers/gpu/drm/xe/xe_pci.c
> > +++ b/drivers/gpu/drm/xe/xe_pci.c
> > @@ -1380,6 +1380,8 @@ static int xe_pci_runtime_suspend(struct device
> > *dev)
> >  {
> >  	struct pci_dev *pdev = to_pci_dev(dev);
> >  	struct xe_device *xe = pdev_to_xe_device(pdev);
> > +	unsigned int flags;
> > +	bool pme_enabled;
> >  	int err;
> >  
> >  	/*
> > @@ -1391,9 +1393,25 @@ static int xe_pci_runtime_suspend(struct
> > device *dev)
> >  	xe_assert(xe, !IS_SRIOV_VF(xe));
> >  	xe_assert(xe, !pci_num_vf(pdev));
> >  
> > +	flags = memalloc_noreclaim_save();
> > +	pme_enabled = xe->pme.capable && !xe->d3cold.allowed &&
> > +		      pci_enable_wake(pdev, PCI_D3hot, true) == 0;
> > +	memalloc_noreclaim_restore(flags);
> > +
> > +	xe_pm_update_pme_enabled(xe, pme_enabled);
> > +
> >  	err = xe_pm_runtime_suspend(xe);
> > -	if (err)
> > +	if (err) {
> > +		if (pme_enabled) {
> > +			flags = memalloc_noreclaim_save();
> > +			pci_enable_wake(pdev, PCI_D3hot, false);
> > +			memalloc_noreclaim_restore(flags);
> > +
> > +			xe_pm_update_pme_enabled(xe, false);
> > +		}
> > +
> >  		return err;
> > +	}
> >  
> >  	pci_save_state(pdev);
> >  
> > @@ -1422,6 +1440,8 @@ static int xe_pci_runtime_resume(struct device
> > *dev)
> >  
> >  	pci_restore_state(pdev);
> >  
> > +	xe_pm_update_pme_enabled(xe, false);
> > +
> >  	if (xe->d3cold.allowed) {
> >  		err = pci_enable_device(pdev);
> >  		if (err)
> > diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> > index f517bf453b54..e71bb90c9b80 100644
> > --- a/drivers/gpu/drm/xe/xe_pm.c
> > +++ b/drivers/gpu/drm/xe/xe_pm.c
> > @@ -78,6 +78,8 @@
> >   * management (RPS).
> >   */
> >  
> > +#define HAS_PM_PME_SUPPORT(xe) (GRAPHICS_VERx100(xe) >= 3500)
> > +
> >  #ifdef CONFIG_LOCKDEP
> >  static struct lockdep_map xe_pm_runtime_d3cold_map = {
> >  	.name = "xe_rpm_d3cold_map"
> > @@ -384,6 +386,14 @@ int xe_pm_init_early(struct xe_device *xe)
> >  }
> >  ALLOW_ERROR_INJECTION(xe_pm_init_early, ERRNO); /* See
> > xe_pci_probe() */
> >  
> > +static bool xe_pm_pci_pme_capable(struct xe_device *xe)
> > +{
> > +	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> > +
> > +	return HAS_PM_PME_SUPPORT(xe) ?
> > +		pci_pme_capable(pdev, PCI_D3hot) : false;
> > +}
> > +
> >  /**
> >   * xe_pm_probe() - Initialize Xe Power Management
> >   * @xe: the &xe_device instance
> > @@ -397,6 +407,16 @@ int xe_pm_probe(struct xe_device *xe)
> >  	xe->d3cold.capable = xe_pm_pci_d3cold_capable(xe);
> >  	xe_dbg(xe, "d3cold: capable=%s\n", str_yes_no(xe-
> > >d3cold.capable));
> >  
> > +	xe->pme.capable = xe_pm_pci_pme_capable(xe);
> > +	xe_dbg(xe, "pme: capable=%s\n", str_yes_no(xe-
> > >pme.capable));
> > +
> > +	if (xe->pme.capable) {
> > +		int err = devm_device_init_wakeup(xe->drm.dev);
> > +
> > +		if (err)
> > +			return err;
> > +	}
> > +
> >  	return 0;
> >  }
> >  
> > @@ -650,6 +670,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
> >  	return 0;
> >  
> >  out_resume:
> > +	xe_pm_update_pme_enabled(xe, false);
> >  	xe_display_pm_runtime_resume(xe);
> >  	xe_pxp_pm_resume(xe->pxp);
> >  out:
> > @@ -993,6 +1014,30 @@ int xe_pm_set_vram_threshold(struct xe_device
> > *xe, u32 threshold)
> >  	return 0;
> >  }
> >  
> > +/**
> > + * xe_pm_pme_enabled - get the current status of PME enabled
> > + * @xe: xe device instance
> > + *
> > + * Returns: True if PME is enabled, false otherwise.
> > + */
> > +bool xe_pm_pme_enabled(struct xe_device *xe)
> > +{
> > +	return xe->pme.enabled;
> > +}
> > +
> > +/**
> > + * xe_pm_update_pme_enabled - Update the PME enabled state
> > + * @xe: xe device instance
> > + * @status: New PME enabled status
> > + *
> > + * Called during runtime suspend / resume. Status is set to True if
> > PME is
> > + * enabled during runtime_suspend. Cleared on runtime_resume.
> > + */
> > +void xe_pm_update_pme_enabled(struct xe_device *xe, bool status)
> > +{
> > +	xe->pme.enabled = status;
> > +}
> > +
> >  /**
> >   * xe_pm_d3cold_allowed_toggle - Check conditions to toggle
> > d3cold.allowed
> >   * @xe: xe device instance
> > diff --git a/drivers/gpu/drm/xe/xe_pm.h b/drivers/gpu/drm/xe/xe_pm.h
> > index 6d5ab09cb769..037c73ea4342 100644
> > --- a/drivers/gpu/drm/xe/xe_pm.h
> > +++ b/drivers/gpu/drm/xe/xe_pm.h
> > @@ -33,6 +33,8 @@ bool xe_pm_runtime_resume_and_get(struct xe_device
> > *xe);
> >  void xe_pm_assert_unbounded_bridge(struct xe_device *xe);
> >  int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold);
> >  void xe_pm_d3cold_allowed_toggle(struct xe_device *xe);
> > +bool xe_pm_pme_enabled(struct xe_device *xe);
> > +void xe_pm_update_pme_enabled(struct xe_device *xe, bool status);
> >  bool xe_rpm_reclaim_safe(const struct xe_device *xe);
> >  struct task_struct *xe_pm_read_callback_task(struct xe_device *xe);
> >  int xe_pm_block_on_suspend(struct xe_device *xe);
> 

  reply	other threads:[~2026-09-16 14:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  9:25 [PATCH v8 0/5] pm_pme support on display hotplug Vinod Govindapillai
2026-09-15  9:25 ` [PATCH v8 1/5] drm/xe/pm: introduce PM PME support Vinod Govindapillai
2026-09-15 12:27   ` Hogander, Jouni
2026-09-16 14:16     ` Rodrigo Vivi [this message]
2026-09-15  9:25 ` [PATCH v8 2/5] drm/i915: add pme_enabled() to the parent interface Vinod Govindapillai
2026-09-15 12:38   ` Hogander, Jouni
2026-09-15  9:25 ` [PATCH v8 3/5] drm/i915/xe: plug the pme_enabed implementation for xe Vinod Govindapillai
2026-09-15 12:39   ` Hogander, Jouni
2026-09-15  9:25 ` [PATCH v8 4/5] drm/i915/irq: conditional HPD IRQ resets based on PME capability Vinod Govindapillai
2026-09-15  9:43   ` sashiko-bot
2026-09-15 12:55   ` Hogander, Jouni
2026-09-15  9:25 ` [PATCH v8 5/5] drm/i915/hotplug: avoid HPD polling if the device is PME capable Vinod Govindapillai
2026-09-15 12:55   ` Hogander, Jouni
2026-09-15 11:01 ` ✓ i915.CI.BAT: success for pm_pme support on display hotplug (rev8) Patchwork
2026-09-15 17:10 ` ✗ i915.CI.Full: failure " Patchwork

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=aqqky2AJ83MWU36q@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jouni.hogander@intel.com \
    --cc=vinod.govindapillai@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