From: Stefan Hajnoczi <stefanha@xxxxxxxxxxxxxxxxxx> Begin adding vhost support by opening /dev/vhost-scsi. (v2: Drop legacy ->vhost_vqs[] usage) Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxxxxxxxxxx> Signed-off-by: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx> Cc: Michael S. Tsirkin <mst@xxxxxxxxxx> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> --- hw/virtio-scsi.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c index 4a787d3..dea3269 100644 --- a/hw/virtio-scsi.c +++ b/hw/virtio-scsi.c @@ -18,6 +18,7 @@ #include "virtio-scsi.h" #include <hw/scsi.h> #include <hw/scsi-defs.h> +#include "vhost.h" #define VIRTIO_SCSI_VQ_SIZE 128 #define VIRTIO_SCSI_CDB_SIZE 32 @@ -137,6 +138,9 @@ typedef struct { VirtQueue *ctrl_vq; VirtQueue *event_vq; VirtQueue *cmd_vqs[0]; + + bool vhost_started; + VHostSCSI *vhost_scsi; } VirtIOSCSI; typedef struct VirtIOSCSIReq { @@ -456,6 +460,11 @@ static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req) virtio_scsi_complete_req(req); } +static VirtIOSCSI *to_virtio_scsi(VirtIODevice *vdev) +{ + return (VirtIOSCSI *)vdev; +} + static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s = (VirtIOSCSI *)vdev; @@ -605,6 +614,8 @@ VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf) s->qdev = dev; s->conf = proxyconf; + s->vhost_started = false; + s->vhost_scsi = proxyconf->vhost_scsi; /* TODO set up vdev function pointers */ s->vdev.get_config = virtio_scsi_get_config; @@ -636,5 +647,6 @@ void virtio_scsi_exit(VirtIODevice *vdev) { VirtIOSCSI *s = (VirtIOSCSI *)vdev; unregister_savevm(s->qdev, "virtio-scsi", s); + vhost_dev_cleanup(&s->vhost_scsi); virtio_cleanup(vdev); } -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html