From patchwork Tue Feb 25 13:14:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1244220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=FswM0EPG; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 48Rffm4Khwz9sPK for ; Wed, 26 Feb 2020 00:19:44 +1100 (AEDT) Received: from localhost ([::1]:55508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6a7i-0005z2-AY for incoming@patchwork.ozlabs.org; Tue, 25 Feb 2020 08:19:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37451) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6a2p-00081e-Nb for qemu-devel@nongnu.org; Tue, 25 Feb 2020 08:14:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6a2n-00026l-U4 for qemu-devel@nongnu.org; Tue, 25 Feb 2020 08:14:39 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:57170) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6a2e-00021S-ST; Tue, 25 Feb 2020 08:14:29 -0500 Received: from crumble.bar.greensocs.com (crumble.bar.greensocs.com [172.16.11.102]) by beetle.greensocs.com (Postfix) with ESMTPS id 1AC3F96F50; Tue, 25 Feb 2020 13:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1582636466; 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=islzJ3dtZ7UUO4t6RapBooYgTjjRcixcXvr9KLyxFa4=; b=FswM0EPGhJv8+TdI65IJixlmJZJOL7Mi0yfyiBeSlmiVTJiifPcTw2Oz5v0CDaYT1jOsHW k5nX3FGUoc3DSf3OZFL1UqfVVjZC395PP7XEM4bxvv4Tsdiih5adtniIquKEgDc9Su282l slfTjlIRRsa0qJEN5Afb99e+bYovXSU= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [PATCH v8 2/9] hw/core/clock-vmstate: define a vmstate entry for clock state Date: Tue, 25 Feb 2020 14:14:15 +0100 Message-Id: <20200225131422.53368-3-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200225131422.53368-1-damien.hedde@greensocs.com> References: <20200225131422.53368-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=1582636466; 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=islzJ3dtZ7UUO4t6RapBooYgTjjRcixcXvr9KLyxFa4=; b=0khKbIB7Jf/XHHfWa+WZKRqhZpW/JU11RKrv/IInegQje8aKBqHSqU9tdJks2MfnjzLxT8 cu2Ei39dA7MVYPlgT38+rn1u2wHDL9zMQoELnMfqFgd9zDYlANoeKGotgg39vACwq+OV+m pgj/BXJ4T6vNQtulNSgQvQoNu0SbNnQ= ARC-Seal: i=1; s=mail; d=greensocs.com; t=1582636466; a=rsa-sha256; cv=none; b=vvamLY7PsCCemQifN4HqxX/xtN9ynJ5Ijjtzmtp4Fz8uQbvD91F/Ql64LjHgYeG+e/0tOa Rr3aBP9RZNyc3RZHFSN+f39xhOxk9DQJ3uEBd49pbgh10WMb6MtUIe8B/wemrOJD02iSrb PRks4bwf2gyyVcIih8x0TPHS09ybUPM= 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, Alistair Francis , marcandre.lureau@redhat.com, edgar.iglesias@gmail.com, philmd@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.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 82a7f3c698..f3e44e9460 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 1d9b0aa205..115df55087 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -21,6 +21,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