[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/15] virtio-pci: reset device before PCI layer
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 04/15] virtio-pci: reset device before PCI layer |
Date: |
Mon, 17 Dec 2012 17:24:39 +0100 |
At the end of this series, qdev will reset devices in post-order: first
the children, then the parents. The ->vdev link is logically a child
of the virtio-pci device and, even though it is not explicitly modeled
like that, we want to use the same reset semantics as qdev.
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/virtio-pci.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 71f4fb5..a7c75fe 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -245,8 +245,8 @@ static void virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy)
void virtio_pci_reset(DeviceState *d)
{
VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
- virtio_pci_stop_ioeventfd(proxy);
virtio_reset(proxy->vdev);
+ virtio_pci_stop_ioeventfd(proxy);
msix_unuse_all_vectors(&proxy->pci_dev);
proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
}
@@ -268,8 +268,8 @@ static void virtio_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
case VIRTIO_PCI_QUEUE_PFN:
pa = (hwaddr)val << VIRTIO_PCI_QUEUE_ADDR_SHIFT;
if (pa == 0) {
- virtio_pci_stop_ioeventfd(proxy);
virtio_reset(proxy->vdev);
+ virtio_pci_stop_ioeventfd(proxy);
msix_unuse_all_vectors(&proxy->pci_dev);
}
else
@@ -285,6 +285,10 @@ static void virtio_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
}
break;
case VIRTIO_PCI_STATUS:
+ if (vdev->status == 0) {
+ virtio_reset(proxy->vdev);
+ }
+
if (!(val & VIRTIO_CONFIG_S_DRIVER_OK)) {
virtio_pci_stop_ioeventfd(proxy);
}
@@ -296,7 +300,6 @@ static void virtio_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
}
if (vdev->status == 0) {
- virtio_reset(proxy->vdev);
msix_unuse_all_vectors(&proxy->pci_dev);
}
--
1.8.0.2
- [Qemu-devel] [PATCH 00/15] qdev: make reset semantics more clear and consistent, reset qbuses under virtio devices, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 03/15] pci: clean up resetting of IRQs, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 05/15] virtio-s390: add a reset function to virtio-s390 devices, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 06/15] qdev: add qbus_reset_all, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 04/15] virtio-pci: reset device before PCI layer,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 08/15] lsi: use qbus_reset_all to reset SCSI bus, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 07/15] pci: do not export pci_bus_reset, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 09/15] qdev: allow both pre- and post-order vists in qdev walking functions, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 10/15] qdev: switch reset to post-order, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 11/15] qdev: remove device_reset, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 15/15] virtio-serial: do not perform bus reset by hand, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 14/15] virtio-s390: reset all qbuses too when writing to the status field, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 13/15] virtio-pci: reset all qbuses too when writing to the status field, Paolo Bonzini, 2012/12/17