summaryrefslogtreecommitdiff
path: root/hw/virtio-blk.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-01-10 13:52:53 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-11 13:40:59 -0600
commit8172539d21a03e982aa7f139ddc1607dc1422045 (patch)
tree67ceb2ca2ea245060d9285623e26e3a42b3cdc1a /hw/virtio-blk.c
parent704a76fcd24372a683652651b4597f6654084975 (diff)
downloadqemu-8172539d21a03e982aa7f139ddc1607dc1422045.tar.gz
qemu-8172539d21a03e982aa7f139ddc1607dc1422045.tar.bz2
qemu-8172539d21a03e982aa7f139ddc1607dc1422045.zip
virtio: add features as qdev properties
Add feature bits as properties to virtio. This makes it possible to e.g. define machine without indirect buffer support, which is required for 0.10 compatibility, or without hardware checksum support, which is required for 0.11 compatibility. Since default values for optional features are now set by qdev, get_features callback has been modified: it sets non-optional bits, and clears bits not supported by host. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r--hw/virtio-blk.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index a2f063974a..cb1ae1f953 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -432,19 +432,15 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
memcpy(config, &blkcfg, s->config_size);
}
-static uint32_t virtio_blk_get_features(VirtIODevice *vdev)
+static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features)
{
VirtIOBlock *s = to_virtio_blk(vdev);
- uint32_t features = 0;
features |= (1 << VIRTIO_BLK_F_SEG_MAX);
features |= (1 << VIRTIO_BLK_F_GEOMETRY);
if (bdrv_enable_write_cache(s->bs))
features |= (1 << VIRTIO_BLK_F_WCACHE);
-#ifdef __linux__
- features |= (1 << VIRTIO_BLK_F_SCSI);
-#endif
if (strcmp(s->serial_str, "0"))
features |= 1 << VIRTIO_BLK_F_IDENTIFY;