kvm: x86: ensure pv_cpuid.features is initialized when enabling cap
authorOliver Upton <oupton@google.com>
Tue, 27 Oct 2020 23:10:42 +0000 (16:10 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 8 Nov 2020 09:41:29 +0000 (04:41 -0500)
commit01b4f510b9f467abfc781e198e810e1ecffb782e
tree2e0ca3e840a0a8f9b3dc2a52fb1a91256d2412c7
parent1930e5ddcead2c23567131e62c86b15efce054be
kvm: x86: ensure pv_cpuid.features is initialized when enabling cap

Make the paravirtual cpuid enforcement mechanism idempotent to ioctl()
ordering by updating pv_cpuid.features whenever userspace requests the
capability. Extract this update out of kvm_update_cpuid_runtime() into a
new helper function and move its other call site into
kvm_vcpu_after_set_cpuid() where it more likely belongs.

Fixes: 66570e966dd9 ("kvm: x86: only provide PV features if enabled in guest's CPUID")
Signed-off-by: Oliver Upton <oupton@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
Message-Id: <20201027231044.655110-5-oupton@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/x86.c