From nobody Sat Jul 12 14:59:42 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.zoho.com; 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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015772481175.01446845038413; Wed, 1 Feb 2017 22:09:32 -0800 (PST) Received: from localhost ([::1]:54503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAaH-0001ne-Ev for importer@patchew.org; Thu, 02 Feb 2017 01:09:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jw-0007Vk-Dd for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9js-0003ts-0I for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from ozlabs.org ([103.22.144.67]:43135) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jr-0003pU-GA; Thu, 02 Feb 2017 00:15:19 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS2xRvz9s8C; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=M0GLrKnuYjfm2FPQqA9eS91yVOsSlelpaWEkXGGsAI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E2d7I2TuvX1iWp/N1DTmkxMxuMmdBm3+BolGAKjMaQn9+kxaP9HPDoTqNmXJkaVSO Nsw0My/S0DkOEl3i1xx+c/y9R36qwDUrK1a2HyT9uBPN4THTsXoGK56BoElHmSk69y 5dYDYPb372gqgWwwE4ywvYMV6v2DLPbiTyqlfyic= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:38 +1100 Message-Id: <20170202051445.5735-41-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 040/107] qtest: convert ivshmem-test to use libqos 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: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This will allow to use it with ppc64. Signed-off-by: Laurent Vivier Signed-off-by: David Gibson --- tests/ivshmem-test.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 04a5c5d..8095d72 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include #include "contrib/ivshmem-server/ivshmem-server.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqtest.h" #include "qemu-common.h" =20 @@ -40,9 +40,8 @@ static QPCIDevice *get_device(QPCIBus *pcibus) } =20 typedef struct _IVState { - QTestState *qtest; + QOSState *qs; QPCIBar reg_bar, mem_bar; - QPCIBus *pcibus; QPCIDevice *dev; } IVState; =20 @@ -74,7 +73,7 @@ static inline unsigned in_reg(IVState *s, enum Reg reg) QTestState *qtest =3D global_qtest; unsigned res; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; res =3D qpci_io_readl(s->dev, s->reg_bar, reg); g_test_message("*%s -> %x\n", name, res); global_qtest =3D qtest; @@ -87,7 +86,7 @@ static inline void out_reg(IVState *s, enum Reg reg, unsi= gned v) const char *name =3D reg2str(reg); QTestState *qtest =3D global_qtest; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; g_test_message("%x -> *%s\n", v, name); qpci_io_writel(s->dev, s->reg_bar, reg, v); global_qtest =3D qtest; @@ -97,7 +96,7 @@ static inline void read_mem(IVState *s, uint64_t off, voi= d *buf, size_t len) { QTestState *qtest =3D global_qtest; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; qpci_memread(s->dev, s->mem_bar, off, buf, len); global_qtest =3D qtest; } @@ -107,7 +106,7 @@ static inline void write_mem(IVState *s, uint64_t off, { QTestState *qtest =3D global_qtest; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; qpci_memwrite(s->dev, s->mem_bar, off, buf, len); global_qtest =3D qtest; } @@ -115,17 +114,21 @@ static inline void write_mem(IVState *s, uint64_t off, static void cleanup_vm(IVState *s) { g_free(s->dev); - qpci_free_pc(s->pcibus); - qtest_quit(s->qtest); + qtest_shutdown(s->qs); } =20 static void setup_vm_cmd(IVState *s, const char *cmd, bool msix) { uint64_t barsize; + const char *arch =3D qtest_get_arch(); =20 - s->qtest =3D qtest_start(cmd); - s->pcibus =3D qpci_init_pc(NULL); - s->dev =3D get_device(s->pcibus); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + s->qs =3D qtest_pc_boot(cmd); + } else { + g_printerr("ivshmem-test tests are only available on x86\n"); + exit(EXIT_FAILURE); + } + s->dev =3D get_device(s->qs->pcibus); =20 s->reg_bar =3D qpci_iomap(s->dev, 0, &barsize); g_assert_cmpuint(barsize, =3D=3D, 256); @@ -347,7 +350,7 @@ static void test_ivshmem_server(bool msi) g_assert_cmpint(vm1, !=3D, vm2); =20 /* check number of MSI-X vectors */ - global_qtest =3D s1->qtest; + global_qtest =3D s1->qs->qts; if (msi) { ret =3D qpci_msix_table_size(s1->dev); g_assert_cmpuint(ret, =3D=3D, nvectors); @@ -370,7 +373,7 @@ static void test_ivshmem_server(bool msi) g_assert_cmpuint(ret, !=3D, 0); =20 /* ping vm1 -> vm2 on vector 1 */ - global_qtest =3D s2->qtest; + global_qtest =3D s2->qs->qts; if (msi) { ret =3D qpci_msix_pending(s2->dev, 1); g_assert_cmpuint(ret, =3D=3D, 0); --=20 2.9.3