From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: "BALATON Zoltan" <balaton@eik.bme.hu>,
"Huacai Chen" <chenhuacai@kernel.org>,
qemu-ppc@nongnu.org, "Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"John Snow" <jsnow@redhat.com>,
qemu-block@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Bernhard Beschow" <shentey@gmail.com>
Subject: [PATCH 6/6] hw/ide/piix: Move registration of VMStateDescription to DeviceClass
Date: Sun, 21 May 2023 13:15:34 +0200 [thread overview]
Message-ID: <20230521111534.207973-7-shentey@gmail.com> (raw)
In-Reply-To: <20230521111534.207973-1-shentey@gmail.com>
The modern, declarative way to set up VM state handling is to assign to
DeviceClass::vmsd attribute.
There shouldn't be any change in behavior since dc->vmsd causes
vmstate_register_with_alias_id() to be called on the instance during
the instance init phase. vmstate_register() was also called during the
instance init phase which forwards to vmstate_register_with_alias_id()
internally. Checking the migration schema before and after this patch confirms:
before:
> qemu-system-x86_64 -S
> qemu > migrate -d exec:cat>before.mig
after:
> qemu-system-x86_64 -S
> qemu > migrate -d exec:cat>after.mig
> analyze-migration.py -d desc -f before.mig > before.json
> analyze-migration.py -d desc -f after.mig > after.json
> diff before.json after.json
-> empty
---
hw/ide/piix.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 47e0b474c3..151f206046 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -28,7 +28,6 @@
*/
#include "qemu/osdep.h"
-#include "migration/vmstate.h"
#include "qapi/error.h"
#include "hw/pci/pci.h"
#include "hw/ide/piix.h"
@@ -159,8 +158,6 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
bmdma_setup_bar(d);
pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar);
- vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d);
-
for (unsigned i = 0; i < 2; i++) {
if (!pci_piix_init_bus(d, i, errp)) {
return;
@@ -186,6 +183,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
dc->reset = piix_ide_reset;
+ dc->vmsd = &vmstate_ide_pci;
k->realize = pci_piix_ide_realize;
k->exit = pci_piix_ide_exitfn;
k->vendor_id = PCI_VENDOR_ID_INTEL;
@@ -208,6 +206,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
dc->reset = piix_ide_reset;
+ dc->vmsd = &vmstate_ide_pci;
k->realize = pci_piix_ide_realize;
k->exit = pci_piix_ide_exitfn;
k->vendor_id = PCI_VENDOR_ID_INTEL;
--
2.40.1
next prev parent reply other threads:[~2023-05-21 11:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-21 11:15 [PATCH 0/6] VIA and general PCI IDE cleanup Bernhard Beschow
2023-05-21 11:15 ` [PATCH 1/6] hw/ide/pci: Expose legacy interrupts as named GPIOs Bernhard Beschow
2023-05-21 11:15 ` [PATCH 2/6] hw/ide/via: Wire up IDE legacy interrupts in host device Bernhard Beschow
2023-05-21 15:09 ` BALATON Zoltan
2023-05-21 15:27 ` BALATON Zoltan
2023-05-21 11:15 ` [PATCH 3/6] hw/isa/vt82c686: Remove via_isa_set_irq() Bernhard Beschow
2023-05-21 11:15 ` [PATCH 4/6] hw/ide: Extract IDEBus assignment into bmdma_init() Bernhard Beschow
2023-05-21 11:15 ` [PATCH 5/6] hw/ide: Extract bmdma_status_writeb() Bernhard Beschow
2023-05-21 15:21 ` BALATON Zoltan
2023-05-25 15:53 ` Mark Cave-Ayland
2023-05-21 11:15 ` Bernhard Beschow [this message]
2023-05-21 15:23 ` [PATCH 6/6] hw/ide/piix: Move registration of VMStateDescription to DeviceClass BALATON Zoltan
2023-05-25 15:56 ` Mark Cave-Ayland
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=20230521111534.207973-7-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=jsnow@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).