From: Marcelo Manzo <marcelomanzo@gmail.com>
To: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org, philmd@oss.qualcomm.com,
Marcelo Manzo <marcelomanzo@gmail.com>,
Jason Wang <jasowangio@gmail.com>
Subject: [PATCH v4 14/17] hw/net/bcm2838_genet: add migration state
Date: Sun, 18 Oct 2026 09:36:00 -0400 [thread overview]
Message-ID: <20261018133603.64323-15-marcelomanzo@gmail.com> (raw)
In-Reply-To: <20261018133603.64323-1-marcelomanzo@gmail.com>
The device had no VMStateDescription, so none of its register or PHY
state was saved or migrated. Describe the MAC register block and the
PHY, shadow and expansion registers, and re-evaluate the interrupt
outputs after load, since they are derived from the registers.
Signed-off-by: Marcelo Manzo <marcelomanzo@gmail.com>
---
hw/net/bcm2838_genet.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/hw/net/bcm2838_genet.c b/hw/net/bcm2838_genet.c
index e20358c8e7..643ee3ec0b 100644
--- a/hw/net/bcm2838_genet.c
+++ b/hw/net/bcm2838_genet.c
@@ -17,6 +17,7 @@
#include "system/dma.h"
#include "hw/core/registerfields.h"
#include "hw/core/resettable.h"
+#include "migration/vmstate.h"
#include "hw/net/bcm2838_genet.h"
#include "trace.h"
@@ -1129,6 +1130,37 @@ static const Property genet_properties[] = {
DEFINE_NIC_PROPERTIES(BCM2838GenetState, nic_conf),
};
+static int bcm2838_genet_post_load(void *opaque, int version_id)
+{
+ BCM2838GenetState *s = opaque;
+
+ /* The interrupt outputs are derived from the register state */
+ bcm2838_genet_set_irq_default(s);
+ bcm2838_genet_set_irq_prio(s);
+
+ return 0;
+}
+
+static const VMStateDescription vmstate_bcm2838_genet = {
+ .name = "bcm2838-genet",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .post_load = bcm2838_genet_post_load,
+ .fields = (const VMStateField[]) {
+ VMSTATE_BUFFER_UNSAFE(regs, BCM2838GenetState, 0,
+ sizeof(BCM2838GenetRegs)),
+ VMSTATE_BUFFER_UNSAFE(phy_regs, BCM2838GenetState, 0,
+ sizeof(BCM2838GenetPhyRegs)),
+ VMSTATE_BUFFER_UNSAFE(phy_shd_regs, BCM2838GenetState, 0,
+ sizeof(BCM2838GenetPhyShdRegs)),
+ VMSTATE_BUFFER_UNSAFE(phy_aux_ctl_shd_regs, BCM2838GenetState, 0,
+ sizeof(BCM2838GenetPhyAuxShdRegs)),
+ VMSTATE_BUFFER_UNSAFE(phy_exp_shd_regs, BCM2838GenetState, 0,
+ sizeof(BCM2838GenetPhyExpShdRegs)),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static void bcm2838_genet_class_init(ObjectClass *class, const void *data)
{
static ResettablePhases unused_parent_phases;
@@ -1136,6 +1168,7 @@ static void bcm2838_genet_class_init(ObjectClass *class, const void *data)
ResettableClass *rc = RESETTABLE_CLASS(class);
dc->realize = bcm2838_genet_realize;
+ dc->vmsd = &vmstate_bcm2838_genet;
resettable_class_set_parent_phases(rc, NULL, bcm2838_genet_reset, NULL,
&unused_parent_phases);
device_class_set_props(dc, genet_properties);
--
2.55.0
next prev parent reply other threads:[~2026-10-18 13:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 13:35 [PATCH v4 00/17] hw/arm/raspi4b: working PCIe and GENET (real networking) Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 01/17] hw/arm/bcm2838_pcie: add BCM2838 PCIe Root Complex Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 02/17] hw/arm/bcm2838_pcie: add BCM2838 PCIe host Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 03/17] hw/arm/bcm2838: enable BCM2838 PCIe host bridge Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 04/17] hw/net/bcm2838_genet: add GENET stub device Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 05/17] hw/net/bcm2838_genet: add GENET register structs, part 1/4 Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 06/17] hw/net/bcm2838_genet: add GENET register structs, part 2/4 Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 07/17] hw/net/bcm2838_genet: add GENET register structs, part 3/4 Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 08/17] hw/net/bcm2838_genet: add GENET register structs, part 4/4 Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 09/17] hw/net/bcm2838_genet: add GENET register access macros Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 10/17] hw/net/bcm2838_genet: implement GENET register ops Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 11/17] hw/net/bcm2838_genet: implement GENET MDIO Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 12/17] hw/net/bcm2838_genet: implement GENET TX path Marcelo Manzo
2026-10-18 13:35 ` [PATCH v4 13/17] hw/net/bcm2838_genet: implement GENET RX path Marcelo Manzo
2026-10-18 13:36 ` Marcelo Manzo [this message]
2026-10-18 13:36 ` [PATCH v4 15/17] hw/arm/bcm2838: enable BCM2838 GENET controller Marcelo Manzo
2026-10-18 13:36 ` [PATCH v4 16/17] docs/system/arm/raspi: move PCIe/GENET from missing to implemented Marcelo Manzo
2026-10-18 13:36 ` [PATCH v4 17/17] tests/functional/aarch64: add raspi4b GENET networking test Marcelo Manzo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261018133603.64323-15-marcelomanzo@gmail.com \
--to=marcelomanzo@gmail.com \
--cc=jasowangio@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.