Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:Update
xen
xsa435-0-45.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xsa435-0-45.patch of Package xen
# Commit 44fde35fdd5abb99a9d7de79ffe95176260b50fe # Date 2023-08-03 19:14:19 +0100 # Author Roger Pau Monne <roger.pau@citrix.com> # Committer Andrew Cooper <andrew.cooper3@citrix.com> libs/guest: introduce support for setting guest MSRs Like it's done with CPUID, introduce support for passing MSR values to xc_cpuid_apply_policy(). The chosen format for expressing MSR policy data matches the current one used for CPUID. Note that existing callers of xc_cpuid_apply_policy() can pass NULL as the value for the newly introduced 'msr' parameter in order to preserve the same functionality, and in fact that's done in libxl on this patch. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com> (cherry picked from commit ed742cf1b65c822759833027ca5cbb087c506a41) --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1783,6 +1783,7 @@ int xc_domain_debug_control(xc_interface uint32_t vcpu); #if defined(__i386__) || defined(__x86_64__) +#define XC_X86_MSR_LEAF XEN_X86_MSR_LEAF int xc_cpuid_check(xc_interface *xch, const unsigned int *input, const char **config, --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -38,6 +38,9 @@ enum { #define clear_feature(idx, dst) ((dst) &= ~bitmaskof(idx)) #define set_feature(idx, dst) ((dst) |= bitmaskof(idx)) +#define FEATURESET_m10Al featureword_of(X86_FEATURE_EIBRS) +#define FEATURESET_m10Ah (FEATURESET_m10Al + 1) + #define DEF_MAX_BASE 0x0000000du #define DEF_MAX_INTELEXT 0x80000008u #define DEF_MAX_AMDEXT 0x8000001cu @@ -202,6 +205,25 @@ static void cpuid(const unsigned int *in #endif } +static void msr(unsigned int input, unsigned int *regs, + const uint32_t *fs, unsigned int n) +{ + regs[0] = 0; + regs[1] = 0; + regs[2] = 0; + regs[3] = 0; + + switch ( input ) + { + case 0x10a: /* ARCH_CAPS */ + if ( n > FEATURESET_m10Al ) + regs[0] = fs[FEATURESET_m10Al]; + if ( n > FEATURESET_m10Ah ) + regs[3] = fs[FEATURESET_m10Ah]; + break; + } +} + static int get_cpuid_domain_info(xc_interface *xch, domid_t domid, struct cpuid_domain_info *info, uint32_t *featureset, @@ -746,7 +768,10 @@ int xc_cpuid_apply_policy(xc_interface * input[1] = XEN_CPUID_INPUT_UNUSED; for ( ; ; ) { - cpuid(input, regs); + if ( input[0] != XEN_X86_MSR_LEAF ) + cpuid(input, regs); + else + msr(input[1], regs, info.featureset, info.nr_features); xc_cpuid_policy(xch, &info, input, regs); if ( regs[0] || regs[1] || regs[2] || regs[3] ) @@ -765,6 +790,9 @@ int xc_cpuid_apply_policy(xc_interface * continue; } + if ( input[0] == XEN_X86_MSR_LEAF ) + break; + input[0]++; if ( !(input[0] & 0x80000000u) && (input[0] > base_max ) ) input[0] = 0x80000000u; @@ -776,7 +804,10 @@ int xc_cpuid_apply_policy(xc_interface * input[1] = 1; /* Xen automatically calculates almost everything. */ if ( (input[0] & 0x80000000u) && (input[0] > ext_max) ) - break; + { + input[0] = XEN_X86_MSR_LEAF; + input[1] = 0x10a; /* ARCH_CAPS */ + } } out: @@ -874,7 +905,10 @@ int xc_cpuid_set( if ( rc ) goto out; - cpuid(input, regs); + if ( input[0] != XC_X86_MSR_LEAF ) + cpuid(input, regs); + else + msr(input[1], regs, info.featureset, info.nr_features); memcpy(polregs, regs, sizeof(regs)); xc_cpuid_policy(xch, &info, input, polregs);
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