qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Juan Quintela" <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH RFC for-1.6 qom-next 2/3] pci: Add MSIX subsection for vmstate_pcie_device
Date: Sun, 28 Jul 2013 03:41:09 +0200	[thread overview]
Message-ID: <1374975670-8820-3-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1374975670-8820-1-git-send-email-afaerber@suse.de>

Instead of having devices like XHCI manually add VMSTATE_MSIX() fields,
reuse vmstate_msix as subsection in VMSTATE_PCIE_DEVICE(), dependent on
msix_present().

XHCI is the only user of VMSTATE_MSIX() and the only PCIe user of
msix_init[_exclusive_bar](). XHCI was marked unmigratable in v1.5.0,
so perform this change before 1.6.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/pci/pci.c      | 14 ++++++++++++++
 hw/usb/hcd-xhci.c |  1 -
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 51ec4f7..b69421a 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -477,6 +477,13 @@ const VMStateDescription vmstate_pci_device = {
     }
 };
 
+static bool pcie_msix_needed(void *opaque)
+{
+    PCIDevice *s = opaque;
+
+    return msix_present(s);
+}
+
 const VMStateDescription vmstate_pcie_device = {
     .name = "PCIEDevice",
     .version_id = 2,
@@ -493,6 +500,13 @@ const VMStateDescription vmstate_pcie_device = {
         VMSTATE_STRUCT(exp.aer_log, PCIDevice, 0,
                        vmstate_pcie_aer_log, PCIEAERLog),
         VMSTATE_END_OF_LIST()
+    },
+    .subsections = (VMStateSubsection[]) {
+        {
+            .vmsd = &vmstate_msix,
+            .needed = pcie_msix_needed,
+        }, {
+        }
     }
 };
 
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 9ba3e3e..c9c29b7 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3545,7 +3545,6 @@ static const VMStateDescription vmstate_xhci = {
     .post_load = usb_xhci_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_PCIE_DEVICE(parent_obj, XHCIState),
-        VMSTATE_MSIX(parent_obj, XHCIState),
 
         VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1,
                                      vmstate_xhci_port, XHCIPort),
-- 
1.8.1.4

  parent reply	other threads:[~2013-07-28  1:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-28  1:41 [Qemu-devel] [PATCH RFC for-1.6 qom-next 0/3] PCIe VMState cleanups for 1.6 Andreas Färber
2013-07-28  1:41 ` [Qemu-devel] [PATCH RFC for-1.6 qom-next 1/3] pcie: Move AER log into VMSTATE_PCIE_DEVICE() Andreas Färber
2013-07-28  1:41 ` Andreas Färber [this message]
2013-07-28  1:41 ` [Qemu-devel] [PATCH RFC for-1.6 qom-next 3/3] pci: Move AER log into VMStateSubsection Andreas Färber
2013-07-28 13:44 ` [Qemu-devel] [PATCH RFC for-1.6 qom-next 0/3] PCIe VMState cleanups for 1.6 Andreas Färber
2013-07-28 14:26   ` Andreas Färber
2013-07-28 14:08 ` Michael S. Tsirkin
2013-07-28 14:59   ` Andreas Färber
2013-07-28 15:52     ` Michael S. Tsirkin

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=1374975670-8820-3-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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).