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