Support for XSAVES intel instructions in QEMU
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
Bug Description
Dear QEMU developers,
I am running Hyper-V on qemu+kvm. During it initialization, it checks for XSAVES support: first it executes CPUID with EAX = 0xd and ECX = 1 and looks at bit 3 in the returned value of EAX (Supports XSAVES/XRSTORS and IA32_XSS [1]), and then it reads the MSR IA32_VMX_
It seems that KVM sets the correct flags (in CPUID and the MSR) when the host CPU supports XSAVES. In QEMU, based on comments in target/i386/cpu.c it seems that XSAVES is not added in
builtin_
I have tested two possible solutions:
- adding the flag in .features[
- removing the support of the instruction in feature_
Both solutions work and Hyper-v is happily running. I can provide a patch for the solution you might consider applying. Otherwise, is there a better way to fix the issue?
Qemu version: 4.2.0
Kernel version: 5.5.4
Qemu command: https:/
Many thanks,
Alexandre
Ref:
[1] Intel SDM Volume 2A, chapter 3, page 196
[2] Intel SDM Volume 3C, chapter 24, page 11
Are you using Libvirt? If so, you can just remove xsaves in the Libvirt XML ("<feature policy='disable' name='xsaves'/>">).
It seems to me that this is a Hyper-V bug, but I understand that this is not a configuration that happens on real hardware.
Adding the flag to all Skylake and newer systems (including Denverton and Snowridge) is the best choice, but we cannot just add it; if you want to send a patch, see the "Intel Atom Processor (SnowRidge)" model for an example of how to do it.