Skip to contentSkip to conversation

drm/{i915,xe}: unify runtime pm calls

PATCH Superseded Jani Nikula 3 participants 13 messages Jun 24 – Jun 25

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover drm/{i915,xe}: unify runtime pm calls

Another stab at unifying the i915/xe runtime pm calls for display.

v1 at [1].

I dropped some R-b's due to the changes from v1.

BR,
Jani.

[1] https://lore.kernel.org/r/[email protected]

Jani Nikula (8):
drm/i915: call intel_uncore_runtime_resume() for each gt drm/i915: call intel_display_power_runtime_resume() on suspend error
path
drm/i915: move some display runtime suspend operations earlier drm/i915: add intel_display_driver_pm_runtime*() functions drm/{i915,xe}: add new
intel_display_driver_runtime_pm_{enable,disable}()
drm/xe/display: separate d3cold handling from
xe_display_pm_runtime_suspend_late()
drm/xe/display: add xe_display_pm_runtime_resume_early() drm/xe/display: unify runtime suspend/resume with i915 for non-d3cold

 .../drm/i915/display/intel_display_driver.c   | 71 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  8 +++
 drivers/gpu/drm/i915/i915_driver.c            | 58 ++++-----------
 drivers/gpu/drm/xe/display/xe_display.c       | 44 ++++++++----
 drivers/gpu/drm/xe/display/xe_display.h       |  1 +
 drivers/gpu/drm/xe/xe_pm.c                    |  2 +
 6 files changed, 125 insertions(+), 59 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/8 drm/i915: call intel_uncore_runtime_resume() for each gt

All uncore suspend/resume calls are done on each gt. Follow suit in vlv_suspend_complete() error path purely for completeness, even if VLV/CHV only have one.

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_driver.c +3 -1
index 43f747c3c31f..f6c7270300c9 100644
@@ -1545,7 +1545,9 @@ static int i915_pm_runtime_suspend(struct device *kdev)
 	if (ret) {
 		drm_err(&dev_priv->drm,
 			"Runtime suspend failed, disabling it (%d)\n", ret);
-		intel_uncore_runtime_resume(&dev_priv->uncore);
+
+		for_each_gt(gt, dev_priv, i)
+			intel_uncore_runtime_resume(gt->uncore);
 
 		intel_irq_resume(dev_priv);
 
Signature · 1 line
2.47.3
Reviewed-by on v2 1/8
#2 lore raw

Re: [PATCH v2 1/8] drm/i915: call intel_uncore_runtime_resume() for each gt

Hi Jani,

Quoted 7 lines · Jani Nikula

All uncore suspend/resume calls are done on each gt. Follow suit in vlv_suspend_complete() error path purely for completeness, even if VLV/CHV only have one.

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
Quoted 9 lines
---
 drivers/gpu/drm/i915/i915_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_driver.c +0 -0
index 43f747c3c31f..f6c7270300c9 100644

drivers/gpu/drm/i915/i915_driver.c static int i915_pm_runtime_suspend(struct device *kdev) · line 1550

Quoted 7 lines
drivers/gpu/drm/i915/i915_driver.c +3 -1
@@ -1545,7 +1545,9 @@ static int i915_pm_runtime_suspend(struct device *kdev)
 	if (ret) {
 		drm_err(&dev_priv->drm,
 			"Runtime suspend failed, disabling it (%d)\n", ret);
-		intel_uncore_runtime_resume(&dev_priv->uncore);
+
+		for_each_gt(gt, dev_priv, i)
+			intel_uncore_runtime_resume(gt->uncore);

I wonder how we got until now with this. This is on the border line for a Fixes kind of patches.

Andi

Quoted 5 lines
drivers/gpu/drm/i915/i915_driver.c +0 -0
 		intel_irq_resume(dev_priv);
 
Signature · 1 line
2.47.3
#3 lore raw

Re: [PATCH v2 1/8] drm/i915: call intel_uncore_runtime_resume() for each gt

Quoted 17 lines · Andi Shyti

Hi Jani,

Quoted 7 lines · Jani Nikula

All uncore suspend/resume calls are done on each gt. Follow suit in vlv_suspend_complete() error path purely for completeness, even if VLV/CHV only have one.

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
Quoted 4 lines
---
 drivers/gpu/drm/i915/i915_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/i915/i915_driver.c static int i915_pm_runtime_suspend(struct device *kdev) · line 1550

Quoted 12 lines
drivers/gpu/drm/i915/i915_driver.c +3 -1
index 43f747c3c31f..f6c7270300c9 100644
@@ -1545,7 +1545,9 @@ static int i915_pm_runtime_suspend(struct device *kdev)
 	if (ret) {
 		drm_err(&dev_priv->drm,
 			"Runtime suspend failed, disabling it (%d)\n", ret);
-		intel_uncore_runtime_resume(&dev_priv->uncore);
+
+		for_each_gt(gt, dev_priv, i)
+			intel_uncore_runtime_resume(gt->uncore);

I wonder how we got until now with this. This is on the border line for a Fixes kind of patches.

We end up here only on VLV/CHV, and on the error path at that. And for VLV/CHV i915->uncore is the only one anyway, so no big deal. I just think doing it the same way everywhere is better.

BR,
Jani.

Quoted 8 lines

Andi

Quoted 5 lines
drivers/gpu/drm/i915/i915_driver.c +0 -0
 		intel_irq_resume(dev_priv);
 
Signature · 1 line
2.47.3
Signature · 1 line
Jani Nikula, Intel
#4 lore raw

PATCH v2 2/8 drm/i915: call intel_display_power_runtime_resume() on suspend error path

In reply to Jani Nikula

The vlv_suspend_complete() error path fails to call intel_display_power_runtime_resume(). Fix it.

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_driver.c +2 -0
index f6c7270300c9..51b8bd751376 100644
@@ -1546,6 +1546,8 @@ static int i915_pm_runtime_suspend(struct device *kdev)
 		drm_err(&dev_priv->drm,
 			"Runtime suspend failed, disabling it (%d)\n", ret);
 
+		intel_display_power_runtime_resume(display);
+
 		for_each_gt(gt, dev_priv, i)
 			intel_uncore_runtime_resume(gt->uncore);
 
Signature · 1 line
2.47.3
#5 lore raw

PATCH v2 3/8 drm/i915: move some display runtime suspend operations earlier

In reply to Jani Nikula

In preparation for abstracting display runtime suspend/resume calls, relocate opregion adapter notification and hotplug poll enable slightly earlier. Even though this is intended to be a non-functional change, do it as a separate step to pinpoint any issues here.

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_driver.c | 54 ++++++++++++++++--------------
 1 file changed, 28 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +28 -26
index 51b8bd751376..73616cb6ce7c 100644
@@ -1541,11 +1541,39 @@ static int i915_pm_runtime_suspend(struct device *kdev)
 
 	intel_display_power_runtime_suspend(display);
 
+	/*
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
+	 */
+	if (IS_BROADWELL(dev_priv)) {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at i915_pm_runtime_resume()
+		 * won't be able to restore them. Since PCI_D3hot matches the
+		 * actual specification and appears to be working, use it.
+		 */
+		intel_opregion_notify_adapter(display, PCI_D3hot);
+	} else {
+		/*
+		 * current versions of firmware which depend on this opregion
+		 * notification have repurposed the D1 definition to mean
+		 * "runtime suspended" vs. what you would normally expect (D3)
+		 * to distinguish it from notifications that might be sent via
+		 * the suspend path.
+		 */
+		intel_opregion_notify_adapter(display, PCI_D1);
+	}
+
+	if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
+		intel_hpd_poll_enable(display);
+
 	ret = vlv_suspend_complete(dev_priv);
 	if (ret) {
 		drm_err(&dev_priv->drm,
 			"Runtime suspend failed, disabling it (%d)\n", ret);
 
+		intel_opregion_notify_adapter(display, PCI_D0);
+
 		intel_display_power_runtime_resume(display);
 
 		for_each_gt(gt, dev_priv, i)
@@ -1577,34 +1605,8 @@ static int i915_pm_runtime_suspend(struct device *kdev)
 	if (root_pdev)
 		pci_d3cold_disable(root_pdev);
 
-	/*
-	 * FIXME: We really should find a document that references the arguments
-	 * used below!
-	 */
-	if (IS_BROADWELL(dev_priv)) {
-		/*
-		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
-		 * being detected, and the call we do at i915_pm_runtime_resume()
-		 * won't be able to restore them. Since PCI_D3hot matches the
-		 * actual specification and appears to be working, use it.
-		 */
-		intel_opregion_notify_adapter(display, PCI_D3hot);
-	} else {
-		/*
-		 * current versions of firmware which depend on this opregion
-		 * notification have repurposed the D1 definition to mean
-		 * "runtime suspended" vs. what you would normally expect (D3)
-		 * to distinguish it from notifications that might be sent via
-		 * the suspend path.
-		 */
-		intel_opregion_notify_adapter(display, PCI_D1);
-	}
-
 	assert_forcewakes_inactive(&dev_priv->uncore);
 
-	if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
-		intel_hpd_poll_enable(display);
-
 	drm_dbg(&dev_priv->drm, "Device suspended\n");
 	return 0;
 }
Signature · 1 line
2.47.3
#6 lore raw

PATCH v2 4/8 drm/i915: add intel_display_driver_pm_runtime*() functions

In reply to Jani Nikula

Add new functions intel_display_driver_pm_runtime_suspend(), intel_display_driver_pm_runtime_suspend_late(), intel_display_driver_pm_runtime_resume_early(), and intel_display_driver_pm_runtime_resume(). The IRQ suspend/resume is meant to happen between the corresponding calls. For now, intel_display_driver_pm_runtime_suspend() is empty, but is included for completeness as a placeholder.

Initially, only migrate i915, as there are some differences with xe that will be addressed later.

There's a functional change, which should be benign:
i915_pm_runtime_resume() moves intel_opregion_notify_adapter() call slightly later.

In the interest of not introducing more severe functional changes, the calls become slightly asymmetric. We might want to address this later.

v2:
- Rebase, move placement of suspend calls

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 .../drm/i915/display/intel_display_driver.c   | 61 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  5 ++
 drivers/gpu/drm/i915/i915_driver.c            | 52 +++-------------
 3 files changed, 74 insertions(+), 44 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +61 -0
index 462f78d5b020..0ea8a848a8e6 100644
@@ -868,3 +868,64 @@ void intel_display_driver_pm_resume(struct intel_display *display)
 
 	intel_display_power_enable(display);
 }
+
+/* before irq suspend */
+void intel_display_driver_pm_runtime_suspend(struct intel_display *display)
+{
+}
+
+/* after irq suspend */
+void intel_display_driver_pm_runtime_suspend_late(struct intel_display *display)
+{
+	intel_display_power_runtime_suspend(display);
+
+	/*
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
+	 */
+	if (display->platform.broadwell) {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at i915_pm_runtime_resume()
+		 * won't be able to restore them. Since PCI_D3hot matches the
+		 * actual specification and appears to be working, use it.
+		 */
+		intel_opregion_notify_adapter(display, PCI_D3hot);
+	} else {
+		/*
+		 * current versions of firmware which depend on this opregion
+		 * notification have repurposed the D1 definition to mean
+		 * "runtime suspended" vs. what you would normally expect (D3)
+		 * to distinguish it from notifications that might be sent via
+		 * the suspend path.
+		 */
+		intel_opregion_notify_adapter(display, PCI_D1);
+	}
+
+	if (!display->platform.valleyview && !display->platform.cherryview)
+		intel_hpd_poll_enable(display);
+}
+
+/* before irq resume */
+void intel_display_driver_pm_runtime_resume_early(struct intel_display *display)
+{
+	intel_opregion_notify_adapter(display, PCI_D0);
+
+	intel_display_power_runtime_resume(display);
+}
+
+/* after irq resume */
+void intel_display_driver_pm_runtime_resume(struct intel_display *display)
+{
+	/*
+	 * On VLV/CHV display interrupts are part of the display
+	 * power well, so hpd is reinitialized from there. For
+	 * everyone else do it here.
+	 */
+	if (!display->platform.valleyview && !display->platform.cherryview) {
+		intel_hpd_init(display);
+		intel_hpd_poll_disable(display);
+	}
+
+	skl_watermark_ipc_update(display);
+}
drivers/gpu/drm/i915/display/intel_display_driver.h +5 -0
index 7eca3d17dd82..1b494337d629 100644
@@ -43,5 +43,10 @@ void intel_display_driver_suspend_access(struct intel_display *display);
 void intel_display_driver_resume_access(struct intel_display *display);
 bool intel_display_driver_check_access(struct intel_display *display);
 
+void intel_display_driver_pm_runtime_suspend(struct intel_display *display);
+void intel_display_driver_pm_runtime_suspend_late(struct intel_display *display);
+void intel_display_driver_pm_runtime_resume_early(struct intel_display *display);
+void intel_display_driver_pm_runtime_resume(struct intel_display *display);
+
 #endif /* __INTEL_DISPLAY_DRIVER_H__ */
 
drivers/gpu/drm/i915/i915_driver.c +8 -44

93 lines not on this page · raw message

Signature · 1 line
2.47.3
#7 lore raw

PATCH v2 5/8 drm/{i915, xe}: add new intel_display_driver_runtime_pm_{enable, disable}()

In reply to Jani Nikula

Add new high-level functions intel_display_driver_runtime_pm_enable() and intel_display_driver_runtime_pm_disable() to abstract the low-level functions intel_display_power_enable() and intel_display_power_disable(), respectively.

The asymmetry in the "runtime pm enable/disable" and "pm runtime suspend/etc" naming is intentional, with the latter intended to be called from the PM hooks.

---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 10 ++++++++++
 drivers/gpu/drm/i915/display/intel_display_driver.h |  3 +++
 drivers/gpu/drm/i915/i915_driver.c                  |  4 ++--
 drivers/gpu/drm/xe/display/xe_display.c             |  8 ++++----
 4 files changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +10 -0
index 0ea8a848a8e6..eda34c05ed46 100644
@@ -869,6 +869,16 @@ void intel_display_driver_pm_resume(struct intel_display *display)
 	intel_display_power_enable(display);
 }
 
+void intel_display_driver_runtime_pm_enable(struct intel_display *display)
+{
+	intel_display_power_enable(display);
+}
+
+void intel_display_driver_runtime_pm_disable(struct intel_display *display)
+{
+	intel_display_power_disable(display);
+}
+
 /* before irq suspend */
 void intel_display_driver_pm_runtime_suspend(struct intel_display *display)
 {
drivers/gpu/drm/i915/display/intel_display_driver.h +3 -0
index 1b494337d629..1ae2ad7e95f6 100644
@@ -43,6 +43,9 @@ void intel_display_driver_suspend_access(struct intel_display *display);
 void intel_display_driver_resume_access(struct intel_display *display);
 bool intel_display_driver_check_access(struct intel_display *display);
 
+void intel_display_driver_runtime_pm_enable(struct intel_display *display);
+void intel_display_driver_runtime_pm_disable(struct intel_display *display);
+
 void intel_display_driver_pm_runtime_suspend(struct intel_display *display);
 void intel_display_driver_pm_runtime_suspend_late(struct intel_display *display);
 void intel_display_driver_pm_runtime_resume_early(struct intel_display *display);
drivers/gpu/drm/i915/i915_driver.c +2 -2
index 9ebafd339411..4ba0ae238f93 100644
@@ -659,7 +659,7 @@ static int i915_driver_register(struct drm_i915_private *dev_priv)
 
 	intel_display_driver_register(display);
 
-	intel_display_power_enable(display);
+	intel_display_driver_runtime_pm_enable(display);
 	intel_runtime_pm_enable(&dev_priv->runtime_pm);
 
 	if (i915_switcheroo_register(dev_priv))
@@ -681,7 +681,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 	i915_switcheroo_unregister(dev_priv);
 
 	intel_runtime_pm_disable(&dev_priv->runtime_pm);
-	intel_display_power_disable(display);
+	intel_display_driver_runtime_pm_disable(display);
 
 	intel_display_driver_unregister(display);
 
drivers/gpu/drm/xe/display/xe_display.c +4 -4
index a5768736dbbc..493e9e09b6c9 100644
@@ -176,7 +176,7 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(display);
-	intel_display_power_enable(display);
+	intel_display_driver_runtime_pm_enable(display);
 }
 
 void xe_display_unregister(struct xe_device *xe)
@@ -186,7 +186,7 @@ void xe_display_unregister(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_display_power_disable(display);
+	intel_display_driver_runtime_pm_disable(display);
 	intel_display_driver_unregister(display);
 }
 
@@ -331,7 +331,7 @@ static void xe_display_enable_d3cold(struct xe_device *xe)
 	 * We do a lot of poking in a lot of registers, make sure they work
 	 * properly.
 	 */
-	intel_display_power_disable(display);
+	intel_display_driver_runtime_pm_disable(display);
 
 	intel_display_flush_cleanup_work(display);
 
@@ -364,7 +364,7 @@ static void xe_display_disable_d3cold(struct xe_device *xe)
 
 	intel_opregion_resume(display);
 
-	intel_display_power_enable(display);
+	intel_display_driver_runtime_pm_enable(display);
 }
 
 void xe_display_pm_runtime_suspend(struct xe_device *xe)
Signature · 1 line
2.47.3
#8 lore raw

PATCH v2 6/8 drm/xe/display: separate d3cold handling from xe_display_pm_runtime_suspend_late()

In reply to Jani Nikula

Make the special d3cold paths completely separate from the rest of the runtime pm calls.

The intel_dmc_wl_flush_release_work() call right after xe_display_pm_suspend_late() might be completely redundant, but this avoids any functional changes.

Wiggle the comment while at it. It gets duplicated for now, but this will be addressed in the follow-up.

v2: Update comments

---
 drivers/gpu/drm/xe/display/xe_display.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +6 -6
index 493e9e09b6c9..bdafc010fae1 100644
@@ -389,14 +389,14 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed)
+	if (xe->d3cold.allowed) {
 		xe_display_pm_suspend_late(xe);
+		/* Ensure the wakelock release work gets flushed */
+		intel_dmc_wl_flush_release_work(display);
+		return;
+	}
 
-	/*
-	 * If xe_display_pm_suspend_late() is not called, it is likely
-	 * that we will be on dynamic DC states with DMC wakelock enabled. We
-	 * need to flush the release work in that case.
-	 */
+	/* Ensure the wakelock release work gets flushed */
 	intel_dmc_wl_flush_release_work(display);
 }
 
Signature · 1 line
2.47.3
#9 lore raw

PATCH v2 7/8 drm/xe/display: add xe_display_pm_runtime_resume_early()

In reply to Jani Nikula

Add new display runtime PM hook xe_display_pm_runtime_resume_early(), to be called before IRQ resume. This is initially a no-op placeholder.

Add comments on the timing relative to irq suspend/resume to all the runtime PM hooks.

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_display.c | 13 +++++++++++++
 drivers/gpu/drm/xe/display/xe_display.h |  1 +
 drivers/gpu/drm/xe/xe_pm.c              |  2 ++
 3 files changed, 16 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +13 -0
index bdafc010fae1..a26b8bca1cb6 100644
@@ -367,6 +367,7 @@ static void xe_display_disable_d3cold(struct xe_device *xe)
 	intel_display_driver_runtime_pm_enable(display);
 }
 
+/* before irq suspend */
 void xe_display_pm_runtime_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = xe->display;
@@ -382,6 +383,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 	intel_hpd_poll_enable(display);
 }
 
+/* after irq suspend */
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 {
 	struct intel_display *display = xe->display;
@@ -400,6 +402,17 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 	intel_dmc_wl_flush_release_work(display);
 }
 
+/* before irq resume */
+void xe_display_pm_runtime_resume_early(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		return;
+}
+
+/* after irq resume */
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	struct intel_display *display = xe->display;
drivers/gpu/drm/xe/display/xe_display.h +1 -0
index e5f9aed93206..52a5afed172c 100644
@@ -43,6 +43,7 @@ void xe_display_pm_resume_early(struct xe_device *xe);
 void xe_display_pm_resume(struct xe_device *xe);
 void xe_display_pm_runtime_suspend(struct xe_device *xe);
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe);
+void xe_display_pm_runtime_resume_early(struct xe_device *xe);
 void xe_display_pm_runtime_resume(struct xe_device *xe);
 
 #define XE_DISPLAY_DRIVER_FEATURES	(DRIVER_MODESET | DRIVER_ATOMIC)
drivers/gpu/drm/xe/xe_pm.c +2 -0
index 99562f691080..a5289a9df8d2 100644
@@ -700,6 +700,8 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 	if (xe->d3cold.allowed)
 		xe_sysctrl_pm_resume(xe);
 
+	xe_display_pm_runtime_resume_early(xe);
+
 	xe_irq_resume(xe);
 
 	for_each_gt(gt, xe, id) {
Signature · 1 line
2.47.3
#10 lore raw

PATCH v2 8/8 drm/xe/display: unify runtime suspend/resume with i915 for non-d3cold

In reply to Jani Nikula

With the special d3cold handling in xe runtime suspend/resume separated, unify the non-d3cold paths with i915. There are multiple changes here at once that probably wouldn't make much sense to split out further.

Add the call to intel_display_driver_pm_runtime_suspend(), which, for the time being, is a no-op. The intel_hpd_poll_enable() is called later.

Add the call to intel_display_driver_pm_runtime_suspend_late(), which starts calling intel_display_power_runtime_suspend() and intel_opregion_notify_adapter(). Deep down, the former should take care of intel_dmc_wl_flush_release_work(), allowing us to drop the extra call in xe_display_pm_runtime_suspend_late(). The intel_hpd_poll_enable() call is also done here, postponed from the previous location in xe_display_pm_runtime_suspend().

Add the call to intel_display_driver_pm_runtime_resume_early(), which contains the intel_display_power_runtime_resume() and intel_opregion_notify_adapter() counterparts to the calls in intel_display_power_runtime_suspend_late().

Finally, intel_display_driver_pm_runtime_resume() replaces the direct calls to intel_hpd_init(), intel_hpd_poll_disable(), and skl_watermark_ipc_update(). (The hotplug poll enable/disable calls are asymmetric.)

v2:
- Rebase, move placement of the calls

Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_display.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +7 -6
index a26b8bca1cb6..8e48853c276e 100644
@@ -380,7 +380,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 		return;
 	}
 
-	intel_hpd_poll_enable(display);
+	intel_display_driver_pm_runtime_suspend(display);
 }
 
 /* after irq suspend */
@@ -398,18 +398,21 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 		return;
 	}
 
-	/* Ensure the wakelock release work gets flushed */
-	intel_dmc_wl_flush_release_work(display);
+	intel_display_driver_pm_runtime_suspend_late(display);
 }
 
 /* before irq resume */
 void xe_display_pm_runtime_resume_early(struct xe_device *xe)
 {
+	struct intel_display *display = xe->display;
+
 	if (!xe->info.probe_display)
 		return;
 
 	if (xe->d3cold.allowed)
 		return;
+
+	intel_display_driver_pm_runtime_resume_early(display);
 }
 
 /* after irq resume */
@@ -425,9 +428,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 		return;
 	}
 
-	intel_hpd_init(display);
-	intel_hpd_poll_disable(display);
-	skl_watermark_ipc_update(display);
+	intel_display_driver_pm_runtime_resume(display);
 }
 
 
Signature · 1 line
2.47.3
#11 lore raw

✗ CI.KUnit: failure for drm/{i915,xe}: unify runtime pm calls (rev2)

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/{i915,xe}: unify runtime pm calls (rev2)
URL : https://patchwork.freedesktop.org/series/168519/
State : failure

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:../drivers/gpu/drm/xe/xe_pm.c: In function ‘xe_pm_runtime_resume’:
../drivers/gpu/drm/xe/xe_pm.c:703:9: error: implicit declaration of function ‘xe_display_pm_runtime_resume_early’; did you mean ‘xe_display_pm_runtime_resume’? [-Werror=implicit-function-declaration]

  703 |         xe_display_pm_runtime_resume_early(xe);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         xe_display_pm_runtime_resume

cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:289: drivers/gpu/drm/xe/xe_pm.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:548: drivers/gpu/drm/xe] Error 2 make[5]: *** [../scripts/Makefile.build:548: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:548: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:548: drivers] Error 2 make[2]: *** [/kernel/Makefile:2144: .] Error 2
make[1]: *** [/kernel/Makefile:248: __sub-make] Error 2
make: *** [Makefile:248: __sub-make] Error 2

[14:43:25] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[14:43:30] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel
#12 lore raw

✓ i915.CI.BAT: success for drm/{i915,xe}: unify runtime pm calls (rev2)

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/{i915,xe}: unify runtime pm calls (rev2)
URL : https://patchwork.freedesktop.org/series/168520/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_18716 -> Patchwork_168520v2
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_168520v2/index.html

Participating hosts (42 -> 40)
------------------------------

Missing (2): bat-dg2-13 fi-snb-2520m

Changes
-------

No changes found

Build changes
-------------

* Linux: CI_DRM_18716 -> Patchwork_168520v2

CI-20190529: 20190529
CI_DRM_18716: 4e1cbe14a45bd66fe75e0d08febddb9bab0405b1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8985: d5fe8732b8547454c38fdd220b55f6f0cc841a3b @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_168520v2: 4e1cbe14a45bd66fe75e0d08febddb9bab0405b1 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_168520v2/index.html