Scsi passthrough was no longer supported in 1.0, so fail the
initialization when user want both features.

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

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);
     }
 
-- 
2.1.4


Reply via email to