On 4/24/2023 9:38 AM, Binbin Wu wrote:
On 4/21/2023 9:46 PM, Yang Weijiang wrote:
[...]
@@ -276,9 +276,14 @@ static void __kvm_update_cpuid_runtime(struct
kvm_vcpu *vcpu, struct kvm_cpuid_e
best->ebx = xstate_required_size(vcpu->arch.xcr0, false);
best = cpuid_entry2_find(entries, nent, 0xD, 1);
- if (best && (cpuid_entry_has(best, X86_FEATURE_XSAVES) ||
- cpuid_entry_has(best, X86_FEATURE_XSAVEC)))
- best->ebx = xstate_required_size(vcpu->arch.xcr0, true);
+ if (best) {
+ if (cpuid_entry_has(best, X86_FEATURE_XSAVES) ||
+ cpuid_entry_has(best, X86_FEATURE_XSAVEC)) {
Is it necessary to change to use two ifs?
Good catch! I changed the patch a bit, but forgot to re-shape it.
+ u64 xstate = vcpu->arch.xcr0 | vcpu->arch.ia32_xss;
+
+ best->ebx = xstate_required_size(xstate, true);
[...]