From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti38P-0004uz-Dg for qemu-devel@nongnu.org; Mon, 10 Dec 2012 08:11:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ti38G-00053H-GP for qemu-devel@nongnu.org; Mon, 10 Dec 2012 08:11:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti38G-000536-7Q for qemu-devel@nongnu.org; Mon, 10 Dec 2012 08:10:52 -0500 From: Stefan Hajnoczi Date: Mon, 10 Dec 2012 14:09:43 +0100 Message-Id: <1355144985-12897-11-git-send-email-stefanha@redhat.com> In-Reply-To: <1355144985-12897-1-git-send-email-stefanha@redhat.com> References: <1355144985-12897-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v6 10/12] virtio-blk: restore VirtIOBlkConf->config_wce flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , "Michael S. Tsirkin" , Blue Swirl , khoa@us.ibm.com, Stefan Hajnoczi , Paolo Bonzini , Asias He Two slightly different versions of a patch to conditionally set VIRTIO_BLK_F_CONFIG_WCE through the "config-wce" qdev property have been applied (ea776abca and eec7f96c2). David Gibson noticed that the "config-wce" property is broken as a result and fixed it recently. The fix sets the host_features VIRTIO_BLK_F_CONFIG_WCE bit from a qdev property. Unfortunately, the virtio device then has no chance to test for the presence of the feature bit during virtio_blk_init(). Therefore, reinstate the VirtIOBlkConf->config_wce flag. Drop the duplicate qdev property to set the host_features bit. The VirtIOBlkConf->config_wce flag will be used by virtio-blk-data-plane in a later patch. Signed-off-by: Stefan Hajnoczi --- hw/virtio-blk.c | 3 +++ hw/virtio-blk.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index e25cc96..fabf387 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -524,6 +524,9 @@ static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features) features |= (1 << VIRTIO_BLK_F_BLK_SIZE); features |= (1 << VIRTIO_BLK_F_SCSI); + if (s->blk->config_wce) { + features |= (1 << VIRTIO_BLK_F_CONFIG_WCE); + } if (bdrv_enable_write_cache(s->bs)) features |= (1 << VIRTIO_BLK_F_WCE); diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h index 651a000..454f445 100644 --- a/hw/virtio-blk.h +++ b/hw/virtio-blk.h @@ -104,10 +104,10 @@ struct VirtIOBlkConf BlockConf conf; char *serial; uint32_t scsi; + uint32_t config_wce; }; #define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \ - DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \ - DEFINE_PROP_BIT("config-wce", _state, _field, VIRTIO_BLK_F_CONFIG_WCE, true) + DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) #endif -- 1.8.0.1