From patchwork Tue Dec 2 13:00:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 416869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7423F140160 for ; Wed, 3 Dec 2014 00:12:35 +1100 (AEDT) Received: from localhost ([::1]:36779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvnFp-00076k-C5 for incoming@patchwork.ozlabs.org; Tue, 02 Dec 2014 08:12:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xvn4h-0007DI-Mz for qemu-devel@nongnu.org; Tue, 02 Dec 2014 08:01:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xvn4Y-00037h-K7 for qemu-devel@nongnu.org; Tue, 02 Dec 2014 08:01:03 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:50693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xvn4Y-00037Z-A9 for qemu-devel@nongnu.org; Tue, 02 Dec 2014 08:00:54 -0500 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 Dec 2014 13:00:53 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 2 Dec 2014 13:00:50 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1C53A2190056 for ; Tue, 2 Dec 2014 13:00:22 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sB2D0oIr43188468 for ; Tue, 2 Dec 2014 13:00:50 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sB2D0nhf008318 for ; Tue, 2 Dec 2014 06:00:50 -0700 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-210.boeblingen.de.ibm.com [9.152.224.210]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sB2D0X4Y006940; Tue, 2 Dec 2014 06:00:49 -0700 From: Cornelia Huck To: virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org, kvm@vger.kernel.org Date: Tue, 2 Dec 2014 14:00:27 +0100 Message-Id: <1417525227-14051-20-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417525227-14051-1-git-send-email-cornelia.huck@de.ibm.com> References: <1417525227-14051-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14120213-0029-0000-0000-000001FA23CB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.113 Cc: Cornelia Huck , rusty@rustcorp.com.au, thuth@linux.vnet.ibm.com, mst@redhat.com Subject: [Qemu-devel] [PATCH RFC v5 19/19] virtio-blk: revision specific feature bits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Wire up virtio-blk to provide different feature bit sets depending on whether legacy or v1.0 has been requested. Note that VERSION_1 is still disabled due to missing ANY_LAYOUT support. Signed-off-by: Cornelia Huck --- hw/block/virtio-blk.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 9cfae66..fdc236a 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -587,6 +587,24 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features) return features; } +static uint64_t virtio_blk_get_features_rev(VirtIODevice *vdev, + uint64_t features, + unsigned int revision) +{ + if (revision == 0) { + /* legacy */ + virtio_clear_feature(&features, VIRTIO_F_VERSION_1); + return virtio_blk_get_features(vdev, features); + } + /* virtio 1.0 or later */ + virtio_clear_feature(&features, VIRTIO_BLK_F_SCSI); + virtio_clear_feature(&features, VIRTIO_BLK_F_CONFIG_WCE); + virtio_clear_feature(&features, VIRTIO_BLK_F_WCE); + /* we're still missing ANY_LAYOUT */ + /* virtio_add_feature(&features, VIRTIO_F_VERSION_1); */ + return features; +} + static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status) { VirtIOBlock *s = VIRTIO_BLK(vdev); @@ -821,6 +839,7 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data) vdc->get_config = virtio_blk_update_config; vdc->set_config = virtio_blk_set_config; vdc->get_features = virtio_blk_get_features; + vdc->get_features_rev = virtio_blk_get_features_rev; vdc->set_status = virtio_blk_set_status; vdc->reset = virtio_blk_reset; vdc->save = virtio_blk_save_device;