Re: [PATCH 2/2] KVM: use KVM_{GET|SET}_SREGS2 when supported by kvm.

2021-04-01 Thread Maxim Levitsky
On Thu, 2021-04-01 at 18:09 +0200, Paolo Bonzini wrote: > On 01/04/21 16:45, Maxim Levitsky wrote: > > + > > +for (i = 0; i < 4; i++) { > > +sregs.pdptrs[i] = env->pdptrs[i]; > > +} > > + > > +sregs.flags = 0; > > +sregs.padding = 0; > > + > > +return

Re: [PATCH 2/2] KVM: use KVM_{GET|SET}_SREGS2 when supported by kvm.

2021-04-01 Thread Paolo Bonzini
On 01/04/21 16:45, Maxim Levitsky wrote: + +for (i = 0; i < 4; i++) { +sregs.pdptrs[i] = env->pdptrs[i]; +} + +sregs.flags = 0; +sregs.padding = 0; + +return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_SREGS2, ); +} + This breaks when migrating from old to new kernel, because

[PATCH 2/2] KVM: use KVM_{GET|SET}_SREGS2 when supported by kvm.

2021-04-01 Thread Maxim Levitsky
This allows qemu to make PDPTRs be part of the migration stream and thus not reload them after a migration which is against X86 spec. Signed-off-by: Maxim Levitsky --- accel/kvm/kvm-all.c | 4 ++ include/sysemu/kvm.h | 4 ++ target/i386/cpu.h | 1 + target/i386/kvm/kvm.c | 101