]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
KVM: x86: emulate FXSAVE and FXRSTOR
authorRadim Krčmář <rkrcmar@redhat.com>
Wed, 9 Nov 2016 18:07:06 +0000 (19:07 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Wed, 16 Nov 2016 21:09:46 +0000 (22:09 +0100)
commit283c95d0e3891b64087706b344a4b545d04a6e62
treeed7d530132e7ef7607fc07fc70139d23e697203c
parentaabba3c6abd50b05b1fc2c6ec44244aa6bcda576
KVM: x86: emulate FXSAVE and FXRSTOR

Internal errors were reported on 16 bit fxsave and fxrstor with ipxe.
Old Intels don't have unrestricted_guest, so we have to emulate them.

The patch takes advantage of the hardware implementation.

AMD and Intel differ in saving and restoring other fields in first 32
bytes.  A test wrote 0xff to the fxsave area, 0 to upper bits of MCSXR
in the fxsave area, executed fxrstor, rewrote the fxsave area to 0xee,
and executed fxsave:

  Intel (Nehalem):
    7f 1f 7f 7f ff 00 ff 07 ff ff ff ff ff ff 00 00
    ff ff ff ff ff ff 00 00 ff ff 00 00 ff ff 00 00
  Intel (Haswell -- deprecated FPU CS and FPU DS):
    7f 1f 7f 7f ff 00 ff 07 ff ff ff ff 00 00 00 00
    ff ff ff ff 00 00 00 00 ff ff 00 00 ff ff 00 00
  AMD (Opteron 2300-series):
    7f 1f 7f 7f ff 00 ee ee ee ee ee ee ee ee ee ee
    ee ee ee ee ee ee ee ee ff ff 00 00 ff ff 02 00

fxsave/fxrstor will only be emulated on early Intels, so KVM can't do
much to improve the situation.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/emulate.c