From 8172539d21a03e982aa7f139ddc1607dc1422045 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Sun, 10 Jan 2010 13:52:53 +0200 Subject: 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 Acked-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- hw/virtio-blk.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hw/virtio-blk.h') diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h index 23ad74caec..c28f776c2e 100644 --- a/hw/virtio-blk.h +++ b/hw/virtio-blk.h @@ -92,4 +92,12 @@ struct virtio_scsi_inhdr uint32_t residual; }; +#ifdef __linux__ +#define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \ + DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \ + DEFINE_PROP_BIT("scsi", _state, _field, VIRTIO_BLK_F_SCSI, true) +#else +#define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \ + DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) +#endif #endif -- cgit v1.2.1