KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to __kvm_update_cpuid_runtime()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 24 Jan 2022 10:36:05 +0000 (11:36 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 25 Jan 2022 14:40:19 +0000 (09:40 -0500)
commit5c89be1dd5cfb697614bc13626ba3bd0781aa160
treef6a8068079ebeafc55366b4558a3e0703419ac26
parent1625566ec8fd3a42e305c5118df81fb113eb60a7
KVM: x86: Move CPUID.(EAX=0x12,ECX=1) mangling to __kvm_update_cpuid_runtime()

Full equality check of CPUID data on update (kvm_cpuid_check_equal()) may
fail for SGX enabled CPUs as CPUID.(EAX=0x12,ECX=1) is currently being
mangled in kvm_vcpu_after_set_cpuid(). Move it to
__kvm_update_cpuid_runtime() and split off cpuid_get_supported_xcr0()
helper  as 'vcpu->arch.guest_supported_xcr0' update needs (logically)
to stay in kvm_vcpu_after_set_cpuid().

Cc: stable@vger.kernel.org
Fixes: feb627e8d6f6 ("KVM: x86: Forbid KVM_SET_CPUID{,2} after KVM_RUN")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220124103606.2630588-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c