Re: [Patch 4/6] kvm: svm: Enumerate XSAVES in guest CPUID when it is available to the guest

Paolo Bonzini
2019-10-09T06:32:42Z

On 09/10/19 03:42, Yang Weijiang wrote:
> + if (guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
> + boot_cpu_has(X86_FEATURE_XSAVES))
> + guest_cpuid_set(vcpu, X86_FEATURE_XSAVES);
> +

This is incorrect, as it would cause a change in the guest ABI when
migrating from an XSAVES-enabled processor to one that doesn't have it.

As long as IA32_XSS is 0, XSAVES is indistinguishable from XSAVEC, so
it's okay if the guest "tries" to run it despite the bit being clear in
CPUID.

Paolo