Re: [PATCH v2 4/6] KVM: x86: Introduce KVM_GET_SREGS2 / KVM_SET_SREGS2

From: Paolo Bonzini
Date: Mon Apr 26 2021 - 09:29:11 EST


On 26/04/21 14:56, Maxim Levitsky wrote:
On Mon, 2021-04-26 at 14:32 +0200, Paolo Bonzini wrote:
On 26/04/21 13:13, Maxim Levitsky wrote:
+ if (sregs2->flags & KVM_SREGS2_FLAGS_PDPTRS_VALID) {
+
+ if (!is_pae_paging(vcpu))
+ return -EINVAL;
+
+ for (i = 0 ; i < 4 ; i++)
+ kvm_pdptr_write(vcpu, i, sregs2->pdptrs[i]);
+
+ kvm_register_mark_dirty(vcpu, VCPU_EXREG_PDPTR);
+ mmu_reset_needed = 1;
+ }

I think this should also have

else {
if (is_pae_paging(vcpu))
return -EINVAL;
}


What about the case when we migrate from qemu that doesn't use
this ioctl to qemu that does?

Right, that makes sense but then the "else" branch should do the same as KVM_SET_SREGS. Maybe add a "load_pdptrs" bool to __set_sregs_common?

Paolo