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>
This commit is contained in:
Sasha Levin
2013-05-03 16:29:12 -04:00
committed by Will Deacon
parent 9e56ec1413
commit 04b53c1615
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -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);
+2
View File
@@ -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);