@@ -1118,6 +1118,15 @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f,
return 0;
}
+void virtio_blk_device_event(DeviceState *dev, int event, int queue,
+ Error **errp)
+{
+ VirtIOBlock *s = VIRTIO_BLK(dev);
+ bool irqfd = s->dataplane_started && !s->dataplane_disabled;
+
+ virtio_device_event(dev, event, queue, irqfd, errp);
+}
+
static void virtio_resize_cb(void *opaque)
{
VirtIODevice *vdev = opaque;
@@ -47,6 +47,15 @@ static Property virtio_blk_pci_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
+static void virtio_blk_pci_event(DeviceState *dev, int event, int queue,
+ Error **errp)
+{
+ VirtIOBlkPCI *vblk = VIRTIO_BLK_PCI(dev);
+ DeviceState *vdev = DEVICE(&vblk->vdev);
+
+ virtio_blk_device_event(vdev, event, queue, errp);
+}
+
static void virtio_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(vpci_dev);
@@ -72,6 +81,7 @@ static void virtio_blk_pci_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
device_class_set_props(dc, virtio_blk_pci_properties);
+ dc->event = virtio_blk_pci_event;
k->realize = virtio_blk_pci_realize;
pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
@@ -92,5 +92,7 @@ typedef struct MultiReqBuffer {
bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq);
void virtio_blk_process_queued_requests(VirtIOBlock *s, bool is_bh);
+void virtio_blk_device_event(DeviceState *dev, int event, int queue,
+ Error **errp);
#endif
This is to implement the device event interface for virtio-blk-pci. Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> --- hw/block/virtio-blk.c | 9 +++++++++ hw/virtio/virtio-blk-pci.c | 10 ++++++++++ include/hw/virtio/virtio-blk.h | 2 ++ 3 files changed, 21 insertions(+)