On Thu, Apr 16, 2026 at 02:11:15PM +0200, Magnus Kulke wrote:
> We cannot statically set the responses for CPUID[0xD,{1,2}].EBX, b/c
> those are dynamic, dependent on which features the guest enables.
>
> Hence we mask EBX when registering answers for those subleaves at the
> hypervisor, which will result in the hypervisor providing us answers,
> considering XCR0 and XSS.
>
> The reported size now reflects the field masks properly (without the
> mask they were 576 and 10728, which is wrong):
>
> $ cpuid -l 0xd -s 0
> CPU 0:
> XSAVE features (0xd/0):
> XCR0 valid bit field mask = 0x00000000000600e7
> ...
> bytes required by fields in XCR0 = 0x00002b00 (11008)
> bytes required by XSAVE/XRSTOR area = 0x00002b00 (11008)
>
> $ cpuid -l 0xd -s 1
> CPU 0:
> XSAVE features (0xd/1):
> ...
> SAVE area size in bytes = 0x000029c0 (10688)
> IA32_XSS lower 32 bits valid bit field mask = 0x00001800
> IA32_XSS upper 32 bits valid bit field mask = 0x00000000
>
> Signed-off-by: Magnus Kulke <[email protected]>
> ---
> target/i386/mshv/mshv-cpu.c | 23 +++++++++++++++++++++--
> 1 file changed, 21 insertions(+), 2 deletions(-)
>
Reviewed-by: Doru Blânzeanu <[email protected]>