mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-08-25 23:47:13 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user