From patchwork Fri Feb 5 10:45:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 8233461 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A75EEBEEE5 for ; Fri, 5 Feb 2016 10:47:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15B6A20397 for ; Fri, 5 Feb 2016 10:47:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D81E20390 for ; Fri, 5 Feb 2016 10:47:25 +0000 (UTC) Received: from localhost ([::1]:47424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRdvA-0003f6-LN for patchwork-qemu-devel@patchwork.kernel.org; Fri, 05 Feb 2016 05:47:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRdtu-0001eZ-RI for qemu-devel@nongnu.org; Fri, 05 Feb 2016 05:46:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRdtr-0000pa-LM for qemu-devel@nongnu.org; Fri, 05 Feb 2016 05:46:06 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:56126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRdtr-0000pV-CU for qemu-devel@nongnu.org; Fri, 05 Feb 2016 05:46:03 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Feb 2016 10:46:02 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 Feb 2016 10:45:58 -0000 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: gkurz@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;lvivier@redhat.com;mst@redhat.com Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id A78B417D8066; Fri, 5 Feb 2016 10:46:10 +0000 (GMT) Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u15AjwPf9306524; Fri, 5 Feb 2016 10:45:58 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7519F52036; Fri, 5 Feb 2016 09:44:43 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6E13852045; Fri, 5 Feb 2016 09:44:41 +0000 (GMT) Received: from bahia.huguette.org (sig-9-84-79-61.evts.de.ibm.com [9.84.79.61]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 397CA220029; Fri, 5 Feb 2016 11:45:52 +0100 (CET) From: Greg Kurz To: "Michael S. Tsirkin" Date: Fri, 05 Feb 2016 11:45:49 +0100 Message-ID: <20160205104548.21017.80009.stgit@bahia.huguette.org> In-Reply-To: <20160205103927.21017.26364.stgit@bahia.huguette.org> References: <20160205103927.21017.26364.stgit@bahia.huguette.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020510-0017-0000-0000-00000711EC61 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.110 Cc: Cornelia Huck , Laurent Vivier , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v4 4/6] vhost: move virtio 1.0 check to cross-endian helper 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Indeed vhost doesn't need to ask for vring endian fixing if the device is virtio 1.0, since it is already handled by the in-kernel vhost driver. This patch simply consolidates the logic into the existing helper. Reviewed-by: Cornelia Huck Signed-off-by: Greg Kurz Reviewed-by: Laurent Vivier --- hw/virtio/vhost.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 6fea07c8ae15..bb17177f5e7e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -751,6 +751,9 @@ static void vhost_log_stop(MemoryListener *listener, static inline bool vhost_needs_vring_endian(VirtIODevice *vdev) { + if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { + return false; + } #ifdef TARGET_IS_BIENDIAN #ifdef HOST_WORDS_BIGENDIAN return !virtio_is_big_endian(vdev); @@ -812,8 +815,7 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, return -errno; } - if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1) && - vhost_needs_vring_endian(vdev)) { + if (vhost_needs_vring_endian(vdev)) { r = vhost_virtqueue_set_vring_endian_legacy(dev, virtio_is_big_endian(vdev), vhost_vq_index); @@ -909,8 +911,7 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev, /* In the cross-endian case, we need to reset the vring endianness to * native as legacy devices expect so by default. */ - if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1) && - vhost_needs_vring_endian(vdev)) { + if (vhost_needs_vring_endian(vdev)) { r = vhost_virtqueue_set_vring_endian_legacy(dev, !virtio_is_big_endian(vdev), vhost_vq_index);