Thomas Zimmermann ebf85e
From 3164888a40469c102b5d6d1b756c7646e7eb19e7 Mon Sep 17 00:00:00 2001
Thomas Zimmermann ebf85e
From: Marta Lofstedt <marta.lofstedt@intel.com>
Thomas Zimmermann ebf85e
Date: Fri, 8 Sep 2017 16:28:29 +0300
Thomas Zimmermann ebf85e
Subject: [PATCH] drm/i915: Increase poll time for BDW FCLK_DONE
Thomas Zimmermann ebf85e
Git-commit: 3164888a40469c102b5d6d1b756c7646e7eb19e7
Thomas Zimmermann ebf85e
Patch-mainline: v4.15-rc1
Thomas Zimmermann ebf85e
References: FATE#322643 bsc#1055900
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
During IGT testing it has been shown that the specification
Thomas Zimmermann ebf85e
defined polling time of 1 us for FCLK_DONE, is sometimes not
Thomas Zimmermann ebf85e
enough. The issue is still reproducible while disabling
Thomas Zimmermann ebf85e
C-states through the PM QoS framework and also while disabling
Thomas Zimmermann ebf85e
preemtion. From this the most plausible explanation is that the
Thomas Zimmermann ebf85e
issue is due to a firmware flaw.
Thomas Zimmermann ebf85e
As a workaround, it is better to wait a little bit longer for
Thomas Zimmermann ebf85e
the FCLK_DONE to come around, than to leave with an DRM_ERROR
Thomas Zimmermann ebf85e
and having FCLK_DONE at a randome time after.
Thomas Zimmermann ebf85e
While spinning a list of igt tests prone to reproduce the issue
Thomas Zimmermann ebf85e
the FCLK_DONE poll failed at approximately 2% of the invocations
Thomas Zimmermann ebf85e
of the bdw_set_cdclk function. The longest poll time during this
Thomas Zimmermann ebf85e
testing was measured to ~7us. So, the suggested new poll time of
Thomas Zimmermann ebf85e
100us is on the safe side.
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
V2: Added more documentation about investigations done.
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102243
Thomas Zimmermann ebf85e
Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Thomas Zimmermann ebf85e
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Thomas Zimmermann ebf85e
Signed-off-by: Imre Deak <imre.deak@intel.com>
Thomas Zimmermann ebf85e
Link: https://patchwork.freedesktop.org/patch/msgid/20170908132829.6312-1-marta.lofstedt@intel.com
Thomas Zimmermann ebf85e
Acked-by: Takashi Iwai <tiwai@suse.de>
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
---
Thomas Zimmermann ebf85e
 drivers/gpu/drm/i915/intel_cdclk.c |    6 +++++-
Thomas Zimmermann ebf85e
 1 file changed, 5 insertions(+), 1 deletion(-)
Thomas Zimmermann ebf85e
Thomas Zimmermann ebf85e
--- a/drivers/gpu/drm/i915/intel_cdclk.c
Thomas Zimmermann ebf85e
+++ b/drivers/gpu/drm/i915/intel_cdclk.c
Thomas Zimmermann ebf85e
@@ -669,8 +669,12 @@ static void bdw_set_cdclk(struct drm_i91
Thomas Zimmermann ebf85e
 	val |= LCPLL_CD_SOURCE_FCLK;
Thomas Zimmermann ebf85e
 	I915_WRITE(LCPLL_CTL, val);
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
+	/*
Thomas Zimmermann ebf85e
+	 * According to the spec, it should be enough to poll for this 1 us.
Thomas Zimmermann ebf85e
+	 * However, extensive testing shows that this can take longer.
Thomas Zimmermann ebf85e
+	 */
Thomas Zimmermann ebf85e
 	if (wait_for_us(I915_READ(LCPLL_CTL) &
Thomas Zimmermann ebf85e
-			LCPLL_CD_SOURCE_FCLK_DONE, 1))
Thomas Zimmermann ebf85e
+			LCPLL_CD_SOURCE_FCLK_DONE, 100))
Thomas Zimmermann ebf85e
 		DRM_ERROR("Switching to FCLK failed\n");
Thomas Zimmermann ebf85e
 
Thomas Zimmermann ebf85e
 	val = I915_READ(LCPLL_CTL);