diff options
author | Maxim Polyakov <max.senia.poliak@gmail.com> | 2019-10-09 18:35:23 +0300 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-08-17 12:20:26 +0000 |
commit | d8163ede51b25dde6fc446d609adae1c7a80ca01 (patch) | |
tree | c3789a26d89ed808022ca91571e10196dc0e4937 /util/inteltool/cpu.c | |
parent | b11f7e2b6b4e249f544299ab5ad64309723535eb (diff) |
inteltool: Allow to set cores range for MSRs dump
Adds the ability to output MSRs dump for the specified range of CPU
cores. This makes it easier to reverse engineer server multicore
processors using the inteltool utility.
The range is set using --cpu-range <start>[-<end>] command line option:
$ sudo ./inteltool -M --cpu-range 0-7
$ sudo ./inteltool -M --cpu-range 7-15
$ sudo ./inteltool -M --cpu-range 32
$ sudo ./inteltool -M will print a register dump for all cores, just
as before.
Change-Id: I3a037cf7ac270d2b51d6e453334c358ff47b4105
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35919
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/inteltool/cpu.c')
-rw-r--r-- | util/inteltool/cpu.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/util/inteltool/cpu.c b/util/inteltool/cpu.c index db63d36729..74252293de 100644 --- a/util/inteltool/cpu.c +++ b/util/inteltool/cpu.c @@ -7,6 +7,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <limits.h> #include "inteltool.h" @@ -265,9 +266,9 @@ void print_tme(void) #endif } -int print_intel_core_msrs(void) +int print_intel_msrs(unsigned int range_start, unsigned int range_end) { - unsigned int i, core, id, core_num = get_number_of_cores(); + unsigned int i, core, id; msr_t msr; #define IA32_PLATFORM_ID 0x0017 @@ -2295,7 +2296,15 @@ int print_intel_core_msrs(void) close(fd_msr); - for (core = 0; core < core_num; core++) { + const unsigned int cores_range_max_limit = get_number_of_cores() - 1; + if (range_end > cores_range_max_limit) { + if (range_end != UINT_MAX) + printf("Warning: the range exceeds the maximum core number %d!\n", + cores_range_max_limit); + range_end = cores_range_max_limit; + } + + for (core = range_start; core <= range_end; core++) { #ifndef __DARWIN__ char msrfilename[64]; memset(msrfilename, 0, 64); |