drm/i915/display: Communicate display configuration to pcode
Subsystems (3)
PATCH 1/1 drm/i915/display: Communicate display configuration to pcode
From: Jigar Bhatt <[email protected]>
Display to communicate "display configuration" to Pcode for more accurate power accounting for DG2. Existing sequence is only sending the voltage value to the Pcode. Adding new sequence with current cdclk associate with voltage value masking. Adding pcode request when any power well will disable or enable.
v2: - Fixed identation(Stanislav Lisovskiy)
- Made conditions more specific(in the commit we declare that we do this for DG2 only, however that commit changes >= to == for many other platforms.(Stanislav Lisovskiy)
v3: - Refactored code for proper identation and smaller conditions
(Andi Shyti)
- Switched to proper function naming, removed platform specific code from intel_atomic_commit_tail(Jani Nikula)
- Moved intel_cdclk_power_usage_to_pcode_pre/post_notification to proper places, before and after setting CDCLK(Stanislav Lisovskiy)
--- drivers/gpu/drm/i915/display/intel_cdclk.c | 97 ++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_cdclk.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 4 + 3 files changed, 94 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/display/intel_cdclk.c +88 -9
@@ -1908,10 +1908,10 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,* NOOP - No Pcode communication needed for * Display versions 14 and beyond */ ; - else if (DISPLAY_VER(dev_priv) >= 11) + else if (DISPLAY_VER(dev_priv) >= 11 && !IS_DG2(dev_priv)) ret =snb_pcode_write (&dev_priv->uncore,SKL_PCODE_CDCLK_CONTROL , cdclk_config->voltage_level); - else +if (DISPLAY_VER (dev_priv) <11 ) {/* * The timeout isn't specified, the 2ms used here is based on * experiment.
@@ -1922,7 +1922,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , cdclk_config->voltage_level, 150, 2); - + }if (ret) { drm_err(&dev_priv->drm, "PCode CDCLK freq set failed, (err %d, freq %d)\n",
@@ -2218,6 +2218,29 @@ void intel_cdclk_dump_config(struct drm_i915_private *i915, cdclk_config->voltage_level); } +static void intel_pcode_notify (struct drm_i915_private *i915, +unsigned int cdclk,u8 voltage_level, +u8 active_pipes) +{ +int ret; + +if (DISPLAY_VER (i915) <12 ) +return ; + + ret =skl_pcode_request (&i915->uncore,SKL_PCODE_CDCLK_CONTROL , +SKL_CDCLK_PREPARE_FOR_CHANGE | +DISPLAY_TO_PCODE_MASK + (cdclk, active_pipes, voltage_level), +SKL_CDCLK_READY_FOR_CHANGE , +SKL_CDCLK_READY_FOR_CHANGE ,3 ); +if (ret) { +drm_err (&i915->drm, +"Failed to inform PCU about display config (err %d)\n" , + ret); +return ; + } +} +/** * intel_set_cdclk - Push the CDCLK configuration to the hardware * @dev_priv: i915 device
@@ -2287,6 +2310,56 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, } } +/** +* intel_cdclk_power_usage_to_pcode_pre_notification: display to pcode notification +* before the enabling power wells. +* send notification with cdclk, number of pipes, voltage_level. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *old_cdclk_state = +intel_atomic_get_old_cdclk_state (state); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +if (!intel_cdclk_changed (&old_cdclk_state->actual, + &new_cdclk_state->actual) && + (new_cdclk_state->active_pipes == + old_cdclk_state->active_pipes)) +return ; +else if (old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +else if (old_cdclk_state->actual.cdclk >= new_cdclk_state->actual.cdclk) +intel_pcode_notify (dev_priv, old_cdclk_state->actual.cdclk, + old_cdclk_state->actual.voltage_level, + old_cdclk_state->active_pipes); +else if (old_cdclk_state->active_pipes != new_cdclk_state->active_pipes) +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); + +intel_pcode_notify (dev_priv,DISPLAY_TO_PCODE_CDCLK_MAX , + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +} + +/* intel_cdclk_power_usage_to_pcode_post_notification: after frequency change sending +* voltage_level, active pipes, current CDCLK frequency. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +} +/** * intel_set_cdclk_pre_plane_update - Push the CDCLK state to the hardware * @state: intel atomic state
@@ -2297,7 +2370,7 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =
@@ -2308,11 +2381,14 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_pre_notification (state); +if (pipe ==INVALID_PIPE || old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }
@@ -2326,7 +2402,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =
@@ -2337,11 +2413,14 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_post_notification (state); +if (pipe !=INVALID_PIPE && old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }
drivers/gpu/drm/i915/display/intel_cdclk.h +2 -0
@@ -64,6 +64,8 @@ bool intel_cdclk_needs_modeset(const struct intel_cdclk_config *a, const struct intel_cdclk_config *b);void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state);void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state);void intel_cdclk_dump_config (struct drm_i915_private *i915,const struct intel_cdclk_config *cdclk_config,const char *context);
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -6498,6 +6498,10 @@#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO (point) (((point) << 16) | (0x1 << 8))#define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8)) +#define DISPLAY_TO_PCODE_CDCLK_MAX 0x28D +#define DISPLAY_TO_PCODE_MASK (cdclk, num_pipes, voltage_level) \ + ((1 << 31) | (num_pipes << 28) | \ + (cdclk << 16) | (1 << 27) | voltage_level)#define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe#define ICL_PCODE_REP_QGV_MASK REG_GENMASK(1, 0)#define ICL_PCODE_REP_QGV_SAFE REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 0)
Signature · 1 line
2.37.3
Quoted 59 lines · Stanislav Lisovskiy
From: Jigar Bhatt <[email protected]>
Display to communicate "display configuration" to Pcode for more accurate power accounting for DG2. Existing sequence is only sending the voltage value to the Pcode. Adding new sequence with current cdclk associate with voltage value masking. Adding pcode request when any power well will disable or enable.
v2: - Fixed identation(Stanislav Lisovskiy)
- Made conditions more specific(in the commit we declare that we do this for DG2 only, however that commit changes >= to == for many other platforms.(Stanislav Lisovskiy)v3: - Refactored code for proper identation and smaller conditions
(Andi Shyti)
- Switched to proper function naming, removed platform specific code fromintel_atomic_commit_tail(Jani Nikula)
- Moved intel_cdclk_power_usage_to_pcode_pre/post_notification to proper places, before and after setting CDCLK(Stanislav Lisovskiy)Signed-off-by Jigar Bhatt <[email protected]>Signed-off-by Stanislav Lisovskiy <[email protected]>--- drivers/gpu/drm/i915/display/intel_cdclk.c | 97 ++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_cdclk.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 4 + 3 files changed, 94 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/display/intel_cdclk.c +4
-3@@ -1908,10 +1908,10 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,* NOOP - No Pcode communication needed for * Display versions 14 and beyond */ ; - else if (DISPLAY_VER(dev_priv) >= 11) + else if (DISPLAY_VER(dev_priv) >= 11 && !IS_DG2(dev_priv)) ret =snb_pcode_write (&dev_priv->uncore,SKL_PCODE_CDCLK_CONTROL , cdclk_config->voltage_level); - else +if (DISPLAY_VER (dev_priv) <11 ) {/* * The timeout isn't specified, the 2ms used here is based on * experiment. @@ -1922,7 +1922,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , cdclk_config->voltage_level, 150, 2); - + }if (ret) { drm_err(&dev_priv->drm, "PCode CDCLK freq set failed, (err %d, freq %d)\n",@@ -2218,6 +2218,29 @@ void intel_cdclk_dump_config(struct drm_i915_private *i915, cdclk_config->voltage_level); } +static void intel_pcode_notify(struct drm_i915_private *i915,
drivers/gpu/drm/i915/display/intel_cdclk.c void intel_cdclk_dump_config(struct drm_i915_private *i915, · line 2231
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +10
-0+ unsigned int cdclk, u8 voltage_level, + u8 active_pipes) +{ + int ret; + +if (DISPLAY_VER (i915) <12 ) +return ; + + ret = skl_pcode_request(&i915->uncore, SKL_PCODE_CDCLK_CONTROL, + SKL_CDCLK_PREPARE_FOR_CHANGE |
Isn't that something we're supposed to set only *before* the change? Here it looks like we're setting also for the post call.
Quoted 43 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +36
-0+DISPLAY_TO_PCODE_MASK + (cdclk, active_pipes, voltage_level), +SKL_CDCLK_READY_FOR_CHANGE , + SKL_CDCLK_READY_FOR_CHANGE, 3); +if (ret) { +drm_err (&i915->drm, +"Failed to inform PCU about display config (err %d)\n" , + ret); +return ; + } +} +/** * intel_set_cdclk - Push the CDCLK configuration to the hardware * @dev_priv: i915 device @@ -2287,6 +2310,56 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, } } +/** +* intel_cdclk_power_usage_to_pcode_pre_notification: display to pcode notification +* before the enabling power wells. +* send notification with cdclk, number of pipes, voltage_level. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *old_cdclk_state = +intel_atomic_get_old_cdclk_state (state); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +if (!intel_cdclk_changed (&old_cdclk_state->actual, + &new_cdclk_state->actual) && + (new_cdclk_state->active_pipes == + old_cdclk_state->active_pipes)) +return ; +else if (old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +else if (old_cdclk_state->actual.cdclk >= new_cdclk_state->actual.cdclk) + intel_pcode_notify(dev_priv, old_cdclk_state->actual.cdclk,
drivers/gpu/drm/i915/display/intel_cdclk.c static void intel_set_cdclk(struct drm_i915_private *dev_priv, · line 2346
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +10
-0+ old_cdclk_state->actual.voltage_level, + old_cdclk_state->active_pipes); + else if (old_cdclk_state->active_pipes != new_cdclk_state->active_pipes) + intel_pcode_notify(dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); + +intel_pcode_notify (dev_priv,DISPLAY_TO_PCODE_CDCLK_MAX , + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes);
I don't understand what is going on here. Are we trying to say something like
intel_pcode_notify(...,
max(old_cdclk, new_cdclk), max(old_voltage_level, new_voltage_level), old_active_pipes | new_active_pipes);
?
Also the inclusion of the pipes here would imply that we need to think about serialize vs. lock.
Quoted 101 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +28
-6+} + +/* intel_cdclk_power_usage_to_pcode_post_notification: after frequency change sending +* voltage_level, active pipes, current CDCLK frequency. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +} +/** * intel_set_cdclk_pre_plane_update - Push the CDCLK state to the hardware * @state: intel atomic state @@ -2297,7 +2370,7 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2308,11 +2381,14 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_pre_notification (state); +if (pipe ==INVALID_PIPE || old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }@@ -2326,7 +2402,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2337,11 +2413,14 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_post_notification (state); +if (pipe !=INVALID_PIPE && old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }drivers/gpu/drm/i915/display/intel_cdclk.h +2
-0@@ -64,6 +64,8 @@ bool intel_cdclk_needs_modeset(const struct intel_cdclk_config *a, const struct intel_cdclk_config *b);void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state);void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state);void intel_cdclk_dump_config (struct drm_i915_private *i915,const struct intel_cdclk_config *cdclk_config,const char *context);drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -6498,6 +6498,10 @@#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO (point) (((point) << 16) | (0x1 << 8))#define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8)) +#define DISPLAY_TO_PCODE_CDCLK_MAX 0x28D +#define DISPLAY_TO_PCODE_MASK (cdclk, num_pipes, voltage_level) \ + ((1 << 31) | (num_pipes << 28) | \ + (cdclk << 16) | (1 << 27) | voltage_level)#define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe#define ICL_PCODE_REP_QGV_MASK REG_GENMASK(1, 0)#define ICL_PCODE_REP_QGV_SAFE REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 0)Signature · 1 line
2.37.3
Signature · 2 lines
Ville Syrjälä Intel
Quoted 59 lines · Ville Syrjälä
Quoted 58 lines · Stanislav Lisovskiy
From: Jigar Bhatt <[email protected]>
Display to communicate "display configuration" to Pcode for more accurate power accounting for DG2. Existing sequence is only sending the voltage value to the Pcode. Adding new sequence with current cdclk associate with voltage value masking. Adding pcode request when any power well will disable or enable.
v2: - Fixed identation(Stanislav Lisovskiy)
- Made conditions more specific(in the commit we declare that we do this for DG2 only, however that commit changes >= to == for many other platforms.(Stanislav Lisovskiy)v3: - Refactored code for proper identation and smaller conditions
(Andi Shyti)
- Switched to proper function naming, removed platform specific code fromintel_atomic_commit_tail(Jani Nikula)
- Moved intel_cdclk_power_usage_to_pcode_pre/post_notification to proper places, before and after setting CDCLK(Stanislav Lisovskiy)Signed-off-by Jigar Bhatt <[email protected]>Signed-off-by Stanislav Lisovskiy <[email protected]>--- drivers/gpu/drm/i915/display/intel_cdclk.c | 97 ++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_cdclk.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 4 + 3 files changed, 94 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/display/intel_cdclk.c +3
-3@@ -1908,10 +1908,10 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,* NOOP - No Pcode communication needed for * Display versions 14 and beyond */ ; - else if (DISPLAY_VER(dev_priv) >= 11) + else if (DISPLAY_VER(dev_priv) >= 11 && !IS_DG2(dev_priv)) ret =snb_pcode_write (&dev_priv->uncore,SKL_PCODE_CDCLK_CONTROL , cdclk_config->voltage_level); - else +if (DISPLAY_VER (dev_priv) <11 ) {/* * The timeout isn't specified, the 2ms used here is based on * experiment. @@ -1922,7 +1922,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , cdclk_config->voltage_level, 150, 2); - + }if (ret) { drm_err(&dev_priv->drm, "PCode CDCLK freq set failed, (err %d, freq %d)\n",@@ -2218,6 +2218,29 @@ void intel_cdclk_dump_config(struct drm_i915_private *i915, cdclk_config->voltage_level); }
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_cdclk.c void intel_cdclk_dump_config(struct drm_i915_private *i915, · line 2231
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +11
-0+static void intel_pcode_notify (struct drm_i915_private *i915, +unsigned int cdclk,u8 voltage_level, +u8 active_pipes) +{ +int ret; + +if (DISPLAY_VER (i915) <12 ) +return ; + + ret = skl_pcode_request(&i915->uncore, SKL_PCODE_CDCLK_CONTROL, + SKL_CDCLK_PREPARE_FOR_CHANGE |Isn't that something we're supposed to set only *before* the change? Here it looks like we're setting also for the post call.
According to BSpec, we are supposed to send notifications both before and after setting CDCLK:
1) Before the change we need to set voltage bits to the max(bits 1:0 set to 3)
2) If CDCLK is increasing set to increased value or leave the same
3) If enabling pipe write upcoming pipe count
After the change
1) we set required voltage level
2) write CDCLK bits if CDCLK is disabled
3) If pipe is disabled write the current pipe count
I agree, current code in fact doesn't do it exactly as described.
Quoted 58 lines
Quoted 44 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +36
-0+DISPLAY_TO_PCODE_MASK + (cdclk, active_pipes, voltage_level), +SKL_CDCLK_READY_FOR_CHANGE , + SKL_CDCLK_READY_FOR_CHANGE, 3); +if (ret) { +drm_err (&i915->drm, +"Failed to inform PCU about display config (err %d)\n" , + ret); +return ; + } +} +/** * intel_set_cdclk - Push the CDCLK configuration to the hardware * @dev_priv: i915 device @@ -2287,6 +2310,56 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, } } +/** +* intel_cdclk_power_usage_to_pcode_pre_notification: display to pcode notification +* before the enabling power wells. +* send notification with cdclk, number of pipes, voltage_level. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *old_cdclk_state = +intel_atomic_get_old_cdclk_state (state); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +if (!intel_cdclk_changed (&old_cdclk_state->actual, + &new_cdclk_state->actual) && + (new_cdclk_state->active_pipes == + old_cdclk_state->active_pipes)) +return ; +else if (old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +else if (old_cdclk_state->actual.cdclk >= new_cdclk_state->actual.cdclk) + intel_pcode_notify(dev_priv, old_cdclk_state->actual.cdclk,drivers/gpu/drm/i915/display/intel_cdclk.c static void intel_set_cdclk(struct drm_i915_private *dev_priv, · line 2346
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +10
-0+ old_cdclk_state->actual.voltage_level, + old_cdclk_state->active_pipes); + else if (old_cdclk_state->active_pipes != new_cdclk_state->active_pipes) + intel_pcode_notify(dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); + +intel_pcode_notify (dev_priv,DISPLAY_TO_PCODE_CDCLK_MAX , + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes);I don't understand what is going on here. Are we trying to say something like
Quoted 4 lines
intel_pcode_notify(...,
max(old_cdclk, new_cdclk), max(old_voltage_level, new_voltage_level), old_active_pipes | new_active_pipes);
Regarding CDCLK yes, for voltage level, just read out from BSpec that we are supposed to set voltage level to to max(3) always before the change. Dunno why this was implemented that way initially(BSpec got updated?)
Quoted 4 lines
?
Also the inclusion of the pipes here would imply that we need to think about serialize vs. lock.
Should we already had locked/serialized global state in intel_modeset_calc_cdclk, if active_pipes/cdclk had changed?
Stan
Quoted 106 lines
Quoted 102 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +28
-6+} + +/* intel_cdclk_power_usage_to_pcode_post_notification: after frequency change sending +* voltage_level, active pipes, current CDCLK frequency. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +} +/** * intel_set_cdclk_pre_plane_update - Push the CDCLK state to the hardware * @state: intel atomic state @@ -2297,7 +2370,7 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2308,11 +2381,14 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_pre_notification (state); +if (pipe ==INVALID_PIPE || old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }@@ -2326,7 +2402,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2337,11 +2413,14 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_post_notification (state); +if (pipe !=INVALID_PIPE && old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }drivers/gpu/drm/i915/display/intel_cdclk.h +2
-0@@ -64,6 +64,8 @@ bool intel_cdclk_needs_modeset(const struct intel_cdclk_config *a, const struct intel_cdclk_config *b);void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state);void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state);void intel_cdclk_dump_config (struct drm_i915_private *i915,const struct intel_cdclk_config *cdclk_config,const char *context);drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -6498,6 +6498,10 @@#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO (point) (((point) << 16) | (0x1 << 8))#define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8)) +#define DISPLAY_TO_PCODE_CDCLK_MAX 0x28D +#define DISPLAY_TO_PCODE_MASK (cdclk, num_pipes, voltage_level) \ + ((1 << 31) | (num_pipes << 28) | \ + (cdclk << 16) | (1 << 27) | voltage_level)#define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe#define ICL_PCODE_REP_QGV_MASK REG_GENMASK(1, 0)#define ICL_PCODE_REP_QGV_SAFE REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 0)Signature · 1 line
2.37.3Signature · 2 lines
Ville Syrjälä Intel
Quoted 76 lines · Stanislav
Quoted 59 lines · Ville Syrjälä
Quoted 58 lines · Stanislav Lisovskiy
From: Jigar Bhatt <[email protected]>
Display to communicate "display configuration" to Pcode for more accurate power accounting for DG2. Existing sequence is only sending the voltage value to the Pcode. Adding new sequence with current cdclk associate with voltage value masking. Adding pcode request when any power well will disable or enable.
v2: - Fixed identation(Stanislav Lisovskiy)
- Made conditions more specific(in the commit we declare that we do this for DG2 only, however that commit changes >= to == for many other platforms.(Stanislav Lisovskiy)v3: - Refactored code for proper identation and smaller conditions
(Andi Shyti)
- Switched to proper function naming, removed platform specific code fromintel_atomic_commit_tail(Jani Nikula)
- Moved intel_cdclk_power_usage_to_pcode_pre/post_notification to proper places, before and after setting CDCLK(Stanislav Lisovskiy)Signed-off-by Jigar Bhatt <[email protected]>Signed-off-by Stanislav Lisovskiy <[email protected]>--- drivers/gpu/drm/i915/display/intel_cdclk.c | 97 ++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_cdclk.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 4 + 3 files changed, 94 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/display/intel_cdclk.c +3
-3@@ -1908,10 +1908,10 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,* NOOP - No Pcode communication needed for * Display versions 14 and beyond */ ; - else if (DISPLAY_VER(dev_priv) >= 11) + else if (DISPLAY_VER(dev_priv) >= 11 && !IS_DG2(dev_priv)) ret =snb_pcode_write (&dev_priv->uncore,SKL_PCODE_CDCLK_CONTROL , cdclk_config->voltage_level); - else +if (DISPLAY_VER (dev_priv) <11 ) {/* * The timeout isn't specified, the 2ms used here is based on * experiment. @@ -1922,7 +1922,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , cdclk_config->voltage_level, 150, 2); - + }if (ret) { drm_err(&dev_priv->drm, "PCode CDCLK freq set failed, (err %d, freq %d)\n",@@ -2218,6 +2218,29 @@ void intel_cdclk_dump_config(struct drm_i915_private *i915, cdclk_config->voltage_level); }Quoted 15 lines
drivers/gpu/drm/i915/display/intel_cdclk.c void intel_cdclk_dump_config(struct drm_i915_private *i915, · line 2231
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +11
-0+static void intel_pcode_notify (struct drm_i915_private *i915, +unsigned int cdclk,u8 voltage_level, +u8 active_pipes) +{ +int ret; + +if (DISPLAY_VER (i915) <12 ) +return ; + + ret = skl_pcode_request(&i915->uncore, SKL_PCODE_CDCLK_CONTROL, + SKL_CDCLK_PREPARE_FOR_CHANGE |Isn't that something we're supposed to set only *before* the change? Here it looks like we're setting also for the post call.
Quoted 4 lines
According to BSpec, we are supposed to send notifications both before and after setting CDCLK:
1) Before the change we need to set voltage bits to the max(bits 1:0 set to 3)
You are doing that for both pre and post now.
Quoted 69 lines
2) If CDCLK is increasing set to increased value or leave the same
3) If enabling pipe write upcoming pipe countAfter the change
1) we set required voltage level
2) write CDCLK bits if CDCLK is disabled
3) If pipe is disabled write the current pipe countI agree, current code in fact doesn't do it exactly as described.
Quoted 58 lines
Quoted 44 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +36
-0+DISPLAY_TO_PCODE_MASK + (cdclk, active_pipes, voltage_level), +SKL_CDCLK_READY_FOR_CHANGE , + SKL_CDCLK_READY_FOR_CHANGE, 3); +if (ret) { +drm_err (&i915->drm, +"Failed to inform PCU about display config (err %d)\n" , + ret); +return ; + } +} +/** * intel_set_cdclk - Push the CDCLK configuration to the hardware * @dev_priv: i915 device @@ -2287,6 +2310,56 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, } } +/** +* intel_cdclk_power_usage_to_pcode_pre_notification: display to pcode notification +* before the enabling power wells. +* send notification with cdclk, number of pipes, voltage_level. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *old_cdclk_state = +intel_atomic_get_old_cdclk_state (state); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +if (!intel_cdclk_changed (&old_cdclk_state->actual, + &new_cdclk_state->actual) && + (new_cdclk_state->active_pipes == + old_cdclk_state->active_pipes)) +return ; +else if (old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +else if (old_cdclk_state->actual.cdclk >= new_cdclk_state->actual.cdclk) + intel_pcode_notify(dev_priv, old_cdclk_state->actual.cdclk,drivers/gpu/drm/i915/display/intel_cdclk.c static void intel_set_cdclk(struct drm_i915_private *dev_priv, · line 2346
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +10
-0+ old_cdclk_state->actual.voltage_level, + old_cdclk_state->active_pipes); + else if (old_cdclk_state->active_pipes != new_cdclk_state->active_pipes) + intel_pcode_notify(dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); + +intel_pcode_notify (dev_priv,DISPLAY_TO_PCODE_CDCLK_MAX , + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes);I don't understand what is going on here. Are we trying to say something like
Quoted 8 lines
Quoted 4 lines
intel_pcode_notify(...,
max(old_cdclk, new_cdclk), max(old_voltage_level, new_voltage_level), old_active_pipes | new_active_pipes);Regarding CDCLK yes, for voltage level, just read out from BSpec that we are supposed to set voltage level to to max(3) always before the change. Dunno why this was implemented that way initially(BSpec got updated?)
Pretty sure it's always been like that for all platforms. Dunno why.
Quoted 9 lines
Quoted 6 lines
?
Also the inclusion of the pipes here would imply that we need to think about serialize vs. lock.
Should we already had locked/serialized global state in
intel_modeset_calc_cdclk, if active_pipes/cdclk had changed?
For active_pipes in particular, locked yes, serialized no since no other platform needs us to poke the hardware state on active_pipes changes. The lock is what protects the software state, serialize is what guarantees the hardware state updates happen in the correct order.
Quoted 109 lines
Stan
Quoted 106 lines
Quoted 102 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +28
-6+} + +/* intel_cdclk_power_usage_to_pcode_post_notification: after frequency change sending +* voltage_level, active pipes, current CDCLK frequency. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +} +/** * intel_set_cdclk_pre_plane_update - Push the CDCLK state to the hardware * @state: intel atomic state @@ -2297,7 +2370,7 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2308,11 +2381,14 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_pre_notification (state); +if (pipe ==INVALID_PIPE || old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }@@ -2326,7 +2402,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2337,11 +2413,14 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_post_notification (state); +if (pipe !=INVALID_PIPE && old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }drivers/gpu/drm/i915/display/intel_cdclk.h +2
-0@@ -64,6 +64,8 @@ bool intel_cdclk_needs_modeset(const struct intel_cdclk_config *a, const struct intel_cdclk_config *b);void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state);void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state);void intel_cdclk_dump_config (struct drm_i915_private *i915,const struct intel_cdclk_config *cdclk_config,const char *context);drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -6498,6 +6498,10 @@#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO (point) (((point) << 16) | (0x1 << 8))#define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8)) +#define DISPLAY_TO_PCODE_CDCLK_MAX 0x28D +#define DISPLAY_TO_PCODE_MASK (cdclk, num_pipes, voltage_level) \ + ((1 << 31) | (num_pipes << 28) | \ + (cdclk << 16) | (1 << 27) | voltage_level)#define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe#define ICL_PCODE_REP_QGV_MASK REG_GENMASK(1, 0)#define ICL_PCODE_REP_QGV_SAFE REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 0)Signature · 1 line
2.37.3Signature · 2 lines
Ville Syrjälä Intel
Signature · 2 lines
Ville Syrjälä Intel
Quoted 171 lines · Ville Syrjälä
Quoted 76 lines · Stanislav
Quoted 59 lines · Ville Syrjälä
Quoted 58 lines · Stanislav Lisovskiy
From: Jigar Bhatt <[email protected]>
Display to communicate "display configuration" to Pcode for more accurate power accounting for DG2. Existing sequence is only sending the voltage value to the Pcode. Adding new sequence with current cdclk associate with voltage value masking. Adding pcode request when any power well will disable or enable.
v2: - Fixed identation(Stanislav Lisovskiy)
- Made conditions more specific(in the commit we declare that we do this for DG2 only, however that commit changes >= to == for many other platforms.(Stanislav Lisovskiy)v3: - Refactored code for proper identation and smaller conditions
(Andi Shyti)
- Switched to proper function naming, removed platform specific code fromintel_atomic_commit_tail(Jani Nikula)
- Moved intel_cdclk_power_usage_to_pcode_pre/post_notification to proper places, before and after setting CDCLK(Stanislav Lisovskiy)Signed-off-by Jigar Bhatt <[email protected]>Signed-off-by Stanislav Lisovskiy <[email protected]>--- drivers/gpu/drm/i915/display/intel_cdclk.c | 97 ++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_cdclk.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 4 + 3 files changed, 94 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/display/intel_cdclk.c +3
-3@@ -1908,10 +1908,10 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,* NOOP - No Pcode communication needed for * Display versions 14 and beyond */ ; - else if (DISPLAY_VER(dev_priv) >= 11) + else if (DISPLAY_VER(dev_priv) >= 11 && !IS_DG2(dev_priv)) ret =snb_pcode_write (&dev_priv->uncore,SKL_PCODE_CDCLK_CONTROL , cdclk_config->voltage_level); - else +if (DISPLAY_VER (dev_priv) <11 ) {/* * The timeout isn't specified, the 2ms used here is based on * experiment. @@ -1922,7 +1922,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , cdclk_config->voltage_level, 150, 2); - + }if (ret) { drm_err(&dev_priv->drm, "PCode CDCLK freq set failed, (err %d, freq %d)\n",@@ -2218,6 +2218,29 @@ void intel_cdclk_dump_config(struct drm_i915_private *i915, cdclk_config->voltage_level); }Quoted 15 lines
drivers/gpu/drm/i915/display/intel_cdclk.c void intel_cdclk_dump_config(struct drm_i915_private *i915, · line 2231
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +11
-0+static void intel_pcode_notify (struct drm_i915_private *i915, +unsigned int cdclk,u8 voltage_level, +u8 active_pipes) +{ +int ret; + +if (DISPLAY_VER (i915) <12 ) +return ; + + ret = skl_pcode_request(&i915->uncore, SKL_PCODE_CDCLK_CONTROL, + SKL_CDCLK_PREPARE_FOR_CHANGE |Isn't that something we're supposed to set only *before* the change? Here it looks like we're setting also for the post call.
Quoted 4 lines
According to BSpec, we are supposed to send notifications both before and after setting CDCLK:
1) Before the change we need to set voltage bits to the max(bits 1:0 set to 3)
You are doing that for both pre and post now.
Quoted 69 lines
2) If CDCLK is increasing set to increased value or leave the same
3) If enabling pipe write upcoming pipe countAfter the change
1) we set required voltage level
2) write CDCLK bits if CDCLK is disabled
3) If pipe is disabled write the current pipe countI agree, current code in fact doesn't do it exactly as described.
Quoted 58 lines
Quoted 44 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +36
-0+DISPLAY_TO_PCODE_MASK + (cdclk, active_pipes, voltage_level), +SKL_CDCLK_READY_FOR_CHANGE , + SKL_CDCLK_READY_FOR_CHANGE, 3); +if (ret) { +drm_err (&i915->drm, +"Failed to inform PCU about display config (err %d)\n" , + ret); +return ; + } +} +/** * intel_set_cdclk - Push the CDCLK configuration to the hardware * @dev_priv: i915 device @@ -2287,6 +2310,56 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv, } } +/** +* intel_cdclk_power_usage_to_pcode_pre_notification: display to pcode notification +* before the enabling power wells. +* send notification with cdclk, number of pipes, voltage_level. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *old_cdclk_state = +intel_atomic_get_old_cdclk_state (state); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +if (!intel_cdclk_changed (&old_cdclk_state->actual, + &new_cdclk_state->actual) && + (new_cdclk_state->active_pipes == + old_cdclk_state->active_pipes)) +return ; +else if (old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +else if (old_cdclk_state->actual.cdclk >= new_cdclk_state->actual.cdclk) + intel_pcode_notify(dev_priv, old_cdclk_state->actual.cdclk,drivers/gpu/drm/i915/display/intel_cdclk.c static void intel_set_cdclk(struct drm_i915_private *dev_priv, · line 2346
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +10
-0+ old_cdclk_state->actual.voltage_level, + old_cdclk_state->active_pipes); + else if (old_cdclk_state->active_pipes != new_cdclk_state->active_pipes) + intel_pcode_notify(dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); + +intel_pcode_notify (dev_priv,DISPLAY_TO_PCODE_CDCLK_MAX , + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes);I don't understand what is going on here. Are we trying to say something like
Quoted 8 lines
Quoted 4 lines
intel_pcode_notify(...,
max(old_cdclk, new_cdclk), max(old_voltage_level, new_voltage_level), old_active_pipes | new_active_pipes);Regarding CDCLK yes, for voltage level, just read out from BSpec that we are supposed to set voltage level to to max(3) always before the change. Dunno why this was implemented that way initially(BSpec got updated?)
Pretty sure it's always been like that for all platforms. Dunno why.
Quoted 7 lines
Quoted 6 lines
?
Also the inclusion of the pipes here would imply that we need to think about serialize vs. lock.
Quoted 7 lines
Quoted 2 lines
Should we already had locked/serialized global state in
intel_modeset_calc_cdclk, if active_pipes/cdclk had changed?For
active_pipesin particular, locked yes, serialized no since no other platform needs us to poke the hardware state onactive_pipeschanges. The lock is what protects the software state, serialize is what guarantees the hardware state updates happen in the correct order.
Okay, then I need to extend serializing also active_pipes change in intel_modeset_calc_cdclk.
As a side note, wonder if we could make some kind of automated way to determine when we need to serialize or lock global state, i.e smth like cdclk_state_is_serialize_needed(new_cdclk_state, old_cdclk_state)
or cdclk_state_is_global_lock_needed. Have similar helpers to compare bw_state and other states also.
So that we don't have to hardcode all this logic, also will make this look more intuitively understandable.
Quoted 114 lines
Quoted 110 lines
Stan
Quoted 106 lines
Quoted 102 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +28
-6+} + +/* intel_cdclk_power_usage_to_pcode_post_notification: after frequency change sending +* voltage_level, active pipes, current CDCLK frequency. +* @state: intel atomic state +*/ +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +const struct intel_cdclk_state *new_cdclk_state = +intel_atomic_get_new_cdclk_state (state); +intel_pcode_notify (dev_priv, new_cdclk_state->actual.cdclk, + new_cdclk_state->actual.voltage_level, + new_cdclk_state->active_pipes); +} +/** * intel_set_cdclk_pre_plane_update - Push the CDCLK state to the hardware * @state: intel atomic state @@ -2297,7 +2370,7 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2308,11 +2381,14 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_pre_notification (state); +if (pipe ==INVALID_PIPE || old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }@@ -2326,7 +2402,7 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state) { -struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_cdclk_state *old_cdclk_state =intel_atomic_get_old_cdclk_state (state); const struct intel_cdclk_state *new_cdclk_state =@@ -2337,11 +2413,14 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state) &new_cdclk_state->actual))return ; +if (DISPLAY_VER (i915) >=12 ) +intel_cdclk_power_usage_to_pcode_post_notification (state); +if (pipe !=INVALID_PIPE && old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&dev_priv->drm, !new_cdclk_state->base.changed); +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); -intel_set_cdclk (dev_priv, &new_cdclk_state->actual, pipe); +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); } }drivers/gpu/drm/i915/display/intel_cdclk.h +2
-0@@ -64,6 +64,8 @@ bool intel_cdclk_needs_modeset(const struct intel_cdclk_config *a, const struct intel_cdclk_config *b);void intel_set_cdclk_pre_plane_update (struct intel_atomic_state *state);void intel_set_cdclk_post_plane_update (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_pre_notification (struct intel_atomic_state *state); +void intel_cdclk_power_usage_to_pcode_post_notification (struct intel_atomic_state *state);void intel_cdclk_dump_config (struct drm_i915_private *i915,const struct intel_cdclk_config *cdclk_config,const char *context);drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -6498,6 +6498,10 @@#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8)#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO (point) (((point) << 16) | (0x1 << 8))#define ADL_PCODE_MEM_SS_READ_PSF_GV_INFO ((0) | (0x2 << 8)) +#define DISPLAY_TO_PCODE_CDCLK_MAX 0x28D +#define DISPLAY_TO_PCODE_MASK (cdclk, num_pipes, voltage_level) \ + ((1 << 31) | (num_pipes << 28) | \ + (cdclk << 16) | (1 << 27) | voltage_level)#define ICL_PCODE_SAGV_DE_MEM_SS_CONFIG 0xe#define ICL_PCODE_REP_QGV_MASK REG_GENMASK(1, 0)#define ICL_PCODE_REP_QGV_SAFE REG_FIELD_PREP(ICL_PCODE_REP_QGV_MASK, 0)Signature · 1 line
2.37.3Signature · 2 lines
Ville Syrjälä IntelSignature · 2 lines
Ville Syrjälä Intel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/display: Communicate display configuration to pcode (rev3)
In reply to Stanislav Lisovskiy== Series Details ==
== Series Details ==
Series: drm/i915/display: Communicate display configuration to pcode (rev3)
URL : https://patchwork.freedesktop.org/series/102678/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/display: Communicate display configuration to pcode (rev3)
In reply to Stanislav Lisovskiy== Series Details ==
== Series Details ==
Series: drm/i915/display: Communicate display configuration to pcode (rev3)
URL : https://patchwork.freedesktop.org/series/102678/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_12738 -> Patchwork_102678v3
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_102678v3 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_102678v3, please notify your bug team 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_102678v3/index.html
Participating hosts (38 -> 38)
------------------------------
Additional (2): fi-kbl-soraka fi-rkl-11600
Missing (2): bat-atsm-1 fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_102678v3:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@execlists:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-kbl-soraka/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in Patchwork_102678v3 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@debugfs_test@basic-hwmon:
- fi-rkl-11600: NOTRUN -> [SKIP][2] ([i915#7456])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@gem_huc_copy@huc-copy:
- fi-rkl-11600: NOTRUN -> [SKIP][3] ([i915#2190])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-kbl-soraka/igt@[email protected]
* igt@gem_lmem_swapping@parallel-random-engines:
- fi-rkl-11600: NOTRUN -> [SKIP][6] ([i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@gem_tiled_pread_basic:
- fi-rkl-11600: NOTRUN -> [SKIP][7] ([i915#3282])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@gem_tiled_pread_basic.html
* igt@i915_pm_backlight@basic-brightness:
- fi-rkl-11600: NOTRUN -> [SKIP][8] ([i915#7561])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][9] ([i915#5334] / [i915#7872])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][10] ([i915#1886])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html
* igt@kms_chamelium_frames@hdmi-crc-fast:
- fi-kbl-soraka: NOTRUN -> [SKIP][11] ([fdo#109271]) +15 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-kbl-soraka/igt@[email protected]
* igt@kms_chamelium_hpd@dp-hpd-fast:
- fi-rkl-11600: NOTRUN -> [SKIP][12] ([i915#7828]) +8 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
- fi-rkl-11600: NOTRUN -> [SKIP][13] ([i915#4103])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-n3050: [PASS][14] -> [FAIL][15] ([i915#6298])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12738/fi-bsw-n3050/igt@kms_cursor_legacy@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-bsw-n3050/igt@kms_cursor_legacy@[email protected]
* igt@kms_force_connector_basic@force-load-detect:
- fi-rkl-11600: NOTRUN -> [SKIP][16] ([fdo#109285] / [i915#4098])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@kms_psr@sprite_plane_onoff:
- fi-rkl-11600: NOTRUN -> [SKIP][17] ([i915#1072]) +3 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@kms_psr@sprite_plane_onoff.html
* igt@kms_setmode@basic-clone-single-crtc:
- fi-rkl-11600: NOTRUN -> [SKIP][18] ([i915#3555] / [i915#4098])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@prime_vgem@basic-read:
- fi-rkl-11600: NOTRUN -> [SKIP][19] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
* igt@prime_vgem@basic-userptr:
- fi-rkl-11600: NOTRUN -> [SKIP][20] ([fdo#109295] / [i915#3301] / [i915#3708])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/fi-rkl-11600/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s3@smem:
- {bat-rpls-1}: [ABORT][21] ([i915#6687] / [i915#7978]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12738/bat-rpls-1/igt@gem_exec_suspend@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/bat-rpls-1/igt@gem_exec_suspend@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
[i915#7978]: https://gitlab.freedesktop.org/drm/intel/issues/7978
[i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996
Build changes
-------------
* Linux: CI_DRM_12738 -> Patchwork_102678v3
CI-20190529: 20190529
CI_DRM_12738: aad037693df25f8c83ba6cef9facc8e47c7937c3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7160: 45da871dd2684227e93a2fc002b87dfc58bd5fd9 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_102678v3: aad037693df25f8c83ba6cef9facc8e47c7937c3 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
73a5161112ba drm/i915/display: Communicate display configuration to pcode
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102678v3/index.html