From nobody Wed Nov 5 10:45:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534155821625438.10311216947605; Mon, 13 Aug 2018 03:23:41 -0700 (PDT) Received: from localhost ([::1]:38545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpA0g-0005d0-7o for importer@patchew.org; Mon, 13 Aug 2018 06:23:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9sr-0007PB-8b for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp9sq-0002Is-4b for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:33 -0400 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:41405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fp9sp-0002H4-Qk; Mon, 13 Aug 2018 06:15:32 -0400 Received: by mail-ed1-x543.google.com with SMTP id s24-v6so7939822edr.8; Mon, 13 Aug 2018 03:15:31 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.125]) by smtp.gmail.com with ESMTPSA id s27-v6sm11670006edb.73.2018.08.13.03.15.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 03:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PmQ6cZko2EjLPto3VLe+uSqlSyxFZK62HYR5/tCuet4=; b=KrbPscCbNsqbnXijNXB5jSBug8YhbgDT93hmGqlpfUUT9PM8oglDc65+E+E16eJ9G9 f40fyZO9xIojKuXnY07OZuGPgDPk6j17oZalA/68r4t8ZIDJYO7177c50iCfrI5fWsOI 0HQKrUgjYc+gODpdbbSNm6s6dej7LEWWeHiaxt2ZdYwGPiB1Un6YCsYtgsZKp3BZTRmF sKyXP2OPoNXyzKHaDb0PWxbVLhDv/o+JfuuU3DKygKV2XSB8mOtgUQf+39363QWgLfKs DhTK+Hn2JX6kJPTYvy9V9qZc3bCT2Wmp3Rz8Yd8KSS1AadK9AfcU/qD+amJwTelDslmN t0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PmQ6cZko2EjLPto3VLe+uSqlSyxFZK62HYR5/tCuet4=; b=TwGlO4j8IUmGS7HT7yBPOKnl6RFhnMexIY9SV6g8WQ91bDAh+WZjZVq0vuKZtM6+uB tOcTgEacA869WzlyEu+qVyIimsKV6yJHFJGdjmJgvXfjJ+djx74UuKC7iBZFByXND9yq zRqOJi3D1JQsZZyeF967SyC2l0YwvAmngrM45WMFa5ql50akTa+9I8sl0ir0Gnlf1Rim SLIOXvOXT44HHUyDwmJOAlvq7PWq0pof5qZNKjTdx7z7ioAz3jiIWDFn88NZBxuWI4S8 UMEEGqSf2dLn+qChptfsrqHJcYCgRuGVFprr7PV/YATLz8Tva6Wc4FGYTIc3Jez6pAV0 6hHA== X-Gm-Message-State: AOUpUlE3gXqQhuIAhowU+JWQZ9uE8px33rJO+SPsHGvZog8zMlKwQAaT vxvAk3kFixXvyI1NV1UOJaMChS/O67Q= X-Google-Smtp-Source: AA+uWPzuPSKXExPWfBScSL/DVvpEhaAhZlp07ryO4+72BVkkg5NOp1IJUgm8H1bJ1bxS2nlDDkwzhw== X-Received: by 2002:a50:8103:: with SMTP id 3-v6mr21444014edc.131.1534155330538; Mon, 13 Aug 2018 03:15:30 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 12:14:33 +0200 Message-Id: <20180813101453.10200-14-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> References: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::543 Subject: [Qemu-devel] [PATCH 13/33] tests/qgraph: virtio_start_device function 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: Laurent Vivier , Fam Zheng , qemu-block@nongnu.org, "Michael S. Tsirkin" , Jason Wang , Amit Shah , Emanuele Giuseppe Esposito , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Greg Kurz , qemu-ppc@nongnu.org, Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , John Snow , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 | 10 +++------- tests/virtio-net-test.c | 4 +--- tests/virtio-scsi-test.c | 4 +--- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 0dad5c19ac..c1ff0206d5 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 69b5b13840..2c68668de0 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 a976808eba..d43d09a013 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -198,9 +198,7 @@ static void init_virtio_dev(TestServer *s, uint32_t fea= tures_mask) 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(global_qtest); =20 diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c index a2b31085f6..d275c74106 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 9be9ffb378..66797d0348 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -112,10 +112,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 @@ -329,6 +326,7 @@ static void pci_indirect(void) qvirtio_set_features(&dev->vdev, features); =20 vqpci =3D (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, qs->alloc, 0); + qvirtio_set_driver_ok(&dev->vdev); =20 /* Write request */ @@ -715,9 +713,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 b285a262e9..72728acf66 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -45,9 +45,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 037872bb98..1581b6926c 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 2.17.1