msix: add helper to mark all msix entries
PATCH 1/2 msix: add helper to mark all msix entries
In reply to a message not in the archivewill be used by virtio on soft reset
Signed-off-by Michael S. Tsirkin <[email protected]>
--- hw/msix.c | 7 +++++++ hw/msix.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-)
hw/msix.c +7 -0
@@ -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); +}
hw/msix.h +1 -0
@@ -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);
Signature · 1 line
1.6.5.2.143.g8cc62
PATCH 2/2 virtio: do not reset msix state on soft reset
In reply to a message not in the archivemsix 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 <[email protected]>
--- hw/virtio-pci.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
hw/virtio-pci.c +8 -4
@@ -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);
Signature · 1 line
1.6.5.2.143.g8cc62