diff mbox

[V2,4/5] virtio-blk: fail the init when both 1.0 and scsi is set

Message ID 1436938201-16766-5-git-send-email-jasowang@redhat.com
State New
Headers show

Commit Message

Jason Wang July 15, 2015, 5:30 a.m. UTC
Scsi passthrough was no longer supported in 1.0, so fail the
initialization when user want both features.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/block/virtio-blk.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox

Patch

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 362fe53..4a0ef68 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -732,6 +732,10 @@  static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,
     virtio_add_feature(&features, VIRTIO_BLK_F_TOPOLOGY);
     virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
     if (s->conf.scsi) {
+        if (__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {
+            error_setg(errp, "Virtio 1.0 does not support scsi passthrough");
+            return 0;
+        }
         virtio_add_feature(&features, VIRTIO_BLK_F_SCSI);
     }