Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.5:Update
xen.30330
xsa435-0-54.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xsa435-0-54.patch of Package xen.30330
# Commit f1652ccc9093d50c20a74ac5765feecc9724d9a9 # Date 2023-08-03 19:14:19 +0100 # Author Roger Pau Monne <roger.pau@citrix.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> libxl: add support for parsing MSR features Introduce support for handling MSR features in libxl_cpuid_parse_config(). The MSR policies are added to the libxl_cpuid_policy like the CPUID one, which gets passed to xc_cpuid_apply_policy(). This allows existing users of libxl to provide MSR related features as key=value pairs to libxl_cpuid_parse_config() without requiring the usage of a different API. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com> (cherry picked from commit 6d21cedbaa34b3a3856f964189e911112c732b21) # Commit 26a5e35fd81ac97ff9b49bfaf932f67aa2a26e76 # Date 2023-08-03 19:14:19 +0100 # Author Jan Beulich <jbeulich@suse.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> libxl: avoid shadowing of index() Because of -Wshadow the build otherwise fails with old enough glibc. While there also obey line length limits for msr_add(). Fixes: 6d21cedbaa34 ("libxl: add support for parsing MSR features") Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Juergen Gross <jgross@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> (cherry picked from commit 4f6afde88be3e8960eb311d16ac41d44ab71ed10) --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -142,6 +142,41 @@ static int cpuid_add(libxl_cpuid_policy_ return 0; } +static int msr_add(libxl_cpuid_policy_list *policy, uint32_t idx, + unsigned int bit, const char *val) +{ + struct libxl__cpuid_policy *entry = cpuid_find_match(policy, XC_X86_MSR_LEAF, + idx); + + if (entry->policy[0] == NULL) { + entry->policy[0] = strdup("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + entry->policy[3] = strdup("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + } + + /* Only allow options taking a character for MSRs, no values allowed. */ + if (strlen(val) != 1) + return 3; + + switch (val[0]) { + case '0': + case '1': + case 'x': + case 'k': + entry->policy[bit < 32 ? 0 : 3][31 - bit % 32] = val[0]; + break; + + case 's': + /* Translate s -> k as xc_msr doesn't support the deprecated 's'. */ + entry->policy[bit < 32 ? 0 : 3][31 - bit % 32] = 'k'; + break; + + default: + return 3; + } + + return 0; +} + struct feature_name { const char *name; unsigned int bit; @@ -324,7 +359,15 @@ int libxl_cpuid_parse_config(libxl_cpuid } case FEAT_MSR: - return 2; + { + unsigned int bit = feat->bit % 32; + + if (feature_to_policy[feat->bit / 32].u.msr.reg == CPUID_REG_EDX) + bit += 32; + + return msr_add(cpuid, feature_to_policy[feat->bit / 32].u.msr.index, + bit, val); + } } return 2;
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