Re: [PATCH] KVM: x86: Restore update of required xstate size in guest's CPUID
From: Paolo Bonzini
Date: Sat May 09 2020 - 08:51:45 EST
On 09/05/20 01:37, Sean Christopherson wrote:
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 35845704cf57a..cd708b0b460a0 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -84,11 +84,13 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)
> kvm_read_cr4_bits(vcpu, X86_CR4_PKE));
>
> best = kvm_find_cpuid_entry(vcpu, 0xD, 0);
> - if (!best)
> + if (!best) {
> vcpu->arch.guest_supported_xcr0 = 0;
> - else
> + } else {
> vcpu->arch.guest_supported_xcr0 =
> (best->eax | ((u64)best->edx << 32)) & supported_xcr0;
> + best->ebx = xstate_required_size(vcpu->arch.xcr0, false);
> + }
>
> best = kvm_find_cpuid_entry(vcpu, 0xD, 1);
> if (best && (cpuid_entry_has(best, X86_FEATURE_XSAVES) ||
> -- 2.26.0
Ugh, I'll write a testcase as penance. Squashed, thanks.
Paolo