qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] msix: add helper to mark all msix entries
       [not found] <cover.1259093857.git.mst@redhat.com>
@ 2009-11-24 21:31 ` Michael S. Tsirkin
  2009-11-24 21:31 ` [Qemu-devel] [PATCH 2/2] virtio: do not reset msix state on soft reset Michael S. Tsirkin
  1 sibling, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2009-11-24 21:31 UTC (permalink / raw)
  To: qemu-devel, anthony

will be used by virtio on soft reset

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---
 hw/msix.c |    7 +++++++
 hw/msix.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/hw/msix.c b/hw/msix.c
index 548ffd5..d499441 100644
--- 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);
+}
diff --git a/hw/msix.h b/hw/msix.h
index 39fa568..a9f7993 100644
--- 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);
 
-- 
1.6.5.2.143.g8cc62

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH 2/2] virtio: do not reset msix state on soft reset
       [not found] <cover.1259093857.git.mst@redhat.com>
  2009-11-24 21:31 ` [Qemu-devel] [PATCH 1/2] msix: add helper to mark all msix entries Michael S. Tsirkin
@ 2009-11-24 21:31 ` Michael S. Tsirkin
  1 sibling, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2009-11-24 21:31 UTC (permalink / raw)
  To: qemu-devel, anthony

msix state is managed by OS, not the
driver, so it's wrong to touch it
on io from driver

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio-pci.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index aebcf9d..d222ce0 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -185,8 +185,10 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         break;
     case VIRTIO_PCI_QUEUE_PFN:
         pa = (target_phys_addr_t)val << VIRTIO_PCI_QUEUE_ADDR_SHIFT;
-        if (pa == 0)
-            virtio_pci_reset(&proxy->pci_dev.qdev);
+        if (pa == 0) {
+            virtio_reset(proxy->vdev);
+            msix_unuse_all_vectors(&proxy->pci_dev);
+        }
         else
             virtio_queue_set_addr(vdev, vdev->queue_sel, pa);
         break;
@@ -199,8 +201,10 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         break;
     case VIRTIO_PCI_STATUS:
         vdev->status = val & 0xFF;
-        if (vdev->status == 0)
-            virtio_pci_reset(&proxy->pci_dev.qdev);
+        if (vdev->status == 0) {
+            virtio_reset(proxy->vdev);
+            msix_unuse_all_vectors(&proxy->pci_dev);
+        }
         break;
     case VIRTIO_MSI_CONFIG_VECTOR:
         msix_vector_unuse(&proxy->pci_dev, vdev->config_vector);
-- 
1.6.5.2.143.g8cc62

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-24 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1259093857.git.mst@redhat.com>
2009-11-24 21:31 ` [Qemu-devel] [PATCH 1/2] msix: add helper to mark all msix entries Michael S. Tsirkin
2009-11-24 21:31 ` [Qemu-devel] [PATCH 2/2] virtio: do not reset msix state on soft reset Michael S. Tsirkin

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).