Skip to contentSkip to conversation

Reconcile i915's and xe's display power mgt sequences

PATCH In review Rodrigo Vivi 8 participants 84 messages Sep 24, 2024 – Nov 15, 2024

Subsystems (4)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

cover Reconcile i915's and xe's display power mgt sequences

Reconcile i915's and xe's display power management sequences.

The main goal of this series is to ensure that the display power management sequences from both drivers are fully aligned. So, it needs to live under i915/display/ and xe_display_pm can only be a wrapper to check for the xe's module parameter before jumping in the i915/display functions.

During this process, it was clear that the Xe's runtime pm sequences for integrated gfx (non d3cold capable) was totally misaligned with i915 and prune to more bugs. So, this series ends up fixing this and bringing a full alignment there as well.

The one new thing under i915 is the d3cold sequences. Apparently that can be reduced, but for now this is what is validated and stable on both DG2 and BMG. So, let's move that to the i915/display side as well and continue on the improvements with the code in the right place.

When I started this work I was hoping that I could run more conversions to intel_display struct before moving things from i915_driver.c to intel_display_driver, however that was a deeper task and this series is already deep enough.

Rodrigo Vivi (31):
drm/i915: Remove vga and gmbus seq out of i915_restore_display drm/i915/display: Convert i915_suspend into i9xx_display_sr drm/i915/display: Move regfile registers intel_display.restore drm/i915/display: Move shutdown sequences under display driver drm/xe: At shutdown disable commit helpers instead of flushing drm/xe: Use i915-display shutdown sequence directly drm/{i915,xe}/display: Move DP MST calls to display_driver drm/i915/display: Move suspend sequences to intel_display_driver drm/xe/display: Delay hpd_init resume
drm/xe/display: Spin-off xe_display runtime/d3cold sequences drm/{i915,xe}: Consolidate display resume functions drm/i915: Remove lingering pci_save_state
drm/{i915,xe}: Consolidate display suspend functions drm/i915/display: Move resume sequences to intel_display_driver drm/xe/display: Delay dsm handler registration drm/{i915,xe}: Move power_domains suspend/resume to display_power drm/{i915,xe}: Move remaining intel_power_domains to intel_display drm/i915/display: Split resume_noirq calls for now drm/xe/display: Align display resume sequence with i915 drm/xe/display: Align suspend sequence with i915 drm/{i915,xe}/display: Move dsm registration under intel_driver drm/i915/display: Move runtime pm related calls under
intel_display_driver
drm/xe/display: Prepare runtime pm functions drm/xe/display: Call intel_hpd_init on every runtime resume drm/xe/display: Move hpd_poll calls to later runtime stages drm/xe/display: Add missing watermark ipc update at runtime resume drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold drm/xe/display: Move display runtime suspend to a later point drm/xe/display: Kill crtc commit flush
drm/xe/display: Add missing power display handling on non-d3cold rpm drm/{i915,xe}/display: Consolidade entire runtime pm sequence

 drivers/gpu/drm/i915/Makefile                 |   2 +-
 .../gpu/drm/i915/display/i9xx_display_sr.c    |  99 +++++++
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  14 +
 .../gpu/drm/i915/display/intel_display_core.h |   5 +
 .../drm/i915/display/intel_display_driver.c   | 247 ++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  18 ++
 .../drm/i915/display/intel_display_power.c    |   6 +-
 .../drm/i915/display/intel_display_power.h    |   2 +-
 drivers/gpu/drm/i915/i915_driver.c            | 161 ++----------
 drivers/gpu/drm/i915/i915_drv.h               |   9 -
 drivers/gpu/drm/i915/i915_suspend.c           | 141 ----------
 drivers/gpu/drm/i915/i915_suspend.h           |  14 -
 drivers/gpu/drm/xe/display/xe_display.c       | 185 ++++---------
 drivers/gpu/drm/xe/display/xe_display.h       |  11 +-
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |   8 +
 drivers/gpu/drm/xe/xe_device.c                |   4 +-
 drivers/gpu/drm/xe/xe_pm.c                    |  16 +-
 17 files changed, 498 insertions(+), 444 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.c
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.h
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.c
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.h
Signature · 1 line
2.46.0
author maintainer
#1 lore raw

PATCH 1/31 drm/i915: Remove vga and gmbus seq out of i915_restore_display

Restrict this function to only save and restore registers functionality. Then, that can be moved out later to under display with a proper name.

---
 drivers/gpu/drm/i915/i915_driver.c  | 6 ++++++
 drivers/gpu/drm/i915/i915_suspend.c | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +6 -0
index 6dc0104a3e36..c5ffcf229f42 100644
@@ -60,6 +60,7 @@
 #include "display/intel_pch_refclk.h"
 #include "display/intel_pps.h"
 #include "display/intel_sprite_uapi.h"
+#include "display/intel_vga.h"
 #include "display/skl_watermark.h"
 
 #include "gem/i915_gem_context.h"
@@ -1167,6 +1168,11 @@ static int i915_drm_resume(struct drm_device *dev)
 	intel_dmc_resume(display);
 
 	i915_restore_display(dev_priv);
+
+	intel_vga_redisable(display);
+
+	intel_gmbus_reset(dev_priv);
+
 	intel_pps_unlock_regs_wa(display);
 
 	intel_init_pch_refclk(dev_priv);
drivers/gpu/drm/i915/i915_suspend.c +0 -6
index 9d3d9b983032..fb67b05cd864 100644
@@ -26,7 +26,6 @@
 
 #include "display/intel_de.h"
 #include "display/intel_gmbus.h"
-#include "display/intel_vga.h"
 
 #include "i915_drv.h"
 #include "i915_reg.h"
@@ -118,7 +117,6 @@ void i915_save_display(struct drm_i915_private *dev_priv)
 
 void i915_restore_display(struct drm_i915_private *dev_priv)
 {
-	struct intel_display *display = &dev_priv->display;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	if (!HAS_DISPLAY(dev_priv))
@@ -134,8 +132,4 @@ void i915_restore_display(struct drm_i915_private *dev_priv)
 	if (GRAPHICS_VER(dev_priv) <= 4)
 		intel_de_write(dev_priv, DSPARB(dev_priv),
 			       dev_priv->regfile.saveDSPARB);
-
-	intel_vga_redisable(display);
-
-	intel_gmbus_reset(dev_priv);
 }
Signature · 1 line
2.46.0
#2 lore raw

Re: [PATCH 01/31] drm/i915: Remove vga and gmbus seq out of i915_restore_display

Quoted 24 lines · Rodrigo Vivi

Restrict this function to only save and restore registers functionality. Then, that can be moved out later to under display with a proper name.

---
 drivers/gpu/drm/i915/i915_driver.c  | 6 ++++++
 drivers/gpu/drm/i915/i915_suspend.c | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +1 -0
index 6dc0104a3e36..c5ffcf229f42 100644
@@ -60,6 +60,7 @@
 #include "display/intel_pch_refclk.h"
 #include "display/intel_pps.h"
 #include "display/intel_sprite_uapi.h"
+#include "display/intel_vga.h"
 #include "display/skl_watermark.h"
 
 #include "gem/i915_gem_context.h"

drivers/gpu/drm/i915/i915_driver.c static int i915_drm_resume(struct drm_device *dev) · line 1175

Quoted 8 lines
drivers/gpu/drm/i915/i915_driver.c +5 -0
@@ -1167,6 +1168,11 @@ static int i915_drm_resume(struct drm_device *dev)
 	intel_dmc_resume(display);
 
 	i915_restore_display(dev_priv);
+
+	intel_vga_redisable(display);
+
+	intel_gmbus_reset(dev_priv);
+

Hate to be nitpicky, but these are now called for !HAS_DISPLAY() too. Maybe the later patches fix it, but here it's not right.

I agree with the approach though.

Quoted 32 lines
drivers/gpu/drm/i915/i915_driver.c +0 -0
 	intel_pps_unlock_regs_wa(display);
 
 	intel_init_pch_refclk(dev_priv);
drivers/gpu/drm/i915/i915_suspend.c +0 -6
index 9d3d9b983032..fb67b05cd864 100644
@@ -26,7 +26,6 @@
 
 #include "display/intel_de.h"
 #include "display/intel_gmbus.h"
-#include "display/intel_vga.h"
 
 #include "i915_drv.h"
 #include "i915_reg.h"
@@ -118,7 +117,6 @@ void i915_save_display(struct drm_i915_private *dev_priv)
 
 void i915_restore_display(struct drm_i915_private *dev_priv)
 {
-	struct intel_display *display = &dev_priv->display;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	if (!HAS_DISPLAY(dev_priv))
@@ -134,8 +132,4 @@ void i915_restore_display(struct drm_i915_private *dev_priv)
 	if (GRAPHICS_VER(dev_priv) <= 4)
 		intel_de_write(dev_priv, DSPARB(dev_priv),
 			       dev_priv->regfile.saveDSPARB);
-
-	intel_vga_redisable(display);
-
-	intel_gmbus_reset(dev_priv);
 }
Signature · 1 line
Jani Nikula, Intel
author maintainer
#3 lore raw

Re: [PATCH 01/31] drm/i915: Remove vga and gmbus seq out of i915_restore_display

Quoted 27 lines · Jani Nikula
Quoted 26 lines · Rodrigo Vivi

Restrict this function to only save and restore registers functionality. Then, that can be moved out later to under display with a proper name.

---
 drivers/gpu/drm/i915/i915_driver.c  | 6 ++++++
 drivers/gpu/drm/i915/i915_suspend.c | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +1 -0
index 6dc0104a3e36..c5ffcf229f42 100644
@@ -60,6 +60,7 @@
 #include "display/intel_pch_refclk.h"
 #include "display/intel_pps.h"
 #include "display/intel_sprite_uapi.h"
+#include "display/intel_vga.h"
 #include "display/skl_watermark.h"
 
 #include "gem/i915_gem_context.h"
@@ -1167,6 +1168,11 @@ static int i915_drm_resume(struct drm_device *dev)
 	intel_dmc_resume(display);
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_driver.c static int i915_drm_resume(struct drm_device *dev) · line 1175

Quoted 6 lines
drivers/gpu/drm/i915/i915_driver.c +5 -0
 	i915_restore_display(dev_priv);
+
+	intel_vga_redisable(display);
+
+	intel_gmbus_reset(dev_priv);
+

Hate to be nitpicky, but these are now called for !HAS_DISPLAY() too. Maybe the later patches fix it, but here it's not right.

no need for hate, this is what the reviews are for ;) I totally agree and will fix on the next revision...

Quoted 38 lines

I agree with the approach though.

Quoted 32 lines
drivers/gpu/drm/i915/i915_driver.c +0 -0
 	intel_pps_unlock_regs_wa(display);
 
 	intel_init_pch_refclk(dev_priv);
drivers/gpu/drm/i915/i915_suspend.c +0 -6
index 9d3d9b983032..fb67b05cd864 100644
@@ -26,7 +26,6 @@
 
 #include "display/intel_de.h"
 #include "display/intel_gmbus.h"
-#include "display/intel_vga.h"
 
 #include "i915_drv.h"
 #include "i915_reg.h"
@@ -118,7 +117,6 @@ void i915_save_display(struct drm_i915_private *dev_priv)
 
 void i915_restore_display(struct drm_i915_private *dev_priv)
 {
-	struct intel_display *display = &dev_priv->display;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	if (!HAS_DISPLAY(dev_priv))
@@ -134,8 +132,4 @@ void i915_restore_display(struct drm_i915_private *dev_priv)
 	if (GRAPHICS_VER(dev_priv) <= 4)
 		intel_de_write(dev_priv, DSPARB(dev_priv),
 			       dev_priv->regfile.saveDSPARB);
-
-	intel_vga_redisable(display);
-
-	intel_gmbus_reset(dev_priv);
 }
Signature · 1 line
Jani Nikula, Intel
Reviewed-by on v1 1/31
#4 lore raw

RE: [PATCH 01/31] drm/i915: Remove vga and gmbus seq out of i915_restore_display

In reply to Rodrigo Vivi

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Nikula, Jani <[email protected]>
Subject: [PATCH 01/31] drm/i915: Remove vga and gmbus seq out of i915_restore_display

Quoted 7 lines

Restrict this function to only save and restore registers functionality. Then, that can be moved out later to under display with a proper name.

LGTM.

-Jonathan Cavitt

Quoted 62 lines
---
 drivers/gpu/drm/i915/i915_driver.c  | 6 ++++++
 drivers/gpu/drm/i915/i915_suspend.c | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +6 -0
index 6dc0104a3e36..c5ffcf229f42 100644
@@ -60,6 +60,7 @@
 #include "display/intel_pch_refclk.h"
 #include "display/intel_pps.h"
 #include "display/intel_sprite_uapi.h"
+#include "display/intel_vga.h"
 #include "display/skl_watermark.h"
 
 #include "gem/i915_gem_context.h"
@@ -1167,6 +1168,11 @@ static int i915_drm_resume(struct drm_device *dev)
 	intel_dmc_resume(display);
 
 	i915_restore_display(dev_priv);
+
+	intel_vga_redisable(display);
+
+	intel_gmbus_reset(dev_priv);
+
 	intel_pps_unlock_regs_wa(display);
 
 	intel_init_pch_refclk(dev_priv);
drivers/gpu/drm/i915/i915_suspend.c +0 -6
index 9d3d9b983032..fb67b05cd864 100644
@@ -26,7 +26,6 @@
 
 #include "display/intel_de.h"
 #include "display/intel_gmbus.h"
-#include "display/intel_vga.h"
 
 #include "i915_drv.h"
 #include "i915_reg.h"
@@ -118,7 +117,6 @@ void i915_save_display(struct drm_i915_private *dev_priv)
 
 void i915_restore_display(struct drm_i915_private *dev_priv)
 {
-	struct intel_display *display = &dev_priv->display;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	if (!HAS_DISPLAY(dev_priv))
@@ -134,8 +132,4 @@ void i915_restore_display(struct drm_i915_private *dev_priv)
 	if (GRAPHICS_VER(dev_priv) <= 4)
 		intel_de_write(dev_priv, DSPARB(dev_priv),
 			       dev_priv->regfile.saveDSPARB);
-
-	intel_vga_redisable(display);
-
-	intel_gmbus_reset(dev_priv);
 }
Signature · 1 line
2.46.0
author maintainer
#5 lore raw

PATCH 2/31 drm/i915/display: Convert i915_suspend into i9xx_display_sr

In reply to Rodrigo Vivi

These save & restore functions inside i915_suspend are old display functions to save and restore a bunch of display related registers.

Move it under display and rename accordantly. Just don't move it entirely towards intel_display struct yet because it depends on drm_i915_private for the IS_MOBILE.

While doing this conversion also update the MIT header using the new SPDX ones.

v2: Fix Makefile and include (Jani)
Removed vga and gmbus (Jani, Ville)

Cc Jesse Barnes <[email protected]>
Cc Jani Nikula <[email protected]>
---
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 .../gpu/drm/i915/display/i9xx_display_sr.c    |  95 ++++++++++++
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  14 ++
 drivers/gpu/drm/i915/i915_driver.c            |   6 +-
 drivers/gpu/drm/i915/i915_suspend.c           | 135 ------------------
 drivers/gpu/drm/i915/i915_suspend.h           |  14 --
 6 files changed, 113 insertions(+), 153 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.c
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.h
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.c
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.h
drivers/gpu/drm/i915/Makefile +1 -1
index 70771e521b1c..f21c28d471e7 100644
@@ -30,7 +30,6 @@ i915-y += \
 	i915_params.o \
 	i915_pci.o \
 	i915_scatterlist.o \
-	i915_suspend.o \
 	i915_switcheroo.o \
 	i915_sysfs.o \
 	i915_utils.o \
@@ -219,6 +218,7 @@ i915-$(CONFIG_HWMON) += \
 i915-y += \
 	display/hsw_ips.o \
 	display/i9xx_plane.o \
+	display/i9xx_display_sr.o \
 	display/i9xx_wm.o \
 	display/intel_alpm.o \
 	display/intel_atomic.o \
drivers/gpu/drm/i915/display/i9xx_display_sr.c new file +95 -0

95 lines not on this page · raw message

drivers/gpu/drm/i915/display/i9xx_display_sr.h new file +14 -0
new file mode 100644
index 000000000000..30383758f97e
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#ifndef __I9XX_DISPLAY_SR_H__
+#define __I9XX_DISPLAY_SR_H__
+
+struct drm_i915_private;
+
+void i9xx_display_sr_save(struct drm_i915_private *i915);
+void i9xx_display_sr_restore(struct drm_i915_private *i915);
+
+#endif
drivers/gpu/drm/i915/i915_driver.c +3 -3
index c5ffcf229f42..ae5906885359 100644
@@ -45,6 +45,7 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
+#include "display/i9xx_display_sr.h"
 #include "display/intel_acpi.h"
 #include "display/intel_bw.h"
 #include "display/intel_cdclk.h"
@@ -94,7 +95,6 @@
 #include "i915_memcpy.h"
 #include "i915_perf.h"
 #include "i915_query.h"
-#include "i915_suspend.h"
 #include "i915_switcheroo.h"
 #include "i915_sysfs.h"
 #include "i915_utils.h"
@@ -1048,7 +1048,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 	intel_dpt_suspend(dev_priv);
 	i915_ggtt_suspend(to_gt(dev_priv)->ggtt);
 
-	i915_save_display(dev_priv);
+	i9xx_display_sr_save(dev_priv);
 
 	opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
 	intel_opregion_suspend(display, opregion_target_state);
@@ -1167,7 +1167,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_dmc_resume(display);
 
-	i915_restore_display(dev_priv);
+	i9xx_display_sr_restore(dev_priv);
 
 	intel_vga_redisable(display);
 
drivers/gpu/drm/i915/i915_suspend.c deleted +0 -135

135 lines not on this page · raw message

drivers/gpu/drm/i915/i915_suspend.h deleted +0 -14
deleted file mode 100644
index e5a611ee3d15..000000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright © 2019 Intel Corporation
- */
-
-#ifndef __I915_SUSPEND_H__
-#define __I915_SUSPEND_H__
-
-struct drm_i915_private;
-
-void i915_save_display(struct drm_i915_private *i915);
-void i915_restore_display(struct drm_i915_private *i915);
-
-#endif /* __I915_SUSPEND_H__ */
Signature · 1 line
2.46.0
Reviewed-by on v1 2/31
#6 lore raw

Re: [PATCH 02/31] drm/i915/display: Convert i915_suspend into i9xx_display_sr

Quoted 6 lines · Rodrigo Vivi

These save & restore functions inside i915_suspend are old display functions to save and restore a bunch of display related registers.

Move it under display and rename accordantly. Just don't move it entirely towards intel_display struct yet because it depends on drm_i915_private for the IS_MOBILE.

'git show --color-moved' has made me a huge proponent of completely separating code movement from any cleanups.

With that, reviewing the movement part takes mere seconds rather than minutes. And the next patch doing independent cleanups on top is easy to review as well. Especially the s/dev_priv/i915/ change is easy with 'git show --color-words' (my MUA does something like that automagically).

Regardless, this is

BR,
Jani.

Quoted 363 lines

While doing this conversion also update the MIT header using the new SPDX ones.

v2: Fix Makefile and include (Jani)
Removed vga and gmbus (Jani, Ville)

Cc Jesse Barnes <[email protected]>
Cc Jani Nikula <[email protected]>
---
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 .../gpu/drm/i915/display/i9xx_display_sr.c    |  95 ++++++++++++
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  14 ++
 drivers/gpu/drm/i915/i915_driver.c            |   6 +-
 drivers/gpu/drm/i915/i915_suspend.c           | 135 ------------------
 drivers/gpu/drm/i915/i915_suspend.h           |  14 --
 6 files changed, 113 insertions(+), 153 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.c
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.h
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.c
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.h
drivers/gpu/drm/i915/Makefile +1 -1
index 70771e521b1c..f21c28d471e7 100644
@@ -30,7 +30,6 @@ i915-y += \
 	i915_params.o \
 	i915_pci.o \
 	i915_scatterlist.o \
-	i915_suspend.o \
 	i915_switcheroo.o \
 	i915_sysfs.o \
 	i915_utils.o \
@@ -219,6 +218,7 @@ i915-$(CONFIG_HWMON) += \
 i915-y += \
 	display/hsw_ips.o \
 	display/i9xx_plane.o \
+	display/i9xx_display_sr.o \
 	display/i9xx_wm.o \
 	display/intel_alpm.o \
 	display/intel_atomic.o \
drivers/gpu/drm/i915/display/i9xx_display_sr.c new file +95 -0
new file mode 100644
index 000000000000..4dd0ce267994
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#include "i915_drv.h"
+#include "i915_reg.h"
+#include "i9xx_display_sr.h"
+#include "intel_de.h"
+#include "intel_gmbus.h"
+#include "intel_pci_config.h"
+
+static void i9xx_display_save_swf(struct drm_i915_private *i915)
+{
+	int i;
+
+	/* Scratch space */
+	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
+		for (i = 0; i < 7; i++) {
+			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
+			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+		}
+		for (i = 0; i < 3; i++)
+			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+	} else if (GRAPHICS_VER(i915) == 2) {
+		for (i = 0; i < 7; i++)
+			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+	} else if (HAS_GMCH(i915)) {
+		for (i = 0; i < 16; i++) {
+			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
+			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+		}
+		for (i = 0; i < 3; i++)
+			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+	}
+}
+
+static void i9xx_display_restore_swf(struct drm_i915_private *i915)
+{
+	int i;
+
+	/* Scratch space */
+	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
+		for (i = 0; i < 7; i++) {
+			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
+			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+		}
+		for (i = 0; i < 3; i++)
+			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+	} else if (GRAPHICS_VER(i915) == 2) {
+		for (i = 0; i < 7; i++)
+			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+	} else if (HAS_GMCH(i915)) {
+		for (i = 0; i < 16; i++) {
+			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
+			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+		}
+		for (i = 0; i < 3; i++)
+			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+	}
+}
+
+void i9xx_display_sr_save(struct drm_i915_private *i915)
+{
+	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+
+	if (!HAS_DISPLAY(i915))
+		return;
+
+	/* Display arbitration control */
+	if (GRAPHICS_VER(i915) <= 4)
+		i915->regfile.saveDSPARB = intel_de_read(i915, DSPARB(i915));
+
+	if (GRAPHICS_VER(i915) == 4)
+		pci_read_config_word(pdev, GCDGMBUS, &i915->regfile.saveGCDGMBUS);
+
+	i9xx_display_save_swf(i915);
+}
+
+void i9xx_display_sr_restore(struct drm_i915_private *i915)
+{
+	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+
+	if (!HAS_DISPLAY(i915))
+		return;
+
+	i9xx_display_restore_swf(i915);
+
+	if (GRAPHICS_VER(i915) == 4)
+		pci_write_config_word(pdev, GCDGMBUS, i915->regfile.saveGCDGMBUS);
+
+	/* Display arbitration */
+	if (GRAPHICS_VER(i915) <= 4)
+		intel_de_write(i915, DSPARB(i915), i915->regfile.saveDSPARB);
+}
drivers/gpu/drm/i915/display/i9xx_display_sr.h new file +14 -0
new file mode 100644
index 000000000000..30383758f97e
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#ifndef __I9XX_DISPLAY_SR_H__
+#define __I9XX_DISPLAY_SR_H__
+
+struct drm_i915_private;
+
+void i9xx_display_sr_save(struct drm_i915_private *i915);
+void i9xx_display_sr_restore(struct drm_i915_private *i915);
+
+#endif
drivers/gpu/drm/i915/i915_driver.c +3 -3
index c5ffcf229f42..ae5906885359 100644
@@ -45,6 +45,7 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
+#include "display/i9xx_display_sr.h"
 #include "display/intel_acpi.h"
 #include "display/intel_bw.h"
 #include "display/intel_cdclk.h"
@@ -94,7 +95,6 @@
 #include "i915_memcpy.h"
 #include "i915_perf.h"
 #include "i915_query.h"
-#include "i915_suspend.h"
 #include "i915_switcheroo.h"
 #include "i915_sysfs.h"
 #include "i915_utils.h"
@@ -1048,7 +1048,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 	intel_dpt_suspend(dev_priv);
 	i915_ggtt_suspend(to_gt(dev_priv)->ggtt);
 
-	i915_save_display(dev_priv);
+	i9xx_display_sr_save(dev_priv);
 
 	opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
 	intel_opregion_suspend(display, opregion_target_state);
@@ -1167,7 +1167,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_dmc_resume(display);
 
-	i915_restore_display(dev_priv);
+	i9xx_display_sr_restore(dev_priv);
 
 	intel_vga_redisable(display);
 
drivers/gpu/drm/i915/i915_suspend.c deleted +0 -135
deleted file mode 100644
index fb67b05cd864..000000000000
@@ -1,135 +0,0 @@
-/*
- *
- * Copyright 2008 (c) Intel Corporation
- *   Jesse Barnes <[email protected]>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "display/intel_de.h"
-#include "display/intel_gmbus.h"
-
-#include "i915_drv.h"
-#include "i915_reg.h"
-#include "i915_suspend.h"
-#include "intel_pci_config.h"
-
-static void intel_save_swf(struct drm_i915_private *dev_priv)
-{
-	int i;
-
-	/* Scratch space */
-	if (GRAPHICS_VER(dev_priv) == 2 && IS_MOBILE(dev_priv)) {
-		for (i = 0; i < 7; i++) {
-			dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv,
-								      SWF0(dev_priv, i));
-			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
-								      SWF1(dev_priv, i));
-		}
-		for (i = 0; i < 3; i++)
-			dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv,
-								      SWF3(dev_priv, i));
-	} else if (GRAPHICS_VER(dev_priv) == 2) {
-		for (i = 0; i < 7; i++)
-			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
-								      SWF1(dev_priv, i));
-	} else if (HAS_GMCH(dev_priv)) {
-		for (i = 0; i < 16; i++) {
-			dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv,
-								      SWF0(dev_priv, i));
-			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
-								      SWF1(dev_priv, i));
-		}
-		for (i = 0; i < 3; i++)
-			dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv,
-								      SWF3(dev_priv, i));
-	}
-}
-
-static void intel_restore_swf(struct drm_i915_private *dev_priv)
-{
-	int i;
-
-	/* Scratch space */
-	if (GRAPHICS_VER(dev_priv) == 2 && IS_MOBILE(dev_priv)) {
-		for (i = 0; i < 7; i++) {
-			intel_de_write(dev_priv, SWF0(dev_priv, i),
-				       dev_priv->regfile.saveSWF0[i]);
-			intel_de_write(dev_priv, SWF1(dev_priv, i),
-				       dev_priv->regfile.saveSWF1[i]);
-		}
-		for (i = 0; i < 3; i++)
-			intel_de_write(dev_priv, SWF3(dev_priv, i),
-				       dev_priv->regfile.saveSWF3[i]);
-	} else if (GRAPHICS_VER(dev_priv) == 2) {
-		for (i = 0; i < 7; i++)
-			intel_de_write(dev_priv, SWF1(dev_priv, i),
-				       dev_priv->regfile.saveSWF1[i]);
-	} else if (HAS_GMCH(dev_priv)) {
-		for (i = 0; i < 16; i++) {
-			intel_de_write(dev_priv, SWF0(dev_priv, i),
-				       dev_priv->regfile.saveSWF0[i]);
-			intel_de_write(dev_priv, SWF1(dev_priv, i),
-				       dev_priv->regfile.saveSWF1[i]);
-		}
-		for (i = 0; i < 3; i++)
-			intel_de_write(dev_priv, SWF3(dev_priv, i),
-				       dev_priv->regfile.saveSWF3[i]);
-	}
-}
-
-void i915_save_display(struct drm_i915_private *dev_priv)
-{
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-
-	if (!HAS_DISPLAY(dev_priv))
-		return;
-
-	/* Display arbitration control */
-	if (GRAPHICS_VER(dev_priv) <= 4)
-		dev_priv->regfile.saveDSPARB = intel_de_read(dev_priv,
-							     DSPARB(dev_priv));
-
-	if (GRAPHICS_VER(dev_priv) == 4)
-		pci_read_config_word(pdev, GCDGMBUS,
-				     &dev_priv->regfile.saveGCDGMBUS);
-
-	intel_save_swf(dev_priv);
-}
-
-void i915_restore_display(struct drm_i915_private *dev_priv)
-{
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-
-	if (!HAS_DISPLAY(dev_priv))
-		return;
-
-	intel_restore_swf(dev_priv);
-
-	if (GRAPHICS_VER(dev_priv) == 4)
-		pci_write_config_word(pdev, GCDGMBUS,
-				      dev_priv->regfile.saveGCDGMBUS);
-
-	/* Display arbitration */
-	if (GRAPHICS_VER(dev_priv) <= 4)
-		intel_de_write(dev_priv, DSPARB(dev_priv),
-			       dev_priv->regfile.saveDSPARB);
-}
drivers/gpu/drm/i915/i915_suspend.h deleted +0 -14
deleted file mode 100644
index e5a611ee3d15..000000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright © 2019 Intel Corporation
- */
-
-#ifndef __I915_SUSPEND_H__
-#define __I915_SUSPEND_H__
-
-struct drm_i915_private;
-
-void i915_save_display(struct drm_i915_private *i915);
-void i915_restore_display(struct drm_i915_private *i915);
-
-#endif /* __I915_SUSPEND_H__ */
Signature · 1 line
Jani Nikula, Intel
Reviewed-by on v1 2/31
#7 lore raw

RE: [PATCH 02/31] drm/i915/display: Convert i915_suspend into i9xx_display_sr

In reply to Rodrigo Vivi

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Jesse Barnes <[email protected]>; Nikula, Jani <[email protected]>
Subject: [PATCH 02/31] drm/i915/display: Convert i915_suspend into i9xx_display_sr

Quoted 11 lines

These save & restore functions inside i915_suspend are old display functions to save and restore a bunch of display related registers.

Move it under display and rename accordantly. Just don't move it entirely towards intel_display struct yet because it depends on drm_i915_private for the IS_MOBILE.

While doing this conversion also update the MIT header using the new SPDX ones.

Quoted 6 lines

v2: Fix Makefile and include (Jani)
Removed vga and gmbus (Jani, Ville)

Cc Jesse Barnes <[email protected]>
Cc Jani Nikula <[email protected]>

LGTM.

-Jonathan Cavitt

Quoted 357 lines
---
 drivers/gpu/drm/i915/Makefile                 |   2 +-
 .../gpu/drm/i915/display/i9xx_display_sr.c    |  95 ++++++++++++
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  14 ++
 drivers/gpu/drm/i915/i915_driver.c            |   6 +-
 drivers/gpu/drm/i915/i915_suspend.c           | 135 ------------------
 drivers/gpu/drm/i915/i915_suspend.h           |  14 --
 6 files changed, 113 insertions(+), 153 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.c
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.h
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.c
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.h
drivers/gpu/drm/i915/Makefile +1 -1
index 70771e521b1c..f21c28d471e7 100644
@@ -30,7 +30,6 @@ i915-y += \
 	i915_params.o \
 	i915_pci.o \
 	i915_scatterlist.o \
-	i915_suspend.o \
 	i915_switcheroo.o \
 	i915_sysfs.o \
 	i915_utils.o \
@@ -219,6 +218,7 @@ i915-$(CONFIG_HWMON) += \
 i915-y += \
 	display/hsw_ips.o \
 	display/i9xx_plane.o \
+	display/i9xx_display_sr.o \
 	display/i9xx_wm.o \
 	display/intel_alpm.o \
 	display/intel_atomic.o \
drivers/gpu/drm/i915/display/i9xx_display_sr.c new file +95 -0
new file mode 100644
index 000000000000..4dd0ce267994
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#include "i915_drv.h"
+#include "i915_reg.h"
+#include "i9xx_display_sr.h"
+#include "intel_de.h"
+#include "intel_gmbus.h"
+#include "intel_pci_config.h"
+
+static void i9xx_display_save_swf(struct drm_i915_private *i915)
+{
+	int i;
+
+	/* Scratch space */
+	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
+		for (i = 0; i < 7; i++) {
+			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
+			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+		}
+		for (i = 0; i < 3; i++)
+			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+	} else if (GRAPHICS_VER(i915) == 2) {
+		for (i = 0; i < 7; i++)
+			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+	} else if (HAS_GMCH(i915)) {
+		for (i = 0; i < 16; i++) {
+			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
+			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+		}
+		for (i = 0; i < 3; i++)
+			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+	}
+}
+
+static void i9xx_display_restore_swf(struct drm_i915_private *i915)
+{
+	int i;
+
+	/* Scratch space */
+	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
+		for (i = 0; i < 7; i++) {
+			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
+			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+		}
+		for (i = 0; i < 3; i++)
+			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+	} else if (GRAPHICS_VER(i915) == 2) {
+		for (i = 0; i < 7; i++)
+			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+	} else if (HAS_GMCH(i915)) {
+		for (i = 0; i < 16; i++) {
+			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
+			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+		}
+		for (i = 0; i < 3; i++)
+			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+	}
+}
+
+void i9xx_display_sr_save(struct drm_i915_private *i915)
+{
+	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+
+	if (!HAS_DISPLAY(i915))
+		return;
+
+	/* Display arbitration control */
+	if (GRAPHICS_VER(i915) <= 4)
+		i915->regfile.saveDSPARB = intel_de_read(i915, DSPARB(i915));
+
+	if (GRAPHICS_VER(i915) == 4)
+		pci_read_config_word(pdev, GCDGMBUS, &i915->regfile.saveGCDGMBUS);
+
+	i9xx_display_save_swf(i915);
+}
+
+void i9xx_display_sr_restore(struct drm_i915_private *i915)
+{
+	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+
+	if (!HAS_DISPLAY(i915))
+		return;
+
+	i9xx_display_restore_swf(i915);
+
+	if (GRAPHICS_VER(i915) == 4)
+		pci_write_config_word(pdev, GCDGMBUS, i915->regfile.saveGCDGMBUS);
+
+	/* Display arbitration */
+	if (GRAPHICS_VER(i915) <= 4)
+		intel_de_write(i915, DSPARB(i915), i915->regfile.saveDSPARB);
+}
drivers/gpu/drm/i915/display/i9xx_display_sr.h new file +14 -0
new file mode 100644
index 000000000000..30383758f97e
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#ifndef __I9XX_DISPLAY_SR_H__
+#define __I9XX_DISPLAY_SR_H__
+
+struct drm_i915_private;
+
+void i9xx_display_sr_save(struct drm_i915_private *i915);
+void i9xx_display_sr_restore(struct drm_i915_private *i915);
+
+#endif
drivers/gpu/drm/i915/i915_driver.c +3 -3
index c5ffcf229f42..ae5906885359 100644
@@ -45,6 +45,7 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
+#include "display/i9xx_display_sr.h"
 #include "display/intel_acpi.h"
 #include "display/intel_bw.h"
 #include "display/intel_cdclk.h"
@@ -94,7 +95,6 @@
 #include "i915_memcpy.h"
 #include "i915_perf.h"
 #include "i915_query.h"
-#include "i915_suspend.h"
 #include "i915_switcheroo.h"
 #include "i915_sysfs.h"
 #include "i915_utils.h"
@@ -1048,7 +1048,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 	intel_dpt_suspend(dev_priv);
 	i915_ggtt_suspend(to_gt(dev_priv)->ggtt);
 
-	i915_save_display(dev_priv);
+	i9xx_display_sr_save(dev_priv);
 
 	opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
 	intel_opregion_suspend(display, opregion_target_state);
@@ -1167,7 +1167,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_dmc_resume(display);
 
-	i915_restore_display(dev_priv);
+	i9xx_display_sr_restore(dev_priv);
 
 	intel_vga_redisable(display);
 
drivers/gpu/drm/i915/i915_suspend.c deleted +0 -135
deleted file mode 100644
index fb67b05cd864..000000000000
@@ -1,135 +0,0 @@
-/*
- *
- * Copyright 2008 (c) Intel Corporation
- *   Jesse Barnes <[email protected]>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "display/intel_de.h"
-#include "display/intel_gmbus.h"
-
-#include "i915_drv.h"
-#include "i915_reg.h"
-#include "i915_suspend.h"
-#include "intel_pci_config.h"
-
-static void intel_save_swf(struct drm_i915_private *dev_priv)
-{
-	int i;
-
-	/* Scratch space */
-	if (GRAPHICS_VER(dev_priv) == 2 && IS_MOBILE(dev_priv)) {
-		for (i = 0; i < 7; i++) {
-			dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv,
-								      SWF0(dev_priv, i));
-			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
-								      SWF1(dev_priv, i));
-		}
-		for (i = 0; i < 3; i++)
-			dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv,
-								      SWF3(dev_priv, i));
-	} else if (GRAPHICS_VER(dev_priv) == 2) {
-		for (i = 0; i < 7; i++)
-			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
-								      SWF1(dev_priv, i));
-	} else if (HAS_GMCH(dev_priv)) {
-		for (i = 0; i < 16; i++) {
-			dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv,
-								      SWF0(dev_priv, i));
-			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
-								      SWF1(dev_priv, i));
-		}
-		for (i = 0; i < 3; i++)
-			dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv,
-								      SWF3(dev_priv, i));
-	}
-}
-
-static void intel_restore_swf(struct drm_i915_private *dev_priv)
-{
-	int i;
-
-	/* Scratch space */
-	if (GRAPHICS_VER(dev_priv) == 2 && IS_MOBILE(dev_priv)) {
-		for (i = 0; i < 7; i++) {
-			intel_de_write(dev_priv, SWF0(dev_priv, i),
-				       dev_priv->regfile.saveSWF0[i]);
-			intel_de_write(dev_priv, SWF1(dev_priv, i),
-				       dev_priv->regfile.saveSWF1[i]);
-		}
-		for (i = 0; i < 3; i++)
-			intel_de_write(dev_priv, SWF3(dev_priv, i),
-				       dev_priv->regfile.saveSWF3[i]);
-	} else if (GRAPHICS_VER(dev_priv) == 2) {
-		for (i = 0; i < 7; i++)
-			intel_de_write(dev_priv, SWF1(dev_priv, i),
-				       dev_priv->regfile.saveSWF1[i]);
-	} else if (HAS_GMCH(dev_priv)) {
-		for (i = 0; i < 16; i++) {
-			intel_de_write(dev_priv, SWF0(dev_priv, i),
-				       dev_priv->regfile.saveSWF0[i]);
-			intel_de_write(dev_priv, SWF1(dev_priv, i),
-				       dev_priv->regfile.saveSWF1[i]);
-		}
-		for (i = 0; i < 3; i++)
-			intel_de_write(dev_priv, SWF3(dev_priv, i),
-				       dev_priv->regfile.saveSWF3[i]);
-	}
-}
-
-void i915_save_display(struct drm_i915_private *dev_priv)
-{
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-
-	if (!HAS_DISPLAY(dev_priv))
-		return;
-
-	/* Display arbitration control */
-	if (GRAPHICS_VER(dev_priv) <= 4)
-		dev_priv->regfile.saveDSPARB = intel_de_read(dev_priv,
-							     DSPARB(dev_priv));
-
-	if (GRAPHICS_VER(dev_priv) == 4)
-		pci_read_config_word(pdev, GCDGMBUS,
-				     &dev_priv->regfile.saveGCDGMBUS);
-
-	intel_save_swf(dev_priv);
-}
-
-void i915_restore_display(struct drm_i915_private *dev_priv)
-{
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-
-	if (!HAS_DISPLAY(dev_priv))
-		return;
-
-	intel_restore_swf(dev_priv);
-
-	if (GRAPHICS_VER(dev_priv) == 4)
-		pci_write_config_word(pdev, GCDGMBUS,
-				      dev_priv->regfile.saveGCDGMBUS);
-
-	/* Display arbitration */
-	if (GRAPHICS_VER(dev_priv) <= 4)
-		intel_de_write(dev_priv, DSPARB(dev_priv),
-			       dev_priv->regfile.saveDSPARB);
-}
drivers/gpu/drm/i915/i915_suspend.h deleted +0 -14
deleted file mode 100644
index e5a611ee3d15..000000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright © 2019 Intel Corporation
- */
-
-#ifndef __I915_SUSPEND_H__
-#define __I915_SUSPEND_H__
-
-struct drm_i915_private;
-
-void i915_save_display(struct drm_i915_private *i915);
-void i915_restore_display(struct drm_i915_private *i915);
-
-#endif /* __I915_SUSPEND_H__ */
Signature · 1 line
2.46.0
author maintainer
#8 lore raw

PATCH 3/31 drm/i915/display: Move regfile registers intel_display.restore

In reply to Rodrigo Vivi

The intel_display struct already has a place for save/restore stuff. Move the i915's regfile there since they are only related to display.

---
 .../gpu/drm/i915/display/i9xx_display_sr.c    | 40 ++++++++++---------
 .../gpu/drm/i915/display/intel_display_core.h |  5 +++
 drivers/gpu/drm/i915/i915_drv.h               |  9 -----
 3 files changed, 27 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/i9xx_display_sr.c +22 -18
index 4dd0ce267994..4c78b7165831 100644
@@ -12,56 +12,59 @@
 
 static void i9xx_display_save_swf(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	int i;
 
 	/* Scratch space */
 	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
 		for (i = 0; i < 7; i++) {
-			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
-			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
 		}
 		for (i = 0; i < 3; i++)
-			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));
 	} else if (GRAPHICS_VER(i915) == 2) {
 		for (i = 0; i < 7; i++)
-			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
 	} else if (HAS_GMCH(i915)) {
 		for (i = 0; i < 16; i++) {
-			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
-			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
 		}
 		for (i = 0; i < 3; i++)
-			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));
 	}
 }
 
 static void i9xx_display_restore_swf(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	int i;
 
 	/* Scratch space */
 	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
 		for (i = 0; i < 7; i++) {
-			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
-			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+			intel_de_write(display, SWF0(i915, i), display->restore.saveSWF0[i]);
+			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
 		}
 		for (i = 0; i < 3; i++)
-			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+			intel_de_write(display, SWF3(i915, i), display->restore.saveSWF3[i]);
 	} else if (GRAPHICS_VER(i915) == 2) {
 		for (i = 0; i < 7; i++)
-			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
 	} else if (HAS_GMCH(i915)) {
 		for (i = 0; i < 16; i++) {
-			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
-			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+			intel_de_write(display, SWF0(i915, i), display->restore.saveSWF0[i]);
+			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
 		}
 		for (i = 0; i < 3; i++)
-			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+			intel_de_write(display, SWF3(i915, i), display->restore.saveSWF3[i]);
 	}
 }
 
 void i9xx_display_sr_save(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 
 	if (!HAS_DISPLAY(i915))
@@ -69,16 +72,17 @@ void i9xx_display_sr_save(struct drm_i915_private *i915)
 
 	/* Display arbitration control */
 	if (GRAPHICS_VER(i915) <= 4)
-		i915->regfile.saveDSPARB = intel_de_read(i915, DSPARB(i915));
+		display->restore.saveDSPARB = intel_de_read(display, DSPARB(i915));
 
 	if (GRAPHICS_VER(i915) == 4)
-		pci_read_config_word(pdev, GCDGMBUS, &i915->regfile.saveGCDGMBUS);
+		pci_read_config_word(pdev, GCDGMBUS, &display->restore.saveGCDGMBUS);
 
 	i9xx_display_save_swf(i915);
 }
 
 void i9xx_display_sr_restore(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 
 	if (!HAS_DISPLAY(i915))
@@ -87,9 +91,9 @@ void i9xx_display_sr_restore(struct drm_i915_private *i915)
 	i9xx_display_restore_swf(i915);
 
 	if (GRAPHICS_VER(i915) == 4)
-		pci_write_config_word(pdev, GCDGMBUS, i915->regfile.saveGCDGMBUS);
+		pci_write_config_word(pdev, GCDGMBUS, display->restore.saveGCDGMBUS);
 
 	/* Display arbitration */
 	if (GRAPHICS_VER(i915) <= 4)
-		intel_de_write(i915, DSPARB(i915), i915->regfile.saveDSPARB);
+		intel_de_write(display, DSPARB(i915), display->restore.saveDSPARB);
 }
drivers/gpu/drm/i915/display/intel_display_core.h +5 -0
index 982dd9469195..2f4dfc8dbedc 100644
@@ -500,6 +500,11 @@ struct intel_display {
 		/* restore state for suspend/resume and display reset */
 		struct drm_atomic_state *modeset_state;
 		struct drm_modeset_acquire_ctx reset_ctx;
+		u32 saveDSPARB;
+		u32 saveSWF0[16];
+		u32 saveSWF1[16];
+		u32 saveSWF3[3];
+		u16 saveGCDGMBUS;
 	} restore;
 
 	struct {
drivers/gpu/drm/i915/i915_drv.h +0 -9
index def3ca135406..9030ea7d54b1 100644
@@ -101,14 +101,6 @@ struct i915_dsm {
 	resource_size_t usable_size;
 };
 
-struct i915_suspend_saved_registers {
-	u32 saveDSPARB;
-	u32 saveSWF0[16];
-	u32 saveSWF1[16];
-	u32 saveSWF3[3];
-	u16 saveGCDGMBUS;
-};
-
 #define MAX_L3_SLICES 2
 struct intel_l3_parity {
 	u32 *remap_info[MAX_L3_SLICES];
@@ -291,7 +283,6 @@ struct drm_i915_private {
 	struct i915_gpu_error gpu_error;
 
 	u32 suspend_count;
-	struct i915_suspend_saved_registers regfile;
 	struct vlv_s0ix_state *vlv_s0ix_state;
 
 	struct dram_info {
Signature · 1 line
2.46.0
Reviewed-by on v1 3/31
#9 lore raw

RE: [PATCH 03/31] drm/i915/display: Move regfile registers intel_display.restore

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 03/31] drm/i915/display: Move regfile registers intel_display.restore

Quoted 6 lines

The intel_display struct already has a place for save/restore stuff. Move the i915's regfile there since they are only related to display.

There's probably an argument to be made that this patch and the previous one should've been squashed together, but I think this separation is fine, as this patch does do something distinct from the prior one (component relocation vs. suspend depreciation).

LGTM.

-Jonathan Cavitt

Quoted 163 lines
---
 .../gpu/drm/i915/display/i9xx_display_sr.c    | 40 ++++++++++---------
 .../gpu/drm/i915/display/intel_display_core.h |  5 +++
 drivers/gpu/drm/i915/i915_drv.h               |  9 -----
 3 files changed, 27 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/i9xx_display_sr.c +22 -18
index 4dd0ce267994..4c78b7165831 100644
@@ -12,56 +12,59 @@
 
 static void i9xx_display_save_swf(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	int i;
 
 	/* Scratch space */
 	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
 		for (i = 0; i < 7; i++) {
-			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
-			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
 		}
 		for (i = 0; i < 3; i++)
-			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));
 	} else if (GRAPHICS_VER(i915) == 2) {
 		for (i = 0; i < 7; i++)
-			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
 	} else if (HAS_GMCH(i915)) {
 		for (i = 0; i < 16; i++) {
-			i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));
-			i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));
+			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
 		}
 		for (i = 0; i < 3; i++)
-			i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));
+			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));
 	}
 }
 
 static void i9xx_display_restore_swf(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	int i;
 
 	/* Scratch space */
 	if (GRAPHICS_VER(i915) == 2 && IS_MOBILE(i915)) {
 		for (i = 0; i < 7; i++) {
-			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
-			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+			intel_de_write(display, SWF0(i915, i), display->restore.saveSWF0[i]);
+			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
 		}
 		for (i = 0; i < 3; i++)
-			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+			intel_de_write(display, SWF3(i915, i), display->restore.saveSWF3[i]);
 	} else if (GRAPHICS_VER(i915) == 2) {
 		for (i = 0; i < 7; i++)
-			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
 	} else if (HAS_GMCH(i915)) {
 		for (i = 0; i < 16; i++) {
-			intel_de_write(i915, SWF0(i915, i), i915->regfile.saveSWF0[i]);
-			intel_de_write(i915, SWF1(i915, i), i915->regfile.saveSWF1[i]);
+			intel_de_write(display, SWF0(i915, i), display->restore.saveSWF0[i]);
+			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
 		}
 		for (i = 0; i < 3; i++)
-			intel_de_write(i915, SWF3(i915, i), i915->regfile.saveSWF3[i]);
+			intel_de_write(display, SWF3(i915, i), display->restore.saveSWF3[i]);
 	}
 }
 
 void i9xx_display_sr_save(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 
 	if (!HAS_DISPLAY(i915))
@@ -69,16 +72,17 @@ void i9xx_display_sr_save(struct drm_i915_private *i915)
 
 	/* Display arbitration control */
 	if (GRAPHICS_VER(i915) <= 4)
-		i915->regfile.saveDSPARB = intel_de_read(i915, DSPARB(i915));
+		display->restore.saveDSPARB = intel_de_read(display, DSPARB(i915));
 
 	if (GRAPHICS_VER(i915) == 4)
-		pci_read_config_word(pdev, GCDGMBUS, &i915->regfile.saveGCDGMBUS);
+		pci_read_config_word(pdev, GCDGMBUS, &display->restore.saveGCDGMBUS);
 
 	i9xx_display_save_swf(i915);
 }
 
 void i9xx_display_sr_restore(struct drm_i915_private *i915)
 {
+	struct intel_display *display = &i915->display;
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 
 	if (!HAS_DISPLAY(i915))
@@ -87,9 +91,9 @@ void i9xx_display_sr_restore(struct drm_i915_private *i915)
 	i9xx_display_restore_swf(i915);
 
 	if (GRAPHICS_VER(i915) == 4)
-		pci_write_config_word(pdev, GCDGMBUS, i915->regfile.saveGCDGMBUS);
+		pci_write_config_word(pdev, GCDGMBUS, display->restore.saveGCDGMBUS);
 
 	/* Display arbitration */
 	if (GRAPHICS_VER(i915) <= 4)
-		intel_de_write(i915, DSPARB(i915), i915->regfile.saveDSPARB);
+		intel_de_write(display, DSPARB(i915), display->restore.saveDSPARB);
 }
drivers/gpu/drm/i915/display/intel_display_core.h +5 -0
index 982dd9469195..2f4dfc8dbedc 100644
@@ -500,6 +500,11 @@ struct intel_display {
 		/* restore state for suspend/resume and display reset */
 		struct drm_atomic_state *modeset_state;
 		struct drm_modeset_acquire_ctx reset_ctx;
+		u32 saveDSPARB;
+		u32 saveSWF0[16];
+		u32 saveSWF1[16];
+		u32 saveSWF3[3];
+		u16 saveGCDGMBUS;
 	} restore;
 
 	struct {
drivers/gpu/drm/i915/i915_drv.h +0 -9
index def3ca135406..9030ea7d54b1 100644
@@ -101,14 +101,6 @@ struct i915_dsm {
 	resource_size_t usable_size;
 };
 
-struct i915_suspend_saved_registers {
-	u32 saveDSPARB;
-	u32 saveSWF0[16];
-	u32 saveSWF1[16];
-	u32 saveSWF3[3];
-	u16 saveGCDGMBUS;
-};
-
 #define MAX_L3_SLICES 2
 struct intel_l3_parity {
 	u32 *remap_info[MAX_L3_SLICES];
@@ -291,7 +283,6 @@ struct drm_i915_private {
 	struct i915_gpu_error gpu_error;
 
 	u32 suspend_count;
-	struct i915_suspend_saved_registers regfile;
 	struct vlv_s0ix_state *vlv_s0ix_state;
 
 	struct dram_info {
Signature · 1 line
2.46.0
author maintainer
#10 lore raw

PATCH 4/31 drm/i915/display: Move shutdown sequences under display driver

In reply to Rodrigo Vivi

Move display related shutdown sequences from i915_driver to intel_display_driver.

No functional change. Just taking the right ownership and start some reconciliation of them between i915 and Xe.

---
 .../drm/i915/display/intel_display_driver.c   | 40 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  3 ++
 drivers/gpu/drm/i915/i915_driver.c            | 29 ++------------
 3 files changed, 47 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +40 -0
index c106fb2dd20b..e40b1105168e 100644
@@ -39,6 +39,7 @@
 #include "intel_dp_tunnel.h"
 #include "intel_dpll.h"
 #include "intel_dpll_mgr.h"
+#include "intel_encoder.h"
 #include "intel_fb.h"
 #include "intel_fbc.h"
 #include "intel_fbdev.h"
@@ -755,3 +756,42 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (state)
 		drm_atomic_state_put(state);
 }
+
+void intel_display_driver_shutdown(struct drm_i915_private *i915)
+{
+	intel_power_domains_disable(i915);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
+	if (HAS_DISPLAY(i915)) {
+		drm_kms_helper_poll_disable(&i915->drm);
+		intel_display_driver_disable_user_access(i915);
+
+		drm_atomic_helper_shutdown(&i915->drm);
+	}
+
+	intel_dp_mst_suspend(i915);
+}
+
+void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915)
+{
+	intel_hpd_cancel_work(i915);
+
+	if (HAS_DISPLAY(i915))
+		intel_display_driver_suspend_access(i915);
+
+	intel_encoder_suspend_all(&i915->display);
+	intel_encoder_shutdown_all(&i915->display);
+
+	intel_dmc_suspend(&i915->display);
+}
+
+void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915)
+{
+	/*
+	 * The only requirement is to reboot with display DC states disabled,
+	 * for now leaving all display power wells in the INIT power domain
+	 * enabled.
+	 */
+
+	intel_power_domains_driver_remove(i915);
+}
drivers/gpu/drm/i915/display/intel_display_driver.h +3 -0
index 42cc4af6d3fd..1ee37fb58d38 100644
@@ -26,6 +26,9 @@ void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 int intel_display_driver_suspend(struct drm_i915_private *i915);
 void intel_display_driver_resume(struct drm_i915_private *i915);
+void intel_display_driver_shutdown(struct drm_i915_private *i915);
+void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
+void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
 
 /* interface for intel_display_reset.c */
 int __intel_display_driver_resume(struct drm_i915_private *i915,
drivers/gpu/drm/i915/i915_driver.c +4 -25
index ae5906885359..38c845ad86e5 100644
@@ -939,43 +939,22 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
 {
 	disable_rpm_wakeref_asserts(&i915->runtime_pm);
 	intel_runtime_pm_disable(&i915->runtime_pm);
-	intel_power_domains_disable(i915);
 
-	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
-	if (HAS_DISPLAY(i915)) {
-		drm_kms_helper_poll_disable(&i915->drm);
-		intel_display_driver_disable_user_access(i915);
-
-		drm_atomic_helper_shutdown(&i915->drm);
-	}
-
-	intel_dp_mst_suspend(i915);
+	intel_display_driver_shutdown(i915);
 
 	intel_irq_suspend(i915);
-	intel_hpd_cancel_work(i915);
-
-	if (HAS_DISPLAY(i915))
-		intel_display_driver_suspend_access(i915);
 
-	intel_encoder_suspend_all(&i915->display);
-	intel_encoder_shutdown_all(&i915->display);
-
-	intel_dmc_suspend(&i915->display);
+	intel_display_driver_shutdown_noirq(i915);
 
 	i915_gem_suspend(i915);
 
-	/*
-	 * The only requirement is to reboot with display DC states disabled,
-	 * for now leaving all display power wells in the INIT power domain
-	 * enabled.
-	 *
-	 * TODO:
+	/* TODO:
 	 * - unify the pci_driver::shutdown sequence here with the
 	 *   pci_driver.driver.pm.poweroff,poweroff_late sequence.
 	 * - unify the driver remove and system/runtime suspend sequences with
 	 *   the above unified shutdown/poweroff sequence.
 	 */
-	intel_power_domains_driver_remove(i915);
+
 	enable_rpm_wakeref_asserts(&i915->runtime_pm);
 
 	intel_runtime_pm_driver_last_release(&i915->runtime_pm);
Signature · 1 line
2.46.0
Reviewed-by on v1 4/31
#11 lore raw

RE: [PATCH 04/31] drm/i915/display: Move shutdown sequences under display driver

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 04/31] drm/i915/display: Move shutdown sequences under display driver

Quoted 115 lines

Move display related shutdown sequences from i915_driver to intel_display_driver.

No functional change. Just taking the right ownership and start some reconciliation of them between i915 and Xe.

---
 .../drm/i915/display/intel_display_driver.c   | 40 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  3 ++
 drivers/gpu/drm/i915/i915_driver.c            | 29 ++------------
 3 files changed, 47 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +40 -0
index c106fb2dd20b..e40b1105168e 100644
@@ -39,6 +39,7 @@
 #include "intel_dp_tunnel.h"
 #include "intel_dpll.h"
 #include "intel_dpll_mgr.h"
+#include "intel_encoder.h"
 #include "intel_fb.h"
 #include "intel_fbc.h"
 #include "intel_fbdev.h"
@@ -755,3 +756,42 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (state)
 		drm_atomic_state_put(state);
 }
+
+void intel_display_driver_shutdown(struct drm_i915_private *i915)
+{
+	intel_power_domains_disable(i915);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
+	if (HAS_DISPLAY(i915)) {
+		drm_kms_helper_poll_disable(&i915->drm);
+		intel_display_driver_disable_user_access(i915);
+
+		drm_atomic_helper_shutdown(&i915->drm);
+	}
+
+	intel_dp_mst_suspend(i915);
+}
+
+void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915)
+{
+	intel_hpd_cancel_work(i915);
+
+	if (HAS_DISPLAY(i915))
+		intel_display_driver_suspend_access(i915);
+
+	intel_encoder_suspend_all(&i915->display);
+	intel_encoder_shutdown_all(&i915->display);
+
+	intel_dmc_suspend(&i915->display);
+}
+
+void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915)
+{
+	/*
+	 * The only requirement is to reboot with display DC states disabled,
+	 * for now leaving all display power wells in the INIT power domain
+	 * enabled.
+	 */
+
+	intel_power_domains_driver_remove(i915);
+}
drivers/gpu/drm/i915/display/intel_display_driver.h +3 -0
index 42cc4af6d3fd..1ee37fb58d38 100644
@@ -26,6 +26,9 @@ void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 int intel_display_driver_suspend(struct drm_i915_private *i915);
 void intel_display_driver_resume(struct drm_i915_private *i915);
+void intel_display_driver_shutdown(struct drm_i915_private *i915);
+void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
+void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
 
 /* interface for intel_display_reset.c */
 int __intel_display_driver_resume(struct drm_i915_private *i915,
drivers/gpu/drm/i915/i915_driver.c +2 -18
index ae5906885359..38c845ad86e5 100644
@@ -939,43 +939,22 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
 {
 	disable_rpm_wakeref_asserts(&i915->runtime_pm);
 	intel_runtime_pm_disable(&i915->runtime_pm);
-	intel_power_domains_disable(i915);
 
-	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
-	if (HAS_DISPLAY(i915)) {
-		drm_kms_helper_poll_disable(&i915->drm);
-		intel_display_driver_disable_user_access(i915);
-
-		drm_atomic_helper_shutdown(&i915->drm);
-	}
-
-	intel_dp_mst_suspend(i915);
+	intel_display_driver_shutdown(i915);
 
 	intel_irq_suspend(i915);
-	intel_hpd_cancel_work(i915);
-
-	if (HAS_DISPLAY(i915))
-		intel_display_driver_suspend_access(i915);
 
-	intel_encoder_suspend_all(&i915->display);
-	intel_encoder_shutdown_all(&i915->display);
-
-	intel_dmc_suspend(&i915->display);
+	intel_display_driver_shutdown_noirq(i915);

drivers/gpu/drm/i915/i915_driver.c void i915_driver_shutdown(struct drm_i915_private *i915) · line 951

Quoted 10 lines
drivers/gpu/drm/i915/i915_driver.c +1 -6
 
 	i915_gem_suspend(i915);
 
-	/*
-	 * The only requirement is to reboot with display DC states disabled,
-	 * for now leaving all display power wells in the INIT power domain
-	 * enabled.
-	 *
-	 * TODO:
+	/* TODO:

I think it's supposed to be:

"""

	/*
	 * TODO:

"""
But otherwise:

-Jonathan Cavitt

Quoted 14 lines
drivers/gpu/drm/i915/i915_driver.c +1 -1
 	 * - unify the pci_driver::shutdown sequence here with the
 	 *   pci_driver.driver.pm.poweroff,poweroff_late sequence.
 	 * - unify the driver remove and system/runtime suspend sequences with
 	 *   the above unified shutdown/poweroff sequence.
 	 */
-	intel_power_domains_driver_remove(i915);
+
 	enable_rpm_wakeref_asserts(&i915->runtime_pm);
 
 	intel_runtime_pm_driver_last_release(&i915->runtime_pm);
Signature · 1 line
2.46.0
#12 lore raw

Re: [PATCH 04/31] drm/i915/display: Move shutdown sequences under display driver

In reply to Rodrigo Vivi
Quoted 121 lines · Rodrigo Vivi

Move display related shutdown sequences from i915_driver to intel_display_driver.

No functional change. Just taking the right ownership and start some reconciliation of them between i915 and Xe.

---
 .../drm/i915/display/intel_display_driver.c   | 40 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  3 ++
 drivers/gpu/drm/i915/i915_driver.c            | 29 ++------------
 3 files changed, 47 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +40 -0
index c106fb2dd20b..e40b1105168e 100644
@@ -39,6 +39,7 @@
 #include "intel_dp_tunnel.h"
 #include "intel_dpll.h"
 #include "intel_dpll_mgr.h"
+#include "intel_encoder.h"
 #include "intel_fb.h"
 #include "intel_fbc.h"
 #include "intel_fbdev.h"
@@ -755,3 +756,42 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (state)
 		drm_atomic_state_put(state);
 }
+
+void intel_display_driver_shutdown(struct drm_i915_private *i915)
+{
+	intel_power_domains_disable(i915);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
+	if (HAS_DISPLAY(i915)) {
+		drm_kms_helper_poll_disable(&i915->drm);
+		intel_display_driver_disable_user_access(i915);
+
+		drm_atomic_helper_shutdown(&i915->drm);
+	}
+
+	intel_dp_mst_suspend(i915);
+}
+
+void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915)
+{
+	intel_hpd_cancel_work(i915);
+
+	if (HAS_DISPLAY(i915))
+		intel_display_driver_suspend_access(i915);
+
+	intel_encoder_suspend_all(&i915->display);
+	intel_encoder_shutdown_all(&i915->display);
+
+	intel_dmc_suspend(&i915->display);
+}
+
+void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915)
+{
+	/*
+	 * The only requirement is to reboot with display DC states disabled,
+	 * for now leaving all display power wells in the INIT power domain
+	 * enabled.
+	 */
+
+	intel_power_domains_driver_remove(i915);
+}
drivers/gpu/drm/i915/display/intel_display_driver.h +3 -0
index 42cc4af6d3fd..1ee37fb58d38 100644
@@ -26,6 +26,9 @@ void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 int intel_display_driver_suspend(struct drm_i915_private *i915);
 void intel_display_driver_resume(struct drm_i915_private *i915);
+void intel_display_driver_shutdown(struct drm_i915_private *i915);
+void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
+void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
 
 /* interface for intel_display_reset.c */
 int __intel_display_driver_resume(struct drm_i915_private *i915,
drivers/gpu/drm/i915/i915_driver.c +2 -22
index ae5906885359..38c845ad86e5 100644
@@ -939,43 +939,22 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
 {
 	disable_rpm_wakeref_asserts(&i915->runtime_pm);
 	intel_runtime_pm_disable(&i915->runtime_pm);
-	intel_power_domains_disable(i915);
 
-	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
-	if (HAS_DISPLAY(i915)) {
-		drm_kms_helper_poll_disable(&i915->drm);
-		intel_display_driver_disable_user_access(i915);
-
-		drm_atomic_helper_shutdown(&i915->drm);
-	}
-
-	intel_dp_mst_suspend(i915);
+	intel_display_driver_shutdown(i915);
 
 	intel_irq_suspend(i915);
-	intel_hpd_cancel_work(i915);
-
-	if (HAS_DISPLAY(i915))
-		intel_display_driver_suspend_access(i915);
 
-	intel_encoder_suspend_all(&i915->display);
-	intel_encoder_shutdown_all(&i915->display);
-
-	intel_dmc_suspend(&i915->display);
+	intel_display_driver_shutdown_noirq(i915);
 
 	i915_gem_suspend(i915);
 
-	/*
-	 * The only requirement is to reboot with display DC states disabled,
-	 * for now leaving all display power wells in the INIT power domain
-	 * enabled.

drivers/gpu/drm/i915/i915_driver.c void i915_driver_shutdown(struct drm_i915_private *i915) · line 957

Quoted 10 lines
drivers/gpu/drm/i915/i915_driver.c +2 -3
-	 *
-	 * TODO:
+	/* TODO:
 	 * - unify the pci_driver::shutdown sequence here with the
 	 *   pci_driver.driver.pm.poweroff,poweroff_late sequence.
 	 * - unify the driver remove and system/runtime suspend sequences with
 	 *   the above unified shutdown/poweroff sequence.
 	 */
-	intel_power_domains_driver_remove(i915);
+

Should intel_display_driver_shutdown_nogem() be called here?

Quoted 6 lines
drivers/gpu/drm/i915/i915_driver.c +0 -0
 	enable_rpm_wakeref_asserts(&i915->runtime_pm);
 
 	intel_runtime_pm_driver_last_release(&i915->runtime_pm);
Signature · 1 line
2.46.0
author maintainer
#13 lore raw

PATCH 5/31 drm/xe: At shutdown disable commit helpers instead of flushing

In reply to Rodrigo Vivi

This aligns with the current i915 display sequence.

Cc Maarten Lankhort <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_display.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +3 -2
index 5cbee5040e91..0237d458078b 100644
@@ -10,6 +10,7 @@
 
 #include <drm/drm_drv.h>
 #include <drm/drm_managed.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <uapi/drm/xe_drm.h>
 
@@ -364,10 +365,10 @@ void xe_display_pm_shutdown(struct xe_device *xe)
 	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
 		intel_display_driver_disable_user_access(xe);
-		intel_display_driver_suspend(xe);
+
+		drm_atomic_helper_shutdown(&xe->drm);
 	}
 
-	xe_display_flush_cleanup_work(xe);
 	intel_dp_mst_suspend(xe);
 	intel_hpd_cancel_work(xe);
 
Signature · 1 line
2.46.0
Reviewed-by on v1 5/31
#14 lore raw

RE: [PATCH 05/31] drm/xe: At shutdown disable commit helpers instead of flushing

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Maarten Lankhort <[email protected]>
Subject: [PATCH 05/31] drm/xe: At shutdown disable commit helpers instead of flushing

Quoted 22 lines

This aligns with the current i915 display sequence.

Cc Maarten Lankhort <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_display.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +1 -0
index 5cbee5040e91..0237d458078b 100644
@@ -10,6 +10,7 @@
 
 #include <drm/drm_drv.h>
 #include <drm/drm_managed.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <uapi/drm/xe_drm.h>
 

drivers/gpu/drm/xe/display/xe_display.c void xe_display_pm_shutdown(struct xe_device *xe) · line 369

Quoted 6 lines
drivers/gpu/drm/xe/display/xe_display.c +2 -1
@@ -364,10 +365,10 @@ void xe_display_pm_shutdown(struct xe_device *xe)
 	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
 		intel_display_driver_disable_user_access(xe);
-		intel_display_driver_suspend(xe);
+
+		drm_atomic_helper_shutdown(&xe->drm);

Isn't this functionally equivalent? The only difference AFAICT is that previously we set the display.restore.modeset_state = state, where the state was the return value for drm_atomic_helper_shutdown.

drivers/gpu/drm/xe/display/xe_display.c void xe_display_pm_shutdown(struct xe_device *xe) · line 370

Quoted 3 lines
drivers/gpu/drm/xe/display/xe_display.c +0 -1
 	}
 
-	xe_display_flush_cleanup_work(xe);

And I'm guessing we're removing this line because it's a duplicate in the new execution path now?

I won't block on it.

-Jonathan Cavitt

Quoted 7 lines
drivers/gpu/drm/xe/display/xe_display.c +0 -0
 	intel_dp_mst_suspend(xe);
 	intel_hpd_cancel_work(xe);
 
Signature · 1 line
2.46.0
author maintainer
#15 lore raw

Re: [PATCH 05/31] drm/xe: At shutdown disable commit helpers instead of flushing

Quoted 27 lines · Jonathan

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Maarten Lankhort <[email protected]>
Subject: [PATCH 05/31] drm/xe: At shutdown disable commit helpers instead of flushing

Quoted 21 lines

This aligns with the current i915 display sequence.

Cc Maarten Lankhort <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_display.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +1 -0
index 5cbee5040e91..0237d458078b 100644
@@ -10,6 +10,7 @@
 
 #include <drm/drm_drv.h>
 #include <drm/drm_managed.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <uapi/drm/xe_drm.h>
 
Quoted 11 lines

drivers/gpu/drm/xe/display/xe_display.c void xe_display_pm_shutdown(struct xe_device *xe) · line 369

Quoted 7 lines
drivers/gpu/drm/xe/display/xe_display.c +2 -1
@@ -364,10 +365,10 @@ void xe_display_pm_shutdown(struct xe_device *xe)
 	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
 		intel_display_driver_disable_user_access(xe);
-		intel_display_driver_suspend(xe);
+
+		drm_atomic_helper_shutdown(&xe->drm);

Isn't this functionally equivalent? The only difference AFAICT is that previously we set the display.restore.modeset_state = state, where the state was the return value for drm_atomic_helper_shutdown.

well, both ends up in disabling all crtc, but with the current suspend there's unecessary duplication of the current atomic state. It is a shutdown so we don't need to restore anything later.

Quoted 7 lines

drivers/gpu/drm/xe/display/xe_display.c void xe_display_pm_shutdown(struct xe_device *xe) · line 370

Quoted 4 lines
drivers/gpu/drm/xe/display/xe_display.c +0 -1
 	}
 
-	xe_display_flush_cleanup_work(xe);

And I'm guessing we're removing this line because it's a duplicate in the new execution path now?

all the CRTCs are disabled at this point. This is not doing anything...

Quoted 12 lines

I won't block on it.

-Jonathan Cavitt

Quoted 7 lines
drivers/gpu/drm/xe/display/xe_display.c +0 -0
 	intel_dp_mst_suspend(xe);
 	intel_hpd_cancel_work(xe);
 
Signature · 1 line
2.46.0
author maintainer
#16 lore raw

PATCH 6/31 drm/xe: Use i915-display shutdown sequence directly

In reply to Rodrigo Vivi

Start the xe-i915-display reconciliation by using the same shutdown sequences.

---
 drivers/gpu/drm/xe/display/xe_display.c | 46 +++++++------------------
 drivers/gpu/drm/xe/display/xe_display.h |  5 +--
 drivers/gpu/drm/xe/xe_device.c          |  4 ++-
 3 files changed, 19 insertions(+), 36 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +13 -33
index 0237d458078b..b5a2a09e7a71 100644
@@ -10,7 +10,6 @@
 
 #include <drm/drm_drv.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <uapi/drm/xe_drm.h>
 
@@ -355,32 +354,26 @@ void xe_display_pm_suspend(struct xe_device *xe)
 
 void xe_display_pm_shutdown(struct xe_device *xe)
 {
-	struct intel_display *display = &xe->display;
-
 	if (!xe->info.probe_display)
 		return;
 
-	intel_power_domains_disable(xe);
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
-	if (has_display(xe)) {
-		drm_kms_helper_poll_disable(&xe->drm);
-		intel_display_driver_disable_user_access(xe);
-
-		drm_atomic_helper_shutdown(&xe->drm);
-	}
-
-	intel_dp_mst_suspend(xe);
-	intel_hpd_cancel_work(xe);
+	intel_display_driver_shutdown(xe);
+}
 
-	if (has_display(xe))
-		intel_display_driver_suspend_access(xe);
+void xe_display_pm_shutdown_noirq(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
 
-	intel_encoder_suspend_all(display);
-	intel_encoder_shutdown_all(display);
+	intel_display_driver_shutdown_noirq(xe);
+}
 
-	intel_opregion_suspend(display, PCI_D3cold);
+void xe_display_pm_shutdown_noaccel(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
 
-	intel_dmc_suspend(display);
+	intel_display_driver_shutdown_nogem(xe);
 }
 
 void xe_display_pm_runtime_suspend(struct xe_device *xe)
@@ -405,19 +398,6 @@ void xe_display_pm_suspend_late(struct xe_device *xe)
 	intel_display_power_suspend_late(xe);
 }
 
-void xe_display_pm_shutdown_late(struct xe_device *xe)
-{
-	if (!xe->info.probe_display)
-		return;
-
-	/*
-	 * The only requirement is to reboot with display DC states disabled,
-	 * for now leaving all display power wells in the INIT power domain
-	 * enabled.
-	 */
-	intel_power_domains_driver_remove(xe);
-}
-
 void xe_display_pm_resume_early(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
drivers/gpu/drm/xe/display/xe_display.h +3 -2
index 17afa537aee5..a801db19b64f 100644
@@ -35,9 +35,10 @@ void xe_display_irq_reset(struct xe_device *xe);
 void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt);
 
 void xe_display_pm_suspend(struct xe_device *xe);
-void xe_display_pm_shutdown(struct xe_device *xe);
 void xe_display_pm_suspend_late(struct xe_device *xe);
-void xe_display_pm_shutdown_late(struct xe_device *xe);
+void xe_display_pm_shutdown(struct xe_device *xe);
+void xe_display_pm_shutdown_noirq(struct xe_device *xe);
+void xe_display_pm_shutdown_noaccel(struct xe_device *xe);
 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);
drivers/gpu/drm/xe/xe_device.c +3 -1
index cb5a9fd820cf..7c698b4b265b 100644
@@ -822,10 +822,12 @@ void xe_device_shutdown(struct xe_device *xe)
 
 		xe_irq_suspend(xe);
 
+		xe_display_pm_shutdown_noirq(xe);
+
 		for_each_gt(gt, xe, id)
 			xe_gt_shutdown(gt);
 
-		xe_display_pm_shutdown_late(xe);
+		xe_display_pm_shutdown_noaccel(xe);
 	} else {
 		/* BOOM! */
 		__xe_driver_flr(xe);
Signature · 1 line
2.46.0
Reviewed-by on v1 6/31
#17 lore raw

RE: [PATCH 06/31] drm/xe: Use i915-display shutdown sequence directly

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 06/31] drm/xe: Use i915-display shutdown sequence directly

Quoted 5 lines

Start the xe-i915-display reconciliation by using the same shutdown sequences.

LGTM.

-Jonathan Cavitt

Quoted 123 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 46 +++++++------------------
 drivers/gpu/drm/xe/display/xe_display.h |  5 +--
 drivers/gpu/drm/xe/xe_device.c          |  4 ++-
 3 files changed, 19 insertions(+), 36 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +13 -33
index 0237d458078b..b5a2a09e7a71 100644
@@ -10,7 +10,6 @@
 
 #include <drm/drm_drv.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <uapi/drm/xe_drm.h>
 
@@ -355,32 +354,26 @@ void xe_display_pm_suspend(struct xe_device *xe)
 
 void xe_display_pm_shutdown(struct xe_device *xe)
 {
-	struct intel_display *display = &xe->display;
-
 	if (!xe->info.probe_display)
 		return;
 
-	intel_power_domains_disable(xe);
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
-	if (has_display(xe)) {
-		drm_kms_helper_poll_disable(&xe->drm);
-		intel_display_driver_disable_user_access(xe);
-
-		drm_atomic_helper_shutdown(&xe->drm);
-	}
-
-	intel_dp_mst_suspend(xe);
-	intel_hpd_cancel_work(xe);
+	intel_display_driver_shutdown(xe);
+}
 
-	if (has_display(xe))
-		intel_display_driver_suspend_access(xe);
+void xe_display_pm_shutdown_noirq(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
 
-	intel_encoder_suspend_all(display);
-	intel_encoder_shutdown_all(display);
+	intel_display_driver_shutdown_noirq(xe);
+}
 
-	intel_opregion_suspend(display, PCI_D3cold);
+void xe_display_pm_shutdown_noaccel(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
 
-	intel_dmc_suspend(display);
+	intel_display_driver_shutdown_nogem(xe);
 }
 
 void xe_display_pm_runtime_suspend(struct xe_device *xe)
@@ -405,19 +398,6 @@ void xe_display_pm_suspend_late(struct xe_device *xe)
 	intel_display_power_suspend_late(xe);
 }
 
-void xe_display_pm_shutdown_late(struct xe_device *xe)
-{
-	if (!xe->info.probe_display)
-		return;
-
-	/*
-	 * The only requirement is to reboot with display DC states disabled,
-	 * for now leaving all display power wells in the INIT power domain
-	 * enabled.
-	 */
-	intel_power_domains_driver_remove(xe);
-}
-
 void xe_display_pm_resume_early(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
drivers/gpu/drm/xe/display/xe_display.h +3 -2
index 17afa537aee5..a801db19b64f 100644
@@ -35,9 +35,10 @@ void xe_display_irq_reset(struct xe_device *xe);
 void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt);
 
 void xe_display_pm_suspend(struct xe_device *xe);
-void xe_display_pm_shutdown(struct xe_device *xe);
 void xe_display_pm_suspend_late(struct xe_device *xe);
-void xe_display_pm_shutdown_late(struct xe_device *xe);
+void xe_display_pm_shutdown(struct xe_device *xe);
+void xe_display_pm_shutdown_noirq(struct xe_device *xe);
+void xe_display_pm_shutdown_noaccel(struct xe_device *xe);
 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);
drivers/gpu/drm/xe/xe_device.c +3 -1
index cb5a9fd820cf..7c698b4b265b 100644
@@ -822,10 +822,12 @@ void xe_device_shutdown(struct xe_device *xe)
 
 		xe_irq_suspend(xe);
 
+		xe_display_pm_shutdown_noirq(xe);
+
 		for_each_gt(gt, xe, id)
 			xe_gt_shutdown(gt);
 
-		xe_display_pm_shutdown_late(xe);
+		xe_display_pm_shutdown_noaccel(xe);
 	} else {
 		/* BOOM! */
 		__xe_driver_flr(xe);
Signature · 1 line
2.46.0
author maintainer
#18 lore raw

PATCH 7/31 drm/{i915, xe}/display: Move DP MST calls to display_driver

In reply to Rodrigo Vivi

Move dp_mst suspend/resume functions from the drivers towards intel_display_driver to continue with the unification.

---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 6 ++++++
 drivers/gpu/drm/i915/i915_driver.c                  | 4 ----
 drivers/gpu/drm/xe/display/xe_display.c             | 7 -------
 3 files changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +6 -0
index e40b1105168e..51fc1c148283 100644
@@ -676,6 +676,9 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 			ret);
 	else
 		i915->display.restore.modeset_state = state;
+
+	intel_dp_mst_suspend(i915);
+
 	return ret;
 }
 
@@ -729,6 +732,9 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	/* MST sideband requires HPD interrupts enabled */
+	intel_dp_mst_resume(i915);
+
 	i915->display.restore.modeset_state = NULL;
 	if (state)
 		state->acquire_ctx = &ctx;
drivers/gpu/drm/i915/i915_driver.c +0 -4
index 38c845ad86e5..d166a8164b42 100644
@@ -1013,8 +1013,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 
 	intel_display_driver_suspend(dev_priv);
 
-	intel_dp_mst_suspend(dev_priv);
-
 	intel_irq_suspend(dev_priv);
 	intel_hpd_cancel_work(dev_priv);
 
@@ -1182,8 +1180,6 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_hpd_init(dev_priv);
 
-	/* MST sideband requires HPD interrupts enabled */
-	intel_dp_mst_resume(dev_priv);
 	intel_display_driver_resume(dev_priv);
 
 	if (HAS_DISPLAY(dev_priv)) {
drivers/gpu/drm/xe/display/xe_display.c +0 -7
index b5a2a09e7a71..bc5c00437ab3 100644
@@ -332,9 +332,6 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 
 	xe_display_flush_cleanup_work(xe);
 
-	if (!runtime)
-		intel_dp_mst_suspend(xe);
-
 	intel_hpd_cancel_work(xe);
 
 	if (!runtime && has_display(xe)) {
@@ -426,10 +423,6 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 	if (!runtime && has_display(xe))
 		intel_display_driver_resume_access(xe);
 
-	/* MST sideband requires HPD interrupts enabled */
-	if (!runtime)
-		intel_dp_mst_resume(xe);
-
 	if (!runtime && has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
Signature · 1 line
2.46.0
Reviewed-by on v1 7/31
#19 lore raw

RE: [PATCH 07/31] drm/{i915, xe}/display: Move DP MST calls to display_driver

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 07/31] drm/{i915, xe}/display: Move DP MST calls to display_driver

Quoted 5 lines

Move dp_mst suspend/resume functions from the drivers towards intel_display_driver to continue with the unification.

There's probably an argument to be made that this should be two patches, one for each platform, but I think it's fine.

-Jonathan Cavitt

Quoted 81 lines
---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 6 ++++++
 drivers/gpu/drm/i915/i915_driver.c                  | 4 ----
 drivers/gpu/drm/xe/display/xe_display.c             | 7 -------
 3 files changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +6 -0
index e40b1105168e..51fc1c148283 100644
@@ -676,6 +676,9 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 			ret);
 	else
 		i915->display.restore.modeset_state = state;
+
+	intel_dp_mst_suspend(i915);
+
 	return ret;
 }
 
@@ -729,6 +732,9 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	/* MST sideband requires HPD interrupts enabled */
+	intel_dp_mst_resume(i915);
+
 	i915->display.restore.modeset_state = NULL;
 	if (state)
 		state->acquire_ctx = &ctx;
drivers/gpu/drm/i915/i915_driver.c +0 -4
index 38c845ad86e5..d166a8164b42 100644
@@ -1013,8 +1013,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 
 	intel_display_driver_suspend(dev_priv);
 
-	intel_dp_mst_suspend(dev_priv);
-
 	intel_irq_suspend(dev_priv);
 	intel_hpd_cancel_work(dev_priv);
 
@@ -1182,8 +1180,6 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_hpd_init(dev_priv);
 
-	/* MST sideband requires HPD interrupts enabled */
-	intel_dp_mst_resume(dev_priv);
 	intel_display_driver_resume(dev_priv);
 
 	if (HAS_DISPLAY(dev_priv)) {
drivers/gpu/drm/xe/display/xe_display.c +0 -7
index b5a2a09e7a71..bc5c00437ab3 100644
@@ -332,9 +332,6 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 
 	xe_display_flush_cleanup_work(xe);
 
-	if (!runtime)
-		intel_dp_mst_suspend(xe);
-
 	intel_hpd_cancel_work(xe);
 
 	if (!runtime && has_display(xe)) {
@@ -426,10 +423,6 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 	if (!runtime && has_display(xe))
 		intel_display_driver_resume_access(xe);
 
-	/* MST sideband requires HPD interrupts enabled */
-	if (!runtime)
-		intel_dp_mst_resume(xe);
-
 	if (!runtime && has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
Signature · 1 line
2.46.0
author maintainer
#20 lore raw

PATCH 8/31 drm/i915/display: Move suspend sequences to intel_display_driver

In reply to Rodrigo Vivi

The goal is to reconcile the Xe and i915 PM functions. Start by moving the display sequences from i915_drv towards intel_display_driver.

---
 .../drm/i915/display/intel_display_driver.c   | 20 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  3 +++
 drivers/gpu/drm/i915/i915_driver.c            | 14 ++-----------
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |  4 ++++
 4 files changed, 29 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +20 -0
index 51fc1c148283..42624bf80f91 100644
@@ -36,6 +36,7 @@
 #include "intel_dkl_phy.h"
 #include "intel_dmc.h"
 #include "intel_dp.h"
+#include "intel_dpt.h"
 #include "intel_dp_tunnel.h"
 #include "intel_dpll.h"
 #include "intel_dpll_mgr.h"
@@ -682,6 +683,25 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 	return ret;
 }
 
+void intel_display_driver_suspend_noirq(struct drm_i915_private *i915)
+{
+	intel_hpd_cancel_work(i915);
+
+	if (HAS_DISPLAY(i915))
+		intel_display_driver_suspend_access(i915);
+
+	intel_encoder_suspend_all(&i915->display);
+
+	/* Must be called before GGTT is suspended. */
+	intel_dpt_suspend(i915);
+}
+
+void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle)
+{
+	intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
+	intel_dmc_suspend(display);
+}
+
 int
 __intel_display_driver_resume(struct drm_i915_private *i915,
 			      struct drm_atomic_state *state,
drivers/gpu/drm/i915/display/intel_display_driver.h +3 -0
index 1ee37fb58d38..179fbb86923a 100644
@@ -12,6 +12,7 @@ struct drm_atomic_state;
 struct drm_i915_private;
 struct drm_modeset_acquire_ctx;
 struct pci_dev;
+struct intel_display;
 
 bool intel_display_driver_probe_defer(struct pci_dev *pdev);
 void intel_display_driver_init_hw(struct drm_i915_private *i915);
@@ -25,6 +26,8 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915);
 void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 int intel_display_driver_suspend(struct drm_i915_private *i915);
+void intel_display_driver_suspend_noirq(struct drm_i915_private *i915);
+void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle);
 void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +2 -12
index d166a8164b42..ac8bf00458b5 100644
@@ -996,7 +996,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_display *display = &dev_priv->display;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-	pci_power_t opregion_target_state;
 
 	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
@@ -1014,26 +1013,17 @@ static int i915_drm_suspend(struct drm_device *dev)
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
-	intel_hpd_cancel_work(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		intel_display_driver_suspend_access(dev_priv);
-
-	intel_encoder_suspend_all(&dev_priv->display);
+	intel_display_driver_suspend_noirq(dev_priv);
 
-	/* Must be called before GGTT is suspended. */
-	intel_dpt_suspend(dev_priv);
 	i915_ggtt_suspend(to_gt(dev_priv)->ggtt);
 
 	i9xx_display_sr_save(dev_priv);
 
-	opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
-	intel_opregion_suspend(display, opregion_target_state);
+	intel_display_driver_suspend_noggtt(display, suspend_to_idle(dev_priv));
 
 	dev_priv->suspend_count++;
 
-	intel_dmc_suspend(display);
-
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
 	i915_gem_drain_freed_objects(dev_priv);
drivers/gpu/drm/xe/display/xe_fb_pin.c +4 -0
index 79dbbbe03c7f..49dc91bdbcb0 100644
@@ -408,3 +408,7 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 {
 	return 0;
 }
+
+void intel_dpt_suspend(struct xe_device *xe)
+{
+}
Signature · 1 line
2.46.0
Reviewed-by on v1 8/31
#21 lore raw

RE: [PATCH 08/31] drm/i915/display: Move suspend sequences to intel_display_driver

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 08/31] drm/i915/display: Move suspend sequences to intel_display_driver

Quoted 118 lines

The goal is to reconcile the Xe and i915 PM functions. Start by moving the display sequences from i915_drv towards intel_display_driver.

---
 .../drm/i915/display/intel_display_driver.c   | 20 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  3 +++
 drivers/gpu/drm/i915/i915_driver.c            | 14 ++-----------
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |  4 ++++
 4 files changed, 29 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +20 -0
index 51fc1c148283..42624bf80f91 100644
@@ -36,6 +36,7 @@
 #include "intel_dkl_phy.h"
 #include "intel_dmc.h"
 #include "intel_dp.h"
+#include "intel_dpt.h"
 #include "intel_dp_tunnel.h"
 #include "intel_dpll.h"
 #include "intel_dpll_mgr.h"
@@ -682,6 +683,25 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 	return ret;
 }
 
+void intel_display_driver_suspend_noirq(struct drm_i915_private *i915)
+{
+	intel_hpd_cancel_work(i915);
+
+	if (HAS_DISPLAY(i915))
+		intel_display_driver_suspend_access(i915);
+
+	intel_encoder_suspend_all(&i915->display);
+
+	/* Must be called before GGTT is suspended. */
+	intel_dpt_suspend(i915);
+}
+
+void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle)
+{
+	intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
+	intel_dmc_suspend(display);
+}
+
 int
 __intel_display_driver_resume(struct drm_i915_private *i915,
 			      struct drm_atomic_state *state,
drivers/gpu/drm/i915/display/intel_display_driver.h +3 -0
index 1ee37fb58d38..179fbb86923a 100644
@@ -12,6 +12,7 @@ struct drm_atomic_state;
 struct drm_i915_private;
 struct drm_modeset_acquire_ctx;
 struct pci_dev;
+struct intel_display;
 
 bool intel_display_driver_probe_defer(struct pci_dev *pdev);
 void intel_display_driver_init_hw(struct drm_i915_private *i915);
@@ -25,6 +26,8 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915);
 void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 int intel_display_driver_suspend(struct drm_i915_private *i915);
+void intel_display_driver_suspend_noirq(struct drm_i915_private *i915);
+void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle);
 void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +2 -12
index d166a8164b42..ac8bf00458b5 100644
@@ -996,7 +996,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_display *display = &dev_priv->display;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
-	pci_power_t opregion_target_state;
 
 	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
@@ -1014,26 +1013,17 @@ static int i915_drm_suspend(struct drm_device *dev)
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
-	intel_hpd_cancel_work(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		intel_display_driver_suspend_access(dev_priv);
-
-	intel_encoder_suspend_all(&dev_priv->display);
+	intel_display_driver_suspend_noirq(dev_priv);
 
-	/* Must be called before GGTT is suspended. */
-	intel_dpt_suspend(dev_priv);
 	i915_ggtt_suspend(to_gt(dev_priv)->ggtt);
 
 	i9xx_display_sr_save(dev_priv);
 
-	opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
-	intel_opregion_suspend(display, opregion_target_state);
+	intel_display_driver_suspend_noggtt(display, suspend_to_idle(dev_priv));
 
 	dev_priv->suspend_count++;
 
-	intel_dmc_suspend(display);
-
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
 	i915_gem_drain_freed_objects(dev_priv);
drivers/gpu/drm/xe/display/xe_fb_pin.c +0 -0
index 79dbbbe03c7f..49dc91bdbcb0 100644

drivers/gpu/drm/xe/display/xe_fb_pin.c u64 intel_dpt_offset(struct i915_vma *dpt_vma) · line 414

Quoted 7 lines
drivers/gpu/drm/xe/display/xe_fb_pin.c +4 -0
@@ -408,3 +408,7 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 {
 	return 0;
 }
+
+void intel_dpt_suspend(struct xe_device *xe)
+{
+}

I can't really tell why this is being disabled here. Maybe this can be broken into a separate patch with an explanation for why this is being done?

Something similar is done in patch 14 with intel_dpt_resume, so perhaps both changes can be collected together in the same patch?

I won't block on it, but I am curious.

-Jonathan Cavitt

Quoted 4 lines
Signature · 1 line
2.46.0
author maintainer
#22 lore raw

PATCH 9/31 drm/xe/display: Delay hpd_init resume

In reply to Rodrigo Vivi

Align with i915 and only initialize hotplugs after the display driver access has been resumed.

---
 drivers/gpu/drm/xe/display/xe_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/display/xe_display.c +2 -1
index bc5c00437ab3..be431d9907df 100644
@@ -418,11 +418,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 		drm_mode_config_reset(&xe->drm);
 
 	intel_display_driver_init_hw(xe);
-	intel_hpd_init(xe);
 
 	if (!runtime && has_display(xe))
 		intel_display_driver_resume_access(xe);
 
+	intel_hpd_init(xe);
+
 	if (!runtime && has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
Signature · 1 line
2.46.0
Reviewed-by on v1 9/31
#23 lore raw

RE: [PATCH 09/31] drm/xe/display: Delay hpd_init resume

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 09/31] drm/xe/display: Delay hpd_init resume

Quoted 5 lines

Align with i915 and only initialize hotplugs after the display driver access has been resumed.

LGTM.

-Jonathan Cavitt

Quoted 26 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/display/xe_display.c +2 -1
index bc5c00437ab3..be431d9907df 100644
@@ -418,11 +418,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 		drm_mode_config_reset(&xe->drm);
 
 	intel_display_driver_init_hw(xe);
-	intel_hpd_init(xe);
 
 	if (!runtime && has_display(xe))
 		intel_display_driver_resume_access(xe);
 
+	intel_hpd_init(xe);
+
 	if (!runtime && has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
Signature · 1 line
2.46.0
author maintainer
#24 lore raw

PATCH 10/31 drm/xe/display: Spin-off xe_display runtime/d3cold sequences

In reply to Rodrigo Vivi

No functional change. This patch only splits the xe_display_pm suspend/resume functions in the regular suspend/resume from the runtime/d3cold ones.

---
 drivers/gpu/drm/xe/display/xe_display.c | 68 ++++++++++++++++---------
 1 file changed, 45 insertions(+), 23 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +45 -23
index be431d9907df..a4705a452adb 100644
@@ -308,8 +308,41 @@ static void xe_display_flush_cleanup_work(struct xe_device *xe)
 	}
 }
 
-/* TODO: System and runtime suspend/resume sequences will be sanitized as a follow-up. */
-static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
+static void xe_display_to_d3cold(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(xe);
+
+	xe_display_flush_cleanup_work(xe);
+
+	intel_hpd_cancel_work(xe);
+
+	intel_opregion_suspend(display, PCI_D3cold);
+
+	intel_dmc_suspend(display);
+}
+
+static void xe_display_from_d3cold(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+
+	intel_dmc_resume(display);
+
+	if (has_display(xe))
+		drm_mode_config_reset(&xe->drm);
+
+	intel_display_driver_init_hw(xe);
+
+	intel_hpd_init(xe);
+
+	intel_opregion_resume(display);
+
+	intel_power_domains_enable(xe);
+}
+
+void xe_display_pm_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 	bool s2idle = suspend_to_idle();
@@ -321,10 +354,10 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	 * properly.
 	 */
 	intel_power_domains_disable(xe);
-	if (!runtime)
-		intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
 
-	if (!runtime && has_display(xe)) {
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
+
+	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
 		intel_display_driver_disable_user_access(xe);
 		intel_display_driver_suspend(xe);
@@ -334,7 +367,7 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 
 	intel_hpd_cancel_work(xe);
 
-	if (!runtime && has_display(xe)) {
+	if (has_display(xe)) {
 		intel_display_driver_suspend_access(xe);
 		intel_encoder_suspend_all(&xe->display);
 	}
@@ -344,11 +377,6 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	intel_dmc_suspend(display);
 }
 
-void xe_display_pm_suspend(struct xe_device *xe)
-{
-	__xe_display_pm_suspend(xe, false);
-}
-
 void xe_display_pm_shutdown(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -379,7 +407,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 		return;
 
 	if (xe->d3cold.allowed)
-		__xe_display_pm_suspend(xe, true);
+		xe_display_to_d3cold(xe);
 
 	intel_hpd_poll_enable(xe);
 }
@@ -405,7 +433,7 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 	intel_power_domains_resume(xe);
 }
 
-static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
+void xe_display_pm_resume(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 
@@ -419,12 +447,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 
 	intel_display_driver_init_hw(xe);
 
-	if (!runtime && has_display(xe))
+	if (has_display(xe))
 		intel_display_driver_resume_access(xe);
 
 	intel_hpd_init(xe);
 
-	if (!runtime && has_display(xe)) {
+	if (has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
 		intel_display_driver_enable_user_access(xe);
@@ -433,17 +461,11 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 
 	intel_opregion_resume(display);
 
-	if (!runtime)
-		intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
 
 	intel_power_domains_enable(xe);
 }
 
-void xe_display_pm_resume(struct xe_device *xe)
-{
-	__xe_display_pm_resume(xe, false);
-}
-
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -452,7 +474,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 	intel_hpd_poll_disable(xe);
 
 	if (xe->d3cold.allowed)
-		__xe_display_pm_resume(xe, true);
+		xe_display_from_d3cold(xe);
 }
 
 
Signature · 1 line
2.46.0
Reviewed-by on v1 10/31
#25 lore raw

RE: [PATCH 10/31] drm/xe/display: Spin-off xe_display runtime/d3cold sequences

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 10/31] drm/xe/display: Spin-off xe_display runtime/d3cold sequences

Quoted 43 lines

No functional change. This patch only splits the xe_display_pm suspend/resume functions in the regular suspend/resume from the runtime/d3cold ones.

---
 drivers/gpu/drm/xe/display/xe_display.c | 68 ++++++++++++++++---------
 1 file changed, 45 insertions(+), 23 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +23 -2
index be431d9907df..a4705a452adb 100644
@@ -308,8 +308,41 @@ static void xe_display_flush_cleanup_work(struct xe_device *xe)
 	}
 }
 
-/* TODO: System and runtime suspend/resume sequences will be sanitized as a follow-up. */
-static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
+static void xe_display_to_d3cold(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(xe);
+
+	xe_display_flush_cleanup_work(xe);
+
+	intel_hpd_cancel_work(xe);
+
+	intel_opregion_suspend(display, PCI_D3cold);
+
+	intel_dmc_suspend(display);
+}
+
+static void xe_display_from_d3cold(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+
+	intel_dmc_resume(display);
+
+	if (has_display(xe))

drivers/gpu/drm/xe/display/xe_display.c static void xe_display_flush_cleanup_work(struct xe_device *xe) · line 343

Quoted 10 lines
drivers/gpu/drm/xe/display/xe_display.c +10 -0
+		drm_mode_config_reset(&xe->drm);
+
+	intel_display_driver_init_hw(xe);
+
+	intel_hpd_init(xe);
+
+	intel_opregion_resume(display);
+
+	intel_power_domains_enable(xe);
+}

xe_display_to_d3cold and xe_display_from_d3cold sound like conversion functions that take an xe_display and return a d3cold, and vice versa, respectively. Perhaps we should consider a different naming scheme? Something like:

xe_display_enable_d3cold
xe_display_disable_d3cold

Also, we're going to need to move these functions in patch 31 later, so perhaps it would be for the best to put these functions in the correct place from the start?

I won't block on this, but do consider renaming these functions.

-Jonathan Cavitt

Quoted 105 lines
drivers/gpu/drm/xe/display/xe_display.c +12 -21
+
+void xe_display_pm_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 	bool s2idle = suspend_to_idle();
@@ -321,10 +354,10 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	 * properly.
 	 */
 	intel_power_domains_disable(xe);
-	if (!runtime)
-		intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
 
-	if (!runtime && has_display(xe)) {
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
+
+	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
 		intel_display_driver_disable_user_access(xe);
 		intel_display_driver_suspend(xe);
@@ -334,7 +367,7 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 
 	intel_hpd_cancel_work(xe);
 
-	if (!runtime && has_display(xe)) {
+	if (has_display(xe)) {
 		intel_display_driver_suspend_access(xe);
 		intel_encoder_suspend_all(&xe->display);
 	}
@@ -344,11 +377,6 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	intel_dmc_suspend(display);
 }
 
-void xe_display_pm_suspend(struct xe_device *xe)
-{
-	__xe_display_pm_suspend(xe, false);
-}
-
 void xe_display_pm_shutdown(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -379,7 +407,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 		return;
 
 	if (xe->d3cold.allowed)
-		__xe_display_pm_suspend(xe, true);
+		xe_display_to_d3cold(xe);
 
 	intel_hpd_poll_enable(xe);
 }
@@ -405,7 +433,7 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 	intel_power_domains_resume(xe);
 }
 
-static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
+void xe_display_pm_resume(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 
@@ -419,12 +447,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 
 	intel_display_driver_init_hw(xe);
 
-	if (!runtime && has_display(xe))
+	if (has_display(xe))
 		intel_display_driver_resume_access(xe);
 
 	intel_hpd_init(xe);
 
-	if (!runtime && has_display(xe)) {
+	if (has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
 		intel_display_driver_enable_user_access(xe);
@@ -433,17 +461,11 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 
 	intel_opregion_resume(display);
 
-	if (!runtime)
-		intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
 
 	intel_power_domains_enable(xe);
 }
 
-void xe_display_pm_resume(struct xe_device *xe)
-{
-	__xe_display_pm_resume(xe, false);
-}
-
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -452,7 +474,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 	intel_hpd_poll_disable(xe);
 
 	if (xe->d3cold.allowed)
-		__xe_display_pm_resume(xe, true);
+		xe_display_from_d3cold(xe);
 }
 
 
Signature · 1 line
2.46.0
#26 lore raw

Re: [PATCH 10/31] drm/xe/display: Spin-off xe_display runtime/d3cold sequences

In reply to Rodrigo Vivi
Quoted 19 lines · Rodrigo Vivi

No functional change. This patch only splits the xe_display_pm suspend/resume functions in the regular suspend/resume from the runtime/d3cold ones.

---
 drivers/gpu/drm/xe/display/xe_display.c | 68 ++++++++++++++++---------
 1 file changed, 45 insertions(+), 23 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +0 -2
index be431d9907df..a4705a452adb 100644
@@ -308,8 +308,41 @@ static void xe_display_flush_cleanup_work(struct xe_device *xe)
 	}
 }
 
-/* TODO: System and runtime suspend/resume sequences will be sanitized as a follow-up. */
-static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)

drivers/gpu/drm/xe/display/xe_display.c static void xe_display_flush_cleanup_work(struct xe_device *xe) · line 320

Quoted 10 lines
drivers/gpu/drm/xe/display/xe_display.c +10 -0
+static void xe_display_to_d3cold(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(xe);
+
+	xe_display_flush_cleanup_work(xe);
+
+	intel_hpd_cancel_work(xe);

This cancels a work synchronously that takes a runtime PM reference, so it could dead-lock. I know that xe adds a way to get an RPM reference in the runtime suspend/resume handlers, not sure if that's a good approach in general. Also, not sure if it's ok to to drop all interrupts - in intel_hpd_cancel_work() - here that got raised before runtime suspend, instead of handling them as expected. So I think intel_hpd_cancel_work() shouldn't be called here.

Quoted 4 lines
drivers/gpu/drm/xe/display/xe_display.c +4 -0
+
+	intel_opregion_suspend(display, PCI_D3cold);
+
+	intel_dmc_suspend(display);

drivers/gpu/drm/xe/display/xe_display.c static void xe_display_flush_cleanup_work(struct xe_device *xe) · line 334

Quoted 10 lines
drivers/gpu/drm/xe/display/xe_display.c +10 -0
+}
+
+static void xe_display_from_d3cold(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+
+	intel_dmc_resume(display);
+
+	if (has_display(xe))
+		drm_mode_config_reset(&xe->drm);

The above is the counterpart of intel_encoder_suspend_all() which is only called during system suspend.

Quoted 113 lines
drivers/gpu/drm/xe/display/xe_display.c +21 -21
+
+	intel_display_driver_init_hw(xe);
+
+	intel_hpd_init(xe);
+
+	intel_opregion_resume(display);
+
+	intel_power_domains_enable(xe);
+}
+
+void xe_display_pm_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 	bool s2idle = suspend_to_idle();
@@ -321,10 +354,10 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	 * properly.
 	 */
 	intel_power_domains_disable(xe);
-	if (!runtime)
-		intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
 
-	if (!runtime && has_display(xe)) {
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
+
+	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
 		intel_display_driver_disable_user_access(xe);
 		intel_display_driver_suspend(xe);
@@ -334,7 +367,7 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 
 	intel_hpd_cancel_work(xe);
 
-	if (!runtime && has_display(xe)) {
+	if (has_display(xe)) {
 		intel_display_driver_suspend_access(xe);
 		intel_encoder_suspend_all(&xe->display);
 	}
@@ -344,11 +377,6 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	intel_dmc_suspend(display);
 }
 
-void xe_display_pm_suspend(struct xe_device *xe)
-{
-	__xe_display_pm_suspend(xe, false);
-}
-
 void xe_display_pm_shutdown(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -379,7 +407,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 		return;
 
 	if (xe->d3cold.allowed)
-		__xe_display_pm_suspend(xe, true);
+		xe_display_to_d3cold(xe);
 
 	intel_hpd_poll_enable(xe);
 }
@@ -405,7 +433,7 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 	intel_power_domains_resume(xe);
 }
 
-static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
+void xe_display_pm_resume(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 
@@ -419,12 +447,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 
 	intel_display_driver_init_hw(xe);
 
-	if (!runtime && has_display(xe))
+	if (has_display(xe))
 		intel_display_driver_resume_access(xe);
 
 	intel_hpd_init(xe);
 
-	if (!runtime && has_display(xe)) {
+	if (has_display(xe)) {
 		intel_display_driver_resume(xe);
 		drm_kms_helper_poll_enable(&xe->drm);
 		intel_display_driver_enable_user_access(xe);
@@ -433,17 +461,11 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
 
 	intel_opregion_resume(display);
 
-	if (!runtime)
-		intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
 
 	intel_power_domains_enable(xe);
 }
 
-void xe_display_pm_resume(struct xe_device *xe)
-{
-	__xe_display_pm_resume(xe, false);
-}
-
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -452,7 +474,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 	intel_hpd_poll_disable(xe);
 
 	if (xe->d3cold.allowed)
-		__xe_display_pm_resume(xe, true);
+		xe_display_from_d3cold(xe);
 }
 
 
Signature · 1 line
2.46.0
author maintainer
#27 lore raw

PATCH 11/31 drm/{i915,xe}: Consolidate display resume functions

In reply to Rodrigo Vivi

Same sequences are currently executed by i915 and xe during system resume. Consolidate them in the intel_display_driver side.

---
 .../drm/i915/display/intel_display_driver.c    | 16 ++++++++++++++++
 drivers/gpu/drm/i915/i915_driver.c             | 17 -----------------
 drivers/gpu/drm/xe/display/xe_display.c        | 18 +-----------------
 3 files changed, 17 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +16 -0
index 42624bf80f91..86d6ebf0c82f 100644
@@ -752,6 +752,10 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_display_driver_resume_access(i915);
+
+	intel_hpd_init(i915);
+
 	/* MST sideband requires HPD interrupts enabled */
 	intel_dp_mst_resume(i915);
 
@@ -781,6 +785,18 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 			"Restoring old state failed with %i\n", ret);
 	if (state)
 		drm_atomic_state_put(state);
+
+	intel_display_driver_enable_user_access(i915);
+
+	drm_kms_helper_poll_enable(&i915->drm);
+
+	intel_hpd_poll_disable(i915);
+
+	intel_opregion_resume(&i915->display);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_RUNNING, false);
+
+	intel_power_domains_enable(i915);
 }
 
 void intel_display_driver_shutdown(struct drm_i915_private *i915)
drivers/gpu/drm/i915/i915_driver.c +0 -17
index ac8bf00458b5..ce2dd03136d3 100644
@@ -1165,25 +1165,8 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_clock_gating_init(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		intel_display_driver_resume_access(dev_priv);
-
-	intel_hpd_init(dev_priv);
-
 	intel_display_driver_resume(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv)) {
-		intel_display_driver_enable_user_access(dev_priv);
-		drm_kms_helper_poll_enable(dev);
-	}
-	intel_hpd_poll_disable(dev_priv);
-
-	intel_opregion_resume(display);
-
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
-
-	intel_power_domains_enable(dev_priv);
-
 	intel_gvt_resume(dev_priv);
 
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
drivers/gpu/drm/xe/display/xe_display.c +1 -17
index a4705a452adb..98ff603a1f84 100644
@@ -447,23 +447,7 @@ void xe_display_pm_resume(struct xe_device *xe)
 
 	intel_display_driver_init_hw(xe);
 
-	if (has_display(xe))
-		intel_display_driver_resume_access(xe);
-
-	intel_hpd_init(xe);
-
-	if (has_display(xe)) {
-		intel_display_driver_resume(xe);
-		drm_kms_helper_poll_enable(&xe->drm);
-		intel_display_driver_enable_user_access(xe);
-		intel_hpd_poll_disable(xe);
-	}
-
-	intel_opregion_resume(display);
-
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
-
-	intel_power_domains_enable(xe);
+	intel_display_driver_resume(xe);
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
Reviewed-by on v1 11/31
#28 lore raw

RE: [PATCH 11/31] drm/{i915, xe}: Consolidate display resume functions

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 11/31] drm/{i915,xe}: Consolidate display resume functions

Quoted 33 lines

Same sequences are currently executed by i915 and xe during system resume. Consolidate them in the intel_display_driver side.

---
 .../drm/i915/display/intel_display_driver.c    | 16 ++++++++++++++++
 drivers/gpu/drm/i915/i915_driver.c             | 17 -----------------
 drivers/gpu/drm/xe/display/xe_display.c        | 18 +-----------------
 3 files changed, 17 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +6 -0
index 42624bf80f91..86d6ebf0c82f 100644
@@ -752,6 +752,10 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_display_driver_resume_access(i915);
+
+	intel_hpd_init(i915);
+
 	/* MST sideband requires HPD interrupts enabled */
 	intel_dp_mst_resume(i915);
 
@@ -781,6 +785,18 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 			"Restoring old state failed with %i\n", ret);
 	if (state)
 		drm_atomic_state_put(state);
+
+	intel_display_driver_enable_user_access(i915);

drivers/gpu/drm/i915/display/intel_display_driver.c void intel_display_driver_resume(struct drm_i915_private *i915) · line 799

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display_driver.c +10 -0
+
+	drm_kms_helper_poll_enable(&i915->drm);
+
+	intel_hpd_poll_disable(i915);
+
+	intel_opregion_resume(&i915->display);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_RUNNING, false);
+
+	intel_power_domains_enable(i915);

Hmm... It looks like everything here is being gated by HAS_DISPLAY, when it wasn't before in i915_drm_resume or xe_display_pm_resume. Is this correct behavior?

I'll trust your judgement on this.

-Jonathan Cavitt

Quoted 66 lines
drivers/gpu/drm/i915/display/intel_display_driver.c +0 -0
 }
 
 void intel_display_driver_shutdown(struct drm_i915_private *i915)
drivers/gpu/drm/i915/i915_driver.c +0 -17
index ac8bf00458b5..ce2dd03136d3 100644
@@ -1165,25 +1165,8 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_clock_gating_init(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		intel_display_driver_resume_access(dev_priv);
-
-	intel_hpd_init(dev_priv);
-
 	intel_display_driver_resume(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv)) {
-		intel_display_driver_enable_user_access(dev_priv);
-		drm_kms_helper_poll_enable(dev);
-	}
-	intel_hpd_poll_disable(dev_priv);
-
-	intel_opregion_resume(display);
-
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
-
-	intel_power_domains_enable(dev_priv);
-
 	intel_gvt_resume(dev_priv);
 
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
drivers/gpu/drm/xe/display/xe_display.c +1 -17
index a4705a452adb..98ff603a1f84 100644
@@ -447,23 +447,7 @@ void xe_display_pm_resume(struct xe_device *xe)
 
 	intel_display_driver_init_hw(xe);
 
-	if (has_display(xe))
-		intel_display_driver_resume_access(xe);
-
-	intel_hpd_init(xe);
-
-	if (has_display(xe)) {
-		intel_display_driver_resume(xe);
-		drm_kms_helper_poll_enable(&xe->drm);
-		intel_display_driver_enable_user_access(xe);
-		intel_hpd_poll_disable(xe);
-	}
-
-	intel_opregion_resume(display);
-
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
-
-	intel_power_domains_enable(xe);
+	intel_display_driver_resume(xe);
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
author maintainer
#29 lore raw

Re: [PATCH 11/31] drm/{i915, xe}: Consolidate display resume functions

Quoted 45 lines · Jonathan

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 11/31] drm/{i915,xe}: Consolidate display resume functions

Quoted 39 lines

Same sequences are currently executed by i915 and xe during system resume. Consolidate them in the intel_display_driver side.

---
 .../drm/i915/display/intel_display_driver.c    | 16 ++++++++++++++++
 drivers/gpu/drm/i915/i915_driver.c             | 17 -----------------
 drivers/gpu/drm/xe/display/xe_display.c        | 18 +-----------------
 3 files changed, 17 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +12 -0
index 42624bf80f91..86d6ebf0c82f 100644
@@ -752,6 +752,10 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_display_driver_resume_access(i915);
+
+	intel_hpd_init(i915);
+
 	/* MST sideband requires HPD interrupts enabled */
 	intel_dp_mst_resume(i915);
 
@@ -781,6 +785,18 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 			"Restoring old state failed with %i\n", ret);
 	if (state)
 		drm_atomic_state_put(state);
+
+	intel_display_driver_enable_user_access(i915);
+
+	drm_kms_helper_poll_enable(&i915->drm);
+
+	intel_hpd_poll_disable(i915);
+
+	intel_opregion_resume(&i915->display);
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display_driver.c void intel_display_driver_resume(struct drm_i915_private *i915) · line 799

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display_driver.c +4 -0
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_RUNNING, false);
+
+	intel_power_domains_enable(i915);

Hmm... It looks like everything here is being gated by HAS_DISPLAY, when it wasn't before in i915_drm_resume or xe_display_pm_resume. Is this correct behavior?

This is a very good question. I really dislike the sprinkled if HAS_DISPLAY s, and I hope this is okay...

Quoted 71 lines

I'll trust your judgement on this.

-Jonathan Cavitt

Quoted 66 lines
drivers/gpu/drm/i915/display/intel_display_driver.c +0 -0
 }
 
 void intel_display_driver_shutdown(struct drm_i915_private *i915)
drivers/gpu/drm/i915/i915_driver.c +0 -17
index ac8bf00458b5..ce2dd03136d3 100644
@@ -1165,25 +1165,8 @@ static int i915_drm_resume(struct drm_device *dev)
 
 	intel_clock_gating_init(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		intel_display_driver_resume_access(dev_priv);
-
-	intel_hpd_init(dev_priv);
-
 	intel_display_driver_resume(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv)) {
-		intel_display_driver_enable_user_access(dev_priv);
-		drm_kms_helper_poll_enable(dev);
-	}
-	intel_hpd_poll_disable(dev_priv);
-
-	intel_opregion_resume(display);
-
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
-
-	intel_power_domains_enable(dev_priv);
-
 	intel_gvt_resume(dev_priv);
 
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
drivers/gpu/drm/xe/display/xe_display.c +1 -17
index a4705a452adb..98ff603a1f84 100644
@@ -447,23 +447,7 @@ void xe_display_pm_resume(struct xe_device *xe)
 
 	intel_display_driver_init_hw(xe);
 
-	if (has_display(xe))
-		intel_display_driver_resume_access(xe);
-
-	intel_hpd_init(xe);
-
-	if (has_display(xe)) {
-		intel_display_driver_resume(xe);
-		drm_kms_helper_poll_enable(&xe->drm);
-		intel_display_driver_enable_user_access(xe);
-		intel_hpd_poll_disable(xe);
-	}
-
-	intel_opregion_resume(display);
-
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
-
-	intel_power_domains_enable(xe);
+	intel_display_driver_resume(xe);
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
author maintainer
#30 lore raw

PATCH 12/31 drm/i915: Remove lingering pci_save_state

In reply to Rodrigo Vivi

The pairing pci_restore_state was removed by commit 'b7e53aba2f0e ("drm/i915: remove restore in resume")' to fix a hardware hang in resume.

Furthermore, it looks like PCI subsystem should be taking care of the save and restore here.

Remove the lingering/stand-alone pci_save_state call.

Cc Anshuman Gupta <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_driver.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +0 -2
index ce2dd03136d3..4fc9d8bce1fd 100644
@@ -1008,8 +1008,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 		intel_display_driver_disable_user_access(dev_priv);
 	}
 
-	pci_save_state(pdev);
-
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
Signature · 1 line
2.46.0
Reviewed-by on v1 12/31
#31 lore raw

RE: [PATCH 12/31] drm/i915: Remove lingering pci_save_state

Quoted 33 lines

-----Original Message-----
From: Vivi, Rodrigo <[email protected]>
Sent: Wednesday, September 25, 2024 2:06 AM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Gupta, Anshuman <[email protected]>; Ville Syrjälä <[email protected]>
Subject: [PATCH 12/31] drm/i915: Remove lingering pci_save_state

The pairing pci_restore_state was removed by commit 'b7e53aba2f0e ("drm/i915: remove restore in resume")'
to fix a hardware hang in resume.

Furthermore, it looks like PCI subsystem should be taking care of the save and restore here.

Remove the lingering/stand-alone pci_save_state call.

Cc Anshuman Gupta <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/i915_driver.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +0 -0
index ce2dd03136d3..4fc9d8bce1fd 100644

drivers/gpu/drm/i915/i915_driver.c static int i915_drm_suspend(struct drm_device *dev) · line 1011

Quoted 4 lines
drivers/gpu/drm/i915/i915_driver.c +0 -1
@@ -1008,8 +1008,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 		intel_display_driver_disable_user_access(dev_priv);
 	}
 
-	pci_save_state(pdev);

Looks good to me!

Quoted 6 lines
drivers/gpu/drm/i915/i915_driver.c +0 -2
-
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
--

2.46.0

Reviewed-by Reviewed-by on v1 12/31
#32 lore raw

RE: [PATCH 12/31] drm/i915: Remove lingering pci_save_state

In reply to Rodrigo Vivi

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Gupta, Anshuman <[email protected]>; Ville Syrjälä <[email protected]>
Subject: [PATCH 12/31] drm/i915: Remove lingering pci_save_state

Quoted 5 lines

The pairing pci_restore_state was removed by commit 'b7e53aba2f0e ("drm/i915: remove restore in resume")' to fix a hardware hang in resume.

Quoted 8 lines

Furthermore, it looks like PCI subsystem should be taking care of the save and restore here.

Remove the lingering/stand-alone pci_save_state call.

Cc Anshuman Gupta <[email protected]>
Cc Ville Syrjälä <[email protected]>

LGTM. Though the wording of the commit message may initially confuse some people (me) into thinking pci_save_state is now unused and can have its definition removed, which is not the case. I can't think of any better alternatives, though, so I won't block on it.

-Jonathan Cavitt

Quoted 21 lines
---
 drivers/gpu/drm/i915/i915_driver.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +0 -2
index ce2dd03136d3..4fc9d8bce1fd 100644
@@ -1008,8 +1008,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 		intel_display_driver_disable_user_access(dev_priv);
 	}
 
-	pci_save_state(pdev);
-
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
Signature · 1 line
2.46.0
author maintainer
#33 lore raw

PATCH 13/31 drm/{i915,xe}: Consolidate display suspend functions

In reply to Rodrigo Vivi

Same sequences are currently executed by i915 and xe during system suspend. Consolidate them in the intel_display_driver side.

---
 .../gpu/drm/i915/display/intel_display_driver.c   |  9 +++++++++
 drivers/gpu/drm/i915/i915_driver.c                | 12 ------------
 drivers/gpu/drm/xe/display/xe_display.c           | 15 ++-------------
 3 files changed, 11 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +9 -0
index 86d6ebf0c82f..f509ed1503c1 100644
@@ -670,6 +670,15 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return 0;
 
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(i915);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
+
+	drm_kms_helper_poll_disable(&i915->drm);
+
+	intel_display_driver_disable_user_access(i915);
+
 	state = drm_atomic_helper_suspend(&i915->drm);
 	ret = PTR_ERR_OR_ZERO(state);
 	if (ret)
drivers/gpu/drm/i915/i915_driver.c +0 -12
index 4fc9d8bce1fd..12639fa232b3 100644
@@ -43,7 +43,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_probe_helper.h>
 
 #include "display/i9xx_display_sr.h"
 #include "display/intel_acpi.h"
@@ -55,7 +54,6 @@
 #include "display/intel_dp.h"
 #include "display/intel_dpt.h"
 #include "display/intel_encoder.h"
-#include "display/intel_fbdev.h"
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pch_refclk.h"
@@ -995,19 +993,9 @@ static int i915_drm_suspend(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_display *display = &dev_priv->display;
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
-	/* We do a lot of poking in a lot of registers, make sure they work
-	 * properly. */
-	intel_power_domains_disable(dev_priv);
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
-	if (HAS_DISPLAY(dev_priv)) {
-		drm_kms_helper_poll_disable(dev);
-		intel_display_driver_disable_user_access(dev_priv);
-	}
-
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
drivers/gpu/drm/xe/display/xe_display.c +2 -13
index 98ff603a1f84..45949b095d7e 100644
@@ -346,22 +346,11 @@ void xe_display_pm_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 	bool s2idle = suspend_to_idle();
+
 	if (!xe->info.probe_display)
 		return;
 
-	/*
-	 * We do a lot of poking in a lot of registers, make sure they work
-	 * properly.
-	 */
-	intel_power_domains_disable(xe);
-
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
-
-	if (has_display(xe)) {
-		drm_kms_helper_poll_disable(&xe->drm);
-		intel_display_driver_disable_user_access(xe);
-		intel_display_driver_suspend(xe);
-	}
+	intel_display_driver_suspend(xe);
 
 	xe_display_flush_cleanup_work(xe);
 
Signature · 1 line
2.46.0
Reviewed-by on v1 13/31
#34 lore raw

RE: [PATCH 13/31] drm/{i915,xe}: Consolidate display suspend functions

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 13/31] drm/{i915,xe}: Consolidate display suspend functions

Quoted 6 lines

Same sequences are currently executed by i915 and xe during system suspend. Consolidate them in the intel_display_driver side.

This is the third patch that could or perhaps should be split into two patches (I forgot to note it in patch 11) by i915 and xe.

I won't block on it, though.

-Jonathan Cavitt

Quoted 99 lines
---
 .../gpu/drm/i915/display/intel_display_driver.c   |  9 +++++++++
 drivers/gpu/drm/i915/i915_driver.c                | 12 ------------
 drivers/gpu/drm/xe/display/xe_display.c           | 15 ++-------------
 3 files changed, 11 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +9 -0
index 86d6ebf0c82f..f509ed1503c1 100644
@@ -670,6 +670,15 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return 0;
 
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(i915);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
+
+	drm_kms_helper_poll_disable(&i915->drm);
+
+	intel_display_driver_disable_user_access(i915);
+
 	state = drm_atomic_helper_suspend(&i915->drm);
 	ret = PTR_ERR_OR_ZERO(state);
 	if (ret)
drivers/gpu/drm/i915/i915_driver.c +0 -12
index 4fc9d8bce1fd..12639fa232b3 100644
@@ -43,7 +43,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_probe_helper.h>
 
 #include "display/i9xx_display_sr.h"
 #include "display/intel_acpi.h"
@@ -55,7 +54,6 @@
 #include "display/intel_dp.h"
 #include "display/intel_dpt.h"
 #include "display/intel_encoder.h"
-#include "display/intel_fbdev.h"
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pch_refclk.h"
@@ -995,19 +993,9 @@ static int i915_drm_suspend(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_display *display = &dev_priv->display;
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
-	/* We do a lot of poking in a lot of registers, make sure they work
-	 * properly. */
-	intel_power_domains_disable(dev_priv);
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
-	if (HAS_DISPLAY(dev_priv)) {
-		drm_kms_helper_poll_disable(dev);
-		intel_display_driver_disable_user_access(dev_priv);
-	}
-
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
drivers/gpu/drm/xe/display/xe_display.c +2 -13
index 98ff603a1f84..45949b095d7e 100644
@@ -346,22 +346,11 @@ void xe_display_pm_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 	bool s2idle = suspend_to_idle();
+
 	if (!xe->info.probe_display)
 		return;
 
-	/*
-	 * We do a lot of poking in a lot of registers, make sure they work
-	 * properly.
-	 */
-	intel_power_domains_disable(xe);
-
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
-
-	if (has_display(xe)) {
-		drm_kms_helper_poll_disable(&xe->drm);
-		intel_display_driver_disable_user_access(xe);
-		intel_display_driver_suspend(xe);
-	}
+	intel_display_driver_suspend(xe);
 
 	xe_display_flush_cleanup_work(xe);
 
Signature · 1 line
2.46.0
author maintainer
#35 lore raw

PATCH 14/31 drm/i915/display: Move resume sequences to intel_display_driver

In reply to Rodrigo Vivi

The goal is to reconcile the Xe and i915 PM functions. Continue by moving the display sequences related to system resume from i915_drv towards intel_display_driver.

---
 .../drm/i915/display/intel_display_driver.c   | 25 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  2 ++
 drivers/gpu/drm/i915/i915_driver.c            | 17 ++-----------
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |  4 +++
 4 files changed, 33 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +25 -0
index f509ed1503c1..2a171cb2613a 100644
@@ -53,6 +53,7 @@
 #include "intel_modeset_setup.h"
 #include "intel_opregion.h"
 #include "intel_overlay.h"
+#include "intel_pch_refclk.h"
 #include "intel_plane_initial.h"
 #include "intel_pmdemand.h"
 #include "intel_pps.h"
@@ -711,6 +712,30 @@ void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2i
 	intel_dmc_suspend(display);
 }
 
+void intel_display_driver_resume_noirq(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
+
+	/* Must be called after GGTT is resumed. */
+	intel_dpt_resume(i915);
+
+	intel_dmc_resume(display);
+
+	intel_vga_redisable(display);
+
+	intel_gmbus_reset(i915);
+
+	intel_pps_unlock_regs_wa(display);
+
+	intel_init_pch_refclk(i915);
+}
+
+void intel_display_driver_resume_nogem(struct intel_display *display)
+{
+	if (HAS_DISPLAY(display))
+		drm_mode_config_reset(display->drm);
+}
+
 int
 __intel_display_driver_resume(struct drm_i915_private *i915,
 			      struct drm_atomic_state *state,
drivers/gpu/drm/i915/display/intel_display_driver.h +2 -0
index 179fbb86923a..dec93f2f37c6 100644
@@ -29,6 +29,8 @@ int intel_display_driver_suspend(struct drm_i915_private *i915);
 void intel_display_driver_suspend_noirq(struct drm_i915_private *i915);
 void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle);
 void intel_display_driver_resume(struct drm_i915_private *i915);
+void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
+void intel_display_driver_resume_nogem(struct intel_display *display);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +2 -15
index 12639fa232b3..c9df361f898f 100644
@@ -56,7 +56,6 @@
 #include "display/intel_encoder.h"
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
-#include "display/intel_pch_refclk.h"
 #include "display/intel_pps.h"
 #include "display/intel_sprite_uapi.h"
 #include "display/intel_vga.h"
@@ -1115,20 +1114,9 @@ static int i915_drm_resume(struct drm_device *dev)
 		if (GRAPHICS_VER(gt->i915) >= 8)
 			setup_private_pat(gt);
 
-	/* Must be called after GGTT is resumed. */
-	intel_dpt_resume(dev_priv);
-
-	intel_dmc_resume(display);
-
 	i9xx_display_sr_restore(dev_priv);
 
-	intel_vga_redisable(display);
-
-	intel_gmbus_reset(dev_priv);
-
-	intel_pps_unlock_regs_wa(display);
-
-	intel_init_pch_refclk(dev_priv);
+	intel_display_driver_resume_noirq(dev_priv);
 
 	/*
 	 * Interrupts have to be enabled before any batches are run. If not the
@@ -1142,8 +1130,7 @@ static int i915_drm_resume(struct drm_device *dev)
 	 */
 	intel_irq_resume(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		drm_mode_config_reset(dev);
+	intel_display_driver_resume_nogem(display);
 
 	i915_gem_resume(dev_priv);
 
drivers/gpu/drm/xe/display/xe_fb_pin.c +4 -0
index 49dc91bdbcb0..c26a47dac332 100644
@@ -412,3 +412,7 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 void intel_dpt_suspend(struct xe_device *xe)
 {
 }
+
+void intel_dpt_resume(struct xe_device *xe)
+{
+}
Signature · 1 line
2.46.0
Reviewed-by on v1 14/31
#36 lore raw

RE: [PATCH 14/31] drm/i915/display: Move resume sequences to intel_display_driver

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 14/31] drm/i915/display: Move resume sequences to intel_display_driver

Quoted 118 lines

The goal is to reconcile the Xe and i915 PM functions. Continue by moving the display sequences related to system resume from i915_drv towards intel_display_driver.

---
 .../drm/i915/display/intel_display_driver.c   | 25 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  2 ++
 drivers/gpu/drm/i915/i915_driver.c            | 17 ++-----------
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |  4 +++
 4 files changed, 33 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +25 -0
index f509ed1503c1..2a171cb2613a 100644
@@ -53,6 +53,7 @@
 #include "intel_modeset_setup.h"
 #include "intel_opregion.h"
 #include "intel_overlay.h"
+#include "intel_pch_refclk.h"
 #include "intel_plane_initial.h"
 #include "intel_pmdemand.h"
 #include "intel_pps.h"
@@ -711,6 +712,30 @@ void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2i
 	intel_dmc_suspend(display);
 }
 
+void intel_display_driver_resume_noirq(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
+
+	/* Must be called after GGTT is resumed. */
+	intel_dpt_resume(i915);
+
+	intel_dmc_resume(display);
+
+	intel_vga_redisable(display);
+
+	intel_gmbus_reset(i915);
+
+	intel_pps_unlock_regs_wa(display);
+
+	intel_init_pch_refclk(i915);
+}
+
+void intel_display_driver_resume_nogem(struct intel_display *display)
+{
+	if (HAS_DISPLAY(display))
+		drm_mode_config_reset(display->drm);
+}
+
 int
 __intel_display_driver_resume(struct drm_i915_private *i915,
 			      struct drm_atomic_state *state,
drivers/gpu/drm/i915/display/intel_display_driver.h +2 -0
index 179fbb86923a..dec93f2f37c6 100644
@@ -29,6 +29,8 @@ int intel_display_driver_suspend(struct drm_i915_private *i915);
 void intel_display_driver_suspend_noirq(struct drm_i915_private *i915);
 void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle);
 void intel_display_driver_resume(struct drm_i915_private *i915);
+void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
+void intel_display_driver_resume_nogem(struct intel_display *display);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +2 -15
index 12639fa232b3..c9df361f898f 100644
@@ -56,7 +56,6 @@
 #include "display/intel_encoder.h"
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
-#include "display/intel_pch_refclk.h"
 #include "display/intel_pps.h"
 #include "display/intel_sprite_uapi.h"
 #include "display/intel_vga.h"
@@ -1115,20 +1114,9 @@ static int i915_drm_resume(struct drm_device *dev)
 		if (GRAPHICS_VER(gt->i915) >= 8)
 			setup_private_pat(gt);
 
-	/* Must be called after GGTT is resumed. */
-	intel_dpt_resume(dev_priv);
-
-	intel_dmc_resume(display);
-
 	i9xx_display_sr_restore(dev_priv);
 
-	intel_vga_redisable(display);
-
-	intel_gmbus_reset(dev_priv);
-
-	intel_pps_unlock_regs_wa(display);
-
-	intel_init_pch_refclk(dev_priv);
+	intel_display_driver_resume_noirq(dev_priv);
 
 	/*
 	 * Interrupts have to be enabled before any batches are run. If not the
@@ -1142,8 +1130,7 @@ static int i915_drm_resume(struct drm_device *dev)
 	 */
 	intel_irq_resume(dev_priv);
 
-	if (HAS_DISPLAY(dev_priv))
-		drm_mode_config_reset(dev);
+	intel_display_driver_resume_nogem(display);
 
 	i915_gem_resume(dev_priv);
 
drivers/gpu/drm/xe/display/xe_fb_pin.c +0 -0
index 49dc91bdbcb0..c26a47dac332 100644

drivers/gpu/drm/xe/display/xe_fb_pin.c u64 intel_dpt_offset(struct i915_vma *dpt_vma) · line 418

Quoted 7 lines
drivers/gpu/drm/xe/display/xe_fb_pin.c +4 -0
@@ -412,3 +412,7 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 void intel_dpt_suspend(struct xe_device *xe)
 {
 }
+
+void intel_dpt_resume(struct xe_device *xe)
+{
+}

See my note on patch 8. Otherwise:

-Jonathan Cavitt

Quoted 4 lines
Signature · 1 line
2.46.0
author maintainer
#37 lore raw

PATCH 15/31 drm/xe/display: Delay dsm handler registration

In reply to Rodrigo Vivi

Bring some consistency to register/unregister order at the same time it aligns with i915 sequence order.

---
 drivers/gpu/drm/xe/display/xe_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/display/xe_display.c +1 -1
index 45949b095d7e..e5df50221a04 100644
@@ -217,8 +217,8 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(xe);
-	intel_register_dsm_handler();
 	intel_power_domains_enable(xe);
+	intel_register_dsm_handler();
 }
 
 void xe_display_unregister(struct xe_device *xe)
Signature · 1 line
2.46.0
Reviewed-by on v1 15/31
#38 lore raw

RE: [PATCH 15/31] drm/xe/display: Delay dsm handler registration

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 15/31] drm/xe/display: Delay dsm handler registration

Quoted 5 lines

Bring some consistency to register/unregister order at the same time it aligns with i915 sequence order.

LGTM.

-Jonathan Cavitt

Quoted 22 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/display/xe_display.c +1 -1
index 45949b095d7e..e5df50221a04 100644
@@ -217,8 +217,8 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(xe);
-	intel_register_dsm_handler();
 	intel_power_domains_enable(xe);
+	intel_register_dsm_handler();
 }
 
 void xe_display_unregister(struct xe_device *xe)
Signature · 1 line
2.46.0
author maintainer
#39 lore raw

PATCH 16/31 drm/{i915, xe}: Move power_domains suspend/resume to display_power

In reply to Rodrigo Vivi

Move intel_power_domains_{suspend,resume} to inside intel_display_power_{suspend_late, resume_early}.

With this also change the VLV suspend failure to call the intel_display_power_resume_early. In the end, the only function executed there for VLV is the intel_power_domains_resume. Besides make the code more consistency give the call that was immediately before: intel_display_power_suspend_late.

---
 drivers/gpu/drm/i915/display/intel_display_power.c | 6 +++++-
 drivers/gpu/drm/i915/display/intel_display_power.h | 2 +-
 drivers/gpu/drm/i915/i915_driver.c                 | 8 ++------
 drivers/gpu/drm/xe/display/xe_display.c            | 7 ++-----
 4 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_display_power.c +5 -1
index ecabb674644b..923178a4ffe5 100644
@@ -2231,10 +2231,12 @@ static void intel_power_domains_verify_state(struct drm_i915_private *i915)
 
 #endif
 
-void intel_display_power_suspend_late(struct drm_i915_private *i915)
+void intel_display_power_suspend_late(struct drm_i915_private *i915, bool s2idle)
 {
 	struct intel_display *display = &i915->display;
 
+	intel_power_domains_suspend(i915, s2idle);
+
 	if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
 	    IS_BROXTON(i915)) {
 		bxt_enable_dc9(display);
@@ -2262,6 +2264,8 @@ void intel_display_power_resume_early(struct drm_i915_private *i915)
 	/* Tweaked Wa_14010685332:cnp,icp,jsp,mcc,tgp,adp */
 	if (INTEL_PCH_TYPE(i915) >= PCH_CNP && INTEL_PCH_TYPE(i915) < PCH_DG1)
 		intel_de_rmw(i915, SOUTH_CHICKEN1, SBCLK_RUN_REFCLK_DIS, 0);
+
+	intel_power_domains_resume(i915);
 }
 
 void intel_display_power_suspend(struct drm_i915_private *i915)
drivers/gpu/drm/i915/display/intel_display_power.h +1 -1
index 425452c5a469..ccac3c06b2f7 100644
@@ -176,7 +176,7 @@ void intel_power_domains_suspend(struct drm_i915_private *dev_priv, bool s2idle)
 void intel_power_domains_resume(struct drm_i915_private *dev_priv);
 void intel_power_domains_sanitize_state(struct drm_i915_private *dev_priv);
 
-void intel_display_power_suspend_late(struct drm_i915_private *i915);
+void intel_display_power_suspend_late(struct drm_i915_private *i915, bool s2idle);
 void intel_display_power_resume_early(struct drm_i915_private *i915);
 void intel_display_power_suspend(struct drm_i915_private *i915);
 void intel_display_power_resume(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +2 -6
index c9df361f898f..9e788e1c178e 100644
@@ -1034,14 +1034,12 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
 	for_each_gt(gt, dev_priv, i)
 		intel_uncore_suspend(gt->uncore);
 
-	intel_power_domains_suspend(dev_priv, s2idle);
-
-	intel_display_power_suspend_late(dev_priv);
+	intel_display_power_suspend_late(dev_priv, s2idle);
 
 	ret = vlv_suspend_complete(dev_priv);
 	if (ret) {
 		drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret);
-		intel_power_domains_resume(dev_priv);
+		intel_display_power_resume_early(dev_priv);
 
 		goto out;
 	}
@@ -1211,8 +1209,6 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	intel_display_power_resume_early(dev_priv);
 
-	intel_power_domains_resume(dev_priv);
-
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
 	return ret;
drivers/gpu/drm/xe/display/xe_display.c +2 -5
index e5df50221a04..d5be622f831b 100644
@@ -404,12 +404,11 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 void xe_display_pm_suspend_late(struct xe_device *xe)
 {
 	bool s2idle = suspend_to_idle();
+
 	if (!xe->info.probe_display)
 		return;
 
-	intel_power_domains_suspend(xe, s2idle);
-
-	intel_display_power_suspend_late(xe);
+	intel_display_power_suspend_late(xe, s2idle);
 }
 
 void xe_display_pm_resume_early(struct xe_device *xe)
@@ -418,8 +417,6 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 		return;
 
 	intel_display_power_resume_early(xe);
-
-	intel_power_domains_resume(xe);
 }
 
 void xe_display_pm_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
Reviewed-by on v1 16/31
#40 lore raw

RE: [PATCH 16/31] drm/{i915, xe}: Move power_domains suspend/resume to display_power

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 16/31] drm/{i915, xe}: Move power_domains suspend/resume to display_power

Quoted 11 lines

Move intel_power_domains_{suspend,resume} to inside intel_display_power_{suspend_late, resume_early}.

With this also change the VLV suspend failure to call the intel_display_power_resume_early. In the end, the only function executed there for VLV is the intel_power_domains_resume. Besides make the code more consistency give the call that was immediately before: intel_display_power_suspend_late.

Debatably, this should be done the other way around: Instead of putting intel_power_domains_resume as the last part of running intel_display_power_resume_early, we should be making intel_display_power_resume_early the first part of running intel_power_domains_resume. Same with intel_power_domains_suspend and its relation to intel_display_power_suspend_late.

Also, this patch may want to be split in two (for i915 and xe).

But I'll trust your judgement here.

-Jonathan Cavitt

Quoted 109 lines
---
 drivers/gpu/drm/i915/display/intel_display_power.c | 6 +++++-
 drivers/gpu/drm/i915/display/intel_display_power.h | 2 +-
 drivers/gpu/drm/i915/i915_driver.c                 | 8 ++------
 drivers/gpu/drm/xe/display/xe_display.c            | 7 ++-----
 4 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_display_power.c +5 -1
index ecabb674644b..923178a4ffe5 100644
@@ -2231,10 +2231,12 @@ static void intel_power_domains_verify_state(struct drm_i915_private *i915)
 
 #endif
 
-void intel_display_power_suspend_late(struct drm_i915_private *i915)
+void intel_display_power_suspend_late(struct drm_i915_private *i915, bool s2idle)
 {
 	struct intel_display *display = &i915->display;
 
+	intel_power_domains_suspend(i915, s2idle);
+
 	if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
 	    IS_BROXTON(i915)) {
 		bxt_enable_dc9(display);
@@ -2262,6 +2264,8 @@ void intel_display_power_resume_early(struct drm_i915_private *i915)
 	/* Tweaked Wa_14010685332:cnp,icp,jsp,mcc,tgp,adp */
 	if (INTEL_PCH_TYPE(i915) >= PCH_CNP && INTEL_PCH_TYPE(i915) < PCH_DG1)
 		intel_de_rmw(i915, SOUTH_CHICKEN1, SBCLK_RUN_REFCLK_DIS, 0);
+
+	intel_power_domains_resume(i915);
 }
 
 void intel_display_power_suspend(struct drm_i915_private *i915)
drivers/gpu/drm/i915/display/intel_display_power.h +1 -1
index 425452c5a469..ccac3c06b2f7 100644
@@ -176,7 +176,7 @@ void intel_power_domains_suspend(struct drm_i915_private *dev_priv, bool s2idle)
 void intel_power_domains_resume(struct drm_i915_private *dev_priv);
 void intel_power_domains_sanitize_state(struct drm_i915_private *dev_priv);
 
-void intel_display_power_suspend_late(struct drm_i915_private *i915);
+void intel_display_power_suspend_late(struct drm_i915_private *i915, bool s2idle);
 void intel_display_power_resume_early(struct drm_i915_private *i915);
 void intel_display_power_suspend(struct drm_i915_private *i915);
 void intel_display_power_resume(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +2 -6
index c9df361f898f..9e788e1c178e 100644
@@ -1034,14 +1034,12 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
 	for_each_gt(gt, dev_priv, i)
 		intel_uncore_suspend(gt->uncore);
 
-	intel_power_domains_suspend(dev_priv, s2idle);
-
-	intel_display_power_suspend_late(dev_priv);
+	intel_display_power_suspend_late(dev_priv, s2idle);
 
 	ret = vlv_suspend_complete(dev_priv);
 	if (ret) {
 		drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret);
-		intel_power_domains_resume(dev_priv);
+		intel_display_power_resume_early(dev_priv);
 
 		goto out;
 	}
@@ -1211,8 +1209,6 @@ static int i915_drm_resume_early(struct drm_device *dev)
 
 	intel_display_power_resume_early(dev_priv);
 
-	intel_power_domains_resume(dev_priv);
-
 	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
 	return ret;
drivers/gpu/drm/xe/display/xe_display.c +2 -5
index e5df50221a04..d5be622f831b 100644
@@ -404,12 +404,11 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 void xe_display_pm_suspend_late(struct xe_device *xe)
 {
 	bool s2idle = suspend_to_idle();
+
 	if (!xe->info.probe_display)
 		return;
 
-	intel_power_domains_suspend(xe, s2idle);
-
-	intel_display_power_suspend_late(xe);
+	intel_display_power_suspend_late(xe, s2idle);
 }
 
 void xe_display_pm_resume_early(struct xe_device *xe)
@@ -418,8 +417,6 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 		return;
 
 	intel_display_power_resume_early(xe);
-
-	intel_power_domains_resume(xe);
 }
 
 void xe_display_pm_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
author maintainer
#41 lore raw

PATCH 17/31 drm/{i915, xe}: Move remaining intel_power_domains to intel_display

In reply to Rodrigo Vivi

Consolidate the intel_power_domains calls under
intel_display_driver.

---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 9 +++++++++
 drivers/gpu/drm/i915/display/intel_display_driver.h | 1 +
 drivers/gpu/drm/i915/i915_driver.c                  | 4 +---
 drivers/gpu/drm/xe/display/xe_display.c             | 4 +---
 4 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +9 -0
index 2a171cb2613a..a64468e3a052 100644
@@ -563,6 +563,13 @@ void intel_display_driver_register(struct drm_i915_private *i915)
 
 	intel_display_device_info_print(DISPLAY_INFO(i915),
 					DISPLAY_RUNTIME_INFO(i915), &p);
+
+	intel_power_domains_enable(i915);
+}
+
+void intel_display_driver_cleanup(struct drm_i915_private *i915)
+{
+	intel_power_domains_cleanup(i915);
 }
 
 /* part #1: call before irq uninstall */
@@ -640,6 +647,8 @@ void intel_display_driver_unregister(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_power_domains_disable(i915);
+
 	drm_client_dev_unregister(&i915->drm);
 
 	/*
drivers/gpu/drm/i915/display/intel_display_driver.h +1 -0
index dec93f2f37c6..4b2c041667e0 100644
@@ -21,6 +21,7 @@ int intel_display_driver_probe_noirq(struct drm_i915_private *i915);
 int intel_display_driver_probe_nogem(struct drm_i915_private *i915);
 int intel_display_driver_probe(struct drm_i915_private *i915);
 void intel_display_driver_register(struct drm_i915_private *i915);
+void intel_display_driver_cleanup(struct drm_i915_private *i915);
 void intel_display_driver_remove(struct drm_i915_private *i915);
 void intel_display_driver_remove_noirq(struct drm_i915_private *i915);
 void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +1 -3
index 9e788e1c178e..53960326b68d 100644
@@ -281,7 +281,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
 static void i915_driver_late_release(struct drm_i915_private *dev_priv)
 {
 	intel_irq_fini(dev_priv);
-	intel_power_domains_cleanup(dev_priv);
+	intel_display_driver_cleanup(dev_priv);
 	i915_gem_cleanup_early(dev_priv);
 	intel_gt_driver_late_release_all(dev_priv);
 	intel_region_ttm_device_fini(dev_priv);
@@ -627,7 +627,6 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 
 	intel_display_driver_register(dev_priv);
 
-	intel_power_domains_enable(dev_priv);
 	intel_runtime_pm_enable(&dev_priv->runtime_pm);
 
 	intel_register_dsm_handler();
@@ -650,7 +649,6 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 	intel_unregister_dsm_handler();
 
 	intel_runtime_pm_disable(&dev_priv->runtime_pm);
-	intel_power_domains_disable(dev_priv);
 
 	intel_display_driver_unregister(dev_priv);
 
drivers/gpu/drm/xe/display/xe_display.c +1 -3
index d5be622f831b..df66e47daca3 100644
@@ -107,7 +107,7 @@ static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_power_domains_cleanup(xe);
+	intel_display_driver_cleanup(xe);
 }
 
 int xe_display_init_nommio(struct xe_device *xe)
@@ -217,7 +217,6 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(xe);
-	intel_power_domains_enable(xe);
 	intel_register_dsm_handler();
 }
 
@@ -227,7 +226,6 @@ void xe_display_unregister(struct xe_device *xe)
 		return;
 
 	intel_unregister_dsm_handler();
-	intel_power_domains_disable(xe);
 	intel_display_driver_unregister(xe);
 }
 
Signature · 1 line
2.46.0
Reviewed-by on v1 17/31
#42 lore raw

RE: [PATCH 17/31] drm/{i915, xe}: Move remaining intel_power_domains to intel_display

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 17/31] drm/{i915, xe}: Move remaining intel_power_domains to intel_display

Quoted 5 lines

Consolidate the intel_power_domains calls under
intel_display_driver.

LGTM. I'd suggest splitting this patch into i915 and xe parts, but for this patch in particular it might be a bit difficult.

-Jonathan Cavitt

Quoted 108 lines
---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 9 +++++++++
 drivers/gpu/drm/i915/display/intel_display_driver.h | 1 +
 drivers/gpu/drm/i915/i915_driver.c                  | 4 +---
 drivers/gpu/drm/xe/display/xe_display.c             | 4 +---
 4 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +9 -0
index 2a171cb2613a..a64468e3a052 100644
@@ -563,6 +563,13 @@ void intel_display_driver_register(struct drm_i915_private *i915)
 
 	intel_display_device_info_print(DISPLAY_INFO(i915),
 					DISPLAY_RUNTIME_INFO(i915), &p);
+
+	intel_power_domains_enable(i915);
+}
+
+void intel_display_driver_cleanup(struct drm_i915_private *i915)
+{
+	intel_power_domains_cleanup(i915);
 }
 
 /* part #1: call before irq uninstall */
@@ -640,6 +647,8 @@ void intel_display_driver_unregister(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_power_domains_disable(i915);
+
 	drm_client_dev_unregister(&i915->drm);
 
 	/*
drivers/gpu/drm/i915/display/intel_display_driver.h +1 -0
index dec93f2f37c6..4b2c041667e0 100644
@@ -21,6 +21,7 @@ int intel_display_driver_probe_noirq(struct drm_i915_private *i915);
 int intel_display_driver_probe_nogem(struct drm_i915_private *i915);
 int intel_display_driver_probe(struct drm_i915_private *i915);
 void intel_display_driver_register(struct drm_i915_private *i915);
+void intel_display_driver_cleanup(struct drm_i915_private *i915);
 void intel_display_driver_remove(struct drm_i915_private *i915);
 void intel_display_driver_remove_noirq(struct drm_i915_private *i915);
 void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +1 -3
index 9e788e1c178e..53960326b68d 100644
@@ -281,7 +281,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
 static void i915_driver_late_release(struct drm_i915_private *dev_priv)
 {
 	intel_irq_fini(dev_priv);
-	intel_power_domains_cleanup(dev_priv);
+	intel_display_driver_cleanup(dev_priv);
 	i915_gem_cleanup_early(dev_priv);
 	intel_gt_driver_late_release_all(dev_priv);
 	intel_region_ttm_device_fini(dev_priv);
@@ -627,7 +627,6 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 
 	intel_display_driver_register(dev_priv);
 
-	intel_power_domains_enable(dev_priv);
 	intel_runtime_pm_enable(&dev_priv->runtime_pm);
 
 	intel_register_dsm_handler();
@@ -650,7 +649,6 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 	intel_unregister_dsm_handler();
 
 	intel_runtime_pm_disable(&dev_priv->runtime_pm);
-	intel_power_domains_disable(dev_priv);
 
 	intel_display_driver_unregister(dev_priv);
 
drivers/gpu/drm/xe/display/xe_display.c +1 -3
index d5be622f831b..df66e47daca3 100644
@@ -107,7 +107,7 @@ static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_power_domains_cleanup(xe);
+	intel_display_driver_cleanup(xe);
 }
 
 int xe_display_init_nommio(struct xe_device *xe)
@@ -217,7 +217,6 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(xe);
-	intel_power_domains_enable(xe);
 	intel_register_dsm_handler();
 }
 
@@ -227,7 +226,6 @@ void xe_display_unregister(struct xe_device *xe)
 		return;
 
 	intel_unregister_dsm_handler();
-	intel_power_domains_disable(xe);
 	intel_display_driver_unregister(xe);
 }
 
Signature · 1 line
2.46.0
author maintainer
#43 lore raw

PATCH 18/31 drm/i915/display: Split resume_noirq calls for now

In reply to Rodrigo Vivi

Some functions are not yet called from Xe. Move them to a separate function that will be only used in i915 for now.

---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 10 ++++++++++
 drivers/gpu/drm/i915/display/intel_display_driver.h |  1 +
 drivers/gpu/drm/i915/i915_driver.c                  |  1 +
 3 files changed, 12 insertions(+)
drivers/gpu/drm/i915/display/intel_display_driver.c +10 -0
index a64468e3a052..85a51b9d49f8 100644
@@ -729,6 +729,16 @@ void intel_display_driver_resume_noirq(struct drm_i915_private *i915)
 	intel_dpt_resume(i915);
 
 	intel_dmc_resume(display);
+}
+
+/*
+ * TODO: Current sequences missing from Xe! Check and merge with above function.
+ *       DPT is also a missing case there, but the TODO is recorded as the
+ *       empty stub DPT functions inside Xe.
+ */
+void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
 
 	intel_vga_redisable(display);
 
drivers/gpu/drm/i915/display/intel_display_driver.h +1 -0
index 4b2c041667e0..e287574fcd35 100644
@@ -31,6 +31,7 @@ void intel_display_driver_suspend_noirq(struct drm_i915_private *i915);
 void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle);
 void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
+void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915);
 void intel_display_driver_resume_nogem(struct intel_display *display);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +1 -0
index 53960326b68d..65f885e03880 100644
@@ -1113,6 +1113,7 @@ static int i915_drm_resume(struct drm_device *dev)
 	i9xx_display_sr_restore(dev_priv);
 
 	intel_display_driver_resume_noirq(dev_priv);
+	intel_display_driver_resume_noirq_legacy(dev_priv);
 
 	/*
 	 * Interrupts have to be enabled before any batches are run. If not the
Signature · 1 line
2.46.0
Reviewed-by on v1 18/31
#44 lore raw

RE: [PATCH 18/31] drm/i915/display: Split resume_noirq calls for now

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 18/31] drm/i915/display: Split resume_noirq calls for now

Quoted 5 lines

Some functions are not yet called from Xe. Move them to a separate function that will be only used in i915 for now.

s/be only/only be
But otherwise:

-Jonathan Cavitt

Quoted 55 lines
---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 10 ++++++++++
 drivers/gpu/drm/i915/display/intel_display_driver.h |  1 +
 drivers/gpu/drm/i915/i915_driver.c                  |  1 +
 3 files changed, 12 insertions(+)
drivers/gpu/drm/i915/display/intel_display_driver.c +10 -0
index a64468e3a052..85a51b9d49f8 100644
@@ -729,6 +729,16 @@ void intel_display_driver_resume_noirq(struct drm_i915_private *i915)
 	intel_dpt_resume(i915);
 
 	intel_dmc_resume(display);
+}
+
+/*
+ * TODO: Current sequences missing from Xe! Check and merge with above function.
+ *       DPT is also a missing case there, but the TODO is recorded as the
+ *       empty stub DPT functions inside Xe.
+ */
+void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
 
 	intel_vga_redisable(display);
 
drivers/gpu/drm/i915/display/intel_display_driver.h +1 -0
index 4b2c041667e0..e287574fcd35 100644
@@ -31,6 +31,7 @@ void intel_display_driver_suspend_noirq(struct drm_i915_private *i915);
 void intel_display_driver_suspend_noggtt(struct intel_display *display, bool s2idle);
 void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
+void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915);
 void intel_display_driver_resume_nogem(struct intel_display *display);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +1 -0
index 53960326b68d..65f885e03880 100644
@@ -1113,6 +1113,7 @@ static int i915_drm_resume(struct drm_device *dev)
 	i9xx_display_sr_restore(dev_priv);
 
 	intel_display_driver_resume_noirq(dev_priv);
+	intel_display_driver_resume_noirq_legacy(dev_priv);
 
 	/*
 	 * Interrupts have to be enabled before any batches are run. If not the
Signature · 1 line
2.46.0
author maintainer
#45 lore raw

PATCH 19/31 drm/xe/display: Align display resume sequence with i915

In reply to Rodrigo Vivi

Resume DMC before resuming IRQ.
Reset mode_config before GT resume.
Use direct intel_display_driver functions for that.

---
 drivers/gpu/drm/xe/display/xe_display.c | 23 ++++++++++++++++-------
 drivers/gpu/drm/xe/display/xe_display.h |  2 ++
 drivers/gpu/drm/xe/xe_pm.c              |  4 ++++
 3 files changed, 22 insertions(+), 7 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +16 -7
index df66e47daca3..959635653cfb 100644
@@ -419,21 +419,30 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 
 void xe_display_pm_resume(struct xe_device *xe)
 {
-	struct intel_display *display = &xe->display;
-
 	if (!xe->info.probe_display)
 		return;
 
-	intel_dmc_resume(display);
-
-	if (has_display(xe))
-		drm_mode_config_reset(&xe->drm);
-
 	intel_display_driver_init_hw(xe);
 
 	intel_display_driver_resume(xe);
 }
 
+void xe_display_pm_resume_noirq(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	intel_display_driver_resume_noirq(xe);
+}
+
+void xe_display_pm_resume_noaccel(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	intel_display_driver_resume_nogem(&xe->display);
+}
+
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
drivers/gpu/drm/xe/display/xe_display.h +2 -0
index a801db19b64f..b4ed5b598c2d 100644
@@ -41,6 +41,8 @@ void xe_display_pm_shutdown_noirq(struct xe_device *xe);
 void xe_display_pm_shutdown_noaccel(struct xe_device *xe);
 void xe_display_pm_resume_early(struct xe_device *xe);
 void xe_display_pm_resume(struct xe_device *xe);
+void xe_display_pm_resume_noirq(struct xe_device *xe);
+void xe_display_pm_resume_noaccel(struct xe_device *xe);
 void xe_display_pm_runtime_suspend(struct xe_device *xe);
 void xe_display_pm_runtime_resume(struct xe_device *xe);
 
drivers/gpu/drm/xe/xe_pm.c +4 -0
index 33eb039053e4..f5d89c326d46 100644
@@ -182,8 +182,12 @@ int xe_pm_resume(struct xe_device *xe)
 	if (err)
 		goto err;
 
+	xe_display_pm_resume_noirq(xe);
+
 	xe_irq_resume(xe);
 
+	xe_display_pm_resume_noaccel(xe);
+
 	for_each_gt(gt, xe, id)
 		xe_gt_resume(gt);
 
Signature · 1 line
2.46.0
Reviewed-by on v1 19/31
#46 lore raw

RE: [PATCH 19/31] drm/xe/display: Align display resume sequence with i915

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 19/31] drm/xe/display: Align display resume sequence with i915

Quoted 6 lines

Resume DMC before resuming IRQ.
Reset mode_config before GT resume.
Use direct intel_display_driver functions for that.

This looks fine, though it also looks like two different changes:
1. The change to xe_display_pm_resume
2. The addition and use of xe_display_pm_resume_noirq and xe_display_pm_resume_noaccel

I won't say these changes need to be separated, but it might be worth considering.

-Jonathan Cavitt

Quoted 82 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 23 ++++++++++++++++-------
 drivers/gpu/drm/xe/display/xe_display.h |  2 ++
 drivers/gpu/drm/xe/xe_pm.c              |  4 ++++
 3 files changed, 22 insertions(+), 7 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +16 -7
index df66e47daca3..959635653cfb 100644
@@ -419,21 +419,30 @@ void xe_display_pm_resume_early(struct xe_device *xe)
 
 void xe_display_pm_resume(struct xe_device *xe)
 {
-	struct intel_display *display = &xe->display;
-
 	if (!xe->info.probe_display)
 		return;
 
-	intel_dmc_resume(display);
-
-	if (has_display(xe))
-		drm_mode_config_reset(&xe->drm);
-
 	intel_display_driver_init_hw(xe);
 
 	intel_display_driver_resume(xe);
 }
 
+void xe_display_pm_resume_noirq(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	intel_display_driver_resume_noirq(xe);
+}
+
+void xe_display_pm_resume_noaccel(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	intel_display_driver_resume_nogem(&xe->display);
+}
+
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
drivers/gpu/drm/xe/display/xe_display.h +2 -0
index a801db19b64f..b4ed5b598c2d 100644
@@ -41,6 +41,8 @@ void xe_display_pm_shutdown_noirq(struct xe_device *xe);
 void xe_display_pm_shutdown_noaccel(struct xe_device *xe);
 void xe_display_pm_resume_early(struct xe_device *xe);
 void xe_display_pm_resume(struct xe_device *xe);
+void xe_display_pm_resume_noirq(struct xe_device *xe);
+void xe_display_pm_resume_noaccel(struct xe_device *xe);
 void xe_display_pm_runtime_suspend(struct xe_device *xe);
 void xe_display_pm_runtime_resume(struct xe_device *xe);
 
drivers/gpu/drm/xe/xe_pm.c +4 -0
index 33eb039053e4..f5d89c326d46 100644
@@ -182,8 +182,12 @@ int xe_pm_resume(struct xe_device *xe)
 	if (err)
 		goto err;
 
+	xe_display_pm_resume_noirq(xe);
+
 	xe_irq_resume(xe);
 
+	xe_display_pm_resume_noaccel(xe);
+
 	for_each_gt(gt, xe, id)
 		xe_gt_resume(gt);
 
Signature · 1 line
2.46.0
author maintainer
#47 lore raw

PATCH 20/31 drm/xe/display: Align suspend sequence with i915

In reply to Rodrigo Vivi

Move a few things to after GT has stopped and also IRQ has been disabled:
- intel_hpd_cancel_work
- intel_display_driver_suspend_access
- intel_encoder_suspend_all

With that, also remove the xe_display_flush_cleanup_work, which is no longer necessary.

Then, use directly all the intel_display_driver functions for a full alignment.

---
 drivers/gpu/drm/xe/display/xe_display.c | 25 ++++++++++++++-----------
 drivers/gpu/drm/xe/display/xe_display.h |  2 ++
 drivers/gpu/drm/xe/xe_pm.c              |  2 ++
 3 files changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +14 -11
index 959635653cfb..44850b6cd382 100644
@@ -342,26 +342,29 @@ static void xe_display_from_d3cold(struct xe_device *xe)
 
 void xe_display_pm_suspend(struct xe_device *xe)
 {
-	struct intel_display *display = &xe->display;
-	bool s2idle = suspend_to_idle();
-
 	if (!xe->info.probe_display)
 		return;
 
 	intel_display_driver_suspend(xe);
+}
 
-	xe_display_flush_cleanup_work(xe);
+void xe_display_pm_suspend_noirq(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
 
-	intel_hpd_cancel_work(xe);
+	intel_display_driver_suspend_noirq(xe);
+}
 
-	if (has_display(xe)) {
-		intel_display_driver_suspend_access(xe);
-		intel_encoder_suspend_all(&xe->display);
-	}
+void xe_display_pm_suspend_noggtt(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+	bool s2idle = suspend_to_idle();
 
-	intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
+	if (!xe->info.probe_display)
+		return;
 
-	intel_dmc_suspend(display);
+	intel_display_driver_suspend_noggtt(display, s2idle);
 }
 
 void xe_display_pm_shutdown(struct xe_device *xe)
drivers/gpu/drm/xe/display/xe_display.h +2 -0
index b4ed5b598c2d..256bd2d23964 100644
@@ -35,6 +35,8 @@ void xe_display_irq_reset(struct xe_device *xe);
 void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt);
 
 void xe_display_pm_suspend(struct xe_device *xe);
+void xe_display_pm_suspend_noirq(struct xe_device *xe);
+void xe_display_pm_suspend_noggtt(struct xe_device *xe);
 void xe_display_pm_suspend_late(struct xe_device *xe);
 void xe_display_pm_shutdown(struct xe_device *xe);
 void xe_display_pm_shutdown_noirq(struct xe_device *xe);
drivers/gpu/drm/xe/xe_pm.c +2 -0
index f5d89c326d46..77eb45a641e8 100644
@@ -140,6 +140,8 @@ int xe_pm_suspend(struct xe_device *xe)
 
 	xe_irq_suspend(xe);
 
+	xe_display_pm_suspend_noirq(xe);
+	xe_display_pm_suspend_noggtt(xe);
 	xe_display_pm_suspend_late(xe);
 
 	drm_dbg(&xe->drm, "Device suspended\n");
Signature · 1 line
2.46.0
Reviewed-by on v1 20/31
#48 lore raw

RE: [PATCH 20/31] drm/xe/display: Align suspend sequence with i915

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 20/31] drm/xe/display: Align suspend sequence with i915

Quoted 7 lines

Move a few things to after GT has stopped and also IRQ has been disabled:
- intel_hpd_cancel_work
- intel_display_driver_suspend_access
- intel_encoder_suspend_all

Quoted 7 lines

With that, also remove the xe_display_flush_cleanup_work, which is no longer necessary.

Then, use directly all the intel_display_driver functions for a full alignment.

LGTM.

-Jonathan Cavitt

Quoted 81 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 25 ++++++++++++++-----------
 drivers/gpu/drm/xe/display/xe_display.h |  2 ++
 drivers/gpu/drm/xe/xe_pm.c              |  2 ++
 3 files changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +14 -11
index 959635653cfb..44850b6cd382 100644
@@ -342,26 +342,29 @@ static void xe_display_from_d3cold(struct xe_device *xe)
 
 void xe_display_pm_suspend(struct xe_device *xe)
 {
-	struct intel_display *display = &xe->display;
-	bool s2idle = suspend_to_idle();
-
 	if (!xe->info.probe_display)
 		return;
 
 	intel_display_driver_suspend(xe);
+}
 
-	xe_display_flush_cleanup_work(xe);
+void xe_display_pm_suspend_noirq(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
 
-	intel_hpd_cancel_work(xe);
+	intel_display_driver_suspend_noirq(xe);
+}
 
-	if (has_display(xe)) {
-		intel_display_driver_suspend_access(xe);
-		intel_encoder_suspend_all(&xe->display);
-	}
+void xe_display_pm_suspend_noggtt(struct xe_device *xe)
+{
+	struct intel_display *display = &xe->display;
+	bool s2idle = suspend_to_idle();
 
-	intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
+	if (!xe->info.probe_display)
+		return;
 
-	intel_dmc_suspend(display);
+	intel_display_driver_suspend_noggtt(display, s2idle);
 }
 
 void xe_display_pm_shutdown(struct xe_device *xe)
drivers/gpu/drm/xe/display/xe_display.h +2 -0
index b4ed5b598c2d..256bd2d23964 100644
@@ -35,6 +35,8 @@ void xe_display_irq_reset(struct xe_device *xe);
 void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt);
 
 void xe_display_pm_suspend(struct xe_device *xe);
+void xe_display_pm_suspend_noirq(struct xe_device *xe);
+void xe_display_pm_suspend_noggtt(struct xe_device *xe);
 void xe_display_pm_suspend_late(struct xe_device *xe);
 void xe_display_pm_shutdown(struct xe_device *xe);
 void xe_display_pm_shutdown_noirq(struct xe_device *xe);
drivers/gpu/drm/xe/xe_pm.c +2 -0
index f5d89c326d46..77eb45a641e8 100644
@@ -140,6 +140,8 @@ int xe_pm_suspend(struct xe_device *xe)
 
 	xe_irq_suspend(xe);
 
+	xe_display_pm_suspend_noirq(xe);
+	xe_display_pm_suspend_noggtt(xe);
 	xe_display_pm_suspend_late(xe);
 
 	drm_dbg(&xe->drm, "Device suspended\n");
Signature · 1 line
2.46.0
author maintainer
#49 lore raw

PATCH 21/31 drm/{i915, xe}/display: Move dsm registration under intel_driver

In reply to Rodrigo Vivi

Move dsm register/unregister calls from the drivers to under intel_display_driver register/unregister.

---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 4 ++++
 drivers/gpu/drm/i915/i915_driver.c                  | 5 -----
 drivers/gpu/drm/xe/display/xe_display.c             | 3 ---
 3 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +4 -0
index 85a51b9d49f8..f3a586913c6f 100644
@@ -565,6 +565,8 @@ void intel_display_driver_register(struct drm_i915_private *i915)
 					DISPLAY_RUNTIME_INFO(i915), &p);
 
 	intel_power_domains_enable(i915);
+
+	intel_register_dsm_handler();
 }
 
 void intel_display_driver_cleanup(struct drm_i915_private *i915)
@@ -647,6 +649,8 @@ void intel_display_driver_unregister(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_unregister_dsm_handler();
+
 	intel_power_domains_disable(i915);
 
 	drm_client_dev_unregister(&i915->drm);
drivers/gpu/drm/i915/i915_driver.c +0 -5
index 65f885e03880..7fce210d355d 100644
@@ -45,7 +45,6 @@
 #include <drm/drm_managed.h>
 
 #include "display/i9xx_display_sr.h"
-#include "display/intel_acpi.h"
 #include "display/intel_bw.h"
 #include "display/intel_cdclk.h"
 #include "display/intel_crtc.h"
@@ -629,8 +628,6 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 
 	intel_runtime_pm_enable(&dev_priv->runtime_pm);
 
-	intel_register_dsm_handler();
-
 	if (i915_switcheroo_register(dev_priv))
 		drm_err(&dev_priv->drm, "Failed to register vga switcheroo!\n");
 }
@@ -646,8 +643,6 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 
 	i915_switcheroo_unregister(dev_priv);
 
-	intel_unregister_dsm_handler();
-
 	intel_runtime_pm_disable(&dev_priv->runtime_pm);
 
 	intel_display_driver_unregister(dev_priv);
drivers/gpu/drm/xe/display/xe_display.c +0 -3
index 44850b6cd382..6bfad26a3c06 100644
@@ -14,7 +14,6 @@
 #include <uapi/drm/xe_drm.h>
 
 #include "soc/intel_dram.h"
-#include "intel_acpi.h"
 #include "intel_audio.h"
 #include "intel_bw.h"
 #include "intel_display.h"
@@ -217,7 +216,6 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(xe);
-	intel_register_dsm_handler();
 }
 
 void xe_display_unregister(struct xe_device *xe)
@@ -225,7 +223,6 @@ void xe_display_unregister(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_unregister_dsm_handler();
 	intel_display_driver_unregister(xe);
 }
 
Signature · 1 line
2.46.0
Reviewed-by on v1 21/31
#50 lore raw

RE: [PATCH 21/31] drm/{i915, xe}/display: Move dsm registration under intel_driver

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 21/31] drm/{i915, xe}/display: Move dsm registration under intel_driver

Quoted 5 lines

Move dsm register/unregister calls from the drivers to under intel_display_driver register/unregister.

LGTM.

-Jonathan Cavitt

Quoted 90 lines
---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 4 ++++
 drivers/gpu/drm/i915/i915_driver.c                  | 5 -----
 drivers/gpu/drm/xe/display/xe_display.c             | 3 ---
 3 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +4 -0
index 85a51b9d49f8..f3a586913c6f 100644
@@ -565,6 +565,8 @@ void intel_display_driver_register(struct drm_i915_private *i915)
 					DISPLAY_RUNTIME_INFO(i915), &p);
 
 	intel_power_domains_enable(i915);
+
+	intel_register_dsm_handler();
 }
 
 void intel_display_driver_cleanup(struct drm_i915_private *i915)
@@ -647,6 +649,8 @@ void intel_display_driver_unregister(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return;
 
+	intel_unregister_dsm_handler();
+
 	intel_power_domains_disable(i915);
 
 	drm_client_dev_unregister(&i915->drm);
drivers/gpu/drm/i915/i915_driver.c +0 -5
index 65f885e03880..7fce210d355d 100644
@@ -45,7 +45,6 @@
 #include <drm/drm_managed.h>
 
 #include "display/i9xx_display_sr.h"
-#include "display/intel_acpi.h"
 #include "display/intel_bw.h"
 #include "display/intel_cdclk.h"
 #include "display/intel_crtc.h"
@@ -629,8 +628,6 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 
 	intel_runtime_pm_enable(&dev_priv->runtime_pm);
 
-	intel_register_dsm_handler();
-
 	if (i915_switcheroo_register(dev_priv))
 		drm_err(&dev_priv->drm, "Failed to register vga switcheroo!\n");
 }
@@ -646,8 +643,6 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 
 	i915_switcheroo_unregister(dev_priv);
 
-	intel_unregister_dsm_handler();
-
 	intel_runtime_pm_disable(&dev_priv->runtime_pm);
 
 	intel_display_driver_unregister(dev_priv);
drivers/gpu/drm/xe/display/xe_display.c +0 -3
index 44850b6cd382..6bfad26a3c06 100644
@@ -14,7 +14,6 @@
 #include <uapi/drm/xe_drm.h>
 
 #include "soc/intel_dram.h"
-#include "intel_acpi.h"
 #include "intel_audio.h"
 #include "intel_bw.h"
 #include "intel_display.h"
@@ -217,7 +216,6 @@ void xe_display_register(struct xe_device *xe)
 		return;
 
 	intel_display_driver_register(xe);
-	intel_register_dsm_handler();
 }
 
 void xe_display_unregister(struct xe_device *xe)
@@ -225,7 +223,6 @@ void xe_display_unregister(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_unregister_dsm_handler();
 	intel_display_driver_unregister(xe);
 }
 
Signature · 1 line
2.46.0
author maintainer
#51 lore raw

PATCH 22/31 drm/i915/display: Move runtime pm related calls under intel_display_driver

In reply to Rodrigo Vivi

Continue moving more display stuff from i915_driver to intel_display. With the end goal of reconciling xe and i915 sequences.

---
 .../drm/i915/display/intel_display_driver.c   | 58 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  4 ++
 drivers/gpu/drm/i915/i915_driver.c            | 46 ++-------------
 3 files changed, 66 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +58 -0
index f3a586913c6f..62a7aa56f0da 100644
@@ -856,6 +856,64 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	intel_power_domains_enable(i915);
 }
 
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915)
+{
+	intel_display_power_suspend(i915);
+}
+
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
+
+	/*
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
+	 */
+	if (IS_BROADWELL(i915)) {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at intel_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(i915) && !IS_CHERRYVIEW(i915))
+		intel_hpd_poll_enable(i915);
+}
+
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915)
+{
+	intel_opregion_notify_adapter(&i915->display, PCI_D0);
+
+	intel_display_power_resume(i915);
+}
+
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915)
+{
+	/*
+	 * 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 (!IS_VALLEYVIEW(i915) && !IS_CHERRYVIEW(i915)) {
+		intel_hpd_init(i915);
+		intel_hpd_poll_disable(i915);
+	}
+
+	skl_watermark_ipc_update(i915);
+}
+
 void intel_display_driver_shutdown(struct drm_i915_private *i915)
 {
 	intel_power_domains_disable(i915);
drivers/gpu/drm/i915/display/intel_display_driver.h +4 -0
index e287574fcd35..b1441a55d72d 100644
@@ -33,6 +33,10 @@ void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915);
 void intel_display_driver_resume_nogem(struct intel_display *display);
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915);
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915);
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915);
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +4 -42

91 lines not on this page · raw message

Signature · 1 line
2.46.0
Reviewed-by on v1 22/31
#52 lore raw

RE: [PATCH 22/31] drm/i915/display: Move runtime pm related calls under intel_display_driver

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 22/31] drm/i915/display: Move runtime pm related calls under intel_display_driver

Quoted 5 lines

Continue moving more display stuff from i915_driver to intel_display. With the end goal of reconciling xe and i915 sequences.

LGTM.

-Jonathan Cavitt

Quoted 196 lines
---
 .../drm/i915/display/intel_display_driver.c   | 58 +++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  4 ++
 drivers/gpu/drm/i915/i915_driver.c            | 46 ++-------------
 3 files changed, 66 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +58 -0
index f3a586913c6f..62a7aa56f0da 100644
@@ -856,6 +856,64 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	intel_power_domains_enable(i915);
 }
 
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915)
+{
+	intel_display_power_suspend(i915);
+}
+
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
+
+	/*
+	 * FIXME: We really should find a document that references the arguments
+	 * used below!
+	 */
+	if (IS_BROADWELL(i915)) {
+		/*
+		 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop
+		 * being detected, and the call we do at intel_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(i915) && !IS_CHERRYVIEW(i915))
+		intel_hpd_poll_enable(i915);
+}
+
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915)
+{
+	intel_opregion_notify_adapter(&i915->display, PCI_D0);
+
+	intel_display_power_resume(i915);
+}
+
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915)
+{
+	/*
+	 * 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 (!IS_VALLEYVIEW(i915) && !IS_CHERRYVIEW(i915)) {
+		intel_hpd_init(i915);
+		intel_hpd_poll_disable(i915);
+	}
+
+	skl_watermark_ipc_update(i915);
+}
+
 void intel_display_driver_shutdown(struct drm_i915_private *i915)
 {
 	intel_power_domains_disable(i915);
drivers/gpu/drm/i915/display/intel_display_driver.h +4 -0
index e287574fcd35..b1441a55d72d 100644
@@ -33,6 +33,10 @@ void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915);
 void intel_display_driver_resume_nogem(struct intel_display *display);
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915);
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915);
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915);
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +4 -42
index 7fce210d355d..b3eaa55ebacb 100644
@@ -1373,7 +1373,6 @@ static int i915_pm_restore(struct device *kdev)
 static int intel_runtime_suspend(struct device *kdev)
 {
 	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
-	struct intel_display *display = &dev_priv->display;
 	struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 	struct pci_dev *root_pdev;
@@ -1403,7 +1402,7 @@ static int intel_runtime_suspend(struct device *kdev)
 	for_each_gt(gt, dev_priv, i)
 		intel_uncore_suspend(gt->uncore);
 
-	intel_display_power_suspend(dev_priv);
+	intel_display_driver_runtime_suspend(dev_priv);
 
 	ret = vlv_suspend_complete(dev_priv);
 	if (ret) {
@@ -1437,34 +1436,10 @@ static int intel_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 intel_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);
-	}
+	intel_display_driver_runtime_suspend_late(dev_priv);
 
 	assert_forcewakes_inactive(&dev_priv->uncore);
 
-	if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv))
-		intel_hpd_poll_enable(dev_priv);
-
 	drm_dbg(&dev_priv->drm, "Device suspended\n");
 	return 0;
 }
@@ -1472,7 +1447,6 @@ static int intel_runtime_suspend(struct device *kdev)
 static int intel_runtime_resume(struct device *kdev)
 {
 	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
-	struct intel_display *display = &dev_priv->display;
 	struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
 	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 	struct pci_dev *root_pdev;
@@ -1487,8 +1461,6 @@ static int intel_runtime_resume(struct device *kdev)
 	drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count));
 	disable_rpm_wakeref_asserts(rpm);
 
-	intel_opregion_notify_adapter(display, PCI_D0);
-
 	root_pdev = pcie_find_root_port(pdev);
 	if (root_pdev)
 		pci_d3cold_enable(root_pdev);
@@ -1497,7 +1469,7 @@ static int intel_runtime_resume(struct device *kdev)
 		drm_dbg(&dev_priv->drm,
 			"Unclaimed access during suspend, bios?\n");
 
-	intel_display_power_resume(dev_priv);
+	intel_display_driver_runtime_resume_early(dev_priv);
 
 	ret = vlv_resume_prepare(dev_priv, true);
 
@@ -1515,17 +1487,7 @@ static int intel_runtime_resume(struct device *kdev)
 
 	intel_pxp_runtime_resume(dev_priv->pxp);
 
-	/*
-	 * 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 (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
-		intel_hpd_init(dev_priv);
-		intel_hpd_poll_disable(dev_priv);
-	}
-
-	skl_watermark_ipc_update(dev_priv);
+	intel_display_driver_runtime_resume_early(dev_priv);
 
 	enable_rpm_wakeref_asserts(rpm);
 
Signature · 1 line
2.46.0
author maintainer
#53 lore raw

PATCH 23/31 drm/xe/display: Prepare runtime pm functions

In reply to Rodrigo Vivi

No functional change. Just organize the runtime_pm related functions to allow a later sync with the i915.

Move runtime_suspend down near the runtime_resume. Create runtime_suspend_late and runtime_suspend_early stages for a better visualization of the missed i915 sequences.

---
 drivers/gpu/drm/xe/display/xe_display.c | 41 +++++++++++++++++--------
 drivers/gpu/drm/xe/display/xe_display.h |  2 ++
 drivers/gpu/drm/xe/xe_pm.c              |  7 +++--
 3 files changed, 35 insertions(+), 15 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +29 -12
index 6bfad26a3c06..1ab4dd51094f 100644
@@ -388,17 +388,6 @@ void xe_display_pm_shutdown_noaccel(struct xe_device *xe)
 	intel_display_driver_shutdown_nogem(xe);
 }
 
-void xe_display_pm_runtime_suspend(struct xe_device *xe)
-{
-	if (!xe->info.probe_display)
-		return;
-
-	if (xe->d3cold.allowed)
-		xe_display_to_d3cold(xe);
-
-	intel_hpd_poll_enable(xe);
-}
-
 void xe_display_pm_suspend_late(struct xe_device *xe)
 {
 	bool s2idle = suspend_to_idle();
@@ -443,6 +432,35 @@ void xe_display_pm_resume_noaccel(struct xe_device *xe)
 	intel_display_driver_resume_nogem(&xe->display);
 }
 
+void xe_display_pm_runtime_suspend(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		xe_display_to_d3cold(xe);
+
+	intel_hpd_poll_enable(xe);
+}
+
+void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		intel_display_power_suspend_late(xe, false);
+}
+
+void xe_display_pm_runtime_resume_early(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		intel_display_power_resume_early(xe);
+}
+
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -454,7 +472,6 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 		xe_display_from_d3cold(xe);
 }
 
-
 static void display_device_remove(struct drm_device *dev, void *arg)
 {
 	struct xe_device *xe = arg;
drivers/gpu/drm/xe/display/xe_display.h +2 -0
index 256bd2d23964..64ff2d2f5270 100644
@@ -46,6 +46,8 @@ void xe_display_pm_resume(struct xe_device *xe);
 void xe_display_pm_resume_noirq(struct xe_device *xe);
 void xe_display_pm_resume_noaccel(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);
 
 #else
drivers/gpu/drm/xe/xe_pm.c +4 -3
index 77eb45a641e8..4cacf4b33d83 100644
@@ -418,8 +418,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 
 	xe_irq_suspend(xe);
 
-	if (xe->d3cold.allowed)
-		xe_display_pm_suspend_late(xe);
+	xe_display_pm_runtime_suspend_late(xe);
 out:
 	if (err)
 		xe_display_pm_runtime_resume(xe);
@@ -450,9 +449,11 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 		err = xe_pcode_ready(xe, true);
 		if (err)
 			goto out;
+	}
 
-		xe_display_pm_resume_early(xe);
+	xe_display_pm_runtime_resume_early(xe);
 
+	if (xe->d3cold.allowed) {
 		/*
 		 * This only restores pinned memory which is the memory
 		 * required for the GT(s) to resume.
Signature · 1 line
2.46.0
Reviewed-by on v1 23/31
#54 lore raw

RE: [PATCH 23/31] drm/xe/display: Prepare runtime pm functions

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 23/31] drm/xe/display: Prepare runtime pm functions

Quoted 110 lines

No functional change. Just organize the runtime_pm related functions to allow a later sync with the i915.

Move runtime_suspend down near the runtime_resume. Create runtime_suspend_late and runtime_suspend_early stages for a better visualization of the missed i915 sequences.

---
 drivers/gpu/drm/xe/display/xe_display.c | 41 +++++++++++++++++--------
 drivers/gpu/drm/xe/display/xe_display.h |  2 ++
 drivers/gpu/drm/xe/xe_pm.c              |  7 +++--
 3 files changed, 35 insertions(+), 15 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +29 -12
index 6bfad26a3c06..1ab4dd51094f 100644
@@ -388,17 +388,6 @@ void xe_display_pm_shutdown_noaccel(struct xe_device *xe)
 	intel_display_driver_shutdown_nogem(xe);
 }
 
-void xe_display_pm_runtime_suspend(struct xe_device *xe)
-{
-	if (!xe->info.probe_display)
-		return;
-
-	if (xe->d3cold.allowed)
-		xe_display_to_d3cold(xe);
-
-	intel_hpd_poll_enable(xe);
-}
-
 void xe_display_pm_suspend_late(struct xe_device *xe)
 {
 	bool s2idle = suspend_to_idle();
@@ -443,6 +432,35 @@ void xe_display_pm_resume_noaccel(struct xe_device *xe)
 	intel_display_driver_resume_nogem(&xe->display);
 }
 
+void xe_display_pm_runtime_suspend(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		xe_display_to_d3cold(xe);
+
+	intel_hpd_poll_enable(xe);
+}
+
+void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		intel_display_power_suspend_late(xe, false);
+}
+
+void xe_display_pm_runtime_resume_early(struct xe_device *xe)
+{
+	if (!xe->info.probe_display)
+		return;
+
+	if (xe->d3cold.allowed)
+		intel_display_power_resume_early(xe);
+}
+
 void xe_display_pm_runtime_resume(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -454,7 +472,6 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 		xe_display_from_d3cold(xe);
 }
 
-
 static void display_device_remove(struct drm_device *dev, void *arg)
 {
 	struct xe_device *xe = arg;
drivers/gpu/drm/xe/display/xe_display.h +2 -0
index 256bd2d23964..64ff2d2f5270 100644
@@ -46,6 +46,8 @@ void xe_display_pm_resume(struct xe_device *xe);
 void xe_display_pm_resume_noirq(struct xe_device *xe);
 void xe_display_pm_resume_noaccel(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);
 
 #else
drivers/gpu/drm/xe/xe_pm.c +1 -2
index 77eb45a641e8..4cacf4b33d83 100644
@@ -418,8 +418,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 
 	xe_irq_suspend(xe);
 
-	if (xe->d3cold.allowed)
-		xe_display_pm_suspend_late(xe);
+	xe_display_pm_runtime_suspend_late(xe);
 out:
 	if (err)
 		xe_display_pm_runtime_resume(xe);

drivers/gpu/drm/xe/xe_pm.c int xe_pm_runtime_resume(struct xe_device *xe) · line 454

Quoted 7 lines
drivers/gpu/drm/xe/xe_pm.c +2 -1
@@ -450,9 +449,11 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 		err = xe_pcode_ready(xe, true);
 		if (err)
 			goto out;
+	}
 
-		xe_display_pm_resume_early(xe);
+	xe_display_pm_runtime_resume_early(xe);

Putting a split here makes us check the above and below xe->d3cold.allowed status twice. I think it's mandatory for us to do so, but I can't help but wonder if we can't streamline it a bit. Maybe breaking the above and below checks into their own functions? Something like:

"""
static int xe_pcode_ready_on_d3cold(struct xe_device *xe)

{
	if (xe->d3cold.allowed)
		return xe_pcode_ready(xe, true);
	return 0;
}

static int xe_bo_restore_on_d3cold(struct xe_device *xe)

{
	if (xe->d3cold.allowed)
		return xe_bo_restore_kernel(xe);
	return 0;
}
...
int xe_pm_runtime_resume(struct xe_device *xe)
{
	struct xe_gt *gt;
	u8 id;
	int err = 0;

	trace_xe_pm_runtime_resume(xe, __builtin_return_address(0));
	/* Disable access_ongoing asserts and prevent recursive pm calls */
	xe_pm_write_callback_task(xe, current);

	xe_rpm_lockmap_acquire(xe);

	err = xe_pcode_ready_on_d3cold(xe);
	if (err)
		goto out;
	
	xe_display_pm_runtime_resume_early(xe);

	err = xe_bo_restore_on_d3cold(xe);
	if (err)
		goto out;

"""

Or perhaps it'd work better as an inline function?

"""

	err = xe->d3cold.allowed ?
		xe_pcode_ready(xe, true) : 0;
	if (err)
		goto out;

	xe_display_pm_runtime_resume_early(xe);

	err = xe->d3cold.allowed ?
		xe_bo_restore_kernel(xe) : 0;
	if (err)
		goto out;

"""

IMO I don't think either of these new options are particular upgrades to the current implementation. If anything, they're probably just side-grades. So I won't force the issue.

-Jonathan Cavitt

Quoted 9 lines
drivers/gpu/drm/xe/xe_pm.c +1 -0
+	if (xe->d3cold.allowed) {
 		/*
 		 * This only restores pinned memory which is the memory
 		 * required for the GT(s) to resume.
Signature · 1 line
2.46.0
author maintainer
#55 lore raw

PATCH 24/31 drm/xe/display: Call intel_hpd_init on every runtime resume

In reply to Rodrigo Vivi

We need to ensure this is called on every kind of runtime resume and not only on d3cold is possible. Aligning with the hpd sequence from i915.

Cc Vinod Govindapillai <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +2 -2
index 1ab4dd51094f..4d1dd5294b89 100644
@@ -330,8 +330,6 @@ static void xe_display_from_d3cold(struct xe_device *xe)
 
 	intel_display_driver_init_hw(xe);
 
-	intel_hpd_init(xe);
-
 	intel_opregion_resume(display);
 
 	intel_power_domains_enable(xe);
@@ -470,6 +468,8 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		xe_display_from_d3cold(xe);
+
+	intel_hpd_init(xe);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
Reviewed-by on v1 24/31
#56 lore raw

Re: [PATCH 24/31] drm/xe/display: Call intel_hpd_init on every runtime resume

Quoted 24 lines · Rodrigo Vivi

We need to ensure this is called on every kind of runtime resume and not only on d3cold is possible. Aligning with the hpd sequence from i915.

Cc Vinod Govindapillai <[email protected]>

---
 drivers/gpu/drm/xe/display/xe_display.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +0 -0
index 1ab4dd51094f..4d1dd5294b89 100644
@@ -330,8 +330,6 @@ static void xe_display_from_d3cold(struct xe_device *xe)


        intel_display_driver_init_hw(xe);

-       intel_hpd_init(xe);
-
        intel_opregion_resume(display);

        intel_power_domains_enable(xe);

drivers/gpu/drm/xe/display/xe_display.c +0 -0
@@ -470,6 +468,8 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
Quoted 5 lines


        if (xe->d3cold.allowed)
                xe_display_from_d3cold(xe);
+
+       intel_hpd_init(xe);

I would like to clarify, if the order of calling intel_hpd_init() and intel_hpd_poll_disable(xe) matter? Should the intel_hpd_init be called before the poll disable?

Otherwise, this was missed in my earlier fix. Thanks for fixing this.

Quoted 3 lines

 }

 static void display_device_remove(struct drm_device *dev, void *arg)

#57 lore raw

Re: [PATCH 24/31] drm/xe/display: Call intel_hpd_init on every runtime resume

Quoted 34 lines · Vinod
Quoted 24 lines · Rodrigo Vivi

We need to ensure this is called on every kind of runtime resume and not only on d3cold is possible. Aligning with the hpd sequence from i915.

Cc Vinod Govindapillai <[email protected]>

---
 drivers/gpu/drm/xe/display/xe_display.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +0 -0
index 1ab4dd51094f..4d1dd5294b89 100644
@@ -330,8 +330,6 @@ static void xe_display_from_d3cold(struct xe_device *xe)


        intel_display_driver_init_hw(xe);

-       intel_hpd_init(xe);
-
        intel_opregion_resume(display);

        intel_power_domains_enable(xe);

drivers/gpu/drm/xe/display/xe_display.c +0 -0
@@ -470,6 +468,8 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
Quoted 5 lines


        if (xe->d3cold.allowed)
                xe_display_from_d3cold(xe);
+
+       intel_hpd_init(xe);

I would like to clarify, if the order of calling intel_hpd_init() and intel_hpd_poll_disable(xe) matter? Should the intel_hpd_init be called before the poll disable?

Quoted 3 lines

Otherwise, this was missed in my earlier fix. Thanks for fixing this.

I see that the next patch in the series move the poll disable after the hpd init. My question is not relevant any more!

BR
Vinod

Quoted 6 lines
Quoted 5 lines

 }

 static void display_device_remove(struct drm_device *dev, void *arg)

Reviewed-by on v1 24/31
#58 lore raw

RE: [PATCH 24/31] drm/xe/display: Call intel_hpd_init on every runtime resume

In reply to Rodrigo Vivi

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>; Govindapillai, Vinod <[email protected]>
Subject: [PATCH 24/31] drm/xe/display: Call intel_hpd_init on every runtime resume

Quoted 7 lines

We need to ensure this is called on every kind of runtime resume and not only on d3cold is possible. Aligning with the hpd sequence from i915.

Cc Vinod Govindapillai <[email protected]>

LGTM.

-Jonathan Cavitt

Quoted 30 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +2 -2
index 1ab4dd51094f..4d1dd5294b89 100644
@@ -330,8 +330,6 @@ static void xe_display_from_d3cold(struct xe_device *xe)
 
 	intel_display_driver_init_hw(xe);
 
-	intel_hpd_init(xe);
-
 	intel_opregion_resume(display);
 
 	intel_power_domains_enable(xe);
@@ -470,6 +468,8 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		xe_display_from_d3cold(xe);
+
+	intel_hpd_init(xe);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
author maintainer
#59 lore raw

PATCH 25/31 drm/xe/display: Move hpd_poll calls to later runtime stages

In reply to Rodrigo Vivi

Align placement of HDP poll calls with i915.

---
 drivers/gpu/drm/xe/display/xe_display.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +3 -4
index 4d1dd5294b89..c758874a9059 100644
@@ -437,8 +437,6 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		xe_display_to_d3cold(xe);
-
-	intel_hpd_poll_enable(xe);
 }
 
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
@@ -448,6 +446,8 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		intel_display_power_suspend_late(xe, false);
+
+	intel_hpd_poll_enable(xe);
 }
 
 void xe_display_pm_runtime_resume_early(struct xe_device *xe)
@@ -464,12 +464,11 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_hpd_poll_disable(xe);
-
 	if (xe->d3cold.allowed)
 		xe_display_from_d3cold(xe);
 
 	intel_hpd_init(xe);
+	intel_hpd_poll_disable(xe);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
Reviewed-by on v1 25/31
#60 lore raw

Re: [PATCH 25/31] drm/xe/display: Move hpd_poll calls to later runtime stages

Quoted 6 lines · Rodrigo Vivi

Align placement of HDP poll calls with i915.

---
 drivers/gpu/drm/xe/display/xe_display.c | 7 +++----

 1 file changed, 3 insertions(+), 4 deletions(-)
Quoted 37 lines
drivers/gpu/drm/xe/display/xe_display.c +0 -0
index 4d1dd5294b89..c758874a9059 100644
@@ -437,8 +437,6 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)


        if (xe->d3cold.allowed) xe_display_to_d3cold(xe);
-
-       intel_hpd_poll_enable(xe);
 }

 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)

drivers/gpu/drm/xe/display/xe_display.c +0 -0
@@ -448,6 +446,8 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)


        if (xe->d3cold.allowed) intel_display_power_suspend_late(xe, false); +
+       intel_hpd_poll_enable(xe);
 }

 void xe_display_pm_runtime_resume_early(struct xe_device *xe)

drivers/gpu/drm/xe/display/xe_display.c +0 -0
@@ -464,12 +464,11 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
         if (!xe->info.probe_display)
                 return;


-       intel_hpd_poll_disable(xe);
-
        if (xe->d3cold.allowed) xe_display_from_d3cold(xe);

        intel_hpd_init(xe);
+       intel_hpd_poll_disable(xe);
 }

 static void display_device_remove(struct drm_device *dev, void *arg)

Reviewed-by on v1 25/31
#61 lore raw

RE: [PATCH 25/31] drm/xe/display: Move hpd_poll calls to later runtime stages

In reply to Rodrigo Vivi

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 25/31] drm/xe/display: Move hpd_poll calls to later runtime stages

Quoted 4 lines

Align placement of HDP poll calls with i915.

LGTM.

-Jonathan Cavitt

Quoted 44 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +3 -4
index 4d1dd5294b89..c758874a9059 100644
@@ -437,8 +437,6 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		xe_display_to_d3cold(xe);
-
-	intel_hpd_poll_enable(xe);
 }
 
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
@@ -448,6 +446,8 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		intel_display_power_suspend_late(xe, false);
+
+	intel_hpd_poll_enable(xe);
 }
 
 void xe_display_pm_runtime_resume_early(struct xe_device *xe)
@@ -464,12 +464,11 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	intel_hpd_poll_disable(xe);
-
 	if (xe->d3cold.allowed)
 		xe_display_from_d3cold(xe);
 
 	intel_hpd_init(xe);
+	intel_hpd_poll_disable(xe);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
author maintainer
#62 lore raw

PATCH 26/31 drm/xe/display: Add missing watermark ipc update at runtime resume

In reply to Rodrigo Vivi

Continuing the alignment with i915 runtime pm sequence. Add this missing call.

---
 drivers/gpu/drm/xe/display/xe_display.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +2 -0
index c758874a9059..44cace0237dd 100644
@@ -27,6 +27,7 @@
 #include "intel_hdcp.h"
 #include "intel_hotplug.h"
 #include "intel_opregion.h"
+#include "skl_watermark.h"
 #include "xe_module.h"
 
 /* Xe device functions */
@@ -469,6 +470,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 
 	intel_hpd_init(xe);
 	intel_hpd_poll_disable(xe);
+	skl_watermark_ipc_update(xe);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
Reviewed-by on v1 26/31
#63 lore raw

RE: [PATCH 26/31] drm/xe/display: Add missing watermark ipc update at runtime resume

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 26/31] drm/xe/display: Add missing watermark ipc update at runtime resume

Quoted 5 lines

Continuing the alignment with i915 runtime pm sequence. Add this missing call.

LGTM.

-Jonathan Cavitt

Quoted 28 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +2 -0
index c758874a9059..44cace0237dd 100644
@@ -27,6 +27,7 @@
 #include "intel_hdcp.h"
 #include "intel_hotplug.h"
 #include "intel_opregion.h"
+#include "skl_watermark.h"
 #include "xe_module.h"
 
 /* Xe device functions */
@@ -469,6 +470,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 
 	intel_hpd_init(xe);
 	intel_hpd_poll_disable(xe);
+	skl_watermark_ipc_update(xe);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
author maintainer
#64 lore raw

PATCH 27/31 drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold

In reply to Rodrigo Vivi

Opregion needs to be notified about the power transition even when not going to d3cold. This aligns with i915 sequence.

---
 drivers/gpu/drm/xe/display/xe_display.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +4 -0
index 44cace0237dd..780c8d7f392d 100644
@@ -447,6 +447,8 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		intel_display_power_suspend_late(xe, false);
+	else
+		intel_opregion_notify_adapter(&xe->display, PCI_D1);
 
 	intel_hpd_poll_enable(xe);
 }
@@ -458,6 +460,8 @@ void xe_display_pm_runtime_resume_early(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		intel_display_power_resume_early(xe);
+	else
+		intel_opregion_notify_adapter(&xe->display, PCI_D0);
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
Reviewed-by on v1 27/31
#65 lore raw

RE: [PATCH 27/31] drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 27/31] drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold

Quoted 5 lines

Opregion needs to be notified about the power transition even when not going to d3cold. This aligns with i915 sequence.

LGTM.

-Jonathan Cavitt

Quoted 30 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +4 -0
index 44cace0237dd..780c8d7f392d 100644
@@ -447,6 +447,8 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		intel_display_power_suspend_late(xe, false);
+	else
+		intel_opregion_notify_adapter(&xe->display, PCI_D1);
 
 	intel_hpd_poll_enable(xe);
 }
@@ -458,6 +460,8 @@ void xe_display_pm_runtime_resume_early(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		intel_display_power_resume_early(xe);
+	else
+		intel_opregion_notify_adapter(&xe->display, PCI_D0);
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
author maintainer
#66 lore raw

PATCH 28/31 drm/xe/display: Move display runtime suspend to a later point

In reply to Rodrigo Vivi

On runtime suspend (regardless of d3cold), there's no need to perform the display power sequences before we disable the GT and IRQ.

In a matter of fact, the i915 runtime suspend needs to disable power, which asserts that IRQs are disabled.
So, before the runtime_pm sequences can be reconciled, it is needed to ensure that the Xe's IRQ are disabled before the display.

---
 drivers/gpu/drm/xe/xe_pm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pm.c +1 -2
index 4cacf4b33d83..16854215bea6 100644
@@ -402,8 +402,6 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 		xe_bo_runtime_pm_release_mmap_offset(bo);
 	mutex_unlock(&xe->mem_access.vram_userfault.lock);
 
-	xe_display_pm_runtime_suspend(xe);
-
 	if (xe->d3cold.allowed) {
 		err = xe_bo_evict_all(xe);
 		if (err)
@@ -418,6 +416,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 
 	xe_irq_suspend(xe);
 
+	xe_display_pm_runtime_suspend(xe);
 	xe_display_pm_runtime_suspend_late(xe);
 out:
 	if (err)
Signature · 1 line
2.46.0
Reviewed-by on v1 28/31
#67 lore raw

RE: [PATCH 28/31] drm/xe/display: Move display runtime suspend to a later point

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 28/31] drm/xe/display: Move display runtime suspend to a later point

Quoted 11 lines

On runtime suspend (regardless of d3cold), there's no need to perform the display power sequences before we disable the GT and IRQ.

In a matter of fact, the i915 runtime suspend needs to disable power, which asserts that IRQs are disabled.
So, before the runtime_pm sequences can be reconciled, it is needed to ensure that the Xe's IRQ are disabled before the display.

LGTM.

-Jonathan Cavitt

Quoted 29 lines
---
 drivers/gpu/drm/xe/xe_pm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pm.c +1 -2
index 4cacf4b33d83..16854215bea6 100644
@@ -402,8 +402,6 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 		xe_bo_runtime_pm_release_mmap_offset(bo);
 	mutex_unlock(&xe->mem_access.vram_userfault.lock);
 
-	xe_display_pm_runtime_suspend(xe);
-
 	if (xe->d3cold.allowed) {
 		err = xe_bo_evict_all(xe);
 		if (err)
@@ -418,6 +416,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 
 	xe_irq_suspend(xe);
 
+	xe_display_pm_runtime_suspend(xe);
 	xe_display_pm_runtime_suspend_late(xe);
 out:
 	if (err)
Signature · 1 line
2.46.0
author maintainer
#68 lore raw

PATCH 29/31 drm/xe/display: Kill crtc commit flush

In reply to Rodrigo Vivi

This flush was needed in regular suspend cases in the past. After the clean-up and reconciliation with the i915 it was not needed anymore and removed. However this remained here in the runtime suspend path.

However, the runtime pm flow ensures that there won't be any flying or pending crtc commit when the runtime_suspend is called. So this is not needed here. Clean it up.

---
 drivers/gpu/drm/xe/display/xe_display.c | 23 -----------------------
 1 file changed, 23 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +0 -23
index 780c8d7f392d..23bdd8904c44 100644
@@ -283,27 +283,6 @@ static bool suspend_to_idle(void)
 	return false;
 }
 
-static void xe_display_flush_cleanup_work(struct xe_device *xe)
-{
-	struct intel_crtc *crtc;
-
-	for_each_intel_crtc(&xe->drm, crtc) {
-		struct drm_crtc_commit *commit;
-
-		spin_lock(&crtc->base.commit_lock);
-		commit = list_first_entry_or_null(&crtc->base.commit_list,
-						  struct drm_crtc_commit, commit_entry);
-		if (commit)
-			drm_crtc_commit_get(commit);
-		spin_unlock(&crtc->base.commit_lock);
-
-		if (commit) {
-			wait_for_completion(&commit->cleanup_done);
-			drm_crtc_commit_put(commit);
-		}
-	}
-}
-
 static void xe_display_to_d3cold(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
@@ -311,8 +290,6 @@ static void xe_display_to_d3cold(struct xe_device *xe)
 	/* We do a lot of poking in a lot of registers, make sure they work properly. */
 	intel_power_domains_disable(xe);
 
-	xe_display_flush_cleanup_work(xe);
-
 	intel_hpd_cancel_work(xe);
 
 	intel_opregion_suspend(display, PCI_D3cold);
Signature · 1 line
2.46.0
Reviewed-by on v1 29/31
#69 lore raw

RE: [PATCH 29/31] drm/xe/display: Kill crtc commit flush

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 29/31] drm/xe/display: Kill crtc commit flush

Quoted 10 lines

This flush was needed in regular suspend cases in the past. After the clean-up and reconciliation with the i915 it was not needed anymore and removed. However this remained here in the runtime suspend path.

However, the runtime pm flow ensures that there won't be any flying or pending crtc commit when the runtime_suspend is called. So this is not needed here. Clean it up.

LGTM, though maybe the commit message could use some refactoring. Something like:

"""
xe_display_flush_cleanup_work was originally needed for regular suspend cases. After the clean-up and reconciliation with the i915, however, it was no longer needed and removed. Despite this, the function remained as a part of the runtime suspend path.

Since the runtime pm flow ensures that there won't be any flying or pending crtc commits when the runtime_suspend is called, calling xe_display_flush_cleanup_work here is no longer necessary. With no other use cases, this function can safely be removed.
"""

Just a suggestion. Not blocking.

-Jonathan Cavitt

Quoted 50 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 23 -----------------------
 1 file changed, 23 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +0 -23
index 780c8d7f392d..23bdd8904c44 100644
@@ -283,27 +283,6 @@ static bool suspend_to_idle(void)
 	return false;
 }
 
-static void xe_display_flush_cleanup_work(struct xe_device *xe)
-{
-	struct intel_crtc *crtc;
-
-	for_each_intel_crtc(&xe->drm, crtc) {
-		struct drm_crtc_commit *commit;
-
-		spin_lock(&crtc->base.commit_lock);
-		commit = list_first_entry_or_null(&crtc->base.commit_list,
-						  struct drm_crtc_commit, commit_entry);
-		if (commit)
-			drm_crtc_commit_get(commit);
-		spin_unlock(&crtc->base.commit_lock);
-
-		if (commit) {
-			wait_for_completion(&commit->cleanup_done);
-			drm_crtc_commit_put(commit);
-		}
-	}
-}
-
 static void xe_display_to_d3cold(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
@@ -311,8 +290,6 @@ static void xe_display_to_d3cold(struct xe_device *xe)
 	/* We do a lot of poking in a lot of registers, make sure they work properly. */
 	intel_power_domains_disable(xe);
 
-	xe_display_flush_cleanup_work(xe);
-
 	intel_hpd_cancel_work(xe);
 
 	intel_opregion_suspend(display, PCI_D3cold);
Signature · 1 line
2.46.0
author maintainer
#70 lore raw

PATCH 30/31 drm/xe/display: Add missing power display handling on non-d3cold rpm

In reply to Rodrigo Vivi

On the regular igfx runtime pm sequence where d3cold is not possible, the proper calls to power display are required.

Align with i915.

---
 drivers/gpu/drm/xe/display/xe_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +6 -2
index 23bdd8904c44..ab85c7fb217a 100644
@@ -415,6 +415,8 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		xe_display_to_d3cold(xe);
+	else
+		intel_display_power_suspend(xe);
 }
 
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
@@ -435,10 +437,12 @@ void xe_display_pm_runtime_resume_early(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed)
+	if (xe->d3cold.allowed) {
 		intel_display_power_resume_early(xe);
-	else
+	} else {
 		intel_opregion_notify_adapter(&xe->display, PCI_D0);
+		intel_display_power_resume(xe);
+	}
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
Reviewed-by on v1 30/31
#71 lore raw

RE: [PATCH 30/31] drm/xe/display: Add missing power display handling on non-d3cold rpm

-----Original Message-----
From: Intel-xe <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 30/31] drm/xe/display: Add missing power display handling on non-d3cold rpm

Quoted 7 lines

On the regular igfx runtime pm sequence where d3cold is not possible, the proper calls to power display are required.

Align with i915.

LGTM.

-Jonathan Cavitt

Quoted 36 lines
---
 drivers/gpu/drm/xe/display/xe_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +6 -2
index 23bdd8904c44..ab85c7fb217a 100644
@@ -415,6 +415,8 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 
 	if (xe->d3cold.allowed)
 		xe_display_to_d3cold(xe);
+	else
+		intel_display_power_suspend(xe);
 }
 
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
@@ -435,10 +437,12 @@ void xe_display_pm_runtime_resume_early(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed)
+	if (xe->d3cold.allowed) {
 		intel_display_power_resume_early(xe);
-	else
+	} else {
 		intel_opregion_notify_adapter(&xe->display, PCI_D0);
+		intel_display_power_resume(xe);
+	}
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
Signature · 1 line
2.46.0
author maintainer
#72 lore raw

PATCH 31/31 drm/{i915, xe}/display: Consolidade entire runtime pm sequence

In reply to Rodrigo Vivi

No functional change.

Consolidate the entire runtime pm sequences under
intel_display_driver.

Simplifications and optimizations around the D3cold sequences are likely still possible. But before that can be done, consolidate everything at the intel_display_driver side.

Xe display power management functions are now only a wrapper checking for xe's display probe parameter.

---
 .../drm/i915/display/intel_display_driver.c   | 66 ++++++++++++++++---
 .../drm/i915/display/intel_display_driver.h   | 12 ++--
 drivers/gpu/drm/i915/i915_driver.c            |  8 +--
 drivers/gpu/drm/xe/display/xe_display.c       | 56 ++--------------
 4 files changed, 74 insertions(+), 68 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +58 -8
index 62a7aa56f0da..3861fdbefaff 100644
@@ -856,12 +856,45 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	intel_power_domains_enable(i915);
 }
 
-void intel_display_driver_runtime_suspend(struct drm_i915_private *i915)
+static void intel_display_to_d3cold(struct drm_i915_private *i915)
 {
-	intel_display_power_suspend(i915);
+	struct intel_display *display = &i915->display;
+
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(i915);
+
+	intel_hpd_cancel_work(i915);
+
+	intel_opregion_suspend(display, PCI_D3cold);
+
+	intel_dmc_suspend(display);
+}
+
+static void intel_display_from_d3cold(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
+
+	intel_dmc_resume(display);
+
+	if (HAS_DISPLAY(i915))
+		drm_mode_config_reset(&i915->drm);
+
+	intel_display_driver_init_hw(i915);
+
+	intel_opregion_resume(display);
+
+	intel_power_domains_enable(i915);
+}
+
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915, bool d3cold_allowed)
+{
+	if (d3cold_allowed)
+		intel_display_to_d3cold(i915);
+	else
+		intel_display_power_suspend(i915);
 }
 
-void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915)
+static void display_runtime_suspend_notify_opregion(struct drm_i915_private *i915)
 {
 	struct intel_display *display = &i915->display;
 
@@ -887,20 +920,37 @@ void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915)
 		 */
 		intel_opregion_notify_adapter(display, PCI_D1);
 	}
+}
+
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915,
+					       bool d3cold_allowed)
+{
+	if (d3cold_allowed)
+		intel_display_power_suspend_late(i915, false);
+	else
+		display_runtime_suspend_notify_opregion(i915);
 
 	if (!IS_VALLEYVIEW(i915) && !IS_CHERRYVIEW(i915))
 		intel_hpd_poll_enable(i915);
 }
 
-void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915)
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915,
+					       bool d3cold_allowed)
 {
-	intel_opregion_notify_adapter(&i915->display, PCI_D0);
-
-	intel_display_power_resume(i915);
+	if (d3cold_allowed) {
+		intel_display_power_resume_early(i915);
+	} else {
+		intel_opregion_notify_adapter(&i915->display, PCI_D0);
+		intel_display_power_resume(i915);
+	}
 }
 
-void intel_display_driver_runtime_resume(struct drm_i915_private *i915)
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915,
+					 bool d3cold_allowed)
 {
+	if (d3cold_allowed)
+		intel_display_from_d3cold(i915);
+
 	/*
 	 * On VLV/CHV display interrupts are part of the display
 	 * power well, so hpd is reinitialized from there. For
drivers/gpu/drm/i915/display/intel_display_driver.h +8 -4
index b1441a55d72d..21aa0e551898 100644
@@ -33,10 +33,14 @@ void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915);
 void intel_display_driver_resume_nogem(struct intel_display *display);
-void intel_display_driver_runtime_suspend(struct drm_i915_private *i915);
-void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915);
-void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915);
-void intel_display_driver_runtime_resume(struct drm_i915_private *i915);
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915,
+					  bool d3cold_allowed);
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915,
+					       bool d3cold_allowed);
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915,
+					       bool d3cold_allowed);
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915,
+					 bool d3cold_allowed);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +4 -4
index b3eaa55ebacb..719b1c21b695 100644
@@ -1402,7 +1402,7 @@ static int intel_runtime_suspend(struct device *kdev)
 	for_each_gt(gt, dev_priv, i)
 		intel_uncore_suspend(gt->uncore);
 
-	intel_display_driver_runtime_suspend(dev_priv);
+	intel_display_driver_runtime_suspend(dev_priv, false);
 
 	ret = vlv_suspend_complete(dev_priv);
 	if (ret) {
@@ -1436,7 +1436,7 @@ static int intel_runtime_suspend(struct device *kdev)
 	if (root_pdev)
 		pci_d3cold_disable(root_pdev);
 
-	intel_display_driver_runtime_suspend_late(dev_priv);
+	intel_display_driver_runtime_suspend_late(dev_priv, false);
 
 	assert_forcewakes_inactive(&dev_priv->uncore);
 
@@ -1469,7 +1469,7 @@ static int intel_runtime_resume(struct device *kdev)
 		drm_dbg(&dev_priv->drm,
 			"Unclaimed access during suspend, bios?\n");
 
-	intel_display_driver_runtime_resume_early(dev_priv);
+	intel_display_driver_runtime_resume_early(dev_priv, false);
 
 	ret = vlv_resume_prepare(dev_priv, true);
 
@@ -1487,7 +1487,7 @@ static int intel_runtime_resume(struct device *kdev)
 
 	intel_pxp_runtime_resume(dev_priv->pxp);
 
-	intel_display_driver_runtime_resume_early(dev_priv);
+	intel_display_driver_runtime_resume_early(dev_priv, false);
 
 	enable_rpm_wakeref_asserts(rpm);
 
drivers/gpu/drm/xe/display/xe_display.c +4 -52

86 lines not on this page · raw message

Signature · 1 line
2.46.0
Reviewed-by on v1 31/31
#73 lore raw

RE: [PATCH 31/31] drm/{i915, xe}/display: Consolidade entire runtime pm sequence

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 31/31] drm/{i915, xe}/display: Consolidade entire runtime pm sequence

Quoted 6 lines

No functional change.

Consolidate the entire runtime pm sequences under
intel_display_driver.

Quoted 8 lines

Simplifications and optimizations around the D3cold sequences are likely still possible. But before that can be done, consolidate everything at the intel_display_driver side.

Xe display power management functions are now only a wrapper checking for xe's display probe parameter.

LGTM.

-Jonathan Cavitt

Quoted 265 lines
---
 .../drm/i915/display/intel_display_driver.c   | 66 ++++++++++++++++---
 .../drm/i915/display/intel_display_driver.h   | 12 ++--
 drivers/gpu/drm/i915/i915_driver.c            |  8 +--
 drivers/gpu/drm/xe/display/xe_display.c       | 56 ++--------------
 4 files changed, 74 insertions(+), 68 deletions(-)
drivers/gpu/drm/i915/display/intel_display_driver.c +58 -8
index 62a7aa56f0da..3861fdbefaff 100644
@@ -856,12 +856,45 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	intel_power_domains_enable(i915);
 }
 
-void intel_display_driver_runtime_suspend(struct drm_i915_private *i915)
+static void intel_display_to_d3cold(struct drm_i915_private *i915)
 {
-	intel_display_power_suspend(i915);
+	struct intel_display *display = &i915->display;
+
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(i915);
+
+	intel_hpd_cancel_work(i915);
+
+	intel_opregion_suspend(display, PCI_D3cold);
+
+	intel_dmc_suspend(display);
+}
+
+static void intel_display_from_d3cold(struct drm_i915_private *i915)
+{
+	struct intel_display *display = &i915->display;
+
+	intel_dmc_resume(display);
+
+	if (HAS_DISPLAY(i915))
+		drm_mode_config_reset(&i915->drm);
+
+	intel_display_driver_init_hw(i915);
+
+	intel_opregion_resume(display);
+
+	intel_power_domains_enable(i915);
+}
+
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915, bool d3cold_allowed)
+{
+	if (d3cold_allowed)
+		intel_display_to_d3cold(i915);
+	else
+		intel_display_power_suspend(i915);
 }
 
-void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915)
+static void display_runtime_suspend_notify_opregion(struct drm_i915_private *i915)
 {
 	struct intel_display *display = &i915->display;
 
@@ -887,20 +920,37 @@ void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915)
 		 */
 		intel_opregion_notify_adapter(display, PCI_D1);
 	}
+}
+
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915,
+					       bool d3cold_allowed)
+{
+	if (d3cold_allowed)
+		intel_display_power_suspend_late(i915, false);
+	else
+		display_runtime_suspend_notify_opregion(i915);
 
 	if (!IS_VALLEYVIEW(i915) && !IS_CHERRYVIEW(i915))
 		intel_hpd_poll_enable(i915);
 }
 
-void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915)
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915,
+					       bool d3cold_allowed)
 {
-	intel_opregion_notify_adapter(&i915->display, PCI_D0);
-
-	intel_display_power_resume(i915);
+	if (d3cold_allowed) {
+		intel_display_power_resume_early(i915);
+	} else {
+		intel_opregion_notify_adapter(&i915->display, PCI_D0);
+		intel_display_power_resume(i915);
+	}
 }
 
-void intel_display_driver_runtime_resume(struct drm_i915_private *i915)
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915,
+					 bool d3cold_allowed)
 {
+	if (d3cold_allowed)
+		intel_display_from_d3cold(i915);
+
 	/*
 	 * On VLV/CHV display interrupts are part of the display
 	 * power well, so hpd is reinitialized from there. For
drivers/gpu/drm/i915/display/intel_display_driver.h +8 -4
index b1441a55d72d..21aa0e551898 100644
@@ -33,10 +33,14 @@ void intel_display_driver_resume(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq(struct drm_i915_private *i915);
 void intel_display_driver_resume_noirq_legacy(struct drm_i915_private *i915);
 void intel_display_driver_resume_nogem(struct intel_display *display);
-void intel_display_driver_runtime_suspend(struct drm_i915_private *i915);
-void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915);
-void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915);
-void intel_display_driver_runtime_resume(struct drm_i915_private *i915);
+void intel_display_driver_runtime_suspend(struct drm_i915_private *i915,
+					  bool d3cold_allowed);
+void intel_display_driver_runtime_suspend_late(struct drm_i915_private *i915,
+					       bool d3cold_allowed);
+void intel_display_driver_runtime_resume_early(struct drm_i915_private *i915,
+					       bool d3cold_allowed);
+void intel_display_driver_runtime_resume(struct drm_i915_private *i915,
+					 bool d3cold_allowed);
 void intel_display_driver_shutdown(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
 void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
drivers/gpu/drm/i915/i915_driver.c +4 -4
index b3eaa55ebacb..719b1c21b695 100644
@@ -1402,7 +1402,7 @@ static int intel_runtime_suspend(struct device *kdev)
 	for_each_gt(gt, dev_priv, i)
 		intel_uncore_suspend(gt->uncore);
 
-	intel_display_driver_runtime_suspend(dev_priv);
+	intel_display_driver_runtime_suspend(dev_priv, false);
 
 	ret = vlv_suspend_complete(dev_priv);
 	if (ret) {
@@ -1436,7 +1436,7 @@ static int intel_runtime_suspend(struct device *kdev)
 	if (root_pdev)
 		pci_d3cold_disable(root_pdev);
 
-	intel_display_driver_runtime_suspend_late(dev_priv);
+	intel_display_driver_runtime_suspend_late(dev_priv, false);
 
 	assert_forcewakes_inactive(&dev_priv->uncore);
 
@@ -1469,7 +1469,7 @@ static int intel_runtime_resume(struct device *kdev)
 		drm_dbg(&dev_priv->drm,
 			"Unclaimed access during suspend, bios?\n");
 
-	intel_display_driver_runtime_resume_early(dev_priv);
+	intel_display_driver_runtime_resume_early(dev_priv, false);
 
 	ret = vlv_resume_prepare(dev_priv, true);
 
@@ -1487,7 +1487,7 @@ static int intel_runtime_resume(struct device *kdev)
 
 	intel_pxp_runtime_resume(dev_priv->pxp);
 
-	intel_display_driver_runtime_resume_early(dev_priv);
+	intel_display_driver_runtime_resume_early(dev_priv, false);
 
 	enable_rpm_wakeref_asserts(rpm);
 
drivers/gpu/drm/xe/display/xe_display.c +4 -52
index ab85c7fb217a..9a652292d988 100644
@@ -283,36 +283,6 @@ static bool suspend_to_idle(void)
 	return false;
 }
 
-static void xe_display_to_d3cold(struct xe_device *xe)
-{
-	struct intel_display *display = &xe->display;
-
-	/* We do a lot of poking in a lot of registers, make sure they work properly. */
-	intel_power_domains_disable(xe);
-
-	intel_hpd_cancel_work(xe);
-
-	intel_opregion_suspend(display, PCI_D3cold);
-
-	intel_dmc_suspend(display);
-}
-
-static void xe_display_from_d3cold(struct xe_device *xe)
-{
-	struct intel_display *display = &xe->display;
-
-	intel_dmc_resume(display);
-
-	if (has_display(xe))
-		drm_mode_config_reset(&xe->drm);
-
-	intel_display_driver_init_hw(xe);
-
-	intel_opregion_resume(display);
-
-	intel_power_domains_enable(xe);
-}
-
 void xe_display_pm_suspend(struct xe_device *xe)
 {
 	if (!xe->info.probe_display)
@@ -413,10 +383,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed)
-		xe_display_to_d3cold(xe);
-	else
-		intel_display_power_suspend(xe);
+	intel_display_driver_runtime_suspend(xe, xe->d3cold.allowed);
 }
 
 void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
@@ -424,12 +391,7 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed)
-		intel_display_power_suspend_late(xe, false);
-	else
-		intel_opregion_notify_adapter(&xe->display, PCI_D1);
-
-	intel_hpd_poll_enable(xe);
+	intel_display_driver_runtime_suspend_late(xe, xe->d3cold.allowed);
 }
 
 void xe_display_pm_runtime_resume_early(struct xe_device *xe)
@@ -437,12 +399,7 @@ void xe_display_pm_runtime_resume_early(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed) {
-		intel_display_power_resume_early(xe);
-	} else {
-		intel_opregion_notify_adapter(&xe->display, PCI_D0);
-		intel_display_power_resume(xe);
-	}
+	intel_display_driver_runtime_resume_early(xe, xe->d3cold.allowed);
 }
 
 void xe_display_pm_runtime_resume(struct xe_device *xe)
@@ -450,12 +407,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
 	if (!xe->info.probe_display)
 		return;
 
-	if (xe->d3cold.allowed)
-		xe_display_from_d3cold(xe);
-
-	intel_hpd_init(xe);
-	intel_hpd_poll_disable(xe);
-	skl_watermark_ipc_update(xe);
+	intel_display_driver_runtime_resume(xe, xe->d3cold.allowed);
 }
 
 static void display_device_remove(struct drm_device *dev, void *arg)
Signature · 1 line
2.46.0
maintainer
#74 lore raw
In reply to Rodrigo Vivi
Quoted 19 lines · Rodrigo Vivi

Reconcile i915's and xe's display power management sequences.

The main goal of this series is to ensure that the display power management sequences from both drivers are fully aligned. So, it needs to live under i915/display/ and xe_display_pm can only be a wrapper to check for the xe's module parameter before jumping in the i915/display functions.

During this process, it was clear that the Xe's runtime pm sequences for integrated gfx (non d3cold capable) was totally misaligned with i915 and prune to more bugs. So, this series ends up fixing this and bringing a full alignment there as well.

The one new thing under i915 is the d3cold sequences. Apparently that can be reduced, but for now this is what is validated and stable on both DG2 and BMG. So, let's move that to the i915/display side as well and continue on the improvements with the code in the right place.

Quoted 4 lines

When I started this work I was hoping that I could run more conversions to intel_display struct before moving things from i915_driver.c to intel_display_driver, however that was a deeper task and this series is already deep enough.

Holy crap this is scary and a PITA to review but exactly what we'll need! Thanks for doing this. I've been shying away from this too long.

I'll try to put in some review effort, but at the same time just more eyeballs than mine would be great.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel
author maintainer
#75 lore raw
Quoted 20 lines · Jani Nikula
Quoted 19 lines · Rodrigo Vivi

Reconcile i915's and xe's display power management sequences.

The main goal of this series is to ensure that the display power management sequences from both drivers are fully aligned. So, it needs to live under i915/display/ and xe_display_pm can only be a wrapper to check for the xe's module parameter before jumping in the i915/display functions.

During this process, it was clear that the Xe's runtime pm sequences for integrated gfx (non d3cold capable) was totally misaligned with i915 and prune to more bugs. So, this series ends up fixing this and bringing a full alignment there as well.

The one new thing under i915 is the d3cold sequences. Apparently that can be reduced, but for now this is what is validated and stable on both DG2 and BMG. So, let's move that to the i915/display side as well and continue on the improvements with the code in the right place.

Quoted 7 lines
Quoted 4 lines

When I started this work I was hoping that I could run more conversions to intel_display struct before moving things from i915_driver.c to intel_display_driver, however that was a deeper task and this series is already deep enough.

Holy crap this is scary and a PITA to review but exactly what we'll need! Thanks for doing this. I've been shying away from this too long.

yeap! It was very painful to do this... took me much longer then I was expecting for a refactor :/

But we need to rip the bandaid off

Quoted 3 lines

I'll try to put in some review effort, but at the same time just more eyeballs than mine would be great.

Thank you so much!
Yeap, every help is very much appreciated!

Quoted 7 lines

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel
#76 lore raw

✓ CI.Patch_applied: success for Reconcile i915's and xe's display power mgt sequences

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: Reconcile i915's and xe's display power mgt sequences
URL : https://patchwork.freedesktop.org/series/139061/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 88d592f72f7b drm-tip: 2024y-09m-25d-19h-23m-21s UTC integration manifest === git am output follows ===
Applying: drm/i915: Remove vga and gmbus seq out of i915_restore_display
Applying: drm/i915/display: Convert i915_suspend into i9xx_display_sr
Applying: drm/i915/display: Move regfile registers intel_display.restore
Applying: drm/i915/display: Move shutdown sequences under display driver
Applying: drm/xe: At shutdown disable commit helpers instead of flushing
Applying: drm/xe: Use i915-display shutdown sequence directly
Applying: drm/{i915, xe}/display: Move DP MST calls to display_driver
Applying: drm/i915/display: Move suspend sequences to intel_display_driver
Applying: drm/xe/display: Delay hpd_init resume
Applying: drm/xe/display: Spin-off xe_display runtime/d3cold sequences
Applying: drm/{i915,xe}: Consolidate display resume functions
Applying: drm/i915: Remove lingering pci_save_state
Applying: drm/{i915,xe}: Consolidate display suspend functions
Applying: drm/i915/display: Move resume sequences to intel_display_driver
Applying: drm/xe/display: Delay dsm handler registration
Applying: drm/{i915, xe}: Move power_domains suspend/resume to display_power
Applying: drm/{i915, xe}: Move remaining intel_power_domains to intel_display
Applying: drm/i915/display: Split resume_noirq calls for now
Applying: drm/xe/display: Align display resume sequence with i915
Applying: drm/xe/display: Align suspend sequence with i915
Applying: drm/{i915, xe}/display: Move dsm registration under intel_driver
Applying: drm/i915/display: Move runtime pm related calls under intel_display_driver
Applying: drm/xe/display: Prepare runtime pm functions
Applying: drm/xe/display: Call intel_hpd_init on every runtime resume
Applying: drm/xe/display: Move hpd_poll calls to later runtime stages
Applying: drm/xe/display: Add missing watermark ipc update at runtime resume
Applying: drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold
Applying: drm/xe/display: Move display runtime suspend to a later point
Applying: drm/xe/display: Kill crtc commit flush
Applying: drm/xe/display: Add missing power display handling on non-d3cold rpm
Applying: drm/{i915, xe}/display: Consolidade entire runtime pm sequence

#77 lore raw

✗ CI.checkpatch: warning for Reconcile i915's and xe's display power mgt sequences

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: Reconcile i915's and xe's display power mgt sequences
URL : https://patchwork.freedesktop.org/series/139061/
State : warning

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 30ab6715fc09baee6cc14cb3c89ad8858688d474
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit ba6e2d9dfcbe47c2f91034f4ccc815b96c6b4970

Author: Rodrigo Vivi <[email protected]>
Date:   Tue Sep 24 16:35:52 2024 -0400

drm/{i915, xe}/display: Consolidade entire runtime pm sequence

No functional change.

Consolidate the entire runtime pm sequences under intel_display_driver.

Simplifications and optimizations around the D3cold sequences are likely still possible. But before that can be done, consolidate everything at the intel_display_driver side.

Xe display power management functions are now only a wrapper checking for xe's display probe parameter.

+ /mt/dim checkpatch 88d592f72f7bc508d6a027b1f96aa2e53f803e1b drm-intel 6dcf9b7988ea drm/i915: Remove vga and gmbus seq out of i915_restore_display dcc98b447c20 drm/i915/display: Convert i915_suspend into i9xx_display_sr
-:44: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #44:
new file mode 100644

-:68: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF0> #68: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:20:
+ i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));

-:69: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF1> #69: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:21:
+ i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));

-:72: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF3> #72: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:24:
+ i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));

-:120: CHECK:CAMELCASE: Avoid CamelCase: <saveDSPARB> #120: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:72:
+ i915->regfile.saveDSPARB = intel_de_read(i915, DSPARB(i915));

-:123: CHECK:CAMELCASE: Avoid CamelCase: <saveGCDGMBUS> #123: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:75:
+ pci_read_config_word(pdev, GCDGMBUS, &i915->regfile.saveGCDGMBUS);

total: 0 errors, 1 warnings, 5 checks, 153 lines checked 6fdf46fe51a6 drm/i915/display: Move regfile registers intel_display.restore -:29: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF0>
#29: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:21:
+ display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));

-:30: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF1> #30: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:22:
+ display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));

-:34: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF3> #34: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:25:
+ display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));

-:96: CHECK:CAMELCASE: Avoid CamelCase: <saveDSPARB> #96: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:75:
+ display->restore.saveDSPARB = intel_de_read(display, DSPARB(i915));

-:100: CHECK:CAMELCASE: Avoid CamelCase: <saveGCDGMBUS> #100: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:78:
+ pci_read_config_word(pdev, GCDGMBUS, &display->restore.saveGCDGMBUS);

total: 0 errors, 0 warnings, 5 checks, 135 lines checked
2a136013211e drm/i915/display: Move shutdown sequences under display driver 240890c8a435 drm/xe: At shutdown disable commit helpers instead of flushing 71322c0c3501 drm/xe: Use i915-display shutdown sequence directly ee2b47c496f3 drm/{i915, xe}/display: Move DP MST calls to display_driver 3ce1d09fbde3 drm/i915/display: Move suspend sequences to intel_display_driver dd88fa6b51ff drm/xe/display: Delay hpd_init resume
e969e13b4fdf drm/xe/display: Spin-off xe_display runtime/d3cold sequences 305610315138 drm/{i915,xe}: Consolidate display resume functions 5034a35b96c1 drm/i915: Remove lingering pci_save_state
0e6d56d634c9 drm/{i915,xe}: Consolidate display suspend functions 7418edb973ed drm/i915/display: Move resume sequences to intel_display_driver ac794c821e70 drm/xe/display: Delay dsm handler registration
01363e40e255 drm/{i915, xe}: Move power_domains suspend/resume to display_power 94dabebc8248 drm/{i915, xe}: Move remaining intel_power_domains to intel_display 7b73d94e8368 drm/i915/display: Split resume_noirq calls for now 5df8f96ab07a drm/xe/display: Align display resume sequence with i915 02b9f0b4f20b drm/xe/display: Align suspend sequence with i915 bdac41edb475 drm/{i915, xe}/display: Move dsm registration under intel_driver 827cf45e38a3 drm/i915/display: Move runtime pm related calls under intel_display_driver e4645abdcafb drm/xe/display: Prepare runtime pm functions
2ebc7a206bea drm/xe/display: Call intel_hpd_init on every runtime resume e75e8206db81 drm/xe/display: Move hpd_poll calls to later runtime stages 1425ba996ce8 drm/xe/display: Add missing watermark ipc update at runtime resume 86d89c891685 drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold 085f96294b20 drm/xe/display: Move display runtime suspend to a later point 728a3f15330f drm/xe/display: Kill crtc commit flush
07f8dd0683a5 drm/xe/display: Add missing power display handling on non-d3cold rpm ba6e2d9dfcbe drm/{i915, xe}/display: Consolidade entire runtime pm sequence

#78 lore raw

✗ CI.KUnit: failure for Reconcile i915's and xe's display power mgt sequences

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: Reconcile i915's and xe's display power mgt sequences
URL : https://patchwork.freedesktop.org/series/139061/
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_device.c: In function ‘xe_device_shutdown’:
../drivers/gpu/drm/xe/xe_device.c:823:17: error: implicit declaration of function ‘xe_display_pm_shutdown_noirq’; did you mean ‘xe_display_pm_shutdown_late’? [-Werror=implicit-function-declaration]

  823 |                 xe_display_pm_shutdown_noirq(xe);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 xe_display_pm_shutdown_late
../drivers/gpu/drm/xe/xe_device.c:828:17: error: implicit declaration of function ‘xe_display_pm_shutdown_noaccel’; did you mean ‘xe_display_pm_shutdown_late’? [-Werror=implicit-function-declaration]
  828 |                 xe_display_pm_shutdown_noaccel(xe);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 xe_display_pm_shutdown_late

cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:244: drivers/gpu/drm/xe/xe_device.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:485: drivers/gpu/drm/xe] Error 2 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:485: drivers/gpu/drm] Error 2
make[4]: *** [../scripts/Makefile.build:485: drivers/gpu] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:485: drivers] Error 2
make[3]: *** Waiting for unfinished jobs....
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)

      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~

make[2]: *** [/kernel/Makefile:1926: .] Error 2 make[1]: *** [/kernel/Makefile:224: __sub-make] Error 2
make: *** [Makefile:224: __sub-make] Error 2

[05:30:50] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[05:30:54] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel
#79 lore raw

✗ Fi.CI.BAT: failure for Reconcile i915's and xe's display power mgt sequences

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: Reconcile i915's and xe's display power mgt sequences
URL : https://patchwork.freedesktop.org/series/139062/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_15451 -> Patchwork_139062v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_139062v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_139062v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

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

Participating hosts (37 -> 37)
------------------------------

Additional (2): bat-adlp-9 bat-rpls-4
Missing (2): bat-arls-1 fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_139062v1:

### IGT changes ###

#### Possible regressions ####

* igt@kms_pm_rpm@basic-pci-d3-state:
- bat-twl-1: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-twl-1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-twl-1/igt@[email protected]
- bat-apl-1: [PASS][3] -> [ABORT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-apl-1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-apl-1/igt@[email protected]
- bat-adlm-1: [PASS][5] -> [ABORT][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-adlm-1/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlm-1/igt@[email protected]
- bat-rplp-1: [PASS][7] -> [ABORT][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-rplp-1/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rplp-1/igt@[email protected]
- bat-adls-6: [PASS][9] -> [ABORT][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-adls-6/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adls-6/igt@[email protected]
- bat-jsl-1: [PASS][11] -> [ABORT][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-jsl-1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-jsl-1/igt@[email protected]
- fi-rkl-11600: [PASS][13] -> [ABORT][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/fi-rkl-11600/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/fi-rkl-11600/igt@[email protected]
- bat-twl-2: [PASS][15] -> [ABORT][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-twl-2/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-twl-2/igt@[email protected]
- bat-rpls-4: NOTRUN -> [ABORT][17]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_139062v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- bat-adlp-9: NOTRUN -> [SKIP][18] ([i915#9318])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@[email protected]
- bat-rpls-4: NOTRUN -> [SKIP][19] ([i915#9318])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-adlp-9: NOTRUN -> [SKIP][20] ([i915#3282])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@gem_tiled_pread_basic.html
- bat-rpls-4: NOTRUN -> [SKIP][21] ([i915#3282])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@gem_tiled_pread_basic.html

* igt@kms_chamelium_hpd@vga-hpd-fast:
- bat-dg2-13: NOTRUN -> [SKIP][22] ([i915#7828]) +8 other tests skip
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-dg2-13/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- bat-adlp-9: NOTRUN -> [SKIP][23] ([i915#4103]) +1 other test skip
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@[email protected]
- bat-rpls-4: NOTRUN -> [SKIP][24] ([i915#4103]) +1 other test skip
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@[email protected]

* igt@kms_dsc@dsc-basic:
- bat-rpls-4: NOTRUN -> [SKIP][25] ([i915#3555] / [i915#3840] / [i915#9886])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@[email protected]
- bat-adlp-9: NOTRUN -> [SKIP][26] ([i915#3555] / [i915#3840])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-rpls-4: NOTRUN -> [SKIP][27]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@[email protected]
- bat-adlp-9: NOTRUN -> [SKIP][28]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@[email protected]

* igt@kms_pm_backlight@basic-brightness:
- bat-rpls-4: NOTRUN -> [SKIP][29] ([i915#5354])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-rpls-4/igt@[email protected]
- bat-adlp-9: NOTRUN -> [SKIP][30] ([i915#9812])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@[email protected]

* igt@kms_pm_rpm@basic-pci-d3-state:
- bat-dg2-14: [PASS][31] -> [ABORT][32] ([i915#10553])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-dg2-14/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-dg2-14/igt@[email protected]
- fi-tgl-1115g4: [PASS][33] -> [ABORT][34] ([i915#10553])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/fi-tgl-1115g4/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/fi-tgl-1115g4/igt@[email protected]
- bat-mtlp-6: [PASS][35] -> [ABORT][36] ([i915#10553])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-mtlp-6/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-mtlp-6/igt@[email protected]
- bat-dg2-9: [PASS][37] -> [ABORT][38] ([i915#10553])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-dg2-9/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-dg2-9/igt@[email protected]
- bat-adlp-11: [PASS][39] -> [ABORT][40] ([i915#10553])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-adlp-11/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-11/igt@[email protected]
- bat-arls-2: [PASS][41] -> [ABORT][42] ([i915#10553])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-arls-2/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-arls-2/igt@[email protected]
- bat-mtlp-8: [PASS][43] -> [ABORT][44] ([i915#10553])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-mtlp-8/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-mtlp-8/igt@[email protected]
- bat-arls-5: [PASS][45] -> [ABORT][46] ([i915#10553])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-arls-5/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-arls-5/igt@[email protected]
- bat-adlp-6: [PASS][47] -> [ABORT][48] ([i915#10553])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-adlp-6/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-6/igt@[email protected]
- bat-arlh-2: [PASS][49] -> [ABORT][50] ([i915#10553])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-arlh-2/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-arlh-2/igt@[email protected]
- bat-dg1-7: [PASS][51] -> [ABORT][52] ([i915#10553])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-dg1-7/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-dg1-7/igt@[email protected]
- fi-glk-j4005: [PASS][53] -> [ABORT][54] ([i915#10553])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/fi-glk-j4005/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/fi-glk-j4005/igt@[email protected]
- bat-adlp-9: NOTRUN -> [ABORT][55] ([i915#10553])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-adlp-9/igt@[email protected]
- bat-dg2-11: [PASS][56] -> [ABORT][57] ([i915#10553])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15451/bat-dg2-11/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_139062v1/bat-dg2-11/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#10553]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10553
[i915#3282]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3282
[i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
[i915#3840]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3840
[i915#4103]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4103
[i915#5354]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5354
[i915#7828]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/7828
[i915#9318]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9318
[i915#9812]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9812
[i915#9886]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9886

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

* Linux: CI_DRM_15451 -> Patchwork_139062v1

CI-20190529: 20190529
CI_DRM_15451: 6bd25f52157328ac4b7b09a3946281957afe3bfd @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8034: 73eed10d50c7d1f07df07214ae62924d4e377e12 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_139062v1: 6bd25f52157328ac4b7b09a3946281957afe3bfd @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#80 lore raw

✗ Fi.CI.CHECKPATCH: warning for Reconcile i915's and xe's display power mgt sequences

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: Reconcile i915's and xe's display power mgt sequences
URL : https://patchwork.freedesktop.org/series/139062/
State : warning

== Summary ==

Error: dim checkpatch failed
f04353bed085 drm/i915: Remove vga and gmbus seq out of i915_restore_display 5ede27eb97ba drm/i915/display: Convert i915_suspend into i9xx_display_sr
-:44: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #44:
new file mode 100644

-:68: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF0> #68: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:20:
+ i915->regfile.saveSWF0[i] = intel_de_read(i915, SWF0(i915, i));

-:69: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF1> #69: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:21:
+ i915->regfile.saveSWF1[i] = intel_de_read(i915, SWF1(i915, i));

-:72: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF3> #72: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:24:
+ i915->regfile.saveSWF3[i] = intel_de_read(i915, SWF3(i915, i));

-:120: CHECK:CAMELCASE: Avoid CamelCase: <saveDSPARB> #120: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:72:
+ i915->regfile.saveDSPARB = intel_de_read(i915, DSPARB(i915));

-:123: CHECK:CAMELCASE: Avoid CamelCase: <saveGCDGMBUS> #123: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:75:
+ pci_read_config_word(pdev, GCDGMBUS, &i915->regfile.saveGCDGMBUS);

total: 0 errors, 1 warnings, 5 checks, 153 lines checked 6cee66031328 drm/i915/display: Move regfile registers intel_display.restore -:29: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF0>
#29: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:21:
+ display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));

-:30: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF1> #30: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:22:
+ display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));

-:34: CHECK:CAMELCASE: Avoid CamelCase: <saveSWF3> #34: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:25:
+ display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));

-:96: CHECK:CAMELCASE: Avoid CamelCase: <saveDSPARB> #96: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:75:
+ display->restore.saveDSPARB = intel_de_read(display, DSPARB(i915));

-:100: CHECK:CAMELCASE: Avoid CamelCase: <saveGCDGMBUS> #100: FILE: drivers/gpu/drm/i915/display/i9xx_display_sr.c:78:
+ pci_read_config_word(pdev, GCDGMBUS, &display->restore.saveGCDGMBUS);

total: 0 errors, 0 warnings, 5 checks, 135 lines checked
251a42b9ffff drm/i915/display: Move shutdown sequences under display driver e1cef3d47c2c drm/xe: At shutdown disable commit helpers instead of flushing be9eab4a4c9c drm/xe: Use i915-display shutdown sequence directly b8c3ae74cf20 drm/{i915, xe}/display: Move DP MST calls to display_driver bc8397104476 drm/i915/display: Move suspend sequences to intel_display_driver 4a85d17531d8 drm/xe/display: Delay hpd_init resume
b5e047ddf021 drm/xe/display: Spin-off xe_display runtime/d3cold sequences b0c9f94a3d9e drm/{i915,xe}: Consolidate display resume functions 2a23b1d71196 drm/i915: Remove lingering pci_save_state
d66836d2934b drm/{i915,xe}: Consolidate display suspend functions 7ba5e12da8b1 drm/i915/display: Move resume sequences to intel_display_driver fc7debca5a57 drm/xe/display: Delay dsm handler registration
625ca89a557e drm/{i915, xe}: Move power_domains suspend/resume to display_power 679d013b241c drm/{i915, xe}: Move remaining intel_power_domains to intel_display 3bd9e583d125 drm/i915/display: Split resume_noirq calls for now 92c244819d31 drm/xe/display: Align display resume sequence with i915 ab4e84f34837 drm/xe/display: Align suspend sequence with i915 3d10483ec025 drm/{i915, xe}/display: Move dsm registration under intel_driver a7c8cecd59c0 drm/i915/display: Move runtime pm related calls under intel_display_driver 52b35f48de2c drm/xe/display: Prepare runtime pm functions
b182d1264d8a drm/xe/display: Call intel_hpd_init on every runtime resume 2b4c50ed71d8 drm/xe/display: Move hpd_poll calls to later runtime stages 27cca9d2f364 drm/xe/display: Add missing watermark ipc update at runtime resume af6663b3a8ef drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold 76cce5aec24b drm/xe/display: Move display runtime suspend to a later point aae885e997b4 drm/xe/display: Kill crtc commit flush
938d2b1ce946 drm/xe/display: Add missing power display handling on non-d3cold rpm 0049445434ff drm/{i915, xe}/display: Consolidade entire runtime pm sequence

Reviewed-by on the v1 series
#82 lore raw
In reply to Rodrigo Vivi

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 00/31] Reconcile i915's and xe's display power mgt sequences

Quoted 20 lines

Reconcile i915's and xe's display power management sequences.

The main goal of this series is to ensure that the display power management sequences from both drivers are fully aligned. So, it needs to live under i915/display/ and xe_display_pm can only be a wrapper to check for the xe's module parameter before jumping in the i915/display functions.

During this process, it was clear that the Xe's runtime pm sequences for integrated gfx (non d3cold capable) was totally misaligned with i915 and prune to more bugs. So, this series ends up fixing this and bringing a full alignment there as well.

The one new thing under i915 is the d3cold sequences. Apparently that can be reduced, but for now this is what is validated and stable on both DG2 and BMG. So, let's move that to the i915/display side as well and continue on the improvements with the code in the right place.

Quoted 7 lines

When I started this work I was hoping that I could run more conversions to intel_display struct before moving things from i915_driver.c to intel_display_driver, however that was a deeper task and this series is already deep enough.

I did individual reviews of all 31 patches in the series, and I gave my RB to all of them with some notes. However, there were just a few things that I felt I needed to say before we called this series closed.

Don't worry: none of this is blocking.

1. Are we sure that aligning i915 and Xe like this is the correct course of action? I've been reprimanded in the past for creating patches whose overall conceit is "we do 'X' thing in 'Y' way on i915, so we should also be doing 'X' thing in 'Y' way on Xe". So, I figured I should at least point this out.

2. Several patches in the series operate on both i915 and Xe at the same time. I don't think there's any strict rule stating that we can't do something like that, but IMO we should consider splitting those patches into i915 and Xe components where possible/logical.

3. When all is said and done, this series eventually puts all of the driver management code into intel_display_driver.c. So any changes made to xe_display.c, for example, seem superfluous given we're intending on centralizing the display code outside of xe_display.c in the end. It'd be a lot of work to reorder the patch series, especially at this point, but if we needed to start again from scratch for any reason, it might be worth ordering the changes as such:

- Create all necessary helper functions in intel_display_driver for i915 and Xe, using them in the i915 execution path.

- Use the new helper functions in the xe execution path.

- Create and use all necessary helper functions for the xe execution path.

Again, none of this is blocking, so there's no need to upend everything and start over. I just felt I needed to state some of these things as a part of due diligence.

-Jonathan Cavitt

Quoted 63 lines

Rodrigo Vivi (31):
drm/i915: Remove vga and gmbus seq out of i915_restore_display drm/i915/display: Convert i915_suspend into i9xx_display_sr drm/i915/display: Move regfile registers intel_display.restore drm/i915/display: Move shutdown sequences under display driver drm/xe: At shutdown disable commit helpers instead of flushing drm/xe: Use i915-display shutdown sequence directly drm/{i915,xe}/display: Move DP MST calls to display_driver drm/i915/display: Move suspend sequences to intel_display_driver drm/xe/display: Delay hpd_init resume
drm/xe/display: Spin-off xe_display runtime/d3cold sequences drm/{i915,xe}: Consolidate display resume functions drm/i915: Remove lingering pci_save_state
drm/{i915,xe}: Consolidate display suspend functions drm/i915/display: Move resume sequences to intel_display_driver drm/xe/display: Delay dsm handler registration drm/{i915,xe}: Move power_domains suspend/resume to display_power drm/{i915,xe}: Move remaining intel_power_domains to intel_display drm/i915/display: Split resume_noirq calls for now drm/xe/display: Align display resume sequence with i915 drm/xe/display: Align suspend sequence with i915 drm/{i915,xe}/display: Move dsm registration under intel_driver drm/i915/display: Move runtime pm related calls under
intel_display_driver
drm/xe/display: Prepare runtime pm functions drm/xe/display: Call intel_hpd_init on every runtime resume drm/xe/display: Move hpd_poll calls to later runtime stages drm/xe/display: Add missing watermark ipc update at runtime resume drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold drm/xe/display: Move display runtime suspend to a later point drm/xe/display: Kill crtc commit flush
drm/xe/display: Add missing power display handling on non-d3cold rpm drm/{i915,xe}/display: Consolidade entire runtime pm sequence

 drivers/gpu/drm/i915/Makefile                 |   2 +-
 .../gpu/drm/i915/display/i9xx_display_sr.c    |  99 +++++++
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  14 +
 .../gpu/drm/i915/display/intel_display_core.h |   5 +
 .../drm/i915/display/intel_display_driver.c   | 247 ++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  18 ++
 .../drm/i915/display/intel_display_power.c    |   6 +-
 .../drm/i915/display/intel_display_power.h    |   2 +-
 drivers/gpu/drm/i915/i915_driver.c            | 161 ++----------
 drivers/gpu/drm/i915/i915_drv.h               |   9 -
 drivers/gpu/drm/i915/i915_suspend.c           | 141 ----------
 drivers/gpu/drm/i915/i915_suspend.h           |  14 -
 drivers/gpu/drm/xe/display/xe_display.c       | 185 ++++---------
 drivers/gpu/drm/xe/display/xe_display.h       |  11 +-
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |   8 +
 drivers/gpu/drm/xe/xe_device.c                |   4 +-
 drivers/gpu/drm/xe/xe_pm.c                    |  16 +-
 17 files changed, 498 insertions(+), 444 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.c
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.h
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.c
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.h
Signature · 1 line
2.46.0
author maintainer
#83 lore raw
Quoted 31 lines · Jonathan

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:35 PM
To: [email protected]; [email protected]
Cc: Deak, Imre <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [PATCH 00/31] Reconcile i915's and xe's display power mgt sequences

Quoted 25 lines

Reconcile i915's and xe's display power management sequences.

The main goal of this series is to ensure that the display power management sequences from both drivers are fully aligned. So, it needs to live under i915/display/ and xe_display_pm can only be a wrapper to check for the xe's module parameter before jumping in the i915/display functions.

During this process, it was clear that the Xe's runtime pm sequences for integrated gfx (non d3cold capable) was totally misaligned with i915 and prune to more bugs. So, this series ends up fixing this and bringing a full alignment there as well.

The one new thing under i915 is the d3cold sequences. Apparently that can be reduced, but for now this is what is validated and stable on both DG2 and BMG. So, let's move that to the i915/display side as well and continue on the improvements with the code in the right place.

When I started this work I was hoping that I could run more conversions to intel_display struct before moving things from i915_driver.c to intel_display_driver, however that was a deeper task and this series is already deep enough.

Quoted 6 lines
Quoted 2 lines

I did individual reviews of all 31 patches in the series, and I gave my RB to all of them with some notes. However, there were just a few things that I felt I needed to say before we called this series closed.

First of all, thank you so much for the detailed and careful review of every patch.
Also, I'm sorry for taking so long to come back here.

Quoted 2 lines

Don't worry: none of this is blocking.

No worries. In my first step now I'm only getting the likely non-controversial ones so we can already merge them and then iterate on the ones where you and others might have questions and concerns.

Quoted 7 lines

1. Are we sure that aligning i915 and Xe like this is the correct course of action? I've been reprimanded in the past for creating patches whose overall conceit is "we do 'X' thing in 'Y' way on i915, so we should also be doing 'X' thing in 'Y' way on Xe". So, I figured I should at least point this out.

Yes, we are sure on this. Our overall goal is to have a independent display driver. So every display functionality, including the PM flows should be identical and living in i915/display side.

Quoted 6 lines

2. Several patches in the series operate on both i915 and Xe at the same time. I don't think there's any strict rule stating that we can't do something like that, but IMO we should consider splitting those patches into i915 and Xe components where possible/logical.

yeap, indeed. But in every case here, if we need separated patches we would need to create some temporary stub. So, better to do them together. And the goal is to get them through drm-intel-next since they are all display related in the end of the day.

Quoted 10 lines

3. When all is said and done, this series eventually puts all of the driver management code into intel_display_driver.c. So any changes made to xe_display.c, for example, seem superfluous given we're intending on centralizing the display code outside of xe_display.c in the end. It'd be a lot of work to reorder the patch series, especially at this point, but if we needed to start again from scratch for any reason, it might be worth ordering the changes as such:

Quoted 7 lines

- Create all necessary helper functions in intel_display_driver for i915 and Xe, using them in the i915 execution path.

- Use the new helper functions in the xe execution path.

- Create and use all necessary helper functions for the xe execution path.

In xe we decided to have an extra way to disable display. So we need this intermediate stub. Otherwise this is the goal, to have everything under i915/display/

Quoted 8 lines

Again, none of this is blocking, so there's no need to upend everything and start over. I just felt I needed to state some of these things as a part of due diligence.

-Jonathan Cavitt

Thank you so much,
Rodrigo.

Quoted 64 lines
Quoted 64 lines

Rodrigo Vivi (31):
drm/i915: Remove vga and gmbus seq out of i915_restore_display drm/i915/display: Convert i915_suspend into i9xx_display_sr drm/i915/display: Move regfile registers intel_display.restore drm/i915/display: Move shutdown sequences under display driver drm/xe: At shutdown disable commit helpers instead of flushing drm/xe: Use i915-display shutdown sequence directly drm/{i915,xe}/display: Move DP MST calls to display_driver drm/i915/display: Move suspend sequences to intel_display_driver drm/xe/display: Delay hpd_init resume
drm/xe/display: Spin-off xe_display runtime/d3cold sequences drm/{i915,xe}: Consolidate display resume functions drm/i915: Remove lingering pci_save_state
drm/{i915,xe}: Consolidate display suspend functions drm/i915/display: Move resume sequences to intel_display_driver drm/xe/display: Delay dsm handler registration drm/{i915,xe}: Move power_domains suspend/resume to display_power drm/{i915,xe}: Move remaining intel_power_domains to intel_display drm/i915/display: Split resume_noirq calls for now drm/xe/display: Align display resume sequence with i915 drm/xe/display: Align suspend sequence with i915 drm/{i915,xe}/display: Move dsm registration under intel_driver drm/i915/display: Move runtime pm related calls under
intel_display_driver
drm/xe/display: Prepare runtime pm functions drm/xe/display: Call intel_hpd_init on every runtime resume drm/xe/display: Move hpd_poll calls to later runtime stages drm/xe/display: Add missing watermark ipc update at runtime resume drm/xe/display: Notify opregion upon runtime suspend/resume non-d3cold drm/xe/display: Move display runtime suspend to a later point drm/xe/display: Kill crtc commit flush
drm/xe/display: Add missing power display handling on non-d3cold rpm drm/{i915,xe}/display: Consolidade entire runtime pm sequence

 drivers/gpu/drm/i915/Makefile                 |   2 +-
 .../gpu/drm/i915/display/i9xx_display_sr.c    |  99 +++++++
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  14 +
 .../gpu/drm/i915/display/intel_display_core.h |   5 +
 .../drm/i915/display/intel_display_driver.c   | 247 ++++++++++++++++++
 .../drm/i915/display/intel_display_driver.h   |  18 ++
 .../drm/i915/display/intel_display_power.c    |   6 +-
 .../drm/i915/display/intel_display_power.h    |   2 +-
 drivers/gpu/drm/i915/i915_driver.c            | 161 ++----------
 drivers/gpu/drm/i915/i915_drv.h               |   9 -
 drivers/gpu/drm/i915/i915_suspend.c           | 141 ----------
 drivers/gpu/drm/i915/i915_suspend.h           |  14 -
 drivers/gpu/drm/xe/display/xe_display.c       | 185 ++++---------
 drivers/gpu/drm/xe/display/xe_display.h       |  11 +-
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |   8 +
 drivers/gpu/drm/xe/xe_device.c                |   4 +-
 drivers/gpu/drm/xe/xe_pm.c                    |  16 +-
 17 files changed, 498 insertions(+), 444 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.c
 create mode 100644 drivers/gpu/drm/i915/display/i9xx_display_sr.h
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.c
 delete mode 100644 drivers/gpu/drm/i915/i915_suspend.h
Signature · 1 line
2.46.0