qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

virtio-pci: implement queue_enabled method

With version 1, we can detect whether a queue is enabled via
queue_enabled.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20200701145538.22333-5-lulu@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>

authored by

Jason Wang and committed by
Michael S. Tsirkin
f19bcdfe b2a5f62a

+13
+13
hw/virtio/virtio-pci.c
··· 1107 1107 return pci_get_address_space(dev); 1108 1108 } 1109 1109 1110 + static bool virtio_pci_queue_enabled(DeviceState *d, int n) 1111 + { 1112 + VirtIOPCIProxy *proxy = VIRTIO_PCI(d); 1113 + VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); 1114 + 1115 + if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { 1116 + return proxy->vqs[vdev->queue_sel].enabled; 1117 + } 1118 + 1119 + return virtio_queue_enabled(vdev, n); 1120 + } 1121 + 1110 1122 static int virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, 1111 1123 struct virtio_pci_cap *cap) 1112 1124 { ··· 2064 2076 k->ioeventfd_enabled = virtio_pci_ioeventfd_enabled; 2065 2077 k->ioeventfd_assign = virtio_pci_ioeventfd_assign; 2066 2078 k->get_dma_as = virtio_pci_get_dma_as; 2079 + k->queue_enabled = virtio_pci_queue_enabled; 2067 2080 } 2068 2081 2069 2082 static const TypeInfo virtio_pci_bus_info = {