From: Zeng Guang <guang.zeng@intel.com>
To: jslaby@suse.cz, david@redhat.com, quintela@redhat.com,
qemu-devel@nongnu.org
Cc: Zeng Guang <guang.zeng@intel.com>,
wei.w.wang@intel.com, chao.gao@intel.com
Subject: [PATCH] hw/misc/edu: support pci device state migration
Date: Wed, 22 Jul 2020 16:13:23 +0800 [thread overview]
Message-ID: <20200722081323.9893-1-guang.zeng@intel.com> (raw)
Currently edu device doesn't support live migration. Part of PCI
configuration information would be lost after migration.
PCI device state in source VM:
Bus 0, device 3, function 0:
Class 0255: PCI device 1234:11e8
PCI subsystem 1af4:1100
IRQ 11, pin A
BAR0: 32 bit memory at 0xfea00000 [0xfeafffff].
id ""
PCI device state in destination VM:
Bus 0, device 3, function 0:
Class 0255: PCI device 1234:11e8
PCI subsystem 1af4:1100
IRQ 0, pin A
BAR0: 32 bit memory at 0xffffffffffffffff [0x000ffffe].
id ""
Add VMState for edu device to support migration.
Signed-off-by: Gao Chao <chao.gao@intel.com>
Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Reviewed-by: Wei Wang <wei.w.wang@intel.com>
---
hw/misc/edu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index ec617e63f3..3ff2759ee1 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -27,6 +27,7 @@
#include "hw/pci/pci.h"
#include "hw/hw.h"
#include "hw/pci/msi.h"
+#include "migration/vmstate.h"
#include "qemu/timer.h"
#include "qemu/main-loop.h" /* iothread mutex */
#include "qemu/module.h"
@@ -405,6 +406,16 @@ static void edu_instance_init(Object *obj)
&edu->dma_mask, OBJ_PROP_FLAG_READWRITE);
}
+static const VMStateDescription vmstate_edu = {
+ .name = "edu",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_PCI_DEVICE(pdev, EduState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static void edu_class_init(ObjectClass *class, void *data)
{
DeviceClass *dc = DEVICE_CLASS(class);
@@ -415,6 +426,7 @@ static void edu_class_init(ObjectClass *class, void *data)
k->vendor_id = PCI_VENDOR_ID_QEMU;
k->device_id = 0x11e8;
k->revision = 0x10;
+ dc->vmsd = &vmstate_edu;
k->class_id = PCI_CLASS_OTHERS;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
--
2.17.1
next reply other threads:[~2020-07-22 8:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 8:13 Zeng Guang [this message]
2020-07-22 8:37 ` [PATCH] hw/misc/edu: support pci device state migration Peter Maydell
2020-07-23 1:01 ` Zeng Guang
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=20200722081323.9893-1-guang.zeng@intel.com \
--to=guang.zeng@intel.com \
--cc=chao.gao@intel.com \
--cc=david@redhat.com \
--cc=jslaby@suse.cz \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=wei.w.wang@intel.com \
/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).