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
6 From: Calvin Walton <calvin.walton@kepstin.ca>
8 [ Upstream commit 5aa3d1a20a233d4a5f1ec3d62da3f19d9afea682 ]
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
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.
19 This matches the code in arch/x86/lib/cpu.c
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>
26 tools/power/x86/turbostat/turbostat.c | 4 +++-
27 1 file changed, 3 insertions(+), 1 deletion(-)
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;
35 - if (family == 6 || family == 0xf)
37 + family += (fms >> 20) & 0xff;
39 model += ((fms >> 16) & 0xf) << 4;