[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/libxc: Fix the reported max_leaf values for PV guests
commit 0d045d65c19ac48b31344b566cbf82a0270e6e44 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Jan 9 13:17:01 2017 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Jan 11 15:56:13 2017 +0000 tools/libxc: Fix the reported max_leaf values for PV guests When iterating through CPUID leaves to generating a policy, libxc will clip itself at the hardcoded maxima, meaning that no data outside of the hardcoded maxima are provided to Xen (in turn, causing Xen to return zeros if these leaves are requested.) The HVM code also clips the max_leaf data reported to the guest, but the PV side didn't. This results in a PV guest using the emulated CPUID, or via Xen using CPUID faulting, to observe a max_leaf higher than the toolstack wants, although with zeros being returned in the intervening leaves. Fix the PV side to behave like the HVM side, and clip the max_leaf values in leaf 0 and 0x80000000. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/xc_cpuid_x86.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index e9e3691..b32001b3 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -615,6 +615,11 @@ static void xc_cpuid_pv_policy(xc_interface *xch, { switch ( input[0] ) { + case 0x00000000: + if ( regs[0] > DEF_MAX_BASE ) + regs[0] = DEF_MAX_BASE; + break; + case 0x00000001: { /* Host topology exposed to PV guest. Provide host value. */ @@ -655,6 +660,16 @@ static void xc_cpuid_pv_policy(xc_interface *xch, xc_cpuid_config_xsave(xch, info, input, regs); break; + case 0x80000000: + { + unsigned int max = info->vendor == VENDOR_AMD + ? DEF_MAX_AMDEXT : DEF_MAX_INTELEXT; + + if ( regs[0] > max ) + regs[0] = max; + break; + } + case 0x80000001: { /* Host topology exposed to PV guest. Provide host CMP_LEGACY value. */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |