cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From 3420a9a7d1765a77f5a03e38c0ec6b4b69419e6a Mon Sep 17 00:00:00 2001
218e99
From: Gerd Hoffmann <kraxel@redhat.com>
218e99
Date: Wed, 7 Aug 2013 09:22:44 +0200
218e99
Subject: [PATCH 13/28] pci: add VMSTATE_MSIX
218e99
218e99
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
218e99
Message-id: <1375867368-18979-2-git-send-email-kraxel@redhat.com>
218e99
Patchwork-id: 53038
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 1/5] pci: add VMSTATE_MSIX
218e99
Bugzilla: 838170
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
218e99
218e99
Using a trick cut+pasted from vmstate_scsi_device
218e99
to wind up msix_save and msix_load.
218e99
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
Acked-by: Michael S. Tsirkin <mst@redhat.com>
218e99
(cherry picked from commit 340b50c759d6b4ef33e514c40afcc799c0d7df7a)
218e99
---
218e99
 hw/pci/msix.c         |   33 +++++++++++++++++++++++++++++++++
218e99
 include/hw/pci/msix.h |   11 +++++++++++
218e99
 2 files changed, 44 insertions(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/pci/msix.c         |   33 +++++++++++++++++++++++++++++++++
218e99
 include/hw/pci/msix.h |   11 +++++++++++
218e99
 2 files changed, 44 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
218e99
index e231a0d..6da75ec 100644
218e99
--- a/hw/pci/msix.c
218e99
+++ b/hw/pci/msix.c
218e99
@@ -569,3 +569,36 @@ void msix_unset_vector_notifiers(PCIDevice *dev)
218e99
     dev->msix_vector_release_notifier = NULL;
218e99
     dev->msix_vector_poll_notifier = NULL;
218e99
 }
218e99
+
218e99
+static void put_msix_state(QEMUFile *f, void *pv, size_t size)
218e99
+{
218e99
+    msix_save(pv, f);
218e99
+}
218e99
+
218e99
+static int get_msix_state(QEMUFile *f, void *pv, size_t size)
218e99
+{
218e99
+    msix_load(pv, f);
218e99
+    return 0;
218e99
+}
218e99
+
218e99
+static VMStateInfo vmstate_info_msix = {
218e99
+    .name = "msix state",
218e99
+    .get  = get_msix_state,
218e99
+    .put  = put_msix_state,
218e99
+};
218e99
+
218e99
+const VMStateDescription vmstate_msix = {
218e99
+    .name = "msix",
218e99
+    .fields = (VMStateField[]) {
218e99
+        {
218e99
+            .name         = "msix",
218e99
+            .version_id   = 0,
218e99
+            .field_exists = NULL,
218e99
+            .size         = 0,   /* ouch */
218e99
+            .info         = &vmstate_info_msix,
218e99
+            .flags        = VMS_SINGLE,
218e99
+            .offset       = 0,
218e99
+        },
218e99
+        VMSTATE_END_OF_LIST()
218e99
+    }
218e99
+};
218e99
diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h
218e99
index e648410..954d82b 100644
218e99
--- a/include/hw/pci/msix.h
218e99
+++ b/include/hw/pci/msix.h
218e99
@@ -43,4 +43,15 @@ int msix_set_vector_notifiers(PCIDevice *dev,
218e99
                               MSIVectorReleaseNotifier release_notifier,
218e99
                               MSIVectorPollNotifier poll_notifier);
218e99
 void msix_unset_vector_notifiers(PCIDevice *dev);
218e99
+
218e99
+extern const VMStateDescription vmstate_msix;
218e99
+
218e99
+#define VMSTATE_MSIX(_field, _state) {                               \
218e99
+    .name       = (stringify(_field)),                               \
218e99
+    .size       = sizeof(PCIDevice),                                 \
218e99
+    .vmsd       = &vmstate_msix,                                     \
218e99
+    .flags      = VMS_STRUCT,                                        \
218e99
+    .offset     = vmstate_offset_value(_state, _field, PCIDevice),   \
218e99
+}
218e99
+
218e99
 #endif
218e99
-- 
218e99
1.7.1
218e99