aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2016-09-22 17:00:30 -0400
committerJani Nikula <jani.nikula@intel.com>2016-10-10 09:06:38 -0400
commit4e4d3814a9bb4d71cd3ff0701d8d7041edefd8f0 (patch)
treec8e12e1ff9185611ea5fd69ea29e9fb49471d7f3 /drivers/gpu
parent17777d61f4a87d7b6d5585e8fdffa83773c594e7 (diff)
drm/i915/gen9: fix the WaWmMemoryReadLatency implementation
Bspec says: "The mailbox response data may not account for memory read latency. If the mailbox response data for level 0 is 0us, add 2 microseconds to the result for each valid level." This means we should only do the +2 in case wm[0] == 0, not always. So split the sanitizing implementation from the WA implementation and fix the WA implementation. v2: Add Fixes tag (Maarten). Fixes: 367294be7c25 ("drm/i915/gen9: Add 2us read latency to WM level") Cc: stable@vger.kernel.org Cc: Vandana Kannan <vandana.kannan@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1474578035-424-5-git-send-email-paulo.r.zanoni@intel.com (cherry picked from commit 0727e40a48a1d08cf54ce2c01e120864b92e59bf) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 93ae27408e49..c90be917deae 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2127,32 +2127,34 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])
2127 GEN9_MEM_LATENCY_LEVEL_MASK; 2127 GEN9_MEM_LATENCY_LEVEL_MASK;
2128 2128
2129 /* 2129 /*
2130 * If a level n (n > 1) has a 0us latency, all levels m (m >= n)
2131 * need to be disabled. We make sure to sanitize the values out
2132 * of the punit to satisfy this requirement.
2133 */
2134 for (level = 1; level <= max_level; level++) {
2135 if (wm[level] == 0) {
2136 for (i = level + 1; i <= max_level; i++)
2137 wm[i] = 0;
2138 break;
2139 }
2140 }
2141
2142 /*
2130 * WaWmMemoryReadLatency:skl 2143 * WaWmMemoryReadLatency:skl
2131 * 2144 *
2132 * punit doesn't take into account the read latency so we need 2145 * punit doesn't take into account the read latency so we need
2133 * to add 2us to the various latency levels we retrieve from 2146 * to add 2us to the various latency levels we retrieve from the
2134 * the punit. 2147 * punit when level 0 response data us 0us.
2135 * - W0 is a bit special in that it's the only level that
2136 * can't be disabled if we want to have display working, so
2137 * we always add 2us there.
2138 * - For levels >=1, punit returns 0us latency when they are
2139 * disabled, so we respect that and don't add 2us then
2140 *
2141 * Additionally, if a level n (n > 1) has a 0us latency, all
2142 * levels m (m >= n) need to be disabled. We make sure to
2143 * sanitize the values out of the punit to satisfy this
2144 * requirement.
2145 */ 2148 */
2146 wm[0] += 2; 2149 if (wm[0] == 0) {
2147 for (level = 1; level <= max_level; level++) 2150 wm[0] += 2;
2148 if (wm[level] != 0) 2151 for (level = 1; level <= max_level; level++) {
2152 if (wm[level] == 0)
2153 break;
2149 wm[level] += 2; 2154 wm[level] += 2;
2150 else {
2151 for (i = level + 1; i <= max_level; i++)
2152 wm[i] = 0;
2153
2154 break;
2155 } 2155 }
2156 }
2157
2156 } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { 2158 } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
2157 uint64_t sskpd = I915_READ64(MCH_SSKPD); 2159 uint64_t sskpd = I915_READ64(MCH_SSKPD);
2158 2160