Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Backports:SLE-15-SP1:Update
msr-tools
msr-tools-xen_physical_msr_support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File msr-tools-xen_physical_msr_support.patch of Package msr-tools
From: Jan Beulich <JBeulich@novell.com> msr-tools: Provide access to physical msr Xen interface via parameter Xen provides /dev/cpu/X/msr where virtual CPU msr access is emulated. /dev/xen/cpu/X/msr is passed to the physical CPUs. Provide access to both via -P parameter. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: H. Peter Anvin <hpa@linux.intel.com> --- rdmsr.c | 11 +++++++++-- wrmsr.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) Index: msr-tools-msr-tools-1.3/rdmsr.c =================================================================== --- msr-tools-msr-tools-1.3.orig/rdmsr.c 2013-09-10 04:49:29.000000000 +0200 +++ msr-tools-msr-tools-1.3/rdmsr.c 2016-06-21 16:59:00.706090221 +0200 @@ -44,12 +44,15 @@ static const struct option long_options[ {"zero-pad", 0, 0, '0'}, {"raw", 0, 0, 'r'}, {"all", 0, 0, 'a'}, + {"phys-cpu", 1, 0, 'P'}, {"processor", 1, 0, 'p'}, {"cpu", 1, 0, 'p'}, {"bitfield", 1, 0, 'f'}, {0, 0, 0, 0} }; -static const char short_options[] = "hVxXdoruc0ap:f:"; +static const char short_options[] = "hVxXdoruc0aP:p:f:"; + +static const char *msr_file_pattern = "/dev/cpu/%d/msr"; /* Number of decimal digits for a certain number of bits */ /* (int) ceil(log(2^n)/log(10)) */ @@ -89,6 +92,7 @@ void usage(void) " --raw -r Raw binary output\n" " --all -a all processors\n" " --processor # -p Select processor number (default 0)\n" + " --phys-cpu # -P Select (Xen) physical processor = number\n" " --bitfield h:l -f Output bits [h:l] only\n", program); } @@ -166,6 +170,9 @@ int main(int argc, char *argv[]) case 'a': cpu = -1; break; + case 'P': + msr_file_pattern = "/dev/xen/cpu/%d/msr"; + /* fall through */ case 'p': arg = strtoul(optarg, &endarg, 0); if (*endarg || arg > 255) { @@ -212,7 +219,7 @@ void rdmsr_on_cpu(uint32_t reg, int cpu) char msr_file_name[64]; unsigned int bits; - sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); + sprintf(msr_file_name, msr_file_pattern, cpu); fd = open(msr_file_name, O_RDONLY); if (fd < 0) { if (errno == ENXIO) { Index: msr-tools-msr-tools-1.3/wrmsr.c =================================================================== --- msr-tools-msr-tools-1.3.orig/wrmsr.c 2013-09-10 04:49:29.000000000 +0200 +++ msr-tools-msr-tools-1.3/wrmsr.c 2016-06-21 16:59:00.706090221 +0200 @@ -35,10 +35,13 @@ static const struct option long_options[ {"version", 0, 0, 'V'}, {"all", 0, 0, 'a'}, {"processor", 1, 0, 'p'}, + {"phys-cpu", 1, 0, 'P'}, {"cpu", 1, 0, 'p'}, {0, 0, 0, 0} }; -static const char short_options[] = "hVap:"; +static const char short_options[] = "hVaP:p:"; + +static const char *msr_file_pattern = "/dev/cpu/%d/msr"; const char *program; @@ -48,6 +51,7 @@ void usage(void) " --help -h Print this help\n" " --version -V Print current version\n" " --all -a all processors\n" + " --phys-cpu # -P Select (Xen) physical processor = number\n" " --processor # -p Select processor number (default 0)\n", program); } @@ -100,6 +104,9 @@ int main(int argc, char *argv[]) case 'a': cpu = -1; break; + case 'P': + msr_file_pattern = "/dev/xen/cpu/%d/msr"; + /* fall through */ case 'p': arg = strtoul(optarg, &endarg, 0); if (*endarg || arg > 255) { @@ -137,7 +144,7 @@ void wrmsr_on_cpu(uint32_t reg, int cpu, int fd; char msr_file_name[64]; - sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); + sprintf(msr_file_name, msr_file_pattern, cpu); fd = open(msr_file_name, O_WRONLY); if (fd < 0) { if (errno == ENXIO) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor