Skip to contentSkip to conversation

qemu: remove control vector save

PATCH Superseded Michael S. Tsirkin 1 participant 2 messages Jul 1, 2009 1 message not in the archive KVM

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#2 lore raw

PATCH v2 2/2 qemu: remove control vector save

In reply to a message not in the archive

control vector is saved/restored by virtio-pci,
it does not belong in virtio.

---
 hw/virtio.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
hw/virtio.c +0 -3
index 843be86..41e7ca2 100644
@@ -626,9 +626,6 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
     qemu_put_be32(f, vdev->config_len);
     qemu_put_buffer(f, vdev->config, vdev->config_len);
 
-    if (vdev->nvectors)
-        qemu_put_be16s(f, &vdev->config_vector);
-
     for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
         if (vdev->vq[i].vring.num == 0)
             break;
Signature · 1 line
1.6.2.2
#1 lore raw

PATCH v2 1/2 fix segfault in msix_save

In reply to a message not in the archive

This fixes segfault reported by Kevin Wolf,
and simplifies the code in msix_save.

---
 hw/msix.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
hw/msix.c +7 -5
index 4ab6da6..98c62a5 100644
@@ -284,11 +284,13 @@ int msix_uninit(PCIDevice *dev)
 
 void msix_save(PCIDevice *dev, QEMUFile *f)
 {
-    unsigned nentries = (pci_get_word(dev->config + PCI_MSIX_FLAGS) &
-                         PCI_MSIX_FLAGS_QSIZE) + 1;
-    qemu_put_buffer(f, dev->msix_table_page, nentries * MSIX_ENTRY_SIZE);
-    qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING,
-                    (nentries + 7) / 8);
+    unsigned n = dev->msix_entries_nr;
+
+    if (!dev->cap_present & QEMU_PCI_CAP_MSIX)
+        return;
+
+    qemu_put_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE);
+    qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8);
 }
 
 /* Should be called after restoring the config space. */
Signature · 1 line
1.6.2.2