Currently, virtio-scsi doesn't support any control or event message, this patch adds the basic initialization.
Some backends need this feature, like dpdk/spdk vhost-user backend.
Reproduce: 1. Start spdk vhost-user-scsi backend; 2. Create a vm with a SCSI vhost-user-scsi disk and start the vm; 3. Mount an iso to the vm without an OS; 3. Stop the vhost-user-scsi backend; 5. Vhost-user-scsi backend will crash before exiting when cleaning the resources.
The reason is that the seabios virtio-scsi only initializes the req vq, then the spdk/dpdk treats it a not good session, it's hard to handle this tricky issue from dpdk architecture.
Signed-off-by: Li Feng fengli@smartx.com --- src/hw/virtio-scsi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c index 369c981..e16d4b0 100644 --- a/src/hw/virtio-scsi.c +++ b/src/hw/virtio-scsi.c @@ -203,8 +203,18 @@ init_virtio_scsi(void *data) } }
+ if (vp_find_vq(vp, 0, &vq) < 0 ) { + dprintf(1, "fail to find ctrl vq for virtio-scsi %pP\n", pci); + goto fail; + } + + if (vp_find_vq(vp, 1, &vq) < 0 ) { + dprintf(1, "fail to find event vq for virtio-scsi %pP\n", pci); + goto fail; + } + if (vp_find_vq(vp, 2, &vq) < 0 ) { - dprintf(1, "fail to find vq for virtio-scsi %pP\n", pci); + dprintf(1, "fail to find req vq for virtio-scsi %pP\n", pci); goto fail; }