Skip to content

Commit 382debd

Browse files
vsyrjalagregkh
authored andcommitted
drm/i915: Disable LP3 watermarks on all SNB machines
commit 2155635 upstream. I have a Thinkpad X220 Tablet in my hands that is losing vblank interrupts whenever LP3 watermarks are used. If I nudge the latency value written to the WM3 register just by one in either direction the problem disappears. That to me suggests that the punit will not enter the corrsponding powersave mode (MPLL shutdown IIRC) unless the latency value in the register matches exactly what we read from SSKPD. Ie. it's not really a latency value but rather just a cookie by which the punit can identify the desired power saving state. On HSW/BDW this was changed such that we actually just write the WM level number into those bits, which makes much more sense given the observed behaviour. We could try to handle this by disallowing LP3 watermarks only when vblank interrupts are enabled but we'd first have to prove that only vblank interrupts are affected, which seems unlikely. Also we can't grab the wm mutex from the vblank enable/disable hooks because those are called with various spinlocks held. Thus we'd have to redesigne the watermark locking. So to play it safe and keep the code simple we simply disable LP3 watermarks on all SNB machines. To do that we simply zero out the latency values for watermark level 3, and we adjust the watermark computation to check for that. The behaviour now matches that of the g4x/vlv/skl wm code in the presence of a zeroed latency value. v2: s/USHRT_MAX/U32_MAX/ for consistency with the types (Chris) Cc: stable@vger.kernel.org Cc: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101269 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103713 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181114173440.6730-1-ville.syrjala@linux.intel.com (cherry picked from commit 03981c6) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e3290a5 commit 382debd

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

‎drivers/gpu/drm/i915/intel_pm.c‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2492,6 +2492,9 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate,
24922492
uint32_t method1, method2;
24932493
int cpp;
24942494

2495+
if (mem_value == 0)
2496+
return U32_MAX;
2497+
24952498
if (!intel_wm_plane_visible(cstate, pstate))
24962499
return 0;
24972500

@@ -2521,6 +2524,9 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate,
25212524
uint32_t method1, method2;
25222525
int cpp;
25232526

2527+
if (mem_value == 0)
2528+
return U32_MAX;
2529+
25242530
if (!intel_wm_plane_visible(cstate, pstate))
25252531
return 0;
25262532

@@ -2544,6 +2550,9 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
25442550
{
25452551
int cpp;
25462552

2553+
if (mem_value == 0)
2554+
return U32_MAX;
2555+
25472556
if (!intel_wm_plane_visible(cstate, pstate))
25482557
return 0;
25492558

@@ -2998,6 +3007,34 @@ static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv)
29983007
intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency);
29993008
}
30003009

3010+
static void snb_wm_lp3_irq_quirk(struct drm_i915_private *dev_priv)
3011+
{
3012+
/*
3013+
* On some SNB machines (Thinkpad X220 Tablet at least)
3014+
* LP3 usage can cause vblank interrupts to be lost.
3015+
* The DEIIR bit will go high but it looks like the CPU
3016+
* never gets interrupted.
3017+
*
3018+
* It's not clear whether other interrupt source could
3019+
* be affected or if this is somehow limited to vblank
3020+
* interrupts only. To play it safe we disable LP3
3021+
* watermarks entirely.
3022+
*/
3023+
if (dev_priv->wm.pri_latency[3] == 0 &&
3024+
dev_priv->wm.spr_latency[3] == 0 &&
3025+
dev_priv->wm.cur_latency[3] == 0)
3026+
return;
3027+
3028+
dev_priv->wm.pri_latency[3] = 0;
3029+
dev_priv->wm.spr_latency[3] = 0;
3030+
dev_priv->wm.cur_latency[3] = 0;
3031+
3032+
DRM_DEBUG_KMS("LP3 watermarks disabled due to potential for lost interrupts\n");
3033+
intel_print_wm_latency(dev_priv, "Primary", dev_priv->wm.pri_latency);
3034+
intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency);
3035+
intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency);
3036+
}
3037+
30013038
static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv)
30023039
{
30033040
intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency);
@@ -3014,8 +3051,10 @@ static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv)
30143051
intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency);
30153052
intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency);
30163053

3017-
if (IS_GEN6(dev_priv))
3054+
if (IS_GEN6(dev_priv)) {
30183055
snb_wm_latency_quirk(dev_priv);
3056+
snb_wm_lp3_irq_quirk(dev_priv);
3057+
}
30193058
}
30203059

30213060
static void skl_setup_wm_latency(struct drm_i915_private *dev_priv)

0 commit comments

Comments
 (0)