]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.154/tools-power-turbostat-read-extended-processor-family-from-cpuid.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.154 / tools-power-turbostat-read-extended-processor-family-from-cpuid.patch
1 From foo@baz Tue Aug 28 16:10:37 CEST 2018
2 From: Calvin Walton <calvin.walton@kepstin.ca>
3 Date: Fri, 27 Jul 2018 07:50:53 -0400
4 Subject: tools/power turbostat: Read extended processor family from CPUID
5
6 From: Calvin Walton <calvin.walton@kepstin.ca>
7
8 [ Upstream commit 5aa3d1a20a233d4a5f1ec3d62da3f19d9afea682 ]
9
10 This fixes the reported family on modern AMD processors (e.g. Ryzen,
11 which is family 0x17). Previously these processors all showed up as
12 family 0xf.
13
14 See the document
15 https://support.amd.com/TechDocs/56255_OSRR.pdf
16 section CPUID_Fn00000001_EAX for how to calculate the family
17 from the BaseFamily and ExtFamily values.
18
19 This matches the code in arch/x86/lib/cpu.c
20
21 Signed-off-by: Calvin Walton <calvin.walton@kepstin.ca>
22 Signed-off-by: Len Brown <len.brown@intel.com>
23 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 tools/power/x86/turbostat/turbostat.c | 4 +++-
27 1 file changed, 3 insertions(+), 1 deletion(-)
28
29 --- a/tools/power/x86/turbostat/turbostat.c
30 +++ b/tools/power/x86/turbostat/turbostat.c
31 @@ -2691,7 +2691,9 @@ void process_cpuid()
32 family = (fms >> 8) & 0xf;
33 model = (fms >> 4) & 0xf;
34 stepping = fms & 0xf;
35 - if (family == 6 || family == 0xf)
36 + if (family == 0xf)
37 + family += (fms >> 20) & 0xff;
38 + if (family >= 6)
39 model += ((fms >> 16) & 0xf) << 4;
40
41 if (debug)