From nobody Sun Nov 9 22:37:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551981053031288.30714745435864; Thu, 7 Mar 2019 09:50:53 -0800 (PST) Received: from localhost ([127.0.0.1]:56355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xAN-0002Hd-VU for importer@patchew.org; Thu, 07 Mar 2019 12:50:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wqQ-0002jH-IQ for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wqP-0007lE-KH for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:10 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:53141) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wqP-0007kI-Bb for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:09 -0500 Received: by mail-wm1-x329.google.com with SMTP id f65so10066460wma.2 for ; Thu, 07 Mar 2019 09:30:09 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+fpYfSN8S5YMvoOC7a+nbq24Fgg+Bb1zyXdRL9Ro974=; b=RJlzG3xzLml2yhGYKch6+qYPq8U1XFCu9Kh66HjE4CMMIX9CoGZCxFNaBA9nfmM/Fd UnnB73VRFBN4FeOCa56jXxALz5zuiVgV9rnkqfSSXR97vtHsYZ2aDAKL0H981XPaRgxt D0M2/Cv1Lh3Uc1VzkMo3f89ey2VOuKcFqHFeNmld5Yp8GxtJMP8AgdFuypACcJ2q/Ovv DCsTAL6utJ1vMMAGytakH1ltEaD6/rlf0ycEoq5Ewm9vi4JctSdrswcsccybs40m+m+P aDA92mZTeZlRoJjk4nQJQ5RJ5n67Mm2ZRfez6PnHQcxAWa3yegwdWRUyO7Dw+8y2CDDM D2Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+fpYfSN8S5YMvoOC7a+nbq24Fgg+Bb1zyXdRL9Ro974=; b=EtVw2klvtYUUWOz5+mXJrXVPPBq6T288cItiBQLJ7P5gmwxaDrTHf/OkTVzJOPUdmi 6xGAN5kXBJvZeaqPtW5MfX99sQyF3F9nkDDuiV3REG76Dv3G3Yrf27utNNJIEVPOcgWW BRRNtY+hFQZ1EMzr5fwI/u5iy/5v7+BgPNBQvN2r85rRPTGOPOPA+gzTM6vsoZMRsrKf zeYhbF4lDrpiUO/xpYa99/rG1AIRCeL+zMhLEj/txky3JNYRrD/IytlCmzIeIddXIZ/l jr1qS4XkrUqJ294lZrYlIUVO3IocbUctI3ZHToUau+bIQPOYdJP6I29drGfhgWdgLPNc Hs2g== X-Gm-Message-State: APjAAAWXSKxtLIyTTFlseQ+OPrcmxk0XWIAuTAgW1bXyhqLmwxTehBoT +QK6U0K06ov08lM8rF0gZGGBN5fB X-Google-Smtp-Source: APXvYqxWpjcjvwCPhQIqYQ+p3KBQA1xg+QGetJi55cmMke/KMYJPOyq3FnoejeBtosVq4OUtfaCoMQ== X-Received: by 2002:a1c:e2c2:: with SMTP id z185mr6245381wmg.84.1551979807727; Thu, 07 Mar 2019 09:30:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:09 +0100 Message-Id: <1551979804-6060-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> References: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 02/57] tests/libqos: introduce virtio_start_device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, Emanuele Giuseppe Esposito , lviver@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Emanuele Giuseppe Esposito This function is intended to group all the qvirtio_* functions that start the qvirtio devices. Applied in all tests using this combination of functions. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Laurent Vivier Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- tests/libqos/virtio.c | 7 +++++++ tests/libqos/virtio.h | 1 + tests/vhost-user-test.c | 4 +--- tests/virtio-9p-test.c | 4 +--- tests/virtio-blk-test.c | 9 ++------- tests/virtio-net-test.c | 4 +--- tests/virtio-scsi-test.c | 4 +--- 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 0dad5c1..c1ff020 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -365,3 +365,10 @@ const char *qvirtio_get_dev_type(void) return "pci"; } } + +void qvirtio_start_device(QVirtioDevice *vdev) +{ + qvirtio_reset(vdev); + qvirtio_set_acknowledge(vdev); + qvirtio_set_driver(vdev); +} diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index 69b5b13..2c68668 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -146,5 +146,6 @@ bool qvirtqueue_get_buf(QVirtQueue *vq, uint32_t *desc_= idx, uint32_t *len); void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx); =20 const char *qvirtio_get_dev_type(void); +void qvirtio_start_device(QVirtioDevice *vdev); =20 #endif diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 4cd0a97..770e1e6 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -204,9 +204,7 @@ static void init_virtio_dev(QTestState *qts, TestServer= *s, uint32_t features_ma g_assert_nonnull(s->dev); =20 qvirtio_pci_device_enable(s->dev); - qvirtio_reset(&s->dev->vdev); - qvirtio_set_acknowledge(&s->dev->vdev); - qvirtio_set_driver(&s->dev->vdev); + qvirtio_start_device(&s->dev->vdev); =20 s->alloc =3D pc_alloc_init(qts); =20 diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c index a2b3108..d275c74 100644 --- a/tests/virtio-9p-test.c +++ b/tests/virtio-9p-test.c @@ -65,9 +65,7 @@ static QVirtIO9P *qvirtio_9p_pci_start(void) v9p->dev =3D (QVirtioDevice *) dev; =20 qvirtio_pci_device_enable(dev); - qvirtio_reset(v9p->dev); - qvirtio_set_acknowledge(v9p->dev); - qvirtio_set_driver(v9p->dev); + qvirtio_start_device(v9p->dev); =20 v9p->vq =3D qvirtqueue_setup(v9p->dev, v9p->qs->alloc, 0); =20 diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 8d2fc9c..0680bd0 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -122,10 +122,7 @@ static QVirtioPCIDevice *virtio_blk_pci_init(QPCIBus *= bus, int slot) g_assert_cmphex(dev->pdev->devfn, =3D=3D, ((slot << 3) | PCI_FN)); =20 qvirtio_pci_device_enable(dev); - qvirtio_reset(&dev->vdev); - qvirtio_set_acknowledge(&dev->vdev); - qvirtio_set_driver(&dev->vdev); - + qvirtio_start_device(&dev->vdev); return dev; } =20 @@ -833,9 +830,7 @@ static void mmio_basic(void) g_assert(dev !=3D NULL); g_assert_cmphex(dev->vdev.device_type, =3D=3D, VIRTIO_ID_BLOCK); =20 - qvirtio_reset(&dev->vdev); - qvirtio_set_acknowledge(&dev->vdev); - qvirtio_set_driver(&dev->vdev); + qvirtio_start_device(&dev->vdev); =20 alloc =3D generic_alloc_init(MMIO_RAM_ADDR, MMIO_RAM_SIZE, MMIO_PAGE_S= IZE); vq =3D qvirtqueue_setup(&dev->vdev, alloc, 0); diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index e9783e6..d4a32a4 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -44,9 +44,7 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus= , int slot) g_assert_cmphex(dev->vdev.device_type, =3D=3D, VIRTIO_ID_NET); =20 qvirtio_pci_device_enable(dev); - qvirtio_reset(&dev->vdev); - qvirtio_set_acknowledge(&dev->vdev); - qvirtio_set_driver(&dev->vdev); + qvirtio_start_device(&dev->vdev); =20 return dev; } diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index 0d4f25d..961925c 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -159,9 +159,7 @@ static QVirtIOSCSI *qvirtio_scsi_pci_init(int slot) g_assert_cmphex(vs->dev->device_type, =3D=3D, VIRTIO_ID_SCSI); =20 qvirtio_pci_device_enable(dev); - qvirtio_reset(vs->dev); - qvirtio_set_acknowledge(vs->dev); - qvirtio_set_driver(vs->dev); + qvirtio_start_device(vs->dev); =20 vs->num_queues =3D qvirtio_config_readl(vs->dev, 0); =20 --=20 1.8.3.1