Commit 064b3eee authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Jani Nikula

drm/i915: Populate wm.max_level for everyone

Switch ilk+ and skl+ platforms to also setting up
wm.max_level and remove a bunch of if ladders as a result.

There will be a tiny change in the debugfs on CHV machines
that have DVFS disabled in the BIOS. Presviously debugfs
would show the latency for the DVFS level as well, but
that will no longer be the case. Which is arguably better
as that number is absolutely meaningless when DVFS can't
be enabled anyway.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230209003251.32021-1-ville.syrjala@linux.intel.com
parent 2b9ed318
...@@ -1288,14 +1288,7 @@ static void wm_latency_show(struct seq_file *m, const u16 wm[8]) ...@@ -1288,14 +1288,7 @@ static void wm_latency_show(struct seq_file *m, const u16 wm[8])
int level; int level;
int num_levels; int num_levels;
if (IS_CHERRYVIEW(dev_priv)) num_levels = ilk_wm_max_level(dev_priv) + 1;
num_levels = 3;
else if (IS_VALLEYVIEW(dev_priv))
num_levels = 1;
else if (IS_G4X(dev_priv))
num_levels = 3;
else
num_levels = ilk_wm_max_level(dev_priv) + 1;
drm_modeset_lock_all(&dev_priv->drm); drm_modeset_lock_all(&dev_priv->drm);
...@@ -1407,14 +1400,7 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf, ...@@ -1407,14 +1400,7 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
int ret; int ret;
char tmp[32]; char tmp[32];
if (IS_CHERRYVIEW(dev_priv)) num_levels = ilk_wm_max_level(dev_priv) + 1;
num_levels = 3;
else if (IS_VALLEYVIEW(dev_priv))
num_levels = 1;
else if (IS_G4X(dev_priv))
num_levels = 3;
else
num_levels = ilk_wm_max_level(dev_priv) + 1;
if (len >= sizeof(tmp)) if (len >= sizeof(tmp))
return -EINVAL; return -EINVAL;
......
...@@ -3258,6 +3258,11 @@ static void skl_read_wm_latency(struct drm_i915_private *i915, u16 wm[]) ...@@ -3258,6 +3258,11 @@ static void skl_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
static void skl_setup_wm_latency(struct drm_i915_private *i915) static void skl_setup_wm_latency(struct drm_i915_private *i915)
{ {
if (HAS_HW_SAGV_WM(i915))
i915->display.wm.max_level = 5;
else
i915->display.wm.max_level = 7;
if (DISPLAY_VER(i915) >= 14) if (DISPLAY_VER(i915) >= 14)
mtl_read_wm_latency(i915, i915->display.wm.skl_latency); mtl_read_wm_latency(i915, i915->display.wm.skl_latency);
else else
......
...@@ -2836,6 +2836,8 @@ static void hsw_read_wm_latency(struct drm_i915_private *i915, u16 wm[]) ...@@ -2836,6 +2836,8 @@ static void hsw_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
{ {
u64 sskpd; u64 sskpd;
i915->display.wm.max_level = 4;
sskpd = intel_uncore_read64(&i915->uncore, MCH_SSKPD); sskpd = intel_uncore_read64(&i915->uncore, MCH_SSKPD);
wm[0] = REG_FIELD_GET64(SSKPD_NEW_WM0_MASK_HSW, sskpd); wm[0] = REG_FIELD_GET64(SSKPD_NEW_WM0_MASK_HSW, sskpd);
...@@ -2851,6 +2853,8 @@ static void snb_read_wm_latency(struct drm_i915_private *i915, u16 wm[]) ...@@ -2851,6 +2853,8 @@ static void snb_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
{ {
u32 sskpd; u32 sskpd;
i915->display.wm.max_level = 3;
sskpd = intel_uncore_read(&i915->uncore, MCH_SSKPD); sskpd = intel_uncore_read(&i915->uncore, MCH_SSKPD);
wm[0] = REG_FIELD_GET(SSKPD_WM0_MASK_SNB, sskpd); wm[0] = REG_FIELD_GET(SSKPD_WM0_MASK_SNB, sskpd);
...@@ -2863,6 +2867,8 @@ static void ilk_read_wm_latency(struct drm_i915_private *i915, u16 wm[]) ...@@ -2863,6 +2867,8 @@ static void ilk_read_wm_latency(struct drm_i915_private *i915, u16 wm[])
{ {
u32 mltr; u32 mltr;
i915->display.wm.max_level = 2;
mltr = intel_uncore_read(&i915->uncore, MLTR_ILK); mltr = intel_uncore_read(&i915->uncore, MLTR_ILK);
/* ILK primary LP0 latency is 700 ns */ /* ILK primary LP0 latency is 700 ns */
...@@ -2889,17 +2895,7 @@ static void intel_fixup_cur_wm_latency(struct drm_i915_private *dev_priv, ...@@ -2889,17 +2895,7 @@ static void intel_fixup_cur_wm_latency(struct drm_i915_private *dev_priv,
int ilk_wm_max_level(const struct drm_i915_private *dev_priv) int ilk_wm_max_level(const struct drm_i915_private *dev_priv)
{ {
/* how many WM levels are we expecting */ return dev_priv->display.wm.max_level;
if (HAS_HW_SAGV_WM(dev_priv))
return 5;
else if (DISPLAY_VER(dev_priv) >= 9)
return 7;
else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
return 4;
else if (DISPLAY_VER(dev_priv) >= 6)
return 3;
else
return 2;
} }
void intel_print_wm_latency(struct drm_i915_private *dev_priv, void intel_print_wm_latency(struct drm_i915_private *dev_priv,
......
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