intel_pstate: Correct BYT VID values.
authorDirk Brandewie <dirk.j.brandewie@intel.com>
Mon, 13 Oct 2014 15:37:44 +0000 (08:37 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 17:00:01 +0000 (09:00 -0800)
commit4b019cc1ad058c1378563b8fefb3da63d2f56ec6
treed7d102ec25cef59b134ea2815ec4e975ecb80341
parentda0b49e81e0cb492b384db389c40bff9cbb2b179
intel_pstate: Correct BYT VID values.

commit d022a65ed2473fac4a600e3424503dc571160a3e upstream.

Using a VID value that is not high enough for the requested P state can
cause machine checks. Add a ceiling function to ensure calulated VIDs
with fractional values are set to the next highest integer VID value.

The algorythm for calculating the non-trubo VID from the BIOS writers
guide is:
 vid_ratio = (vid_max - vid_min) / (max_pstate - min_pstate)
 vid = ceiling(vid_min + (req_pstate - min_pstate) * vid_ratio)

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/intel_pstate.c