Received: from eggs.gnu.org ([2001:4830:134:3::10]:36050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCzv4-0005rc-A1 for qemu-devel@nongnu.org; Thu, 31 Jul 2014 19:38:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCzuz-0002lF-11 for qemu-devel@nongnu.org; Thu, 31 Jul 2014 19:37:58 -0400 Received: from [2001:41d0:8:2b42::1] (port=35887 helo=greensocs.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCzuy-0002ku-R1 for qemu-devel@nongnu.org; Thu, 31 Jul 2014 19:37:52 -0400 From: fred.konrad@greensocs.com Date: Fri, 1 Aug 2014 01:37:10 +0200 Message-Id: <1406849835-4288-3-git-send-email-fred.konrad@greensocs.com> In-Reply-To: <1406849835-4288-1-git-send-email-fred.konrad@greensocs.com> References: <1406849835-4288-1-git-send-email-fred.konrad@greensocs.com> Subject: [Qemu-devel] [PATCH 2/7] migration: migrate icount fields. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, pbonzini@redhat.com Cc: peter.maydell@linaro.org, quintela@redhat.com, mark.burton@greensocs.com, dgilbert@redhat.com, Pavel.Dovgaluk@ispras.ru, amit.shah@redhat.com, sebastian.tanase@openwide.fr, fred.konrad@greensocs.com From: KONRAD Frederic This fixes a bug where qemu_icount and qemu_icount_bias are not migrated. It adds a subsection "timer/icount" to vmstate_timers so icount is migrated only when needed. Signed-off-by: KONRAD Frederic Reviewed-by: Amit Shah Reviewed-by: Juan Quintela --- cpus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cpus.c b/cpus.c index ebfd4fb..98e1203 100644 --- a/cpus.c +++ b/cpus.c @@ -452,6 +452,25 @@ void qemu_clock_warp(QEMUClockType type) } } +static bool icount_state_needed(void *opaque) +{ + return use_icount; +} + +/* + * This is a subsection for icount migration. + */ +static const VMStateDescription icount_vmstate_timers = { + .name = "timer/icount", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_INT64(qemu_icount_bias, TimersState), + VMSTATE_INT64(qemu_icount, TimersState), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_timers = { .name = "timer", .version_id = 2, @@ -461,6 +480,14 @@ static const VMStateDescription vmstate_timers = { VMSTATE_INT64(dummy, TimersState), VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2), VMSTATE_END_OF_LIST() + }, + .subsections = (VMStateSubsection[]) { + { + .vmsd = &icount_vmstate_timers, + .needed = icount_state_needed, + }, { + /* empty */ + } } }; -- 1.9.0