Skip to contentSkip to conversation

drm/i915/gen9: fix DMC firmware initialization

PATCH Superseded Imre Deak 3 participants 8 messages Mar 4, 2016 – Mar 7, 2016

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915/gen9: fix DMC firmware initialization

In commit 1e657ad7 we moved the last step of firmware initialization to skl_display_core_init(), where it will be run only during system resume, but not during driver loading. Since this init step needs to be done whenever we program the firmware fix this by moving the initialization to the end of intel_csr_load_program().

While at it simplify a bit csr_load_work_fn().

This issue prevented DC5/6 transitions, this change will re-enable those.

Fixes 1e657ad7a48f ("drm/i915/gen9: Write dc state debugmask bits only once")
CC Mika Kuoppala <[email protected]>
CC Patrik Jakobsson <[email protected]>
---
 drivers/gpu/drm/i915/intel_csr.c        | 43 ++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_drv.h        |  2 +-
 drivers/gpu/drm/i915/intel_runtime_pm.c | 22 ++---------------
 3 files changed, 32 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/intel_csr.c +29 -14
index 902054e..7bca7e9 100644
@@ -212,6 +212,26 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
 	return NULL;
 }
 
+static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
+{
+	uint32_t val, mask;
+
+	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
+
+	if (IS_BROXTON(dev_priv))
+		mask |= DC_STATE_DEBUG_MASK_CORES;
+
+	/* The below bit doesn't need to be cleared ever afterwards */
+	val = I915_READ(DC_STATE_DEBUG);
+	printk("reading dc_state_debug %08x\n", val);
+	if ((val & mask) != mask) {
+		val |= mask;
+		I915_WRITE(DC_STATE_DEBUG, val);
+		POSTING_READ(DC_STATE_DEBUG);
+		printk("write dc_state_debug %08x\n", val);
+	}
+}
+
 /**
  * intel_csr_load_program() - write the firmware from memory to register.
  * @dev_priv: i915 drm device.
@@ -220,19 +240,19 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
  * Everytime display comes back from low power state this function is called to
  * copy the firmware from internal memory to registers.
  */
-bool intel_csr_load_program(struct drm_i915_private *dev_priv)
+void intel_csr_load_program(struct drm_i915_private *dev_priv)
 {
 	u32 *payload = dev_priv->csr.dmc_payload;
 	uint32_t i, fw_size;
 
 	if (!IS_GEN9(dev_priv)) {
 		DRM_ERROR("No CSR support available for this platform\n");
-		return false;
+		return;
 	}
 
 	if (!dev_priv->csr.dmc_payload) {
 		DRM_ERROR("Tried to program CSR with empty payload\n");
-		return false;
+		return;
 	}
 
 	fw_size = dev_priv->csr.dmc_fw_size;
@@ -246,7 +266,7 @@ bool intel_csr_load_program(struct drm_i915_private *dev_priv)
 
 	dev_priv->csr.dc_state = 0;
 
-	return true;
+	gen9_set_dc_state_debugmask(dev_priv);
 }
 
 static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
@@ -388,18 +408,13 @@ static void csr_load_work_fn(struct work_struct *work)
 
 	ret = request_firmware(&fw, dev_priv->csr.fw_path,
 			       &dev_priv->dev->pdev->dev);
-	if (!fw)
-		goto out;
+	if (fw)
+		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
 
-	dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
-	if (!dev_priv->csr.dmc_payload)
-		goto out;
-
-	/* load csr program during system boot, as needed for DC states */
-	intel_csr_load_program(dev_priv);
-
-out:
 	if (dev_priv->csr.dmc_payload) {
+		/* load csr program during system boot, as needed for DC states */
+		intel_csr_load_program(dev_priv);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
 
 		DRM_INFO("Finished loading %s (v%u.%u)\n",
drivers/gpu/drm/i915/intel_drv.h +1 -1
index cd0b4ea..3daf1e3 100644
@@ -1279,7 +1279,7 @@ u32 skl_plane_ctl_rotation(unsigned int rotation);
 
 /* intel_csr.c */
 void intel_csr_ucode_init(struct drm_i915_private *);
-bool intel_csr_load_program(struct drm_i915_private *);
+void intel_csr_load_program(struct drm_i915_private *);
 void intel_csr_ucode_fini(struct drm_i915_private *);
 
 /* intel_dp.c */
drivers/gpu/drm/i915/intel_runtime_pm.c +2 -20
index 09c52b1..5adf4b3 100644
@@ -470,24 +470,6 @@ static void assert_can_disable_dc9(struct drm_i915_private *dev_priv)
 	  */
 }
 
-static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
-{
-	uint32_t val, mask;
-
-	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
-
-	if (IS_BROXTON(dev_priv))
-		mask |= DC_STATE_DEBUG_MASK_CORES;
-
-	/* The below bit doesn't need to be cleared ever afterwards */
-	val = I915_READ(DC_STATE_DEBUG);
-	if ((val & mask) != mask) {
-		val |= mask;
-		I915_WRITE(DC_STATE_DEBUG, val);
-		POSTING_READ(DC_STATE_DEBUG);
-	}
-}
-
 static void gen9_write_dc_state(struct drm_i915_private *dev_priv,
 				u32 state)
 {
@@ -2141,8 +2123,8 @@ static void skl_display_core_init(struct drm_i915_private *dev_priv,
 
 	skl_init_cdclk(dev_priv);
 
-	if (dev_priv->csr.dmc_payload && intel_csr_load_program(dev_priv))
-		gen9_set_dc_state_debugmask(dev_priv);
+	if (dev_priv->csr.dmc_payload)
+		intel_csr_load_program(dev_priv);
 }
 
 static void skl_display_core_uninit(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#1 lore raw

PATCH v2 1/1 drm/i915/gen9: Fix DMC firmware initialization

In commit 1e657ad7 we moved the last step of firmware initialization to skl_display_core_init(), where it will be run only during system resume, but not during driver loading. Since this init step needs to be done whenever we program the firmware fix this by moving the initialization to the end of intel_csr_load_program().

While at it simplify a bit csr_load_work_fn().

This issue prevented DC5/6 transitions, this change will re-enable those.

v2:
- remove debugging left-over and redundant comment in csr_load_work_fn()

Fixes 1e657ad7a48f ("drm/i915/gen9: Write dc state debugmask bits only once")
CC Mika Kuoppala <[email protected]>
CC Patrik Jakobsson <[email protected]>
---
 drivers/gpu/drm/i915/intel_csr.c        | 40 +++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_drv.h        |  2 +-
 drivers/gpu/drm/i915/intel_runtime_pm.c | 22 ++----------------
 3 files changed, 29 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/intel_csr.c +26 -14
index 902054e..d417d9a 100644
@@ -212,6 +212,24 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
 	return NULL;
 }
 
+static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
+{
+	uint32_t val, mask;
+
+	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
+
+	if (IS_BROXTON(dev_priv))
+		mask |= DC_STATE_DEBUG_MASK_CORES;
+
+	/* The below bit doesn't need to be cleared ever afterwards */
+	val = I915_READ(DC_STATE_DEBUG);
+	if ((val & mask) != mask) {
+		val |= mask;
+		I915_WRITE(DC_STATE_DEBUG, val);
+		POSTING_READ(DC_STATE_DEBUG);
+	}
+}
+
 /**
  * intel_csr_load_program() - write the firmware from memory to register.
  * @dev_priv: i915 drm device.
@@ -220,19 +238,19 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
  * Everytime display comes back from low power state this function is called to
  * copy the firmware from internal memory to registers.
  */
-bool intel_csr_load_program(struct drm_i915_private *dev_priv)
+void intel_csr_load_program(struct drm_i915_private *dev_priv)
 {
 	u32 *payload = dev_priv->csr.dmc_payload;
 	uint32_t i, fw_size;
 
 	if (!IS_GEN9(dev_priv)) {
 		DRM_ERROR("No CSR support available for this platform\n");
-		return false;
+		return;
 	}
 
 	if (!dev_priv->csr.dmc_payload) {
 		DRM_ERROR("Tried to program CSR with empty payload\n");
-		return false;
+		return;
 	}
 
 	fw_size = dev_priv->csr.dmc_fw_size;
@@ -246,7 +264,7 @@ bool intel_csr_load_program(struct drm_i915_private *dev_priv)
 
 	dev_priv->csr.dc_state = 0;
 
-	return true;
+	gen9_set_dc_state_debugmask(dev_priv);
 }
 
 static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
@@ -388,18 +406,12 @@ static void csr_load_work_fn(struct work_struct *work)
 
 	ret = request_firmware(&fw, dev_priv->csr.fw_path,
 			       &dev_priv->dev->pdev->dev);
-	if (!fw)
-		goto out;
+	if (fw)
+		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
 
-	dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
-	if (!dev_priv->csr.dmc_payload)
-		goto out;
-
-	/* load csr program during system boot, as needed for DC states */
-	intel_csr_load_program(dev_priv);
-
-out:
 	if (dev_priv->csr.dmc_payload) {
+		intel_csr_load_program(dev_priv);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
 
 		DRM_INFO("Finished loading %s (v%u.%u)\n",
drivers/gpu/drm/i915/intel_drv.h +1 -1
index cd0b4ea..3daf1e3 100644
@@ -1279,7 +1279,7 @@ u32 skl_plane_ctl_rotation(unsigned int rotation);
 
 /* intel_csr.c */
 void intel_csr_ucode_init(struct drm_i915_private *);
-bool intel_csr_load_program(struct drm_i915_private *);
+void intel_csr_load_program(struct drm_i915_private *);
 void intel_csr_ucode_fini(struct drm_i915_private *);
 
 /* intel_dp.c */
drivers/gpu/drm/i915/intel_runtime_pm.c +2 -20
index 09c52b1..5adf4b3 100644
@@ -470,24 +470,6 @@ static void assert_can_disable_dc9(struct drm_i915_private *dev_priv)
 	  */
 }
 
-static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
-{
-	uint32_t val, mask;
-
-	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
-
-	if (IS_BROXTON(dev_priv))
-		mask |= DC_STATE_DEBUG_MASK_CORES;
-
-	/* The below bit doesn't need to be cleared ever afterwards */
-	val = I915_READ(DC_STATE_DEBUG);
-	if ((val & mask) != mask) {
-		val |= mask;
-		I915_WRITE(DC_STATE_DEBUG, val);
-		POSTING_READ(DC_STATE_DEBUG);
-	}
-}
-
 static void gen9_write_dc_state(struct drm_i915_private *dev_priv,
 				u32 state)
 {
@@ -2141,8 +2123,8 @@ static void skl_display_core_init(struct drm_i915_private *dev_priv,
 
 	skl_init_cdclk(dev_priv);
 
-	if (dev_priv->csr.dmc_payload && intel_csr_load_program(dev_priv))
-		gen9_set_dc_state_debugmask(dev_priv);
+	if (dev_priv->csr.dmc_payload)
+		intel_csr_load_program(dev_priv);
 }
 
 static void skl_display_core_uninit(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH v2] drm/i915/gen9: Fix DMC firmware initialization

Quoted 86 lines · Imre Deak

[ text/plain ]
In commit 1e657ad7 we moved the last step of firmware initialization to skl_display_core_init(), where it will be run only during system resume, but not during driver loading. Since this init step needs to be done whenever we program the firmware fix this by moving the initialization to the end of intel_csr_load_program().

While at it simplify a bit csr_load_work_fn().

This issue prevented DC5/6 transitions, this change will re-enable those.

v2:
- remove debugging left-over and redundant comment in csr_load_work_fn()

Fixes 1e657ad7a48f ("drm/i915/gen9: Write dc state debugmask bits only once")
CC Mika Kuoppala <[email protected]>
CC Patrik Jakobsson <[email protected]>
---
 drivers/gpu/drm/i915/intel_csr.c        | 40 +++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_drv.h        |  2 +-
 drivers/gpu/drm/i915/intel_runtime_pm.c | 22 ++----------------
 3 files changed, 29 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/intel_csr.c +22 -4
index 902054e..d417d9a 100644
@@ -212,6 +212,24 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
 	return NULL;
 }
 
+static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
+{
+	uint32_t val, mask;
+
+	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
+
+	if (IS_BROXTON(dev_priv))
+		mask |= DC_STATE_DEBUG_MASK_CORES;
+
+	/* The below bit doesn't need to be cleared ever afterwards */
+	val = I915_READ(DC_STATE_DEBUG);
+	if ((val & mask) != mask) {
+		val |= mask;
+		I915_WRITE(DC_STATE_DEBUG, val);
+		POSTING_READ(DC_STATE_DEBUG);
+	}
+}
+
 /**
  * intel_csr_load_program() - write the firmware from memory to register.
  * @dev_priv: i915 drm device.
@@ -220,19 +238,19 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
  * Everytime display comes back from low power state this function is called to
  * copy the firmware from internal memory to registers.
  */
-bool intel_csr_load_program(struct drm_i915_private *dev_priv)
+void intel_csr_load_program(struct drm_i915_private *dev_priv)
 {
 	u32 *payload = dev_priv->csr.dmc_payload;
 	uint32_t i, fw_size;
 
 	if (!IS_GEN9(dev_priv)) {
 		DRM_ERROR("No CSR support available for this platform\n");
-		return false;
+		return;
 	}
 
 	if (!dev_priv->csr.dmc_payload) {
 		DRM_ERROR("Tried to program CSR with empty payload\n");
-		return false;
+		return;
 	}
 
 	fw_size = dev_priv->csr.dmc_fw_size;
@@ -246,7 +264,7 @@ bool intel_csr_load_program(struct drm_i915_private *dev_priv)
 
 	dev_priv->csr.dc_state = 0;
 
-	return true;
+	gen9_set_dc_state_debugmask(dev_priv);
 }
 
 static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_csr.c static void csr_load_work_fn(struct work_struct *work) · line 411

Quoted 8 lines
drivers/gpu/drm/i915/intel_csr.c +2 -2
@@ -388,18 +406,12 @@ static void csr_load_work_fn(struct work_struct *work)
 
 	ret = request_firmware(&fw, dev_priv->csr.fw_path,
 			       &dev_priv->dev->pdev->dev);
-	if (!fw)
-		goto out;
+	if (fw)
+		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
 

Why we check the fw pointer here and not the return value?

-Mika

Quoted 74 lines
drivers/gpu/drm/i915/intel_csr.c +2 -8
-	dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
-	if (!dev_priv->csr.dmc_payload)
-		goto out;
-
-	/* load csr program during system boot, as needed for DC states */
-	intel_csr_load_program(dev_priv);
-
-out:
 	if (dev_priv->csr.dmc_payload) {
+		intel_csr_load_program(dev_priv);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
 
 		DRM_INFO("Finished loading %s (v%u.%u)\n",
drivers/gpu/drm/i915/intel_drv.h +1 -1
index cd0b4ea..3daf1e3 100644
@@ -1279,7 +1279,7 @@ u32 skl_plane_ctl_rotation(unsigned int rotation);
 
 /* intel_csr.c */
 void intel_csr_ucode_init(struct drm_i915_private *);
-bool intel_csr_load_program(struct drm_i915_private *);
+void intel_csr_load_program(struct drm_i915_private *);
 void intel_csr_ucode_fini(struct drm_i915_private *);
 
 /* intel_dp.c */
drivers/gpu/drm/i915/intel_runtime_pm.c +2 -20
index 09c52b1..5adf4b3 100644
@@ -470,24 +470,6 @@ static void assert_can_disable_dc9(struct drm_i915_private *dev_priv)
 	  */
 }
 
-static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
-{
-	uint32_t val, mask;
-
-	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
-
-	if (IS_BROXTON(dev_priv))
-		mask |= DC_STATE_DEBUG_MASK_CORES;
-
-	/* The below bit doesn't need to be cleared ever afterwards */
-	val = I915_READ(DC_STATE_DEBUG);
-	if ((val & mask) != mask) {
-		val |= mask;
-		I915_WRITE(DC_STATE_DEBUG, val);
-		POSTING_READ(DC_STATE_DEBUG);
-	}
-}
-
 static void gen9_write_dc_state(struct drm_i915_private *dev_priv,
 				u32 state)
 {
@@ -2141,8 +2123,8 @@ static void skl_display_core_init(struct drm_i915_private *dev_priv,
 
 	skl_init_cdclk(dev_priv);
 
-	if (dev_priv->csr.dmc_payload && intel_csr_load_program(dev_priv))
-		gen9_set_dc_state_debugmask(dev_priv);
+	if (dev_priv->csr.dmc_payload)
+		intel_csr_load_program(dev_priv);
 }
 
 static void skl_display_core_uninit(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#3 lore raw

Re: [PATCH v2] drm/i915/gen9: Fix DMC firmware initialization

Quoted 110 lines · Mika Kuoppala
Quoted 108 lines · Imre Deak

[ text/plain ]
In commit 1e657ad7 we moved the last step of firmware initialization to
skl_display_core_init(), where it will be run only during system resume,
but not during driver loading. Since this init step needs to be done
whenever we program the firmware fix this by moving the initialization
to the end of intel_csr_load_program().

While at it simplify a bit csr_load_work_fn().

This issue prevented DC5/6 transitions, this change will re-enable those.

v2:
- remove debugging left-over and redundant comment in csr_load_work_fn()

Fixes 1e657ad7a48f ("drm/i915/gen9: Write dc state debugmask bits

only once")

CC Mika Kuoppala <[email protected]>
CC Patrik Jakobsson <[email protected]>

---
 drivers/gpu/drm/i915/intel_csr.c        | 40
+++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_drv.h        |  2 +- drivers/gpu/drm/i915/intel_runtime_pm.c | 22 ++----------------

 3 files changed, 29 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/intel_csr.c +0 -0
index 902054e..d417d9a 100644
@@ -212,6 +212,24 @@ static const struct stepping_info
 *intel_get_stepping_info(struct drm_device *de
  	return NULL;
  }


+static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/intel_csr.c +9 -0
+{
+	uint32_t val, mask;
+
+	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
+
+	if (IS_BROXTON(dev_priv))
+		mask |= DC_STATE_DEBUG_MASK_CORES;
+
+	/* The below bit doesn't need to be cleared ever

afterwards */

drivers/gpu/drm/i915/intel_csr.c +8 -0
+	val = I915_READ(DC_STATE_DEBUG);
+	if ((val & mask) != mask) {
+		val |= mask;
+		I915_WRITE(DC_STATE_DEBUG, val);
+		POSTING_READ(DC_STATE_DEBUG);
+	}
+}
+

 /**
  * intel_csr_load_program() - write the firmware from memory to register.
  * @dev_priv: i915 drm device.

drivers/gpu/drm/i915/intel_csr.c +0 -0
@@ -220,19 +238,19 @@ static const struct stepping_info
 *intel_get_stepping_info(struct drm_device *de
   * Everytime display comes back from low power state this function

is called to
  * copy the firmware from internal memory to registers. */

drivers/gpu/drm/i915/intel_csr.c +1 -1
-bool intel_csr_load_program(struct drm_i915_private *dev_priv)
+void intel_csr_load_program(struct drm_i915_private *dev_priv)

 {
  u32 *payload = dev_priv->csr.dmc_payload; uint32_t i, fw_size;

  if (!IS_GEN9(dev_priv)) {
  DRM_ERROR("No CSR support available for this platform\n");

drivers/gpu/drm/i915/intel_csr.c +1 -1
-		return false;
+		return;

  }

  if (!dev_priv->csr.dmc_payload) { DRM_ERROR("Tried to program CSR with empty payload\n");

drivers/gpu/drm/i915/intel_csr.c +1 -1
-		return false;
+		return;

  }

  fw_size = dev_priv->csr.dmc_fw_size;

drivers/gpu/drm/i915/intel_csr.c +0 -0
@@ -246,7 +264,7 @@ bool intel_csr_load_program(struct
 drm_i915_private *dev_priv)


  dev_priv->csr.dc_state = 0;

drivers/gpu/drm/i915/intel_csr.c +1 -1
-	return true;
+	gen9_set_dc_state_debugmask(dev_priv);

 }

 static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_csr.c +0 -0
@@ -388,18 +406,12 @@ static void csr_load_work_fn(struct
 work_struct *work)


  ret = request_firmware(&fw, dev_priv->csr.fw_path, &dev_priv->dev->pdev->dev);

Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_csr.c +2 -2
-	if (!fw)
-		goto out;
+	if (fw)
+		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv,

fw);

Why we check the fw pointer here and not the return value?

Yep, I noticed this too, it was an overlook in the the original code. Since it happens to work I didn't want to change it in this patch. But we should fix this as a follow-up.

--Imre

Quoted 74 lines

-Mika

Quoted 70 lines
drivers/gpu/drm/i915/intel_csr.c +0 -5
-	dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
-	if (!dev_priv->csr.dmc_payload)
-		goto out;
-
-	/* load csr program during system boot, as needed for DC

states */

drivers/gpu/drm/i915/intel_csr.c +0 -3
-	intel_csr_load_program(dev_priv);
-
-out:

  if (dev_priv->csr.dmc_payload) {

drivers/gpu/drm/i915/intel_csr.c +2 -0
+		intel_csr_load_program(dev_priv);
+

  intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);

  DRM_INFO("Finished loading %s (v%u.%u)\n",

drivers/gpu/drm/i915/intel_drv.h +0 -0
index cd0b4ea..3daf1e3 100644
@@ -1279,7 +1279,7 @@ u32 skl_plane_ctl_rotation(unsigned int
 rotation);


 /* intel_csr.c */
 void intel_csr_ucode_init(struct drm_i915_private *);

drivers/gpu/drm/i915/intel_drv.h +1 -1
-bool intel_csr_load_program(struct drm_i915_private *);
+void intel_csr_load_program(struct drm_i915_private *);

 void intel_csr_ucode_fini(struct drm_i915_private *);
 /* intel_dp.c */

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
index 09c52b1..5adf4b3 100644
@@ -470,24 +470,6 @@ static void assert_can_disable_dc9(struct
 drm_i915_private *dev_priv)
  	  */
  }


-static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -9
-{
-	uint32_t val, mask;
-
-	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
-
-	if (IS_BROXTON(dev_priv))
-		mask |= DC_STATE_DEBUG_MASK_CORES;
-
-	/* The below bit doesn't need to be cleared ever

afterwards */

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -8
-	val = I915_READ(DC_STATE_DEBUG);
-	if ((val & mask) != mask) {
-		val |= mask;
-		I915_WRITE(DC_STATE_DEBUG, val);
-		POSTING_READ(DC_STATE_DEBUG);
-	}
-}
-

 static void gen9_write_dc_state(struct drm_i915_private *dev_priv, u32 state)
 {

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
@@ -2141,8 +2123,8 @@ static void skl_display_core_init(struct
 drm_i915_private *dev_priv,


  skl_init_cdclk(dev_priv);

drivers/gpu/drm/i915/intel_runtime_pm.c +0 -1
-	if (dev_priv->csr.dmc_payload &&
Quoted 8 lines
Quoted 8 lines

intel_csr_load_program(dev_priv))

drivers/gpu/drm/i915/intel_runtime_pm.c +2 -1
-		gen9_set_dc_state_debugmask(dev_priv);
+	if (dev_priv->csr.dmc_payload)
+		intel_csr_load_program(dev_priv);

 }

 static void skl_display_core_uninit(struct drm_i915_private *dev_priv)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v2 1/1
#4 lore raw

Re: [PATCH v2] drm/i915/gen9: Fix DMC firmware initialization

In reply to Imre Deak
Quoted 11 lines · Imre Deak

[ text/plain ]
In commit 1e657ad7 we moved the last step of firmware initialization to skl_display_core_init(), where it will be run only during system resume, but not during driver loading. Since this init step needs to be done whenever we program the firmware fix this by moving the initialization to the end of intel_csr_load_program().

While at it simplify a bit csr_load_work_fn().

This issue prevented DC5/6 transitions, this change will re-enable those.

Quoted 7 lines

v2:
- remove debugging left-over and redundant comment in csr_load_work_fn()

Fixes 1e657ad7a48f ("drm/i915/gen9: Write dc state debugmask bits only once")
CC Mika Kuoppala <[email protected]>
CC Patrik Jakobsson <[email protected]>
Quoted 150 lines
---
 drivers/gpu/drm/i915/intel_csr.c        | 40 +++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_drv.h        |  2 +-
 drivers/gpu/drm/i915/intel_runtime_pm.c | 22 ++----------------
 3 files changed, 29 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/intel_csr.c +26 -14
index 902054e..d417d9a 100644
@@ -212,6 +212,24 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
 	return NULL;
 }
 
+static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
+{
+	uint32_t val, mask;
+
+	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
+
+	if (IS_BROXTON(dev_priv))
+		mask |= DC_STATE_DEBUG_MASK_CORES;
+
+	/* The below bit doesn't need to be cleared ever afterwards */
+	val = I915_READ(DC_STATE_DEBUG);
+	if ((val & mask) != mask) {
+		val |= mask;
+		I915_WRITE(DC_STATE_DEBUG, val);
+		POSTING_READ(DC_STATE_DEBUG);
+	}
+}
+
 /**
  * intel_csr_load_program() - write the firmware from memory to register.
  * @dev_priv: i915 drm device.
@@ -220,19 +238,19 @@ static const struct stepping_info *intel_get_stepping_info(struct drm_device *de
  * Everytime display comes back from low power state this function is called to
  * copy the firmware from internal memory to registers.
  */
-bool intel_csr_load_program(struct drm_i915_private *dev_priv)
+void intel_csr_load_program(struct drm_i915_private *dev_priv)
 {
 	u32 *payload = dev_priv->csr.dmc_payload;
 	uint32_t i, fw_size;
 
 	if (!IS_GEN9(dev_priv)) {
 		DRM_ERROR("No CSR support available for this platform\n");
-		return false;
+		return;
 	}
 
 	if (!dev_priv->csr.dmc_payload) {
 		DRM_ERROR("Tried to program CSR with empty payload\n");
-		return false;
+		return;
 	}
 
 	fw_size = dev_priv->csr.dmc_fw_size;
@@ -246,7 +264,7 @@ bool intel_csr_load_program(struct drm_i915_private *dev_priv)
 
 	dev_priv->csr.dc_state = 0;
 
-	return true;
+	gen9_set_dc_state_debugmask(dev_priv);
 }
 
 static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
@@ -388,18 +406,12 @@ static void csr_load_work_fn(struct work_struct *work)
 
 	ret = request_firmware(&fw, dev_priv->csr.fw_path,
 			       &dev_priv->dev->pdev->dev);
-	if (!fw)
-		goto out;
+	if (fw)
+		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
 
-	dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
-	if (!dev_priv->csr.dmc_payload)
-		goto out;
-
-	/* load csr program during system boot, as needed for DC states */
-	intel_csr_load_program(dev_priv);
-
-out:
 	if (dev_priv->csr.dmc_payload) {
+		intel_csr_load_program(dev_priv);
+
 		intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
 
 		DRM_INFO("Finished loading %s (v%u.%u)\n",
drivers/gpu/drm/i915/intel_drv.h +1 -1
index cd0b4ea..3daf1e3 100644
@@ -1279,7 +1279,7 @@ u32 skl_plane_ctl_rotation(unsigned int rotation);
 
 /* intel_csr.c */
 void intel_csr_ucode_init(struct drm_i915_private *);
-bool intel_csr_load_program(struct drm_i915_private *);
+void intel_csr_load_program(struct drm_i915_private *);
 void intel_csr_ucode_fini(struct drm_i915_private *);
 
 /* intel_dp.c */
drivers/gpu/drm/i915/intel_runtime_pm.c +2 -20
index 09c52b1..5adf4b3 100644
@@ -470,24 +470,6 @@ static void assert_can_disable_dc9(struct drm_i915_private *dev_priv)
 	  */
 }
 
-static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)
-{
-	uint32_t val, mask;
-
-	mask = DC_STATE_DEBUG_MASK_MEMORY_UP;
-
-	if (IS_BROXTON(dev_priv))
-		mask |= DC_STATE_DEBUG_MASK_CORES;
-
-	/* The below bit doesn't need to be cleared ever afterwards */
-	val = I915_READ(DC_STATE_DEBUG);
-	if ((val & mask) != mask) {
-		val |= mask;
-		I915_WRITE(DC_STATE_DEBUG, val);
-		POSTING_READ(DC_STATE_DEBUG);
-	}
-}
-
 static void gen9_write_dc_state(struct drm_i915_private *dev_priv,
 				u32 state)
 {
@@ -2141,8 +2123,8 @@ static void skl_display_core_init(struct drm_i915_private *dev_priv,
 
 	skl_init_cdclk(dev_priv);
 
-	if (dev_priv->csr.dmc_payload && intel_csr_load_program(dev_priv))
-		gen9_set_dc_state_debugmask(dev_priv);
+	if (dev_priv->csr.dmc_payload)
+		intel_csr_load_program(dev_priv);
 }
 
 static void skl_display_core_uninit(struct drm_i915_private *dev_priv)
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Fi.CI.BAT: failure for drm/i915/gen9: fix DMC firmware initialization (rev2)

In reply to Imre Deak
== Series Details ==

== Series Details ==

Series: drm/i915/gen9: fix DMC firmware initialization (rev2)
URL : https://patchwork.freedesktop.org/series/4121/
State : failure

== Summary ==

Series 4121v2 drm/i915/gen9: fix DMC firmware initialization
http://patchwork.freedesktop.org/api/1.0/series/4121/revisions/2/mbox/

Test kms_pipe_crc_basic:

        Subgroup read-crc-pipe-c:
                dmesg-warn -> PASS       (hsw-gt2)
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (skl-i5k-2)
                skip       -> PASS       (hsw-brixbox)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                dmesg-warn -> PASS       (snb-dellxps)
        Subgroup basic-rte:
                pass       -> DMESG-WARN (snb-x220t)
                pass       -> DMESG-WARN (snb-dellxps)
bdw-nuci7        total:183  pass:172  dwarn:0   dfail:0   fail:0   skip:11 
bdw-ultra        total:183  pass:165  dwarn:0   dfail:0   fail:0   skip:18 
byt-nuc          total:183  pass:152  dwarn:0   dfail:0   fail:0   skip:31 
hsw-brixbox      total:183  pass:164  dwarn:0   dfail:0   fail:0   skip:19 
hsw-gt2          total:183  pass:168  dwarn:1   dfail:0   fail:0   skip:14 
ilk-hp8440p      total:183  pass:125  dwarn:0   dfail:0   fail:0   skip:58 
ivb-t430s        total:183  pass:162  dwarn:0   dfail:0   fail:0   skip:21 
skl-i5k-2        total:183  pass:163  dwarn:0   dfail:0   fail:0   skip:20 
skl-i7k-2        total:183  pass:163  dwarn:0   dfail:0   fail:0   skip:20 
snb-dellxps      total:183  pass:153  dwarn:1   dfail:0   fail:0   skip:29 
snb-x220t        total:183  pass:153  dwarn:1   dfail:0   fail:1   skip:28 

Results at /archive/results/CI_IGT_test/Patchwork_1531/

d369e0096716c6000139162b3b340f684f0a51da drm-intel-nightly: 2016y-03m-04d-17h-18m-08s UTC integration manifest d54f860e963182521d0e4ff7d997c86381312573 drm/i915/gen9: Fix DMC firmware initialization

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#6 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915/gen9: fix DMC firmware initialization (rev2)

Quoted 12 lines · Patchwork

== Series Details ==

Series: drm/i915/gen9: fix DMC firmware initialization (rev2) URL   : https://patchwork.freedesktop.org/series/4121/
State : failure

== Summary ==

Series 4121v2 drm/i915/gen9: fix DMC firmware initialization
http://patchwork.freedesktop.org/api/1.0/series/4121/revisions/2/mbox
/

Quoted 11 lines

Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                dmesg-warn -> PASS       (hsw-gt2) Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (skl-i5k-2) skip       -> PASS       (hsw-brixbox) Test pm_rpm:
        Subgroup basic-pci-d3-state:
                dmesg-warn -> PASS       (snb-dellxps) Subgroup basic-rte:
                pass       -> DMESG-WARN (snb-x220t)

Unrelated platform, pre-existing issue:
https://bugs.freedesktop.org/show_bug.cgi?id=93123

Quoted 1 line

                pass       -> DMESG-WARN (snb-dellxps)

Unrelated platform, will be fixed by Matt's WM patches:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089001.html
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089048.html

--Imre

Quoted 32 lines

bdw-
nuci7        total:183  pass:172  dwarn:0   dfail:0   fail:0   skip:1 1
bdw-
ultra        total:183  pass:165  dwarn:0   dfail:0   fail:0   skip:1 8
byt-
nuc          total:183  pass:152  dwarn:0   dfail:0   fail:0   skip:3 1
hsw-
brixbox      total:183  pass:164  dwarn:0   dfail:0   fail:0   skip:1 9
hsw-
gt2          total:183  pass:168  dwarn:1   dfail:0   fail:0   skip:1 4
ilk-
hp8440p      total:183  pass:125  dwarn:0   dfail:0   fail:0   skip:5 8
ivb-
t430s        total:183  pass:162  dwarn:0   dfail:0   fail:0   skip:2 1
skl-i5k-
2        total:183  pass:163  dwarn:0   dfail:0   fail:0   skip:20 skl-i7k-
2        total:183  pass:163  dwarn:0   dfail:0   fail:0   skip:20 snb-
dellxps      total:183  pass:153  dwarn:1   dfail:0   fail:0   skip:2 9
snb-
x220t        total:183  pass:153  dwarn:1   dfail:0   fail:1   skip:2 8

Quoted 7 lines

Results at /archive/results/CI_IGT_test/Patchwork_1531/

d369e0096716c6000139162b3b340f684f0a51da drm-intel-nightly: 2016y- 03m-04d-17h-18m-08s UTC integration manifest d54f860e963182521d0e4ff7d997c86381312573 drm/i915/gen9: Fix DMC firmware initialization

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#7 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915/gen9: fix DMC firmware initialization (rev2)

Quoted 25 lines · Imre Deak
Quoted 12 lines · Patchwork

== Series Details ==

Series: drm/i915/gen9: fix DMC firmware initialization (rev2) URL   : https://patchwork.freedesktop.org/series/4121/
State : failure

== Summary ==

Series 4121v2 drm/i915/gen9: fix DMC firmware initialization
http://patchwork.freedesktop.org/api/1.0/series/4121/revisions/2/mbox
/

Quoted 11 lines

Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                dmesg-warn -> PASS       (hsw-gt2) Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (skl-i5k-2) skip       -> PASS       (hsw-brixbox) Test pm_rpm:
        Subgroup basic-pci-d3-state:
                dmesg-warn -> PASS       (snb-dellxps) Subgroup basic-rte:
                pass       -> DMESG-WARN (snb-x220t)

Quoted 8 lines

Unrelated platform, pre-existing issue:
https://bugs.freedesktop.org/show_bug.cgi?id=93123

Quoted 1 line

                pass       -> DMESG-WARN (snb-dellxps)

Unrelated platform, will be fixed by Matt's WM patches:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089001.html
https://lists.freedesktop.org/archives/intel-gfx/2016-March/089048.html

Thanks for the review, I pushed the patch to -dinq.

--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx