x86/xsaves: ebx may return wrong value using CPUID eax=0xd,ecx =1
authorShuai Ruan <shuai.ruan@intel.com>
Thu, 7 Apr 2016 22:04:39 +0000 (00:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 7 Apr 2016 22:04:39 +0000 (00:04 +0200)
commit9d313bdebb86ff4dc663f740e7a9a158e238303d
treebbb4fe90e688db5356823c088f4ef487b0648454
parent6b5e0bc7e4ff9e6a8124357d1318259f1cf78b46
x86/xsaves: ebx may return wrong value using CPUID eax=0xd,ecx =1

Refer to SDM Volume 1 Extended Region of an XSAVE Area. The value returned
by ecx[1] with cpuid function 0xd and sub-function i (i>1) indicates
the alignment of the state component i when the compacted format of the
extended region of an xsave area is used.

So when hvm guest using CPUID eax=0xd, ecx=1 to get the size of area
used for compacted format, we need to take alignment into consideration.

tools side is fixed by
"tools/libxc: Calculate xstate cpuid leaf from guest information"
by Andrew Cooper

Signed-off-by: Shuai Ruan <shuai.ruan@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/xstate.c
xen/include/asm-x86/xstate.h