viridian: fix cpuid leaf 0x40000003
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 11 May 2018 14:48:32 +0000 (15:48 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 14 May 2018 11:57:13 +0000 (12:57 +0100)
commit29fc0493d8eabdd63f5bbff9e3069253053addca
treeb06566ec4c8beed1e251808673457858df1e9072
parent858dbaaeda33b05c1ac80aea0ba9a03924e09005
viridian: fix cpuid leaf 0x40000003

The response to viridian leaf 3 needs to split a 64-bit mask across EAX and
EBX, with the low order 32 bits in EAX and the high order 32 bits in EBX.
To facilitate this a union of two uint32_t values and the mask (type
HV_PARTITION_PRIVILEGE_MASK) is allocated on stack as follows:

union {
    HV_PARTITION_PRIVILEGE_MASK mask;
    uint32_t lo, hi;
} u;

This, of course, is incorrect as both lo and hi will alias the low order
32 bits of the mask.

This patch wraps lo and hi in an anonmymous struct to achieve the desired
effect.

NOTE: Fixing this also stops Windows making the HvGetPartitionId hypercall
      which was previously considered erroneous behaviour. Thus the
      hypercall handler is also modified to stop squashing the
      'unimplemented' warning for this hypercall.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/viridian.c