Also, the "Fixes" tag is not really correct as the behavior was the same before. Rather, it fixes commit 02d4160fbd76 ("x86: KVM: add xsetbv to the
It seems the original code comes from 81dd35d42c9a ("KVM: SVM: Add xsetbv intercept").
2acf923e38 ("KVM: VMX: Enable XSAVE/XRSTOR for guest") and 92f9895c146d.
emulator", 2019-08-22). Checking OSXSAVE is a bug in the emulator path, even though it's not needed in the XSETBV vmexit case.
The kvm_emulate_xsetbv() has been removed from the emulator path.
I'm not really sure why it's not needed in the XSETBV vmexit case. More details ?
Thanks,
Paolo
+ if ((is_protmode(vcpu) && static_call(kvm_x86_get_cpl)(vcpu) != 0) ||
__kvm_set_xcr(vcpu, kvm_rcx_read(vcpu), kvm_read_edx_eax(vcpu))) {
kvm_inject_gp(vcpu, 0);
return 1;