tools/libxc: Fix the reported max_leaf values for PV guests
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Jan 2017 13:17:01 +0000 (13:17 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Jan 2017 15:56:13 +0000 (15:56 +0000)
commit0d045d65c19ac48b31344b566cbf82a0270e6e44
treeb75bf973ff4baee90b6befb938c9ad1fdce8d369
parent14a6be89ec04bfadba978dc4c2f1e7f96db8cdf0
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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_cpuid_x86.c