From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXnlU-0001uG-SJ for qemu-devel@nongnu.org; Mon, 22 Feb 2016 05:30:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXnlQ-0007DD-L9 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 05:30:52 -0500 References: <1456132310-4826-1-git-send-email-zxq_yx_007@163.com> From: hitmoon Message-ID: <56CAE2DB.3080702@163.com> Date: Mon, 22 Feb 2016 18:28:43 +0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 5/9] hw/timer: QOM'ify m48txx_sysbus (pass 2) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Igor Mitsyanko , Mark Cave-Ayland , QEMU Developers , Michael Walle , qemu-arm , "Edgar E. Iglesias" , Guan Xuetao , =?UTF-8?Q?Andreas_F=c3=a4rber?= 在 2016年02月22日 17:24, Peter Maydell 写道: > On 22 February 2016 at 09:11, xiaoqiang zhao wrote: >> assign DeviceClass::vmsd instead of using vmstate_register function >> >> Signed-off-by: xiaoqiang zhao >> --- >> hw/timer/m48t59.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c >> index 3c683aa..b0cf79d 100644 >> --- a/hw/timer/m48t59.c >> +++ b/hw/timer/m48t59.c >> @@ -742,8 +742,6 @@ static void m48t59_realize_common(M48t59State *s, Error **errp) >> s->wd_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &watchdog_cb, s); >> } >> qemu_get_timedate(&s->alarm, 0); >> - >> - vmstate_register(NULL, -1, &vmstate_m48t59, s); >> } >> >> static void m48t59_isa_realize(DeviceState *dev, Error **errp) >> @@ -822,6 +820,7 @@ static void m48txx_isa_class_init(ObjectClass *klass, void *data) >> dc->realize = m48t59_isa_realize; >> dc->reset = m48t59_reset_isa; >> dc->props = m48t59_isa_properties; >> + dc->vmsd = &vmstate_m48t59; >> nc->read = m48txx_isa_read; >> nc->write = m48txx_isa_write; >> nc->toggle_lock = m48txx_isa_toggle_lock; >> @@ -866,6 +865,7 @@ static void m48txx_sysbus_class_init(ObjectClass *klass, void *data) >> dc->realize = m48t59_realize; >> dc->reset = m48t59_reset_sysbus; >> dc->props = m48t59_sysbus_properties; >> + dc->vmsd = &vmstate_m48t59; >> nc->read = m48txx_sysbus_read; >> nc->write = m48txx_sysbus_write; >> nc->toggle_lock = m48txx_sysbus_toggle_lock; >> -- >> 2.1.4 >> > Just noticed this won't work as it is -- the vmstate > struct is for the M48t59State*, but the ISA and > Sysbus wrappers have their own structs which are > what the dc->vmsd will be wanting to operate on. > You'd need extra VMState structs I think and > somebody who knows migration better than me to say > whether that is a migration compat break. > > thanks > -- PMM It seems that the old code also use the same vmstate structure. Maybe it's a common structure which will not be used at the same time.