[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv2 06/12] virtio: add set_status callback
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PATCHv2 06/12] virtio: add set_status callback |
Date: |
Thu, 25 Feb 2010 20:28:32 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
vhost net backend needs to be notified when
frontend status changes. Add a callback,
similar to set_features.
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/s390-virtio-bus.c | 7 ++++++-
hw/syborg_virtio.c | 2 ++
hw/virtio-pci.c | 9 ++++++++-
hw/virtio.h | 1 +
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index fa0a74f..d7e3ae1 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -241,8 +241,13 @@ void s390_virtio_device_update_status(VirtIOS390Device
*dev)
{
VirtIODevice *vdev = dev->vdev;
uint32_t features;
+ uint8_t status;
- vdev->status = ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS);
+ status = ldub_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS);
+ if (vdev->set_status) {
+ vdev->set_status(vdev, status);
+ }
+ vdev->status = status;
/* Update guest supported feature bitmap */
diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c
index 65239a0..7a9e584 100644
--- a/hw/syborg_virtio.c
+++ b/hw/syborg_virtio.c
@@ -149,6 +149,8 @@ static void syborg_virtio_writel(void *opaque,
target_phys_addr_t offset,
virtio_queue_notify(vdev, value);
break;
case SYBORG_VIRTIO_STATUS:
+ if (vdev->set_status)
+ vdev->set_status(vdev, value & 0xFF);
vdev->status = value & 0xFF;
if (vdev->status == 0)
virtio_reset(vdev);
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index bcd40f7..006ff38 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -206,6 +206,9 @@ static void virtio_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
virtio_queue_notify(vdev, val);
break;
case VIRTIO_PCI_STATUS:
+ if (vdev->set_status) {
+ vdev->set_status(vdev, val & 0xFF);
+ }
vdev->status = val & 0xFF;
if (vdev->status == 0) {
virtio_reset(proxy->vdev);
@@ -377,7 +380,11 @@ static void virtio_write_config(PCIDevice *pci_dev,
uint32_t address,
if (PCI_COMMAND == address) {
if (!(val & PCI_COMMAND_MASTER)) {
- proxy->vdev->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
+ uint8_t status = proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK;
+ if (proxy->vdev->set_status) {
+ proxy->vdev->set_status(proxy->vdev, status);
+ }
+ proxy->vdev->status = status;
}
}
diff --git a/hw/virtio.h b/hw/virtio.h
index 2ebf2dd..e12e8e3 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -115,6 +115,7 @@ struct VirtIODevice
void (*get_config)(VirtIODevice *vdev, uint8_t *config);
void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
void (*reset)(VirtIODevice *vdev);
+ void (*set_status)(VirtIODevice *vdev, uint8_t val);
VirtQueue *vq;
const VirtIOBindings *binding;
void *binding_opaque;
--
1.7.0.18.g0d53a5
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, (continued)
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Michael S. Tsirkin, 2010/02/26
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Anthony Liguori, 2010/02/26
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Michael S. Tsirkin, 2010/02/27
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Anthony Liguori, 2010/02/28
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Michael S. Tsirkin, 2010/02/28
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Anthony Liguori, 2010/02/28
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Michael S. Tsirkin, 2010/02/28
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Anthony Liguori, 2010/02/28
- [Qemu-devel] Re: [PATCHv2 10/12] tap: add vhost/vhostfd options, Paul Brook, 2010/02/28
[Qemu-devel] [PATCHv2 11/12] tap: add API to retrieve vhost net header, Michael S. Tsirkin, 2010/02/25
[Qemu-devel] [PATCHv2 06/12] virtio: add set_status callback,
Michael S. Tsirkin <=
[Qemu-devel] [PATCHv2 08/12] virtio-pci: fill in notifier support, Michael S. Tsirkin, 2010/02/25
[Qemu-devel] [PATCHv2 03/12] notifier: event notifier implementation, Michael S. Tsirkin, 2010/02/25
[Qemu-devel] [PATCHv2 12/12] virtio-net: vhost net support, Michael S. Tsirkin, 2010/02/25
[Qemu-devel] Re: [PATCHv2 00/12] vhost-net: upstream integration, Anthony Liguori, 2010/02/25