From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6CbT-0001YM-D0 for qemu-devel@nongnu.org; Fri, 27 May 2016 03:54:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6CbP-0005SK-6M for qemu-devel@nongnu.org; Fri, 27 May 2016 03:54:43 -0400 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:34227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6CbO-0005SC-UU for qemu-devel@nongnu.org; Fri, 27 May 2016 03:54:39 -0400 Received: by mail-pa0-x242.google.com with SMTP id yl2so11686007pac.1 for ; Fri, 27 May 2016 00:54:37 -0700 (PDT) References: <1462344751-28281-1-git-send-email-aik@ozlabs.ru> <1462344751-28281-5-git-send-email-aik@ozlabs.ru> From: Alexey Kardashevskiy Message-ID: <4c7fd5e1-da8e-7dad-ab49-c62fec903c53@ozlabs.ru> Date: Fri, 27 May 2016 17:54:30 +1000 MIME-Version: 1.0 In-Reply-To: <1462344751-28281-5-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH qemu v16 04/19] vmstate: Define VARRAY with VMS_ALLOC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Alexander Graf , David Gibson , Alex Williamson , Paolo Bonzini On 04/05/16 16:52, Alexey Kardashevskiy wrote: > This allows dynamic allocation for migrating arrays. > > Already existing VMSTATE_VARRAY_UINT32 requires an array to be > pre-allocated, however there are cases when the size is not known in > advance and there is no real need to enforce it. > > This defines another variant of VMSTATE_VARRAY_UINT32 with WMS_ALLOC > flag which tells the receiving side to allocate memory for the array > before receiving the data. > > The first user of it is a dynamic DMA window which existence and size > are totally dynamic. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: David Gibson > Reviewed-by: Thomas Huth In what tree is this going to go? pseries? Or migration? > --- > include/migration/vmstate.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > index 84ee355..1622638 100644 > --- a/include/migration/vmstate.h > +++ b/include/migration/vmstate.h > @@ -386,6 +386,16 @@ extern const VMStateInfo vmstate_info_bitmap; > .offset = vmstate_offset_pointer(_state, _field, _type), \ > } > > +#define VMSTATE_VARRAY_UINT32_ALLOC(_field, _state, _field_num, _version, _info, _type) {\ > + .name = (stringify(_field)), \ > + .version_id = (_version), \ > + .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\ > + .info = &(_info), \ > + .size = sizeof(_type), \ > + .flags = VMS_VARRAY_UINT32|VMS_POINTER|VMS_ALLOC, \ > + .offset = vmstate_offset_pointer(_state, _field, _type), \ > +} > + > #define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\ > .name = (stringify(_field)), \ > .version_id = (_version), \ > -- Alexey