mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
KVM: x86: fix backward migration with async_PF
Guests on new hypersiors might set KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT
bit when enabling async_PF, but this bit is reserved on old hypervisors,
which results in a failure upon migration.
To avoid breaking different cases, we are checking for CPUID feature bit
before enabling the feature and nothing else.
Fixes: 52a5c155cf
("KVM: async_pf: Let guest support delivery of async_pf from guest mode")
Cc: <stable@vger.kernel.org>
Reviewed-by: Wanpeng Li <wanpengli@tencent.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f75e4924f0
commit
fe2a3027e7
5 changed files with 13 additions and 6 deletions
|
@ -341,10 +341,10 @@ static void kvm_guest_cpu_init(void)
|
|||
#endif
|
||||
pa |= KVM_ASYNC_PF_ENABLED;
|
||||
|
||||
/* Async page fault support for L1 hypervisor is optional */
|
||||
if (wrmsr_safe(MSR_KVM_ASYNC_PF_EN,
|
||||
(pa | KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT) & 0xffffffff, pa >> 32) < 0)
|
||||
wrmsrl(MSR_KVM_ASYNC_PF_EN, pa);
|
||||
if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_VMEXIT))
|
||||
pa |= KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT;
|
||||
|
||||
wrmsrl(MSR_KVM_ASYNC_PF_EN, pa);
|
||||
__this_cpu_write(apf_reason.enabled, 1);
|
||||
printk(KERN_INFO"KVM setup async PF for cpu %d\n",
|
||||
smp_processor_id());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue