Re: [RFC PATCH 1/5] drm/xe/pm: add xe_pm_pme_supported() helper
Jani Nikula <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe,org.freedesktop.lists.intel-gfx |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs Bertel Jungin Aukio 5, 02600 Espoo, Finland |
| Message-ID | <[email protected]> |
On Mon, 17 Aug 2026, Vinod Govindapillai <[email protected]> wrote: > Introduce the helper to check if the device can signal a wakeup event > while runtime suspended. This can avoid scheduling the HPD polling. > > Assisted-by: GitHub_Copilot:claude-opus-5 > Signed-off-by: Vinod Govindapillai <[email protected]> > --- > drivers/gpu/drm/xe/xe_pm.c | 21 +++++++++++++++++++++ > drivers/gpu/drm/xe/xe_pm.h | 1 + > 2 files changed, 22 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c > index a5289a9df8d2..635bfb1c7f78 100644 > --- a/drivers/gpu/drm/xe/xe_pm.c > +++ b/drivers/gpu/drm/xe/xe_pm.c > @@ -937,6 +937,27 @@ bool xe_pm_runtime_resume_and_get(struct xe_device *xe) > return pm_runtime_resume_and_get(xe->drm.dev) >= 0; > } > > +/** > + * xe_pm_pme_supported - Can the device signal PME from its suspend target state? > + * @xe: xe device instance > + * > + * Determine whether the device can generate a Power Management Event while > + * runtime suspended. > + * > + * Return: true if PME is supported from the target state, false otherwise. > + */ > +bool xe_pm_pme_supported(struct xe_device *xe) > +{ > + struct pci_dev *pdev = to_pci_dev(xe->drm.dev); > + > + /* > + * pci_dev_run_wake() checks dev->pme_support, verifies > + * pci_pme_capable() against the state pci_target_state() picks, and > + * walks upstream to confirm the wake can actually be routed. Is this comment helpful? pci_dev_run_wake() has a kernel-doc comment that explains what it does? > + */ > + return pci_dev_run_wake(pdev); > +} > + > /** > * xe_pm_assert_unbounded_bridge - Disable PM on unbounded pcie parent bridge > * @xe: xe device instance > diff --git a/drivers/gpu/drm/xe/xe_pm.h b/drivers/gpu/drm/xe/xe_pm.h > index 6d5ab09cb769..16b8699e59ec 100644 > --- a/drivers/gpu/drm/xe/xe_pm.h > +++ b/drivers/gpu/drm/xe/xe_pm.h > @@ -30,6 +30,7 @@ bool xe_pm_runtime_get_if_active(struct xe_device *xe); > bool xe_pm_runtime_get_if_in_use(struct xe_device *xe); > void xe_pm_runtime_get_noresume(struct xe_device *xe); > bool xe_pm_runtime_resume_and_get(struct xe_device *xe); > +bool xe_pm_pme_supported(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); -- Jani Nikula, Intel