From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47108 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q26tU-0003h1-Ta for qemu-devel@nongnu.org; Tue, 22 Mar 2011 15:05:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q26tM-0006Yt-G8 for qemu-devel@nongnu.org; Tue, 22 Mar 2011 15:05:21 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:39465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q26tM-0006Yn-Bg for qemu-devel@nongnu.org; Tue, 22 Mar 2011 15:05:20 -0400 Received: by vxb41 with SMTP id 41so6347650vxb.4 for ; Tue, 22 Mar 2011 12:05:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1299270860-8927-1-git-send-email-peter.maydell@linaro.org> <1299270860-8927-2-git-send-email-peter.maydell@linaro.org> <4D722880.6090103@redhat.com> <4D724FB5.1040601@redhat.com> Date: Tue, 22 Mar 2011 19:05:19 +0000 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH v2 1/2] hw/arm_sysctl.c: Add the Versatile Express system registers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Juan Quintela On 5 March 2011 16:50, Peter Maydell wrote: > I've appended a draft of a suggested extra section for > docs/migration.txt so you can tell me if I've misunderstood > it all :-) Ping? In particular if somebody can fill in the [XXX] bit for me (and correct any other mistakes!) I'll submit this as a proper patch to the docs. > ---begin--- > =3D=3D=3D Adding state fields to a device =3D=3D=3D > > If you make a bugfix or enhancement to a device which requires the > addition of extra state, you need to add these new state fields > to the VMStateDescription so that: > =C2=A0(1) they are saved and loaded correctly > =C2=A0(2) migration between the new and old versions either works > =C2=A0 =C2=A0 or fails cleanly. > > If the change is such that migration between versions would not > work anyway, you can just add the new fields using the usual > VMSTATE_* macros, increment the version_id and set the > minimum_version_id to be the same as the version_id. > > Migration from the old version to the new version can be supported > if it is OK for the new fields to remain in their default state > [XXX is this right? are they zeroed, or do they get the value > the device's reset function sets them to, or something else?] > when the state of an old-version snapshot is loaded. To implement > this you need to use the VMSTATE_*_V macros which let you specify > the version in which a field was introduced, for instance: > > =C2=A0VMSTATE_UINT32_V(sys_cfgdata, arm_sysctl_state, 2) > > for a field introduced in version 2. You should also increment > the version_id, but leave the minimum_version_id unchanged. > Newly added VMSTATE_*_V fields should go at the end of the > VMState description. > > ---endit--- thanks -- PMM