From: Tom O'Rourke Date: Wed, 11 Feb 2015 07:06:46 +0000 (-0800) Subject: drm/i915: Clamp efficient frequency to valid range X-Git-Tag: firefly_0821_release~176^2~2312^2~3^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=46efa4abe5712276494adbce102f46e3214632fd;p=firefly-linux-kernel-4.4.55.git drm/i915: Clamp efficient frequency to valid range The efficient frequency (RPe) should stay in the range RPn <= RPe <= RP0. The pcode clamps the returned value internally on Broadwell but not on Haswell. Fix for missing range check in commit 93ee29203f506582cca2bcec5f05041526d9ab0a Author: Tom O'Rourke Date: Wed Nov 19 14:21:52 2014 -0800 drm/i915: Use efficient frequency for HSW/BDW Reference: http://lists.freedesktop.org/archives/intel-gfx/2015-February/059802.html Reported-by: Michael Auchter Suggested-by: Chris Wilson Cc: stable@vger.kernel.org # v3.19 Signed-off-by: Tom O'Rourke Signed-off-by: Jani Nikula --- diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 6ece663f3394..24d77ddcc5f4 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -4005,7 +4005,10 @@ static void gen6_init_rps_frequencies(struct drm_device *dev) &ddcc_status); if (0 == ret) dev_priv->rps.efficient_freq = - (ddcc_status >> 8) & 0xff; + clamp_t(u8, + ((ddcc_status >> 8) & 0xff), + dev_priv->rps.min_freq, + dev_priv->rps.max_freq); } /* Preserve min/max settings in case of re-init */