From: Marcel Apfelbaum <marcel@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcel@redhat.com, mst@redhat.com, dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH V2] hw/pcie: fix the generic pcie root port to support migration
Date: Wed, 7 Jun 2017 15:43:59 +0300 [thread overview]
Message-ID: <20170607124359.79478-1-marcel@redhat.com> (raw)
Add msix state to pcie-root-ports's vmstate
in order to support migration.
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
v1 -> v2:
- Added x-migrate-msix compat property to avoid
breaking migration (Dave)
hw/pci-bridge/gen_pcie_root_port.c | 25 +++++++++++++++++++++++++
include/hw/compat.h | 4 ++++
2 files changed, 29 insertions(+)
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index 8ebffa8..cb694d6 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -20,6 +20,14 @@
#define GEN_PCIE_ROOT_PORT_AER_OFFSET 0x100
#define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
+typedef struct GenPCIERootPort {
+ /*< private >*/
+ PCIESlot parent_obj;
+ /*< public >*/
+
+ bool migrate_msix;
+} GenPCIERootPort;
+
static uint8_t gen_rp_aer_vector(const PCIDevice *d)
{
return 0;
@@ -45,6 +53,13 @@ static void gen_rp_interrupts_uninit(PCIDevice *d)
msix_uninit_exclusive_bar(d);
}
+static bool gen_rp_test_migrate_msix(void *opaque, int version_id)
+{
+ GenPCIERootPort *rp = opaque;
+
+ return rp->migrate_msix;
+}
+
static const VMStateDescription vmstate_rp_dev = {
.name = "pcie-root-port",
.version_id = 1,
@@ -54,10 +69,18 @@ static const VMStateDescription vmstate_rp_dev = {
VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
+ VMSTATE_MSIX_TEST(parent_obj.parent_obj.parent_obj.parent_obj,
+ GenPCIERootPort,
+ gen_rp_test_migrate_msix),
VMSTATE_END_OF_LIST()
}
};
+static Property gen_rp_props[] = {
+ DEFINE_PROP_BOOL("x-migrate-msix", GenPCIERootPort, migrate_msix, true),
+ DEFINE_PROP_END_OF_LIST()
+};
+
static void gen_rp_dev_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -68,6 +91,7 @@ static void gen_rp_dev_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_REDHAT_PCIE_RP;
dc->desc = "PCI Express Root Port";
dc->vmsd = &vmstate_rp_dev;
+ dc->props = gen_rp_props;
rpc->aer_vector = gen_rp_aer_vector;
rpc->interrupts_init = gen_rp_interrupts_init;
rpc->interrupts_uninit = gen_rp_interrupts_uninit;
@@ -77,6 +101,7 @@ static void gen_rp_dev_class_init(ObjectClass *klass, void *data)
static const TypeInfo gen_rp_dev_info = {
.name = TYPE_GEN_PCIE_ROOT_PORT,
.parent = TYPE_PCIE_ROOT_PORT,
+ .instance_size = sizeof(GenPCIERootPort),
.class_init = gen_rp_dev_class_init,
};
diff --git a/include/hw/compat.h b/include/hw/compat.h
index 55b1765..4fb6a19 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -6,6 +6,10 @@
.driver = "pci-bridge",\
.property = "shpc",\
.value = "off",\
+ },{\
+ .driver = "pcie-root-port",\
+ .property = "x-migrate-msix",\
+ .value = "false",\
},
#define HW_COMPAT_2_8 \
--
2.9.4
next reply other threads:[~2017-06-07 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 12:43 Marcel Apfelbaum [this message]
2017-06-08 9:01 ` [Qemu-devel] [PATCH V2] hw/pcie: fix the generic pcie root port to support migration Dr. David Alan Gilbert
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=20170607124359.79478-1-marcel@redhat.com \
--to=marcel@redhat.com \
--cc=dgilbert@redhat.com \
--cc=mst@redhat.com \
--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.