Commit d3252e1a authored by Matt Roper's avatar Matt Roper

drm/i915/dg2: Memory latency values from pcode must be doubled

The memory latency values returned by pcode on DG2 are in units of "2
usec" rather than 1 usec on all other platforms.  I.e., we need to
double the value returned by pcode to obtain the true latency value.

The bspec wording here was a bit ambiguous as to whether it wanted us to
multiply or divide the pcode value by two, but we confirmed offline with
the hardware team that we need to double the value the pcode gives us;
this change is intended to support a larger range of potential latency
values.

Bspec: 49326
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Reviewed-by: default avatarHarish Chegondi <harish.chegondi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210820225710.401136-1-matthew.d.roper@intel.com
parent 76a04cd9
...@@ -2859,6 +2859,7 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv, ...@@ -2859,6 +2859,7 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
u32 val; u32 val;
int ret, i; int ret, i;
int level, max_level = ilk_wm_max_level(dev_priv); int level, max_level = ilk_wm_max_level(dev_priv);
int mult = IS_DG2(dev_priv) ? 2 : 1;
/* read the first set of memory latencies[0:3] */ /* read the first set of memory latencies[0:3] */
val = 0; /* data0 to be programmed to 0 for first set */ val = 0; /* data0 to be programmed to 0 for first set */
...@@ -2872,13 +2873,13 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv, ...@@ -2872,13 +2873,13 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
return; return;
} }
wm[0] = val & GEN9_MEM_LATENCY_LEVEL_MASK; wm[0] = (val & GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
wm[1] = (val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) & wm[1] = ((val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) &
GEN9_MEM_LATENCY_LEVEL_MASK; GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
wm[2] = (val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) & wm[2] = ((val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) &
GEN9_MEM_LATENCY_LEVEL_MASK; GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
wm[3] = (val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) & wm[3] = ((val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) &
GEN9_MEM_LATENCY_LEVEL_MASK; GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
/* read the second set of memory latencies[4:7] */ /* read the second set of memory latencies[4:7] */
val = 1; /* data0 to be programmed to 1 for second set */ val = 1; /* data0 to be programmed to 1 for second set */
...@@ -2891,13 +2892,13 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv, ...@@ -2891,13 +2892,13 @@ static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
return; return;
} }
wm[4] = val & GEN9_MEM_LATENCY_LEVEL_MASK; wm[4] = (val & GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
wm[5] = (val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) & wm[5] = ((val >> GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT) &
GEN9_MEM_LATENCY_LEVEL_MASK; GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
wm[6] = (val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) & wm[6] = ((val >> GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT) &
GEN9_MEM_LATENCY_LEVEL_MASK; GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
wm[7] = (val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) & wm[7] = ((val >> GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT) &
GEN9_MEM_LATENCY_LEVEL_MASK; GEN9_MEM_LATENCY_LEVEL_MASK) * mult;
/* /*
* If a level n (n > 1) has a 0us latency, all levels m (m >= n) * If a level n (n > 1) has a 0us latency, all levels m (m >= n)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment