From patchwork Mon Feb 24 17:02:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 11401093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59FE31580 for ; Mon, 24 Feb 2020 17:08:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CBF02080D for ; Mon, 24 Feb 2020 17:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b="3bH2GieB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CBF02080D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6HDE-0007eg-7S for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Feb 2020 12:08:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46921) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6H8h-0003Ag-JM for qemu-devel@nongnu.org; Mon, 24 Feb 2020 12:03:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6H8e-0005hM-Sf for qemu-devel@nongnu.org; Mon, 24 Feb 2020 12:03:26 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:46534) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6H8T-0005VW-1K; Mon, 24 Feb 2020 12:03:13 -0500 Received: from crumble.bar.greensocs.com (crumble.bar.greensocs.com [172.16.11.102]) by beetle.greensocs.com (Postfix) with ESMTPS id D821396F50; Mon, 24 Feb 2020 17:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1582563791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v4G+xlL/fUt5DMmB/QGEqSlK0ypIhsRcgyJCMOphg+8=; b=3bH2GieBoJbrit2fN9HPDpMhgtByLj9BeUKwPyT6ZVpMbjwp1hGFsggPH34Ynd4/kVCiWc GWfjEWikr3+hxkHyCV95mjBfeQ9UzlRh3/W7RlUc+1OOuR0lR35+OZXxln1nXSpV9+ya3r oWwPA1rrZnTI7fHnfnDBdIPaRE9U1l8= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v7 2/9] hw/core/clock-vmstate: define a vmstate entry for clock state Date: Mon, 24 Feb 2020 18:02:54 +0100 Message-Id: <20200224170301.246623-3-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224170301.246623-1-damien.hedde@greensocs.com> References: <20200224170301.246623-1-damien.hedde@greensocs.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1582563791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v4G+xlL/fUt5DMmB/QGEqSlK0ypIhsRcgyJCMOphg+8=; b=2NkdHeYpnOQZx1QmoRPG7Ecs1RNa6DBet+LqkYhvqYt4daz78AYZGggHl8l1T5eX6qcEM/ /mtkH2rn3e7lX4McX8JfudEOM2/dmtqBP9glsZdpan/YuuN2/uhnExVfpJDPOE7OMyb8qg /83vI7Gp8zosj0m+FUU8aE49cIdJ8os= ARC-Seal: i=1; s=mail; d=greensocs.com; t=1582563791; a=rsa-sha256; cv=none; b=j/+4CaaPx/vB8f0nqG2s2v1DQSEpWmYxwZofgVMZ/3mYz1GRv6kVA1NYp4/0w9X3u4+qGe dr8X94dginSYUGov/ESOkvVBBjkh/PgeXi/6BusKyJ8PpNCfC7KrPGZDs33nByDVxu1ew/ bf5/yajH6DjsCow8is4s8PLJsITk6XQ= ARC-Authentication-Results: i=1; beetle.greensocs.com; none X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 5.135.226.135 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , peter.maydell@linaro.org, berrange@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com, alistair@alistair23.me, mark.burton@greensocs.com, qemu-arm@nongnu.org, marcandre.lureau@redhat.com, edgar.iglesias@gmail.com, philmd@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Damien Hedde Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- v7: remove leading underscores in macro args --- include/hw/clock.h | 9 +++++++++ hw/core/clock-vmstate.c | 25 +++++++++++++++++++++++++ hw/core/Makefile.objs | 1 + 3 files changed, 35 insertions(+) create mode 100644 hw/core/clock-vmstate.c diff --git a/include/hw/clock.h b/include/hw/clock.h index 30ac9a9946..8c191751a1 100644 --- a/include/hw/clock.h +++ b/include/hw/clock.h @@ -74,6 +74,15 @@ struct Clock { QLIST_ENTRY(Clock) sibling; }; +/* + * vmstate description entry to be added in device vmsd. + */ +extern const VMStateDescription vmstate_clock; +#define VMSTATE_CLOCK(field, state) \ + VMSTATE_CLOCK_V(field, state, 0) +#define VMSTATE_CLOCK_V(field, state, version) \ + VMSTATE_STRUCT_POINTER_V(field, state, version, vmstate_clock, Clock) + /** * clock_setup_canonical_path: * @clk: clock diff --git a/hw/core/clock-vmstate.c b/hw/core/clock-vmstate.c new file mode 100644 index 0000000000..260b13fc2c --- /dev/null +++ b/hw/core/clock-vmstate.c @@ -0,0 +1,25 @@ +/* + * Clock migration structure + * + * Copyright GreenSocs 2019-2020 + * + * Authors: + * Damien Hedde + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "migration/vmstate.h" +#include "hw/clock.h" + +const VMStateDescription vmstate_clock = { + .name = "clock", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT64(period, Clock), + VMSTATE_END_OF_LIST() + } +}; diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index d7080edf89..e3d796fdd4 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -22,6 +22,7 @@ common-obj-$(CONFIG_SOFTMMU) += null-machine.o common-obj-$(CONFIG_SOFTMMU) += loader.o common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o common-obj-$(CONFIG_SOFTMMU) += numa.o +common-obj-$(CONFIG_SOFTMMU) += clock-vmstate.o obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o