* Paolo Bonzini (pbonz...@redhat.com) wrote: > Il mer 1 lug 2020, 18:28 Dr. David Alan Gilbert <dgilb...@redhat.com> ha > scritto: > > > > > > + return (nested_state->format == KVM_STATE_NESTED_FORMAT_SVM && > > > + nested_state->size > offsetof(struct kvm_nested_state, > > data)); > > > > How does this nested_state->size work? It looks like even if it's 1 byte > > into 'data' we transmit a whole KVM_STATE_NESTED_SVM_VMCB_SIZE. > > > > The format is documented as having either 0 or KVM_STATE_NESTED_SVM_VMCB_SIZE > bytes (for vmx instead it can be 0, 4K or 8K).
OK. Dave > Paolo > > > > Dave > > > > > +} > > > + > > > +static const VMStateDescription vmstate_svm_nested_state = { > > > + .name = "cpu/kvm_nested_state/svm", > > > + .version_id = 1, > > > + .minimum_version_id = 1, > > > + .needed = svm_nested_state_needed, > > > + .fields = (VMStateField[]) { > > > + VMSTATE_U64(hdr.svm.vmcb_pa, struct kvm_nested_state), > > > + VMSTATE_UINT8_ARRAY(data.svm[0].vmcb12, > > > + struct kvm_nested_state, > > > + KVM_STATE_NESTED_SVM_VMCB_SIZE), > > > + VMSTATE_END_OF_LIST() > > > + } > > > +}; > > > + > > > static bool nested_state_needed(void *opaque) > > > { > > > X86CPU *cpu = opaque; > > > CPUX86State *env = &cpu->env; > > > > > > return (env->nested_state && > > > - vmx_nested_state_needed(env->nested_state)); > > > + (vmx_nested_state_needed(env->nested_state) || > > > + svm_nested_state_needed(env->nested_state))); > > > } > > > > > > static int nested_state_post_load(void *opaque, int version_id) > > > @@ -1139,6 +1166,7 @@ static const VMStateDescription > > vmstate_kvm_nested_state = { > > > }, > > > .subsections = (const VMStateDescription*[]) { > > > &vmstate_vmx_nested_state, > > > + &vmstate_svm_nested_state, > > > NULL > > > } > > > }; > > > -- > > > 2.26.2 > > > > > -- > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK > > > > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK