libx86: Helper for clearing out-of-range CPUID leaves
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 21 May 2019 16:56:43 +0000 (17:56 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 6 Jun 2019 14:28:20 +0000 (15:28 +0100)
commit93883a2eab17348fe6ad03273f30aa7526730460
tree8c4af67081366262492facf5769b362660efa6c9
parentc22c073d39dee841a3d2f3ae9a1e957404c3af80
libx86: Helper for clearing out-of-range CPUID leaves

When merging a levelled policy, stale out-of-range leaves may remain.
Introduce a helper to clear them, and test a number of the subtle corner
cases.

The logic based on cpuid_policy_xstates() is liable to need changing when XCR0
has bit 63 defined.  Leave BUILD_BUG_ON()'s behind with comments in all all
impacted areas, which includes in x86_cpuid_policy_fill_native().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/tests/cpu-policy/test-cpu-policy.c
xen/include/xen/lib/x86/cpuid.h
xen/lib/x86/cpuid.c
xen/lib/x86/private.h