msix: add helper to unuse all msix entries
authorMichael S. Tsirkin <mst@redhat.com>
Tue, 24 Nov 2009 14:44:15 +0000 (16:44 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 1 Dec 2009 15:58:27 +0000 (17:58 +0200)
will be used by virtio on soft reset

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/msix.c
hw/msix.h

index 548ffd5c8b6f3705b8abc073b8b341269fd3cde2..d49944111fd373641adec0df1b9a4462512a9718 100644 (file)
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -378,3 +378,10 @@ void msix_vector_unuse(PCIDevice *dev, unsigned vector)
     if (vector < dev->msix_entries_nr && dev->msix_entry_used[vector])
         --dev->msix_entry_used[vector];
 }
+
+void msix_unuse_all_vectors(PCIDevice *dev)
+{
+    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
+        return;
+    msix_free_irq_entries(dev);
+}
index 39fa568f9c74af9737ab2e42f638b097d2a1b32b..a9f7993c396a5923b147526793e8ba7613c77747 100644 (file)
--- a/hw/msix.h
+++ b/hw/msix.h
@@ -25,6 +25,7 @@ uint32_t msix_bar_size(PCIDevice *dev);
 
 int msix_vector_use(PCIDevice *dev, unsigned vector);
 void msix_vector_unuse(PCIDevice *dev, unsigned vector);
+void msix_unuse_all_vectors(PCIDevice *dev);
 
 void msix_notify(PCIDevice *dev, unsigned vector);