aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2013-05-03 16:29:12 -0400
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:39:54 +0100
commit04b53c1615e8dc2bded7a445ef7e9abae6f92afc (patch)
tree664774d083c4f31854caac33e3e1fd4c3673826e
parent9e56ec141326bfdd20ca82e8f92c493e3ecef006 (diff)
downloadkvmtool-04b53c1615e8dc2bded7a445ef7e9abae6f92afc.tar.gz
kvm tools: add status notification hook for virtio
Some devices want to know their status, use this hook to allow them to get that notification. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r--include/kvm/virtio.h1
-rw-r--r--virtio/pci.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/include/kvm/virtio.h b/include/kvm/virtio.h
index 924279b1..269ea4a9 100644
--- a/include/kvm/virtio.h
+++ b/include/kvm/virtio.h
@@ -80,6 +80,7 @@ struct virtio_ops {
void (*notify_vq_eventfd)(struct kvm *kvm, void *dev, u32 vq, u32 efd);
int (*signal_vq)(struct kvm *kvm, struct virtio_device *vdev, u32 queueid);
int (*signal_config)(struct kvm *kvm, struct virtio_device *vdev);
+ void (*notify_status)(struct kvm *kvm, void *dev, u8 status);
int (*init)(struct kvm *kvm, void *dev, struct virtio_device *vdev,
int device_id, int subsys_id, int class);
int (*exit)(struct kvm *kvm, struct virtio_device *vdev);
diff --git a/virtio/pci.c b/virtio/pci.c
index 227d5674..fec8ce06 100644
--- a/virtio/pci.c
+++ b/virtio/pci.c
@@ -210,6 +210,8 @@ static bool virtio_pci__io_out(struct ioport *ioport, struct kvm *kvm, u16 port,
break;
case VIRTIO_PCI_STATUS:
vpci->status = ioport__read8(data);
+ if (vdev->ops->notify_status)
+ vdev->ops->notify_status(kvm, vpci->dev, vpci->status);
break;
default:
ret = virtio_pci__specific_io_out(kvm, vdev, port, data, size, offset);