[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 18/22] virtio-scsi: fix initialization for versio
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH v2 18/22] virtio-scsi: fix initialization for version 1.0 |
Date: |
Tue, 30 Jun 2015 10:39:09 +0200 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
src/hw/virtio-scsi.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c
index b208d49..3ee0f49 100644
--- a/src/hw/virtio-scsi.c
+++ b/src/hw/virtio-scsi.c
@@ -146,14 +146,35 @@ init_virtio_scsi(struct pci_device *pci)
pci_bdf_to_dev(bdf));
struct vring_virtqueue *vq = NULL;
struct vp_device *vp = vp_init_simple(pci);
+ u8 status = VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER;
+
+ if (vp->use_modern) {
+ u64 features = vp_get_features(vp);
+ u64 version1 = 1ull << VIRTIO_F_VERSION_1;
+ if (!(features & version1)) {
+ dprintf(1, "modern device without virtio_1 feature bit: %x:%x\n",
+ pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf));
+ goto fail;
+ }
+
+ vp_set_features(vp, version1);
+ status |= VIRTIO_CONFIG_S_FEATURES_OK;
+ vp_set_status(vp, status);
+ if (!(vp_get_status(vp) & VIRTIO_CONFIG_S_FEATURES_OK)) {
+ dprintf(1, "device didn't accept features: %x:%x\n",
+ pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf));
+ goto fail;
+ }
+ }
+
if (vp_find_vq(vp, 2, &vq) < 0 ) {
dprintf(1, "fail to find vq for virtio-scsi %x:%x\n",
pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf));
goto fail;
}
- vp_set_status(vp, VIRTIO_CONFIG_S_ACKNOWLEDGE |
- VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK);
+ status |= VIRTIO_CONFIG_S_DRIVER_OK;
+ vp_set_status(vp, status);
int i, tot;
for (tot = 0, i = 0; i < 256; i++)
--
1.8.3.1
- [Qemu-devel] [PATCH v2 10/22] virtio: add read/write functions and macros, (continued)
- [Qemu-devel] [PATCH v2 10/22] virtio: add read/write functions and macros, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 08/22] virtio: create vp_cap struct for legacy bar, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 06/22] virtio: add version 0.9.5 struct, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 04/22] virtio: pass struct pci_device to vp_init_simple, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 09/22] virtio: add version 0.9.5 struct [fixup], Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 12/22] virtio: add version 1.0 support to vp_{get, set}_status, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 13/22] virtio: add version 1.0 support to vp_get_isr, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 16/22] virtio: remove unused vp_del_vq, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 14/22] virtio: add version 1.0 support to vp_reset, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 11/22] virtio: make features 64bit, support version 1.0 features, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 18/22] virtio-scsi: fix initialization for version 1.0,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH v2 21/22] virtio: also probe version 1.0 pci ids, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 05/22] virtio: add version 1.0 structs and #defines, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 20/22] virtio: use version 1.0 if available (flip the big switch), Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 03/22] virtio: add struct vp_device, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 17/22] virtio: add version 1.0 support to vp_find_vq, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 22/22] virtio: legacy cleanup, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 15/22] virtio: add version 1.0 support to vp_notify, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 07/22] virtio: find version 1.0 virtio capabilities, Gerd Hoffmann, 2015/06/30
- [Qemu-devel] [PATCH v2 19/22] virtio-blk: fix initialization for version 1.0, Gerd Hoffmann, 2015/06/30