From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B290CA9EAF for ; Mon, 21 Oct 2019 12:12:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25B32205C9 for ; Mon, 21 Oct 2019 12:12:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="N8n37UPn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25B32205C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWY8-0004qQ-5e for qemu-devel@archiver.kernel.org; Mon, 21 Oct 2019 08:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55752) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWWz-0003mb-Qt for qemu-devel@nongnu.org; Mon, 21 Oct 2019 08:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWWy-0004jo-LR for qemu-devel@nongnu.org; Mon, 21 Oct 2019 08:11:25 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:21063 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMWWy-0004je-Ho for qemu-devel@nongnu.org; Mon, 21 Oct 2019 08:11:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571659884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:openpgp:openpgp:autocrypt:autocrypt; bh=WLWXB5pkpOoIX/P69nuH7M6JX66U0PmtOg2Zd2WRgFM=; b=N8n37UPnR6aO59NLrfOvrjd5PKnIPshFSkO5/+4Iyg53DzFI1Xp6WGX3Ze3+YdSG4uTZ/Z aCnd9OC6nn0YwpUSi2YZiit9zU9fs0jATADfECYMAm+WaUyY5x+q2KMuTqceX9VBwERK1L hpRfgfrIiVWo4wsDGZU5/sRHrgEZdhg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-R0pz0waNPOC8AF0-mI5mGA-1; Mon, 21 Oct 2019 08:11:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82042800D41; Mon, 21 Oct 2019 12:11:21 +0000 (UTC) Received: from thuth.remote.csb (dhcp-200-228.str.redhat.com [10.33.200.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF66460127; Mon, 21 Oct 2019 12:11:14 +0000 (UTC) Subject: Re: [PATCH v3 05/16] tests/virtio-blk-test: set up virtqueue after feature negotiation To: Stefan Hajnoczi , qemu-devel@nongnu.org References: <20191019063810.6944-1-stefanha@redhat.com> <20191019063810.6944-6-stefanha@redhat.com> From: Thomas Huth Openpgp: preference=signencrypt Autocrypt: addr=thuth@redhat.com; prefer-encrypt=mutual; keydata= mQINBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FWcOafrVRwU yYkTm9+7zBUc0sW5AuPGR/dp3pSLX/yFWsA/UB4nJsHqgDvDU7BImSeiTrnpMOTXb7Arw2a2 4CflIyFqjCpfDM4MuTmzTjXq4Uov1giGE9X6viNo1pxyEpd7PanlKNnf4PqEQp06X4IgUacW tSGj6Gcns1bCuHV8OPWLkf4hkRnu8hdL6i60Yxz4E6TqlrpxsfYwLXgEeswPHOA6Mn4Cso9O 0lewVYfFfsmokfAVMKWzOl1Sr0KGI5T9CpmRfAiSHpthhHWnECcJFwl72NTi6kUcUzG4se81 O6n9d/kTj7pzTmBdfwuOZ0YUSqcqs0W+l1NcASSYZQaDoD3/SLk+nqVeCBB4OnYOGhgmIHNW 0CwMRO/GK+20alxzk//V9GmIM2ACElbfF8+Uug3pqiHkVnKqM7W9/S1NH2qmxB6zMiJUHlTH gnVeZX0dgH27mzstcF786uPcdEqS0KJuxh2kk5IvUSL3Qn3ZgmgdxBMyCPciD/1cb7/Ahazr 3ThHQXSHXkH/aDXdfLsKVuwDzHLVSkdSnZdt5HHh75/NFHxwaTlydgfHmFFwodK8y/TjyiGZ zg2Kje38xnz8zKn9iesFBCcONXS7txENTzX0z80WKBhK+XSFJwARAQABtB5UaG9tYXMgSHV0 aCA8dGh1dGhAcmVkaGF0LmNvbT6JAjgEEwECACIFAlVgX6oCGwMGCwkIBwMCBhUIAgkKCwQW AgMBAh4BAheAAAoJEC7Z13T+cC21EbIP/ii9cvT2HHGbFRl8HqGT6+7Wkb+XLMqJBMAIGiQK QIP3xk1HPTsLfVG0ao4hy/oYkGNO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o39me/bRUQeQVSxEBmg66yshF9HkcUPGVeC4B0TPwz+HFcVhheo6hoJjLq knFOPLRj+0h+ZL+D0GenyqD3CyuyeTT5dGcNU9qT74bdSr20k/CklvI7S9yoQje8BeQAHtdV cvO8XCLrpGuw9SgOS7OP5oI26a0548M4KldAY+kqX6XVphEw3/6U1KTf7WxW5zYLTtadjISB X9xsRWSU+Yqs3C7oN5TIPSoj9tXMoxZkCIHWvnqGwZ7JhwARAQABiQIfBBgBAgAJBQJR+3lM AhsMAAoJEC7Z13T+cC21hPAQAIsBL9MdGpdEpvXs9CYrBkd6tS9mbaSWj6XBDfA1AEdQkBOn ZH1Qt7HJesk+qNSnLv6+jP4VwqK5AFMrKJ6IjE7jqgzGxtcZnvSjeDGPF1h2CKZQPpTw890k fy18AvgFHkVk2Oylyexw3aOBsXg6ukN44vIFqPoc+YSU0+0QIdYJp/XFsgWxnFIMYwDpxSHS 5fdDxUjsk3UBHZx+IhFjs2siVZi5wnHIqM7eK9abr2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn Organization: Red Hat Message-ID: Date: Mon, 21 Oct 2019 14:11:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191019063810.6944-6-stefanha@redhat.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: R0pz0waNPOC8AF0-mI5mGA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Laurent Vivier , slp@redhat.com, qemu-block@nongnu.org, "Michael S. Tsirkin" , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 19/10/2019 08.37, Stefan Hajnoczi wrote: > VIRTIO Device Initialization requires that feature negotiation has > completed before virtqueues are set up. This makes sense because the > driver must know whether it is operating in Legacy or VIRTIO 1.0 mode > before it can access vring fields with the correct endianness. >=20 > Signed-off-by: Stefan Hajnoczi > --- > tests/virtio-blk-test.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) >=20 > diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c > index 31680cc159..fe0dc4a896 100644 > --- a/tests/virtio-blk-test.c > +++ b/tests/virtio-blk-test.c > @@ -113,8 +113,8 @@ static uint64_t virtio_blk_request(QGuestAllocator *a= lloc, QVirtioDevice *d, > return addr; > } > =20 > -static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc, > - QVirtQueue *vq) > +/* Returns the request virtqueue so the caller can perform further tests= */ > +static QVirtQueue *test_basic(QVirtioDevice *dev, QGuestAllocator *alloc= ) > { > QVirtioBlkReq req; > uint64_t req_addr; > @@ -124,6 +124,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllo= cator *alloc, > uint8_t status; > char *data; > QTestState *qts =3D global_qtest; > + QVirtQueue *vq; > =20 > features =3D qvirtio_get_features(dev); > features =3D features & ~(QVIRTIO_F_BAD_FEATURE | > @@ -135,6 +136,8 @@ static void test_basic(QVirtioDevice *dev, QGuestAllo= cator *alloc, > capacity =3D qvirtio_config_readq(dev, 0); > g_assert_cmpint(capacity, =3D=3D, TEST_IMAGE_SIZE / 512); > =20 > + vq =3D qvirtqueue_setup(dev, alloc, 0); > + > qvirtio_set_driver_ok(dev); > =20 > /* Write and read with 3 descriptor layout */ > @@ -331,14 +334,16 @@ static void test_basic(QVirtioDevice *dev, QGuestAl= locator *alloc, > =20 > guest_free(alloc, req_addr); > } > + > + return vq; > } > =20 > static void basic(void *obj, void *data, QGuestAllocator *t_alloc) > { > QVirtioBlk *blk_if =3D obj; > QVirtQueue *vq; > - vq =3D qvirtqueue_setup(blk_if->vdev, t_alloc, 0); > - test_basic(blk_if->vdev, t_alloc, vq); > + > + vq =3D test_basic(blk_if->vdev, t_alloc); > qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc); > =20 > } > @@ -746,9 +751,7 @@ static void resize(void *obj, void *data, QGuestAlloc= ator *t_alloc) > QVirtQueue *vq; > QTestState *qts =3D global_qtest; > =20 > - vq =3D qvirtqueue_setup(dev, t_alloc, 0); > - > - test_basic(dev, t_alloc, vq); > + vq =3D test_basic(dev, t_alloc); > =20 > qmp_discard_response("{ 'execute': 'block_resize', " > " 'arguments': { 'device': 'drive0', " >=20 Reviewed-by: Thomas Huth