{"id":817656,"url":"http://patchwork.ozlabs.org/api/patches/817656/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170922171323.10348-7-f4bug@amsat.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170922171323.10348-7-f4bug@amsat.org>","list_archive_url":null,"date":"2017-09-22T17:13:22","name":"[v5,6/7] hw/mdio: Add VMState support","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"4b1bfab2df03d0d9a9a8dcd4e4776c0711975301","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/?format=json","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170922171323.10348-7-f4bug@amsat.org/mbox/","series":[{"id":4680,"url":"http://patchwork.ozlabs.org/api/series/4680/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4680","date":"2017-09-22T17:13:16","name":"Generalize MDIO framework","version":5,"mbox":"http://patchwork.ozlabs.org/series/4680/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817656/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817656/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"UEgrMXkQ\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xzKt611qkz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 03:17:34 +1000 (AEST)","from localhost ([::1]:60300 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dvRa0-0006rH-6i\n\tfor incoming@patchwork.ozlabs.org; Fri, 22 Sep 2017 13:17:32 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59453)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dvRWX-0003bE-Un\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 13:13:59 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dvRWW-0003ZK-QP\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 13:13:57 -0400","from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:34738)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dvRWW-0003Z4-M6\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 13:13:56 -0400","by mail-qk0-x241.google.com with SMTP id d70so1028194qkc.1\n\tfor <qemu-devel@nongnu.org>; Fri, 22 Sep 2017 10:13:56 -0700 (PDT)","from yoga.lan ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id\n\tf69sm238468qke.27.2017.09.22.10.13.54\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 22 Sep 2017 10:13:55 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=/uYu4uuFxDkoaslS0IXjyrZpP1KOsmMM+Jx/vmcm260=;\n\tb=UEgrMXkQj/aRiYqXl7o6iS8Pda9PmW3IaeZGJhNd4JFmXDi3SCHJh+aQ0eCMmEoaXQ\n\tWYII1m4/Ls5ES99MrBKOX4d+HOpCuKiz6I5GEYFTaAgxdaZCw9x8OHIfVqY7bLPmPIup\n\tHk9JVRSiZhMh910etJYpvWHfZIf7eln0Lj/7LB+vo3EZsYNx1bxVbgByYluZ86975p7A\n\tUsB9tXj++vvLOOFs4DpXRwfgrnf6WKt+p5BlmvZ2/l6T/S/S9yKbZj3picaNRzmMO3Gh\n\t/AMaAbMvKDB3iLITiTrqRb32/T5cCWcyTl+n1k8q63zBL7G2C6zkqNOLWlR+ouYnsiVz\n\takMQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=/uYu4uuFxDkoaslS0IXjyrZpP1KOsmMM+Jx/vmcm260=;\n\tb=TMtvem+YWNu4QkNNPpAYOnML6ByLUmmvq2tK5DOX9rMcyQtPHBzbB7ZX4m3WeCakQR\n\tJCmCcuiSgZscPCQ6f701GtqD+fEmU65YAeM9O17RHHQXqCp38fhvhpjGu8I4uPoe+Lpx\n\tNJeCPBG+EctO8NLS0ZiizBfyjsUeO/gI9K7hXp7yHyAq5W4MryI5gddaWFU4o7ISqI3T\n\tpjflW1F0/p39WI4+xBXrS6EL3ZQMLjvtAUb3Q0TWFe7TPLEElnnuLMYjbzMtQO6AokUn\n\th1j60XTrlwNfCKo5WkF7Cym4caLoXmHtHtjMaIXbx1kVMCy9XEa/NFy0vq3ofOIOmXNt\n\tNwGA==","X-Gm-Message-State":"AHPjjUj7YBoKcmz1BliOQqut239wMaSIGXH+LdmhrL8EgK2fbvXL48xP\n\tKFjhPfkDXNXuOq6Vv8jwVnA=","X-Google-Smtp-Source":"AOwi7QC/b5kxFgJ6ELzkvdUw+IBPLCzz7da8xc0OyL11evkV2dj+J0WpCtZG40vCnjMeSMANeuO9lA==","X-Received":"by 10.55.66.22 with SMTP id p22mr9027891qka.78.1506100436286;\n\tFri, 22 Sep 2017 10:13:56 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","To":"Peter Maydell <peter.maydell@linaro.org>,\n\tGrant Likely <grant.likely@arm.com>, Jason Wang <jasowang@redhat.com>","Date":"Fri, 22 Sep 2017 14:13:22 -0300","Message-Id":"<20170922171323.10348-7-f4bug@amsat.org>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170922171323.10348-1-f4bug@amsat.org>","References":"<20170922171323.10348-1-f4bug@amsat.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::241","Subject":"[Qemu-devel] [PATCH v5 6/7] hw/mdio: Add VMState support","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?=\n\t<f4bug@amsat.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"From: Grant Likely <grant.likely@arm.com>\n\nThe MDIO model needs to have VMState support before it can be used by\ndevices that support VMState. This patch adds VMState macros for both\nqemu_mdio and qemu_phy.\n\nSigned-off-by: Grant Likely <grant.likely@arm.com>\nSigned-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n[PMD: just rebased]\n---\n include/hw/net/mdio.h | 22 ++++++++++++++++++++++\n hw/net/mdio.c         | 30 ++++++++++++++++++++++++++++++\n 2 files changed, 52 insertions(+)","diff":"diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h\nindex 7fca19784e..b94e5ec337 100644\n--- a/include/hw/net/mdio.h\n+++ b/include/hw/net/mdio.h\n@@ -25,6 +25,8 @@\n  * THE SOFTWARE.\n  */\n \n+#include \"migration/vmstate.h\"\n+\n /* PHY MII Register/Bit Definitions */\n /* PHY Registers defined by IEEE */\n #define PHY_CTRL         0x00 /* Control Register */\n@@ -61,6 +63,16 @@ struct qemu_phy {\n     void (*write)(struct qemu_phy *phy, unsigned int req, uint16_t data);\n };\n \n+extern const VMStateDescription vmstate_mdio_phy;\n+\n+#define VMSTATE_MDIO_PHY(_field, _state) {                           \\\n+    .name   = (stringify(_field)),                                   \\\n+    .size   = sizeof(struct qemu_phy),                               \\\n+    .vmsd   = &vmstate_mdio_phy,                                     \\\n+    .flags  = VMS_STRUCT,                                            \\\n+    .offset = vmstate_offset_value(_state, _field, struct qemu_phy), \\\n+}\n+\n struct qemu_mdio {\n     /* bitbanging state machine */\n     bool mdc;\n@@ -83,6 +95,16 @@ struct qemu_mdio {\n     struct qemu_phy *devs[32];\n };\n \n+extern const VMStateDescription vmstate_mdio;\n+\n+#define VMSTATE_MDIO(_field, _state) {                                 \\\n+    .name   = (stringify(_field)),                                     \\\n+    .size   = sizeof(struct qemu_mdio),                                \\\n+    .vmsd   = &vmstate_mdio,                                           \\\n+    .flags  = VMS_STRUCT,                                              \\\n+    .offset = vmstate_offset_value(_state, _field, struct qemu_mdio),  \\\n+}\n+\n void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, uint16_t id2);\n void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy,\n                  unsigned int addr);\ndiff --git a/hw/net/mdio.c b/hw/net/mdio.c\nindex 96e10fada0..6c13cc7272 100644\n--- a/hw/net/mdio.c\n+++ b/hw/net/mdio.c\n@@ -248,3 +248,33 @@ void mdio_bitbang_set_clk(struct qemu_mdio *bus, bool mdc)\n         break;\n     }\n }\n+\n+const VMStateDescription vmstate_mdio = {\n+    .name = \"mdio\",\n+    .version_id = 1,\n+    .minimum_version_id = 1,\n+    .minimum_version_id_old = 1,\n+    .fields = (VMStateField[]) {\n+        VMSTATE_BOOL(mdc, struct qemu_mdio),\n+        VMSTATE_BOOL(mdio, struct qemu_mdio),\n+        VMSTATE_UINT32(state, struct qemu_mdio),\n+        VMSTATE_UINT16(cnt, struct qemu_mdio),\n+        VMSTATE_UINT16(addr, struct qemu_mdio),\n+        VMSTATE_UINT16(opc, struct qemu_mdio),\n+        VMSTATE_UINT16(req, struct qemu_mdio),\n+        VMSTATE_UINT32(shiftreg, struct qemu_mdio),\n+        VMSTATE_END_OF_LIST()\n+    }\n+};\n+\n+const VMStateDescription vmstate_mdio_phy = {\n+    .name = \"mdio\",\n+    .version_id = 1,\n+    .minimum_version_id = 1,\n+    .minimum_version_id_old = 1,\n+    .fields = (VMStateField[]) {\n+        VMSTATE_UINT16_ARRAY(regs, struct qemu_phy, 32),\n+        VMSTATE_BOOL(link, struct qemu_phy),\n+        VMSTATE_END_OF_LIST()\n+    }\n+};\n","prefixes":["v5","6/7"]}