From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672742; cv=none; d=zoho.com; s=zohoarc; b=HegJsiGybuXhIkStSFNTjXxUvhw0Jt+XwcEcJ9qNX7E0VPHhg4/29W3d2Si/k35I9H1LP8coF7U1/jxqWUwTgMddSrH4E9Z/WOk2sJgooPE10HdHV2ncAEr3amanN9q6FJapcPO+izyKIEP+uZJb4lJHldo88u1TDG45EKR1irE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672742; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ybi7fKPpc6dIGxKJCMCpd56m7YGsVCql7ehAR9KQyf0=; b=A61OaXPL1v8aG4I0SdS1lLjAuLgecJcfJsJJA8fLPjuEOYPb6VMSeXM68xAdXdMUHO4s4sNYOlSs+M9p1tJgUbDVlRsARV5ezY5Cgv6MaN9GhsGwWIIA96AeP28rgyoeOyBv2Bq8Ua46cfbD8eFrOcftOk4atvvfaDPr8GbWMO8= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672742085967.2381549303061; Thu, 5 Sep 2019 01:39:02 -0700 (PDT) Received: from localhost ([::1]:43266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nI7-0006S5-Go for importer@patchew.org; Thu, 05 Sep 2019 04:38:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33086) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAS-0007o5-Vu for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAO-0005mH-1d for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33276) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAN-0005lc-Sy for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E3E3307D977; Thu, 5 Sep 2019 08:30:55 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6665F5D704; Thu, 5 Sep 2019 08:30:54 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:42 +0200 Message-Id: <20190905083049.11645-2-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 05 Sep 2019 08:30:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/8] tests/migration: Do not use functions anymore that rely on global_qtest 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The migration tests deal with multiple test states, so we really should not use functions here that rely on the single global_qtest variable. Switch from qtest_start() to qtest_init() to make sure that global_qtest is not set anymore. This also revealed a regression in the migrate() function: It has once been converted to use the qtest_qmp() function, but commit b5bbd3f315d686bd511 ("Clean up string interpolation into QMP, part 2") accidentally reverted it back to qmp(). Message-Id: <20190904130047.25808-2-thuth@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Laurent Vivier Reviewed-by: Stefan Hajnoczi Signed-off-by: Thomas Huth --- tests/migration-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index b87ba99a9e..a9f81cc185 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -490,7 +490,7 @@ static void migrate(QTestState *who, const char *uri, c= onst char *fmt, ...) g_assert(!qdict_haskey(args, "uri")); qdict_put_str(args, "uri", uri); =20 - rsp =3D qmp("{ 'execute': 'migrate', 'arguments': %p}", args); + rsp =3D qtest_qmp(who, "{ 'execute': 'migrate', 'arguments': %p}", arg= s); =20 g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); @@ -625,7 +625,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, cmd_dst =3D tmp; } =20 - *from =3D qtest_start(cmd_src); + *from =3D qtest_init(cmd_src); g_free(cmd_src); =20 *to =3D qtest_init(cmd_dst); @@ -715,7 +715,7 @@ static void test_deprecated(void) { QTestState *from; =20 - from =3D qtest_start("-machine none"); + from =3D qtest_init("-machine none"); =20 deprecated_set_downtime(from, 0.12345); deprecated_set_speed(from, 12345); --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672643; cv=none; d=zoho.com; s=zohoarc; b=Jppdt2xQNaVYNJ4PaciVESbxj5BDf1ZNkEtrInClnIRsUTqfJT0AgeRBpEhuFTBDJg7a3M9AXTCm1J9pYtA1b+FcUV2PJI8bE2xrUpE5E/rz+N0B9QsfP+R39TywM2Db+9G5X2PReZ7Zxk/JS3AlRnvN0C9ms1QSBQf+cMir4iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672643; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IBt9P+mwuEuezrpylfXnlXHFydjJtj1glqc44dB1gkU=; b=L8lMl/hAUarBGQV2GzJSrgPp3WvYDWhoksiRTSrAP6biTvqsWFXHvT014qrcpWwPz/q8XFYCMh06dCeKbHSs+T8vFxWXMvBfGrzqtTvtlHS/yC6lxSOHBD2xtBxJHm5dLzqZbc5GWRWP555NmYAK5HaEtrNgFmXztg2ereMe+B4= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672643302925.4647202505093; Thu, 5 Sep 2019 01:37:23 -0700 (PDT) Received: from localhost ([::1]:43250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nGZ-0004YZ-Dx for importer@patchew.org; Thu, 05 Sep 2019 04:37:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33049) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAQ-0007lD-8d for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAP-0005nG-0Z for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAO-0005mN-Rd for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 211FF3086208; Thu, 5 Sep 2019 08:30:56 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AAAA5D704; Thu, 5 Sep 2019 08:30:55 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:43 +0200 Message-Id: <20190905083049.11645-3-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 05 Sep 2019 08:30:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/8] tests/libqos/e1000e: Make e1000e libqos functions independent from global_qtest 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" libqos library functions should never depend on functions (like memread(), memwrite() or clock_step()) that require global_qtest to be set, since library functions might get used in qtests that track multiple states, too. Thus let's replace the global_qtest-related functions with their independent counterparts. Message-Id: <20190904130047.25808-3-thuth@redhat.com> Reviewed-by: Laurent Vivier Reviewed-by: Stefan Hajnoczi Signed-off-by: Thomas Huth --- tests/libqos/e1000e.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/libqos/e1000e.c b/tests/libqos/e1000e.c index 1d0592974e..560e7a2bb2 100644 --- a/tests/libqos/e1000e.c +++ b/tests/libqos/e1000e.c @@ -85,26 +85,32 @@ static uint32_t e1000e_macreg_read(QE1000E *d, uint32_t= reg) =20 void e1000e_tx_ring_push(QE1000E *d, void *descr) { + QE1000E_PCI *d_pci =3D container_of(d, QE1000E_PCI, e1000e); uint32_t tail =3D e1000e_macreg_read(d, E1000E_TDT); uint32_t len =3D e1000e_macreg_read(d, E1000E_TDLEN) / E1000E_TXD_LEN; =20 - memwrite(d->tx_ring + tail * E1000E_TXD_LEN, descr, E1000E_TXD_LEN); + qtest_memwrite(d_pci->pci_dev.bus->qts, d->tx_ring + tail * E1000E_TXD= _LEN, + descr, E1000E_TXD_LEN); e1000e_macreg_write(d, E1000E_TDT, (tail + 1) % len); =20 /* Read WB data for the packet transmitted */ - memread(d->tx_ring + tail * E1000E_TXD_LEN, descr, E1000E_TXD_LEN); + qtest_memread(d_pci->pci_dev.bus->qts, d->tx_ring + tail * E1000E_TXD_= LEN, + descr, E1000E_TXD_LEN); } =20 void e1000e_rx_ring_push(QE1000E *d, void *descr) { + QE1000E_PCI *d_pci =3D container_of(d, QE1000E_PCI, e1000e); uint32_t tail =3D e1000e_macreg_read(d, E1000E_RDT); uint32_t len =3D e1000e_macreg_read(d, E1000E_RDLEN) / E1000E_RXD_LEN; =20 - memwrite(d->rx_ring + tail * E1000E_RXD_LEN, descr, E1000E_RXD_LEN); + qtest_memwrite(d_pci->pci_dev.bus->qts, d->rx_ring + tail * E1000E_RXD= _LEN, + descr, E1000E_RXD_LEN); e1000e_macreg_write(d, E1000E_RDT, (tail + 1) % len); =20 /* Read WB data for the packet received */ - memread(d->rx_ring + tail * E1000E_RXD_LEN, descr, E1000E_RXD_LEN); + qtest_memread(d_pci->pci_dev.bus->qts, d->rx_ring + tail * E1000E_RXD_= LEN, + descr, E1000E_RXD_LEN); } =20 static void e1000e_foreach_callback(QPCIDevice *dev, int devfn, void *data) @@ -123,7 +129,7 @@ void e1000e_wait_isr(QE1000E *d, uint16_t msg_id) if (qpci_msix_pending(&d_pci->pci_dev, msg_id)) { return; } - clock_step(10000); + qtest_clock_step(d_pci->pci_dev.bus->qts, 10000); } while (g_get_monotonic_time() < end_time); =20 g_error("Timeout expired"); --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672546; cv=none; d=zoho.com; s=zohoarc; b=k3rPwAkhcRldth1WXRxlTklnexCf9DKefacEJkHqvM6s3KIuT6npz0AgVVMsxYZmBEzJ6Pci45Z3xe9vMQcLurc1i2xlxkovqAid1NzdFJ3AseeLo7maAj30VjgtS7iKI50jVNbJ/U9cq2Ykp7xxhwUv128OWsuEhSJHFvoOx5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672546; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gy4H6K+tqUSdXjiFy5vTVy2j4UGnoWyQPMymvF6/kmQ=; b=gcICMKUBOBfvZpigqKO+g6C8F4vb5wQWxaPuMBvB1Y1keLPMpm0cAwWQEu1hTQ06CsbcUcctrCDz/U3ZVONq0EmiG/D6CPD7lncDf6asCWfi17kWuvKixB+H8RjYe08MoDvMUS7Dy2QCX1FRpqXPNvFrGsYkvf3Fm64FQ08EoYA= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672546118268.3527487727106; Thu, 5 Sep 2019 01:35:46 -0700 (PDT) Received: from localhost ([::1]:43242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nF2-0002sA-Ah for importer@patchew.org; Thu, 05 Sep 2019 04:35:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33075) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAR-0007n6-Rj for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAQ-0005oh-5b for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43594) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAP-0005nc-ST for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 274A980038D; Thu, 5 Sep 2019 08:30:57 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D7445D704; Thu, 5 Sep 2019 08:30:56 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:44 +0200 Message-Id: <20190905083049.11645-4-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Thu, 05 Sep 2019 08:30:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/8] tests/libqos: Replace clock_step with qtest_clock_step in virtio code 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Library functions should not rely on functions that require global_qtest (since they might get used in tests that deal with multiple states). Commit 1999a70a05ad603d ("Make generic virtio code independent from global_qtest") already tried to clean the libqos virtio code, but I missed to replace the clock_step() function. Thus change it now to qtest_clock_step() instead. The logic of the qvirtio_wait_config_isr() function is now pushed to the virtio-mmio.c and virtio-pci.c files instead, since we can get the QTestState here easily. Message-Id: <20190904130047.25808-4-thuth@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Signed-off-by: Thomas Huth --- tests/libqos/virtio-mmio.c | 14 +++++++++++++- tests/libqos/virtio-pci.c | 14 +++++++++++++- tests/libqos/virtio.c | 20 ++++++-------------- tests/libqos/virtio.h | 6 +++--- tests/virtio-blk-test.c | 3 ++- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c index 5f37b51129..d0047876a8 100644 --- a/tests/libqos/virtio-mmio.c +++ b/tests/libqos/virtio-mmio.c @@ -101,6 +101,18 @@ static bool qvirtio_mmio_get_config_isr_status(QVirtio= Device *d) return false; } =20 +static void qvirtio_mmio_wait_config_isr_status(QVirtioDevice *d, + gint64 timeout_us) +{ + QVirtioMMIODevice *dev =3D container_of(d, QVirtioMMIODevice, vdev); + gint64 start_time =3D g_get_monotonic_time(); + + do { + g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); + qtest_clock_step(dev->qts, 100); + } while (!qvirtio_mmio_get_config_isr_status(d)); +} + static void qvirtio_mmio_queue_select(QVirtioDevice *d, uint16_t index) { QVirtioMMIODevice *dev =3D container_of(d, QVirtioMMIODevice, vdev); @@ -179,7 +191,7 @@ const QVirtioBus qvirtio_mmio =3D { .get_status =3D qvirtio_mmio_get_status, .set_status =3D qvirtio_mmio_set_status, .get_queue_isr_status =3D qvirtio_mmio_get_queue_isr_status, - .get_config_isr_status =3D qvirtio_mmio_get_config_isr_status, + .wait_config_isr_status =3D qvirtio_mmio_wait_config_isr_status, .queue_select =3D qvirtio_mmio_queue_select, .get_queue_size =3D qvirtio_mmio_get_queue_size, .set_queue_address =3D qvirtio_mmio_set_queue_address, diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c index 3f55c047a0..50499e75ef 100644 --- a/tests/libqos/virtio-pci.c +++ b/tests/libqos/virtio-pci.c @@ -175,6 +175,18 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioD= evice *d) } } =20 +static void qvirtio_pci_wait_config_isr_status(QVirtioDevice *d, + gint64 timeout_us) +{ + QVirtioPCIDevice *dev =3D container_of(d, QVirtioPCIDevice, vdev); + gint64 start_time =3D g_get_monotonic_time(); + + do { + g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); + qtest_clock_step(dev->pdev->bus->qts, 100); + } while (!qvirtio_pci_get_config_isr_status(d)); +} + static void qvirtio_pci_queue_select(QVirtioDevice *d, uint16_t index) { QVirtioPCIDevice *dev =3D container_of(d, QVirtioPCIDevice, vdev); @@ -257,7 +269,7 @@ const QVirtioBus qvirtio_pci =3D { .get_status =3D qvirtio_pci_get_status, .set_status =3D qvirtio_pci_set_status, .get_queue_isr_status =3D qvirtio_pci_get_queue_isr_status, - .get_config_isr_status =3D qvirtio_pci_get_config_isr_status, + .wait_config_isr_status =3D qvirtio_pci_wait_config_isr_status, .queue_select =3D qvirtio_pci_queue_select, .get_queue_size =3D qvirtio_pci_get_queue_size, .set_queue_address =3D qvirtio_pci_set_queue_address, diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 91ce06954b..0ae9956fc8 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -82,13 +82,13 @@ void qvirtio_set_driver_ok(QVirtioDevice *d) VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE); } =20 -void qvirtio_wait_queue_isr(QVirtioDevice *d, +void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq, gint64 timeout_us) { gint64 start_time =3D g_get_monotonic_time(); =20 for (;;) { - clock_step(100); + qtest_clock_step(qts, 100); if (d->bus->get_queue_isr_status(d, vq)) { return; } @@ -109,8 +109,8 @@ uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts= , QVirtioDevice *d, gint64 start_time =3D g_get_monotonic_time(); uint8_t val; =20 - while ((val =3D readb(addr)) =3D=3D 0xff) { - clock_step(100); + while ((val =3D qtest_readb(qts, addr)) =3D=3D 0xff) { + qtest_clock_step(qts, 100); g_assert(!d->bus->get_queue_isr_status(d, vq)); g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); } @@ -137,7 +137,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDev= ice *d, for (;;) { uint32_t got_desc_idx; =20 - clock_step(100); + qtest_clock_step(qts, 100); =20 if (d->bus->get_queue_isr_status(d, vq) && qvirtqueue_get_buf(qts, vq, &got_desc_idx, len)) { @@ -151,15 +151,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDe= vice *d, =20 void qvirtio_wait_config_isr(QVirtioDevice *d, gint64 timeout_us) { - gint64 start_time =3D g_get_monotonic_time(); - - for (;;) { - clock_step(100); - if (d->bus->get_config_isr_status(d)) { - return; - } - g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); - } + d->bus->wait_config_isr_status(d, timeout_us); } =20 void qvring_init(QTestState *qts, const QGuestAllocator *alloc, QVirtQueue= *vq, diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index 037176dbd8..2cb2448f46 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -69,8 +69,8 @@ struct QVirtioBus { /* Get the queue ISR status of the device */ bool (*get_queue_isr_status)(QVirtioDevice *d, QVirtQueue *vq); =20 - /* Get the configuration ISR status of the device */ - bool (*get_config_isr_status)(QVirtioDevice *d); + /* Wait for the configuration ISR status of the device */ + void (*wait_config_isr_status)(QVirtioDevice *d, gint64 timeout_us); =20 /* Select a queue to work on */ void (*queue_select)(QVirtioDevice *d, uint16_t index); @@ -112,7 +112,7 @@ void qvirtio_set_acknowledge(QVirtioDevice *d); void qvirtio_set_driver(QVirtioDevice *d); void qvirtio_set_driver_ok(QVirtioDevice *d); =20 -void qvirtio_wait_queue_isr(QVirtioDevice *d, +void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq, gint64 timeout_us); uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq, diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 982ff1538c..45375dc4ff 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -737,6 +737,7 @@ static void resize(void *obj, void *data, QGuestAllocat= or *t_alloc) int n_size =3D TEST_IMAGE_SIZE / 2; uint64_t capacity; QVirtQueue *vq; + QTestState *qts =3D global_qtest; =20 vq =3D qvirtqueue_setup(dev, t_alloc, 0); =20 @@ -746,7 +747,7 @@ static void resize(void *obj, void *data, QGuestAllocat= or *t_alloc) " 'arguments': { 'device': 'drive0', " " 'size': %d } }", n_size); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_queue_isr(qts, dev, vq, QVIRTIO_BLK_TIMEOUT_US); =20 capacity =3D qvirtio_config_readq(dev, 0); g_assert_cmpint(capacity, =3D=3D, n_size / 512); --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672704; cv=none; d=zoho.com; s=zohoarc; b=L5AXGx7dA3dpooC7WmZ7zRhHDsAst+4U2ur3Jt9w9DVtaKd35W5jc0IhlZFar6MLsi7YnrlgsGwJtcEO0ZrhEpiqEfFLZwOmXt5oLAVaDmEC64CVHRoQfXk9gUPWXDl1lSzznIr3xGXJUXiwfM3rdyeqWUnZl0jVL6Q1/e4MLKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672704; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=O7NZ5Hzlltp9gfiaztRo0KNNTRAXuD5yCSuTmcOW6Mg=; b=n6ul6/tBitMyZAUDexB/Vb5hemz5rhM+tjiFw9V3kAW2SngPfts8rhTfigKK+jsePzk+adQca0odHovR/RWTxZCqdvMUK5EifVBmnGZGbf1Aba+4oMdFIAFjjufa391ow6KX/j5XxQ3ar2IEZYjTRNyAvvMAFJcYdhuL8y/mqJc= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672704172798.8674000079455; Thu, 5 Sep 2019 01:38:24 -0700 (PDT) Received: from localhost ([::1]:43258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nHU-0005rC-Aa for importer@patchew.org; Thu, 05 Sep 2019 04:38:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33080) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAS-0007nS-Gm for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAR-0005pc-5n for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAQ-0005oy-WB for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:30:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 421FE3082124; Thu, 5 Sep 2019 08:30:58 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70B405D712; Thu, 5 Sep 2019 08:30:57 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:45 +0200 Message-Id: <20190905083049.11645-5-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 05 Sep 2019 08:30:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/8] tests: Remove unnecessary global_qtest references 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are going to remove global_qtest from the main libqtest library soon, so tests that do not urgently need global_qtest anymore should be cleaned from the unnecessary references. Message-Id: <20190904130047.25808-5-thuth@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Signed-off-by: Thomas Huth --- tests/ahci-test.c | 1 - tests/bios-tables-test.c | 1 - tests/ivshmem-test.c | 3 --- tests/rtas-test.c | 1 - 4 files changed, 6 deletions(-) diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 086811e602..c8d42ceea0 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -200,7 +200,6 @@ static void ahci_shutdown(AHCIQState *ahci) { QOSState *qs =3D ahci->parent; =20 - assert(!global_qtest); ahci_clean_mem(ahci); free_ahci_device(ahci->dev); g_free(ahci); diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index a356ac3489..9b3d8b0d1b 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -626,7 +626,6 @@ static void test_acpi_one(const char *params, test_data= *data) test_smbios_structs(data); } =20 - assert(!global_qtest); qtest_quit(data->qts); g_free(args); } diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index b76457948b..be9aa92a61 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -100,7 +100,6 @@ static inline void write_mem(IVState *s, uint64_t off, =20 static void cleanup_vm(IVState *s) { - assert(!global_qtest); g_free(s->dev); qtest_shutdown(s->qs); } @@ -388,7 +387,6 @@ static void test_ivshmem_hotplug(void) =20 qts =3D qtest_init("-object memory-backend-ram,size=3D1M,id=3Dmb1"); =20 - global_qtest =3D qts; /* TODO: Get rid of global_qtest here */ qtest_qmp_device_add(qts, "ivshmem-plain", "iv1", "{'addr': %s, 'memdev': 'mb1'}", stringify(PCI_SLOT_HP)); @@ -397,7 +395,6 @@ static void test_ivshmem_hotplug(void) } =20 qtest_quit(qts); - global_qtest =3D NULL; } =20 static void test_ivshmem_memdev(void) diff --git a/tests/rtas-test.c b/tests/rtas-test.c index ee888676ed..167b42db38 100644 --- a/tests/rtas-test.c +++ b/tests/rtas-test.c @@ -14,7 +14,6 @@ static void test_rtas_get_time_of_day(void) time_t t1, t2; =20 qs =3D qtest_spapr_boot("-machine pseries"); - global_qtest =3D qs->qts; =20 t1 =3D time(NULL); ret =3D qrtas_get_time_of_day(qs->qts, &qs->alloc, &tm, &ns); --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672455; cv=none; d=zoho.com; s=zohoarc; b=DDBjuwm2TTTZ77QabvV9nvV60txnkGi5zrNhn3GQDn0hGnRaCpRjmmN4MtSju2zTvW49oHMIJAIpzRpinga6eNOGEfIAfrocOkXxEVnrz/1Kl7dnZlsDUO0sR1eVmLyPaUbzcV7Pd/0XSGlFlpYP8GJJ8eFkEM4agPWqGgNXARc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672455; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NvGQQRHQySjKylaieb55dxmOKPA3e0qxIhmQ4YMt8p8=; b=Q5syq7Vmp1piAteFxrtejwnadpgWTa6wzEwhI345Cs0Ha25GRvXDgFKb04aWS+OpB9sPHX9g5ZaF2c5/2NGyxiUymY9JX5eeVY4BLRaYln/y4pJh1Al/VEu01eO7whPA6KDRKl+2XSGHR8XjjBAnwjGtQdIDnIKvJxlux4uc5t8= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672455319115.88917330561628; Thu, 5 Sep 2019 01:34:15 -0700 (PDT) Received: from localhost ([::1]:43230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nDa-00019N-66 for importer@patchew.org; Thu, 05 Sep 2019 04:34:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAW-0007qN-Ct for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAS-0005qR-M3 for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAS-0005q2-Ba for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F63180038D; Thu, 5 Sep 2019 08:30:59 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E2925D704; Thu, 5 Sep 2019 08:30:58 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:46 +0200 Message-Id: <20190905083049.11645-6-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Thu, 05 Sep 2019 08:30:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/8] tests/libqtest: Move global_test wrapper function into a separate header 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We want libqtest.h to become completely independent from global_qtest (so that the wrapper functions are not used by accident anymore). As a first step, move the wrapper functions into a separate header file. The new header is only included from libqtest.h for now, so that there is no difference to the users of libqtest.h yet. In the next patch, we will switch this, so that the users of the global_qtest-related functions will be using libqtest-single.h directly and libqtest.h becomes completely independent of this. Message-Id: <20190904130047.25808-6-thuth@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/libqtest-single.h | 311 ++++++++++++++++++++++++++++++++++++++++ tests/libqtest.c | 11 -- tests/libqtest.h | 287 +----------------------------------- 4 files changed, 313 insertions(+), 298 deletions(-) create mode 100644 tests/libqtest-single.h diff --git a/MAINTAINERS b/MAINTAINERS index c4c90f732d..65d8a7c2d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2079,7 +2079,7 @@ R: Paolo Bonzini S: Maintained F: qtest.c F: accel/qtest.c -F: tests/libqtest.* +F: tests/libqtest* F: tests/libqos/ F: tests/*-test.c =20 diff --git a/tests/libqtest-single.h b/tests/libqtest-single.h new file mode 100644 index 0000000000..49259558a5 --- /dev/null +++ b/tests/libqtest-single.h @@ -0,0 +1,311 @@ +/* + * QTest - wrappers for test with single QEMU instances + * + * Copyright IBM, Corp. 2012 + * Copyright Red Hat, Inc. 2012 + * Copyright SUSE LINUX Products GmbH 2013 + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#ifndef LIBQTEST_SINGLE_H +#define LIBQTEST_SINGLE_H + +/** + * qtest_start: + * @args: other arguments to pass to QEMU + * + * Start QEMU and assign the resulting #QTestState to a global variable. + * The global variable is used by "shortcut" functions documented below. + * + * Returns: #QTestState instance. + */ +static inline QTestState *qtest_start(const char *args) +{ + global_qtest =3D qtest_init(args); + return global_qtest; +} + +/** + * qtest_end: + * + * Shut down the QEMU process started by qtest_start(). + */ +static inline void qtest_end(void) +{ + if (!global_qtest) { + return; + } + qtest_quit(global_qtest); + global_qtest =3D NULL; +} + +/** + * qmp: + * @fmt...: QMP message to send to qemu, formatted like + * qobject_from_jsonf_nofail(). See parse_escape() for what's + * supported after '%'. + * + * Sends a QMP message to QEMU and returns the response. + */ +GCC_FMT_ATTR(1, 2) +static inline QDict *qmp(const char *fmt, ...) +{ + va_list ap; + QDict *response; + + va_start(ap, fmt); + response =3D qtest_vqmp(global_qtest, fmt, ap); + va_end(ap); + return response; +} + +/** + * qmp_eventwait: + * @s: #event event to wait for. + * + * Continuously polls for QMP responses until it receives the desired even= t. + */ +static inline void qmp_eventwait(const char *event) +{ + return qtest_qmp_eventwait(global_qtest, event); +} + +/** + * get_irq: + * @num: Interrupt to observe. + * + * Returns: The level of the @num interrupt. + */ +static inline bool get_irq(int num) +{ + return qtest_get_irq(global_qtest, num); +} + +/** + * outb: + * @addr: I/O port to write to. + * @value: Value being written. + * + * Write an 8-bit value to an I/O port. + */ +static inline void outb(uint16_t addr, uint8_t value) +{ + qtest_outb(global_qtest, addr, value); +} + +/** + * outw: + * @addr: I/O port to write to. + * @value: Value being written. + * + * Write a 16-bit value to an I/O port. + */ +static inline void outw(uint16_t addr, uint16_t value) +{ + qtest_outw(global_qtest, addr, value); +} + +/** + * outl: + * @addr: I/O port to write to. + * @value: Value being written. + * + * Write a 32-bit value to an I/O port. + */ +static inline void outl(uint16_t addr, uint32_t value) +{ + qtest_outl(global_qtest, addr, value); +} + +/** + * inb: + * @addr: I/O port to read from. + * + * Reads an 8-bit value from an I/O port. + * + * Returns: Value read. + */ +static inline uint8_t inb(uint16_t addr) +{ + return qtest_inb(global_qtest, addr); +} + +/** + * inw: + * @addr: I/O port to read from. + * + * Reads a 16-bit value from an I/O port. + * + * Returns: Value read. + */ +static inline uint16_t inw(uint16_t addr) +{ + return qtest_inw(global_qtest, addr); +} + +/** + * inl: + * @addr: I/O port to read from. + * + * Reads a 32-bit value from an I/O port. + * + * Returns: Value read. + */ +static inline uint32_t inl(uint16_t addr) +{ + return qtest_inl(global_qtest, addr); +} + +/** + * writeb: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes an 8-bit value to guest memory. + */ +static inline void writeb(uint64_t addr, uint8_t value) +{ + qtest_writeb(global_qtest, addr, value); +} + +/** + * writew: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes a 16-bit value to guest memory. + */ +static inline void writew(uint64_t addr, uint16_t value) +{ + qtest_writew(global_qtest, addr, value); +} + +/** + * writel: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes a 32-bit value to guest memory. + */ +static inline void writel(uint64_t addr, uint32_t value) +{ + qtest_writel(global_qtest, addr, value); +} + +/** + * writeq: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes a 64-bit value to guest memory. + */ +static inline void writeq(uint64_t addr, uint64_t value) +{ + qtest_writeq(global_qtest, addr, value); +} + +/** + * readb: + * @addr: Guest address to read from. + * + * Reads an 8-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint8_t readb(uint64_t addr) +{ + return qtest_readb(global_qtest, addr); +} + +/** + * readw: + * @addr: Guest address to read from. + * + * Reads a 16-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint16_t readw(uint64_t addr) +{ + return qtest_readw(global_qtest, addr); +} + +/** + * readl: + * @addr: Guest address to read from. + * + * Reads a 32-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint32_t readl(uint64_t addr) +{ + return qtest_readl(global_qtest, addr); +} + +/** + * readq: + * @addr: Guest address to read from. + * + * Reads a 64-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint64_t readq(uint64_t addr) +{ + return qtest_readq(global_qtest, addr); +} + +/** + * memread: + * @addr: Guest address to read from. + * @data: Pointer to where memory contents will be stored. + * @size: Number of bytes to read. + * + * Read guest memory into a buffer. + */ +static inline void memread(uint64_t addr, void *data, size_t size) +{ + qtest_memread(global_qtest, addr, data, size); +} + +/** + * memwrite: + * @addr: Guest address to write to. + * @data: Pointer to the bytes that will be written to guest memory. + * @size: Number of bytes to write. + * + * Write a buffer to guest memory. + */ +static inline void memwrite(uint64_t addr, const void *data, size_t size) +{ + qtest_memwrite(global_qtest, addr, data, size); +} + +/** + * clock_step_next: + * + * Advance the QEMU_CLOCK_VIRTUAL to the next deadline. + * + * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. + */ +static inline int64_t clock_step_next(void) +{ + return qtest_clock_step_next(global_qtest); +} + +/** + * clock_step: + * @step: Number of nanoseconds to advance the clock by. + * + * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds. + * + * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. + */ +static inline int64_t clock_step(int64_t step) +{ + return qtest_clock_step(global_qtest, step); +} + +#endif diff --git a/tests/libqtest.c b/tests/libqtest.c index 2713b86cf7..e5101d9d3a 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -1106,17 +1106,6 @@ void qtest_memset(QTestState *s, uint64_t addr, uint= 8_t pattern, size_t size) qtest_rsp(s, 0); } =20 -QDict *qmp(const char *fmt, ...) -{ - va_list ap; - QDict *response; - - va_start(ap, fmt); - response =3D qtest_vqmp(global_qtest, fmt, ap); - va_end(ap); - return response; -} - void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) { va_list ap; diff --git a/tests/libqtest.h b/tests/libqtest.h index 07ea35867c..6a7d7e41ad 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -628,45 +628,6 @@ void qtest_add_data_func_full(const char *str, void *d= ata, =20 void qtest_add_abrt_handler(GHookFunc fn, const void *data); =20 -/** - * qtest_start: - * @args: other arguments to pass to QEMU - * - * Start QEMU and assign the resulting #QTestState to a global variable. - * The global variable is used by "shortcut" functions documented below. - * - * Returns: #QTestState instance. - */ -static inline QTestState *qtest_start(const char *args) -{ - global_qtest =3D qtest_init(args); - return global_qtest; -} - -/** - * qtest_end: - * - * Shut down the QEMU process started by qtest_start(). - */ -static inline void qtest_end(void) -{ - if (!global_qtest) { - return; - } - qtest_quit(global_qtest); - global_qtest =3D NULL; -} - -/** - * qmp: - * @fmt...: QMP message to send to qemu, formatted like - * qobject_from_jsonf_nofail(). See parse_escape() for what's - * supported after '%'. - * - * Sends a QMP message to QEMU and returns the response. - */ -QDict *qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); - /** * qtest_qmp_assert_success: * @qts: QTestState instance to operate on @@ -680,253 +641,7 @@ QDict *qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) GCC_FMT_ATTR(2, 3); =20 -/* - * qmp_eventwait: - * @s: #event event to wait for. - * - * Continuously polls for QMP responses until it receives the desired even= t. - */ -static inline void qmp_eventwait(const char *event) -{ - return qtest_qmp_eventwait(global_qtest, event); -} - -/** - * get_irq: - * @num: Interrupt to observe. - * - * Returns: The level of the @num interrupt. - */ -static inline bool get_irq(int num) -{ - return qtest_get_irq(global_qtest, num); -} - -/** - * outb: - * @addr: I/O port to write to. - * @value: Value being written. - * - * Write an 8-bit value to an I/O port. - */ -static inline void outb(uint16_t addr, uint8_t value) -{ - qtest_outb(global_qtest, addr, value); -} - -/** - * outw: - * @addr: I/O port to write to. - * @value: Value being written. - * - * Write a 16-bit value to an I/O port. - */ -static inline void outw(uint16_t addr, uint16_t value) -{ - qtest_outw(global_qtest, addr, value); -} - -/** - * outl: - * @addr: I/O port to write to. - * @value: Value being written. - * - * Write a 32-bit value to an I/O port. - */ -static inline void outl(uint16_t addr, uint32_t value) -{ - qtest_outl(global_qtest, addr, value); -} - -/** - * inb: - * @addr: I/O port to read from. - * - * Reads an 8-bit value from an I/O port. - * - * Returns: Value read. - */ -static inline uint8_t inb(uint16_t addr) -{ - return qtest_inb(global_qtest, addr); -} - -/** - * inw: - * @addr: I/O port to read from. - * - * Reads a 16-bit value from an I/O port. - * - * Returns: Value read. - */ -static inline uint16_t inw(uint16_t addr) -{ - return qtest_inw(global_qtest, addr); -} - -/** - * inl: - * @addr: I/O port to read from. - * - * Reads a 32-bit value from an I/O port. - * - * Returns: Value read. - */ -static inline uint32_t inl(uint16_t addr) -{ - return qtest_inl(global_qtest, addr); -} - -/** - * writeb: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes an 8-bit value to guest memory. - */ -static inline void writeb(uint64_t addr, uint8_t value) -{ - qtest_writeb(global_qtest, addr, value); -} - -/** - * writew: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes a 16-bit value to guest memory. - */ -static inline void writew(uint64_t addr, uint16_t value) -{ - qtest_writew(global_qtest, addr, value); -} - -/** - * writel: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes a 32-bit value to guest memory. - */ -static inline void writel(uint64_t addr, uint32_t value) -{ - qtest_writel(global_qtest, addr, value); -} - -/** - * writeq: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes a 64-bit value to guest memory. - */ -static inline void writeq(uint64_t addr, uint64_t value) -{ - qtest_writeq(global_qtest, addr, value); -} - -/** - * readb: - * @addr: Guest address to read from. - * - * Reads an 8-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint8_t readb(uint64_t addr) -{ - return qtest_readb(global_qtest, addr); -} - -/** - * readw: - * @addr: Guest address to read from. - * - * Reads a 16-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint16_t readw(uint64_t addr) -{ - return qtest_readw(global_qtest, addr); -} - -/** - * readl: - * @addr: Guest address to read from. - * - * Reads a 32-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint32_t readl(uint64_t addr) -{ - return qtest_readl(global_qtest, addr); -} - -/** - * readq: - * @addr: Guest address to read from. - * - * Reads a 64-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint64_t readq(uint64_t addr) -{ - return qtest_readq(global_qtest, addr); -} - -/** - * memread: - * @addr: Guest address to read from. - * @data: Pointer to where memory contents will be stored. - * @size: Number of bytes to read. - * - * Read guest memory into a buffer. - */ -static inline void memread(uint64_t addr, void *data, size_t size) -{ - qtest_memread(global_qtest, addr, data, size); -} - -/** - * memwrite: - * @addr: Guest address to write to. - * @data: Pointer to the bytes that will be written to guest memory. - * @size: Number of bytes to write. - * - * Write a buffer to guest memory. - */ -static inline void memwrite(uint64_t addr, const void *data, size_t size) -{ - qtest_memwrite(global_qtest, addr, data, size); -} - -/** - * clock_step_next: - * - * Advance the QEMU_CLOCK_VIRTUAL to the next deadline. - * - * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. - */ -static inline int64_t clock_step_next(void) -{ - return qtest_clock_step_next(global_qtest); -} - -/** - * clock_step: - * @step: Number of nanoseconds to advance the clock by. - * - * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds. - * - * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. - */ -static inline int64_t clock_step(int64_t step) -{ - return qtest_clock_step(global_qtest, step); -} +#include "libqtest-single.h" =20 QDict *qmp_fd_receive(int fd); void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672799; cv=none; d=zoho.com; s=zohoarc; b=Y4Yy+fWggWXBwWmfWDzVU57e7yTKTZcCGYlIn4UlQU7r5nishpNcyJEjiuqsj4ouzOgw0FWktUGZ02Xf3FQPJPYD+QYgQlRN2hiSJwkYKLAndLe8OmpvNLnzcsfoU43MuYNfuaqIskvYWP26yS3+pkjGTcQVswn1yynwWJA//G4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672799; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+Oi1plvyx064WWfafxJoZd6Ibf7PIjRxhjm9gmeh3/M=; b=lKgXqOKr8Q8bBS5ANeKwbuE3q7QeqKBhItyVHF9aAvAJiCygifUE7bcWpC4pqkLb0ReLejdpgZlE/TVcYiIMiL81kbjqvEk8mFw7R3tZFGx0hc1GmnKXAaM22bltfAgeXkA6+82HP0CDpaMK+8xp3uuVuFtKbYc5+bLiEB8xMRg= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672799180955.7257920691698; Thu, 5 Sep 2019 01:39:59 -0700 (PDT) Received: from localhost ([::1]:43277 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nJ4-0007zl-Rb for importer@patchew.org; Thu, 05 Sep 2019 04:39:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33120) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAW-0007qM-EJ for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAT-0005qt-JN for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39828) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAT-0005qZ-Av for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 912263086208; Thu, 5 Sep 2019 08:31:00 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB2C35D704; Thu, 5 Sep 2019 08:30:59 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:47 +0200 Message-Id: <20190905083049.11645-7-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 05 Sep 2019 08:31:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/8] tests/libqtest: Use libqtest-single.h in tests that require global_qtest 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Tests that require global_qtest or the related wrapper functions now use the libqtest-single.h header that is dedicated for everything related to global_qtest. The core libqtest.c and libqtest.h files are now completely indepedent from global_qtest, so that the core library is now not depending on a global state anymore. Message-Id: <20190904130047.25808-7-thuth@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Signed-off-by: Thomas Huth --- tests/cpu-plug-test.c | 2 +- tests/display-vga-test.c | 2 +- tests/e1000e-test.c | 2 +- tests/fdc-test.c | 2 +- tests/i440fx-test.c | 2 +- tests/i82801b11-test.c | 2 +- tests/intel-hda-test.c | 2 +- tests/ioh3420-test.c | 2 +- tests/ipmi-kcs-test.c | 3 +-- tests/libqtest-single.h | 4 ++++ tests/libqtest.c | 2 -- tests/libqtest.h | 4 ---- tests/m25p80-test.c | 2 +- tests/qos-test.c | 2 +- tests/rtc-test.c | 2 +- tests/rtl8139-test.c | 2 +- tests/test-arm-mptimer.c | 2 +- tests/test-netfilter.c | 2 +- tests/test-x86-cpuid-compat.c | 2 +- tests/tmp105-test.c | 2 +- tests/tpm-crb-test.c | 2 +- tests/tpm-tests.c | 2 +- tests/tpm-tis-test.c | 2 +- tests/usb-hcd-ohci-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/vhost-user-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-ccw-test.c | 2 +- tests/virtio-net-test.c | 2 +- tests/virtio-scsi-test.c | 2 +- tests/virtio-serial-test.c | 2 +- 32 files changed, 33 insertions(+), 36 deletions(-) diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c index 3049620854..776407e1b6 100644 --- a/tests/cpu-plug-test.c +++ b/tests/cpu-plug-test.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" =20 #include "qemu-common.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" =20 struct PlugTestData { diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c index bd176dcf3a..ace3bb28e0 100644 --- a/tests/display-vga-test.c +++ b/tests/display-vga-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 static void pci_cirrus(void) { diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c index 93628c588d..1a232a663a 100644 --- a/tests/e1000e-test.c +++ b/tests/e1000e-test.c @@ -26,7 +26,7 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu-common.h" #include "libqos/pci-pc.h" #include "qemu/sockets.h" diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 31cd3295c1..26b69f7c5c 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" =20 =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" #include "qemu-common.h" =20 diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index 69205b58a8..1f57d9684b 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" #include "hw/pci/pci_regs.h" diff --git a/tests/i82801b11-test.c b/tests/i82801b11-test.c index a6e31594c9..4345da338b 100644 --- a/tests/i82801b11-test.c +++ b/tests/i82801b11-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/intel-hda-test.c b/tests/intel-hda-test.c index b782b2e944..fc25ccc33c 100644 --- a/tests/intel-hda-test.c +++ b/tests/intel-hda-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 #define HDA_ID "hda0" #define CODEC_DEVICES " -device hda-output,bus=3D" HDA_ID ".0" \ diff --git a/tests/ioh3420-test.c b/tests/ioh3420-test.c index b54c4b9f11..f6ca43cca7 100644 --- a/tests/ioh3420-test.c +++ b/tests/ioh3420-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/ipmi-kcs-test.c b/tests/ipmi-kcs-test.c index a2354c10c7..693a6aacb5 100644 --- a/tests/ipmi-kcs-test.c +++ b/tests/ipmi-kcs-test.c @@ -24,8 +24,7 @@ =20 #include "qemu/osdep.h" =20 - -#include "libqtest.h" +#include "libqtest-single.h" =20 #define IPMI_IRQ 5 =20 diff --git a/tests/libqtest-single.h b/tests/libqtest-single.h index 49259558a5..6f1bb1331c 100644 --- a/tests/libqtest-single.h +++ b/tests/libqtest-single.h @@ -11,6 +11,10 @@ #ifndef LIBQTEST_SINGLE_H #define LIBQTEST_SINGLE_H =20 +#include "libqtest.h" + +QTestState *global_qtest __attribute__((common, weak)); + /** * qtest_start: * @args: other arguments to pass to QEMU diff --git a/tests/libqtest.c b/tests/libqtest.c index e5101d9d3a..0a6b91737e 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -35,8 +35,6 @@ #define SOCKET_TIMEOUT 50 #define SOCKET_MAX_FDS 16 =20 -QTestState *global_qtest; - struct QTestState { int fd; diff --git a/tests/libqtest.h b/tests/libqtest.h index 6a7d7e41ad..c8cffe5d68 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -22,8 +22,6 @@ =20 typedef struct QTestState QTestState; =20 -extern QTestState *global_qtest; - /** * qtest_initf: * @fmt...: Format for creating other arguments to pass to QEMU, formatted @@ -641,8 +639,6 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *d= ata); void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) GCC_FMT_ATTR(2, 3); =20 -#include "libqtest-single.h" - QDict *qmp_fd_receive(int fd); void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, const char *fmt, va_list ap) GCC_FMT_ATTR(4, 0); diff --git a/tests/m25p80-test.c b/tests/m25p80-test.c index 055f7246a8..50c6b79fb3 100644 --- a/tests/m25p80-test.c +++ b/tests/m25p80-test.c @@ -25,7 +25,7 @@ =20 #include "qemu/osdep.h" #include "qemu/bswap.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 /* * ASPEED SPI Controller registers diff --git a/tests/qos-test.c b/tests/qos-test.c index 3c0071b3b7..fd70d73ea5 100644 --- a/tests/qos-test.c +++ b/tests/qos-test.c @@ -18,7 +18,7 @@ =20 #include "qemu/osdep.h" #include -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qstring.h" diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 509be707e3..6309b0ef6c 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/timer.h" #include "hw/timer/mc146818rtc_regs.h" =20 diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c index d6d0c24909..4506049264 100644 --- a/tests/rtl8139-test.c +++ b/tests/rtl8139-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/pci-pc.h" #include "qemu/timer.h" #include "qemu-common.h" diff --git a/tests/test-arm-mptimer.c b/tests/test-arm-mptimer.c index 156a39f50d..7a56d56da9 100644 --- a/tests/test-arm-mptimer.c +++ b/tests/test-arm-mptimer.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" #include "qemu/timer.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 #define TIMER_BLOCK_SCALE(s) ((((s) & 0xff) + 1) * 10) =20 diff --git a/tests/test-netfilter.c b/tests/test-netfilter.c index e47075dd06..22927ee6ab 100644 --- a/tests/test-netfilter.c +++ b/tests/test-netfilter.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" =20 /* add a netfilter to a netdev and then remove it */ diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c index e75b959950..772287bdb4 100644 --- a/tests/test-x86-cpuid-compat.c +++ b/tests/test-x86-cpuid-compat.c @@ -4,7 +4,7 @@ #include "qapi/qmp/qlist.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qbool.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 static char *get_cpu0_qom_path(void) { diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c index f599309a4a..f930a96b83 100644 --- a/tests/tmp105-test.c +++ b/tests/tmp105-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/qgraph.h" #include "libqos/i2c.h" #include "qapi/qmp/qdict.h" diff --git a/tests/tpm-crb-test.c b/tests/tpm-crb-test.c index a139caa51d..632fb7fbd8 100644 --- a/tests/tpm-crb-test.c +++ b/tests/tpm-crb-test.c @@ -15,7 +15,7 @@ =20 #include "hw/acpi/tpm.h" #include "io/channel-socket.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "tpm-emu.h" =20 diff --git a/tests/tpm-tests.c b/tests/tpm-tests.c index e640777aa9..6e45a0ba85 100644 --- a/tests/tpm-tests.c +++ b/tests/tpm-tests.c @@ -15,7 +15,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "tpm-tests.h" =20 static bool diff --git a/tests/tpm-tis-test.c b/tests/tpm-tis-test.c index 92a7e95aad..dcf30e05b7 100644 --- a/tests/tpm-tis-test.c +++ b/tests/tpm-tis-test.c @@ -17,7 +17,7 @@ =20 #include "hw/acpi/tpm.h" #include "io/channel-socket.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "tpm-emu.h" =20 diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c index 0cd73b7363..19d760f3fb 100644 --- a/tests/usb-hcd-ohci-test.c +++ b/tests/usb-hcd-ohci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "libqos/usb.h" #include "libqos/qgraph.h" diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c index 2eef8e3d1c..7a117b64d9 100644 --- a/tests/usb-hcd-uhci-test.c +++ b/tests/usb-hcd-uhci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/libqos.h" #include "libqos/usb.h" #include "libqos/libqos-pc.h" diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c index 01845371f9..10ef9d2a91 100644 --- a/tests/usb-hcd-xhci-test.c +++ b/tests/usb-hcd-xhci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/usb.h" =20 =20 diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 6ae8a23688..91ea373ba5 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -10,7 +10,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qemu/config-file.h" diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 45375dc4ff..ed13167392 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/bswap.h" #include "qemu/module.h" #include "standard-headers/linux/virtio_blk.h" diff --git a/tests/virtio-ccw-test.c b/tests/virtio-ccw-test.c index 9f445ef4ad..d05236407b 100644 --- a/tests/virtio-ccw-test.c +++ b/tests/virtio-ccw-test.c @@ -14,7 +14,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/virtio.h" =20 static void virtio_balloon_nop(void) diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 840875aaae..a08e2ffe12 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/iov.h" #include "qemu/module.h" #include "qapi/qmp/qdict.h" diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index 09348765d7..7c8f9b27f8 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "scsi/constants.h" #include "libqos/libqos-pc.h" diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c index e584ad76e8..2541034822 100644 --- a/tests/virtio-serial-test.c +++ b/tests/virtio-serial-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "libqos/virtio-serial.h" =20 --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672656; cv=none; d=zoho.com; s=zohoarc; b=hH/DCTGWPTcl7XWilko4zqIaWbrd6KE+JxNtsKYaIe/3Fq4Drin8yTvU6/9P+Pl3ReLGnQJAkVRX91aV7QgRGS/SGAMcc0I+ee16SL36bgYoxNkdMZ2B00VgxiylfDB1c470Mo19P8wNB9evk9ojDvga3sySdwQmY4IgW9xKw9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672656; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ydEytqZGoktE4hPHsw5By/d9Ruud+BCCwhB+ygvNC30=; b=ItXNtmMyliDSmRvovTGkGcDw+Y5KlwUWnoAks632IRE/SMj5LgYJysqKtDEynxB1ttEyWySYCgjk6uMnwQ3GhvD7A578cJg3p0dCH9eHqV3+FsGCNXYzeLP2RL3uwbiUUY5WCY9TJGNQp22fqlggeKeIkzNOqWOwMJqLIn5yEvw= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672656104643.3853172908401; Thu, 5 Sep 2019 01:37:36 -0700 (PDT) Received: from localhost ([::1]:43254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nGo-0004kD-94 for importer@patchew.org; Thu, 05 Sep 2019 04:37:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33122) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAW-0007qO-Dl for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAU-0005rd-Mk for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42476) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAU-0005rC-CQ for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94F4610C6976; Thu, 5 Sep 2019 08:31:01 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD1385D704; Thu, 5 Sep 2019 08:31:00 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:48 +0200 Message-Id: <20190905083049.11645-8-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 05 Sep 2019 08:31:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 7/8] tests/vm: Take the J=x setting into account for the vm-boot-ssh targets, too 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For testing whether the VMs can deal with multiple CPUs correctly, it is useful to be able to use the "J=3D" setting for the vm-boot-ssh targets, too. Message-Id: <20190726100207.19112-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/vm/Makefile.include | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 3560716092..fea348e845 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -80,6 +80,7 @@ vm-boot-serial-%: $(IMAGES_DIR)/%.img vm-boot-ssh-%: $(IMAGES_DIR)/%.img $(call quiet-command, \ $(SRC_PATH)/tests/vm/$* \ + $(if $(J),--jobs $(J)) \ --image "$<" \ --interactive \ false, \ --=20 2.18.1 From nobody Mon Apr 29 12:15:23 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567672808; cv=none; d=zoho.com; s=zohoarc; b=AVgP8zxN6oNDR29SqRIjXAGcvBMl1W+Xk9CbVNq2L0L68wnkGR9fZLnLVESA0WTFuUuFjdgR+rX+yXZKDJJ5R9EvqPgMlYYPr6ZT5hDpANyiyvtQvOFlSA1AQMc0c8tdQQgC13YG9raS9b0/qPUrd1OqkT12sNYwyzwWMnZELBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567672808; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=P7/C3+r/RZqb/os+7vczAXeuAEZOIaAT8cVj3/7m4BE=; b=leAqax6kGpI6CqO7zAP5lDu3+mX28B5gud07I1G3kq6J9gFmKkx/anDydayGpkNoV2TG67lcFyURku9t9nDXiC3E00Mu9ny5SSxedbplQ9CHn84Z88IcCM/JvoEifAdRC408BHTqPMRRgNDFyIvcA9i5zGSsRjv1qzWdjS+3UlM= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567672808889754.0313651048484; Thu, 5 Sep 2019 01:40:08 -0700 (PDT) Received: from localhost ([::1]:43280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nJH-0008Gr-G4 for importer@patchew.org; Thu, 05 Sep 2019 04:40:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33163) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5nAi-0007s6-H4 for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5nAY-0005sw-84 for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43610) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5nAW-0005rn-9E for qemu-devel@nongnu.org; Thu, 05 Sep 2019 04:31:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3D358A1C86; Thu, 5 Sep 2019 08:31:02 +0000 (UTC) Received: from thuth.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id E16B85D704; Thu, 5 Sep 2019 08:31:01 +0000 (UTC) From: Thomas Huth To: Peter Maydell Date: Thu, 5 Sep 2019 10:30:49 +0200 Message-Id: <20190905083049.11645-9-thuth@redhat.com> In-Reply-To: <20190905083049.11645-1-thuth@redhat.com> References: <20190905083049.11645-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Thu, 05 Sep 2019 08:31:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 8/8] qemu-doc: Do not hard-code the name of the QEMU binary 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In our documentation, we use a mix of "$QEMU", "qemu-system-i386" and "qemu-system-x86_64" when we give examples to the users how to run QEMU. Some more consistency would be good here. Also some distributions use different names for the QEMU binary (e.g. "qemu-kvm" in RHEL), so providing more flexibility here would also be good. Thus let's define some variables for the names of the QEMU command and use those in the documentation instead: @value{qemu_system} for generic examples, and @value{qemu_system_x86} for examples that only work with the x86 binaries. Message-Id: <20190828093447.12441-1-thuth@redhat.com> Reviewed-by: John Snow Reviewed-by: Miroslav Rezanina Signed-off-by: Thomas Huth --- docs/qemu-block-drivers.texi | 72 ++++++++++---------- docs/qemu-cpu-models.texi | 10 +-- qemu-doc.texi | 81 +++++++++++----------- qemu-options.hx | 128 +++++++++++++++++------------------ 4 files changed, 149 insertions(+), 142 deletions(-) diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi index c02547e28c..2c7ea49c32 100644 --- a/docs/qemu-block-drivers.texi +++ b/docs/qemu-block-drivers.texi @@ -2,6 +2,8 @@ QEMU block driver reference manual @c man end =20 +@set qemu_system qemu-system-x86_64 + @c man begin DESCRIPTION =20 @node disk_images_formats @@ -405,7 +407,7 @@ QEMU can automatically create a virtual FAT disk image = from a directory tree. In order to use it, just type: =20 @example -qemu-system-i386 linux.img -hdb fat:/my_directory +@value{qemu_system} linux.img -hdb fat:/my_directory @end example =20 Then you access access to all the files in the @file{/my_directory} @@ -415,14 +417,14 @@ them via SAMBA or NFS. The default access is @emph{re= ad-only}. Floppies can be emulated with the @code{:floppy:} option: =20 @example -qemu-system-i386 linux.img -fda fat:floppy:/my_directory +@value{qemu_system} linux.img -fda fat:floppy:/my_directory @end example =20 A read/write support is available for testing (beta stage) with the @code{:rw:} option: =20 @example -qemu-system-i386 linux.img -fda fat:floppy:rw:/my_directory +@value{qemu_system} linux.img -fda fat:floppy:rw:/my_directory @end example =20 What you should @emph{never} do: @@ -440,14 +442,14 @@ QEMU can access directly to block device exported usi= ng the Network Block Device protocol. =20 @example -qemu-system-i386 linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/ +@value{qemu_system} linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/ @end example =20 If the NBD server is located on the same host, you can use an unix socket = instead of an inet socket: =20 @example -qemu-system-i386 linux.img -hdb nbd+unix://?socket=3D/tmp/my_socket +@value{qemu_system} linux.img -hdb nbd+unix://?socket=3D/tmp/my_socket @end example =20 In this case, the block device must be exported using qemu-nbd: @@ -464,23 +466,23 @@ qemu-nbd --socket=3D/tmp/my_socket --share=3D2 my_dis= k.qcow2 @noindent and then you can use it with two guests: @example -qemu-system-i386 linux1.img -hdb nbd+unix://?socket=3D/tmp/my_socket -qemu-system-i386 linux2.img -hdb nbd+unix://?socket=3D/tmp/my_socket +@value{qemu_system} linux1.img -hdb nbd+unix://?socket=3D/tmp/my_socket +@value{qemu_system} linux2.img -hdb nbd+unix://?socket=3D/tmp/my_socket @end example =20 If the nbd-server uses named exports (supported since NBD 2.9.18, or with = QEMU's own embedded NBD server), you must specify an export name in the URI: @example -qemu-system-i386 -cdrom nbd://localhost/debian-500-ppc-netinst -qemu-system-i386 -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst +@value{qemu_system} -cdrom nbd://localhost/debian-500-ppc-netinst +@value{qemu_system} -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst @end example =20 The URI syntax for NBD is supported since QEMU 1.3. An alternative syntax= is also available. Here are some example of the older syntax: @example -qemu-system-i386 linux.img -hdb nbd:my_nbd_server.mydomain.org:1024 -qemu-system-i386 linux2.img -hdb nbd:unix:/tmp/my_socket -qemu-system-i386 -cdrom nbd:localhost:10809:exportname=3Ddebian-500-ppc-ne= tinst +@value{qemu_system} linux.img -hdb nbd:my_nbd_server.mydomain.org:1024 +@value{qemu_system} linux2.img -hdb nbd:unix:/tmp/my_socket +@value{qemu_system} -cdrom nbd:localhost:10809:exportname=3Ddebian-500-ppc= -netinst @end example =20 @node disk_images_sheepdog @@ -505,7 +507,7 @@ qemu-img convert @var{filename} sheepdog:///@var{image} =20 You can boot from the Sheepdog disk image with the command: @example -qemu-system-i386 sheepdog:///@var{image} +@value{qemu_system} sheepdog:///@var{image} @end example =20 You can also create a snapshot of the Sheepdog image like qcow2. @@ -517,7 +519,7 @@ where @var{tag} is a tag name of the newly created snap= shot. To boot from the Sheepdog snapshot, specify the tag name of the snapshot. @example -qemu-system-i386 sheepdog:///@var{image}#@var{tag} +@value{qemu_system} sheepdog:///@var{image}#@var{tag} @end example =20 You can create a cloned image from the existing snapshot. @@ -530,14 +532,14 @@ is its tag name. You can use an unix socket instead of an inet socket: =20 @example -qemu-system-i386 sheepdog+unix:///@var{image}?socket=3D@var{path} +@value{qemu_system} sheepdog+unix:///@var{image}?socket=3D@var{path} @end example =20 If the Sheepdog daemon doesn't run on the local host, you need to specify one of the Sheepdog servers to connect to. @example qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size} -qemu-system-i386 sheepdog://@var{hostname}:@var{port}/@var{image} +@value{qemu_system} sheepdog://@var{hostname}:@var{port}/@var{image} @end example =20 @node disk_images_iscsi @@ -627,7 +629,7 @@ cat >iscsi.conf < /sys/bus/pci/devices/0000:06:0d.0/driver/unbind # echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id =20 -# qemu-system-x86_64 -drive file=3Dnvme://@var{host}:@var{bus}:@var{slot}.= @var{func}/@var{namespace} +# @value{qemu_system} -drive file=3Dnvme://@var{host}:@var{bus}:@var{slot}= .@var{func}/@var{namespace} @end example =20 Alternative syntax using properties: =20 @example -qemu-system-x86_64 -drive file.driver=3Dnvme,file.device=3D@var{host}:@var= {bus}:@var{slot}.@var{func},file.namespace=3D@var{namespace} +@value{qemu_system} -drive file.driver=3Dnvme,file.device=3D@var{host}:@va= r{bus}:@var{slot}.@var{func},file.namespace=3D@var{namespace} @end example =20 @var{host}:@var{bus}:@var{slot}.@var{func} is the NVMe controller's PCI de= vice diff --git a/docs/qemu-cpu-models.texi b/docs/qemu-cpu-models.texi index ad040cfc98..f88a1def0d 100644 --- a/docs/qemu-cpu-models.texi +++ b/docs/qemu-cpu-models.texi @@ -2,6 +2,8 @@ QEMU / KVM CPU model configuration @c man end =20 +@set qemu_system_x86 qemu-system-x86_64 + @c man begin DESCRIPTION =20 @menu @@ -578,25 +580,25 @@ CPU models / features in QEMU and libvirt @item Host passthrough =20 @example - $ qemu-system-x86_64 -cpu host + $ @value{qemu_system_x86} -cpu host @end example =20 With feature customization: =20 @example - $ qemu-system-x86_64 -cpu host,-vmx,... + $ @value{qemu_system_x86} -cpu host,-vmx,... @end example =20 @item Named CPU models =20 @example - $ qemu-system-x86_64 -cpu Westmere + $ @value{qemu_system_x86} -cpu Westmere @end example =20 With feature customization: =20 @example - $ qemu-system-x86_64 -cpu Westmere,+pcid,... + $ @value{qemu_system_x86} -cpu Westmere,+pcid,... @end example =20 @end table diff --git a/qemu-doc.texi b/qemu-doc.texi index 577d1e8376..b2654c76a0 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -11,6 +11,9 @@ @paragraphindent 0 @c %**end of header =20 +@set qemu_system qemu-system-x86_64 +@set qemu_system_x86 qemu-system-x86_64 + @ifinfo @direntry * QEMU: (qemu-doc). The QEMU Emulator User Documentation. @@ -207,12 +210,12 @@ Note that, by default, GUS shares IRQ(7) with paralle= l ports and so QEMU must be told to not have parallel ports to have working GUS. =20 @example -qemu-system-i386 dos.img -soundhw gus -parallel none +@value{qemu_system_x86} dos.img -soundhw gus -parallel none @end example =20 Alternatively: @example -qemu-system-i386 dos.img -device gus,irq=3D5 +@value{qemu_system_x86} dos.img -device gus,irq=3D5 @end example =20 Or some other unclaimed IRQ. @@ -225,10 +228,11 @@ CS4231A is the chip used in Windows Sound System and = GUSMAX products @section Quick Start @cindex quick start =20 -Download and uncompress the linux image (@file{linux.img}) and type: +Download and uncompress a hard disk image with Linux installed (e.g. +@file{linux.img}) and type: =20 @example -qemu-system-i386 linux.img +@value{qemu_system} linux.img @end example =20 Linux should boot and give you a prompt. @@ -238,7 +242,7 @@ Linux should boot and give you a prompt. =20 @example @c man begin SYNOPSIS -@command{qemu-system-i386} [@var{options}] [@var{disk_image}] +@command{@value{qemu_system}} [@var{options}] [@var{disk_image}] @c man end @end example =20 @@ -278,21 +282,21 @@ is specified in seconds. The default is 0 which means= no timeout. Libiscsi =20 Example (without authentication): @example -qemu-system-i386 -iscsi initiator-name=3Diqn.2001-04.com.example:my-initia= tor \ +@value{qemu_system} -iscsi initiator-name=3Diqn.2001-04.com.example:my-ini= tiator \ -cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \ -drive file=3Discsi://192.0.2.1/iqn.2001-04.com.example/1 @end example =20 Example (CHAP username/password via URL): @example -qemu-system-i386 -drive file=3Discsi://user%password@@192.0.2.1/iqn.2001-0= 4.com.example/1 +@value{qemu_system} -drive file=3Discsi://user%password@@192.0.2.1/iqn.200= 1-04.com.example/1 @end example =20 Example (CHAP username/password via environment variables): @example LIBISCSI_CHAP_USERNAME=3D"user" \ LIBISCSI_CHAP_PASSWORD=3D"password" \ -qemu-system-i386 -drive file=3Discsi://192.0.2.1/iqn.2001-04.com.example/1 +@value{qemu_system} -drive file=3Discsi://192.0.2.1/iqn.2001-04.com.exampl= e/1 @end example =20 @item NBD @@ -307,12 +311,12 @@ Syntax for specifying a NBD device using Unix Domain = Sockets =20 Example for TCP @example -qemu-system-i386 --drive file=3Dnbd:192.0.2.1:30000 +@value{qemu_system} --drive file=3Dnbd:192.0.2.1:30000 @end example =20 Example for Unix Domain Sockets @example -qemu-system-i386 --drive file=3Dnbd:unix:/tmp/nbd-socket +@value{qemu_system} --drive file=3Dnbd:unix:/tmp/nbd-socket @end example =20 @item SSH @@ -320,8 +324,8 @@ QEMU supports SSH (Secure Shell) access to remote disks. =20 Examples: @example -qemu-system-i386 -drive file=3Dssh://user@@host/path/to/disk.img -qemu-system-i386 -drive file.driver=3Dssh,file.user=3Duser,file.host=3Dhos= t,file.port=3D22,file.path=3D/path/to/disk.img +@value{qemu_system} -drive file=3Dssh://user@@host/path/to/disk.img +@value{qemu_system} -drive file.driver=3Dssh,file.user=3Duser,file.host=3D= host,file.port=3D22,file.path=3D/path/to/disk.img @end example =20 Currently authentication must be done using ssh-agent. Other @@ -339,7 +343,7 @@ sheepdog[+tcp|+unix]://[host:port]/vdiname[?socket=3Dpa= th][#snapid|#tag] =20 Example @example -qemu-system-i386 --drive file=3Dsheepdog://192.0.2.1:30000/MyVirtualMachine +@value{qemu_system} --drive file=3Dsheepdog://192.0.2.1:30000/MyVirtualMac= hine @end example =20 See also @url{https://sheepdog.github.io/sheepdog/}. @@ -365,17 +369,17 @@ JSON: Example @example URI: -qemu-system-x86_64 --drive file=3Dgluster://192.0.2.1/testvol/a.img, +@value{qemu_system} --drive file=3Dgluster://192.0.2.1/testvol/a.img, @ file.debug=3D9,file.logfile=3D/var/log/qem= u-gluster.log =20 JSON: -qemu-system-x86_64 'json:@{"driver":"qcow2", +@value{qemu_system} 'json:@{"driver":"qcow2", @ "file":@{"driver":"gluster", @ "volume":"testvol","path":"a.img", @ "debug":9,"logfile":"/var/log/qemu-glu= ster.log", @ "server":[@{"type":"tcp","host":"1.2.3= .4","port":24007@}, @ @{"type":"unix","socket":"/v= ar/run/glusterd.socket"@}]@}@}' -qemu-system-x86_64 -drive driver=3Dqcow2,file.driver=3Dgluster,file.volume= =3Dtestvol,file.path=3D/path/a.img, +@value{qemu_system} -drive driver=3Dqcow2,file.driver=3Dgluster,file.volum= e=3Dtestvol,file.path=3D/path/a.img, @ file.debug=3D9,file.logfile=3D/var/= log/qemu-gluster.log, @ file.server.0.type=3Dtcp,file.serve= r.0.host=3D1.2.3.4,file.server.0.port=3D24007, @ file.server.1.type=3Dunix,file.serv= er.1.socket=3D/var/run/glusterd.socket @@ -440,9 +444,9 @@ of . =20 Example: boot from a remote Fedora 20 live ISO image @example -qemu-system-x86_64 --drive media=3Dcdrom,file=3Dhttp://dl.fedoraproject.or= g/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.= iso,readonly +@value{qemu_system_x86} --drive media=3Dcdrom,file=3Dhttp://dl.fedoraproje= ct.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-= 20-1.iso,readonly =20 -qemu-system-x86_64 --drive media=3Dcdrom,file.driver=3Dhttp,file.url=3Dhtt= p://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Li= ve-Desktop-x86_64-20-1.iso,readonly +@value{qemu_system_x86} --drive media=3Dcdrom,file.driver=3Dhttp,file.url= =3Dhttp://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fed= ora-Live-Desktop-x86_64-20-1.iso,readonly @end example =20 Example: boot from a remote Fedora 20 cloud image using a local overlay for @@ -450,7 +454,7 @@ writes, copy-on-read, and a readahead of 64k @example qemu-img create -f qcow2 -o backing_file=3D'json:@{"file.driver":"http",, = "file.url":"https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Image= s/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2",, "file.readahead":"64k"@}'= /tmp/Fedora-x86_64-20-20131211.1-sda.qcow2 =20 -qemu-system-x86_64 -drive file=3D/tmp/Fedora-x86_64-20-20131211.1-sda.qcow= 2,copy-on-read=3Don +@value{qemu_system_x86} -drive file=3D/tmp/Fedora-x86_64-20-20131211.1-sda= .qcow2,copy-on-read=3Don @end example =20 Example: boot from an image stored on a VMware vSphere server with a self-= signed @@ -459,7 +463,7 @@ of 10 seconds. @example qemu-img create -f qcow2 -o backing_file=3D'json:@{"file.driver":"https",,= "file.url":"https://user:password@@vsphere.example.com/folder/test/test-fl= at.vmdk?dcPath=3DDatacenter&dsName=3Ddatastore1",, "file.sslverify":"off",,= "file.readahead":"64k",, "file.timeout":10@}' /tmp/test.qcow2 =20 -qemu-system-x86_64 -drive file=3D/tmp/test.qcow2 +@value{qemu_system_x86} -drive file=3D/tmp/test.qcow2 @end example =20 @end table @@ -826,7 +830,7 @@ On Linux hosts, a shared memory device is available. T= he basic syntax is: =20 @example -qemu-system-x86_64 -device ivshmem-plain,memdev=3D@var{hostmem} +@value{qemu_system_x86} -device ivshmem-plain,memdev=3D@var{hostmem} @end example =20 where @var{hostmem} names a host memory backend. For a POSIX shared @@ -847,7 +851,7 @@ memory server is: ivshmem-server -p @var{pidfile} -S @var{path} -m @var{shm-name} -l @var{sh= m-size} -n @var{vectors} =20 # Then start your qemu instances with matching arguments -qemu-system-x86_64 -device ivshmem-doorbell,vectors=3D@var{vectors},charde= v=3D@var{id} +@value{qemu_system_x86} -device ivshmem-doorbell,vectors=3D@var{vectors},c= hardev=3D@var{id} -chardev socket,path=3D@var{path},id=3D@var{id} @end example =20 @@ -872,7 +876,7 @@ Instead of specifying the using POSIX shm, y= ou may specify a memory backend that has hugepage support: =20 @example -qemu-system-x86_64 -object memory-backend-file,size=3D1G,mem-path=3D/dev/h= ugepages/my-shmem-file,share,id=3Dmb1 +@value{qemu_system_x86} -object memory-backend-file,size=3D1G,mem-path=3D/= dev/hugepages/my-shmem-file,share,id=3Dmb1 -device ivshmem-plain,memdev=3Dmb1 @end example =20 @@ -888,7 +892,7 @@ kernel testing. =20 The syntax is: @example -qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -appe= nd "root=3D/dev/hda" +@value{qemu_system} -kernel bzImage -hda rootdisk.img -append "root=3D/dev= /hda" @end example =20 Use @option{-kernel} to provide the Linux kernel image and @@ -903,7 +907,7 @@ If you do not need graphical output, you can disable it= and redirect the virtual serial port and the QEMU monitor to the console with the @option{-nographic} option. The typical command line is: @example -qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ +@value{qemu_system} -kernel bzImage -hda rootdisk.img \ -append "root=3D/dev/hda console=3DttyS0" -nographic @end example =20 @@ -969,7 +973,7 @@ Network adapter that supports CDC ethernet and RNDIS pr= otocols. @var{id} specifies a netdev defined with @code{-netdev @dots{},id=3D@var{id}}. For instance, user-mode networking can be used with @example -qemu-system-i386 [...] -netdev user,id=3Dnet0 -device usb-net,netdev=3Dnet0 +@value{qemu_system} [...] -netdev user,id=3Dnet0 -device usb-net,netdev=3D= net0 @end example @item usb-ccid Smartcard reader device @@ -988,7 +992,7 @@ no type is given, the HCI logic corresponds to @code{-b= t hci,vlan=3D0}. This USB device implements the USB Transport Layer of HCI. Example usage: @example -@command{qemu-system-i386} [...@var{OPTIONS}...] @option{-usbdevice} bt:hc= i,vlan=3D3 @option{-bt} device:keyboard,vlan=3D3 +@command{@value{qemu_system}} [...@var{OPTIONS}...] @option{-usbdevice} bt= :hci,vlan=3D3 @option{-bt} device:keyboard,vlan=3D3 @end example @end table =20 @@ -1065,7 +1069,7 @@ For this setup it is recommended to restrict it to li= sten on a UNIX domain socket only. For example =20 @example -qemu-system-i386 [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc +@value{qemu_system} [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-v= nc @end example =20 This ensures that only users on local box with read/write access to that @@ -1088,7 +1092,7 @@ is running the password is set with the monitor. Unti= l the monitor is used to set the password all clients will be rejected. =20 @example -qemu-system-i386 [...OPTIONS...] -vnc :1,password -monitor stdio +@value{qemu_system} [...OPTIONS...] -vnc :1,password -monitor stdio (qemu) change vnc password Password: ******** (qemu) @@ -1105,7 +1109,7 @@ support provides a secure session, but no authenticat= ion. This allows any client to connect, and provides an encrypted session. =20 @example -qemu-system-i386 [...OPTIONS...] \ +@value{qemu_system} [...OPTIONS...] \ -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,endpoint=3Dserver,v= erify-peer=3Dno \ -vnc :1,tls-creds=3Dtls0 -monitor stdio @end example @@ -1127,7 +1131,7 @@ same syntax as previously, but with @code{verify-peer= } set to @code{yes} instead. =20 @example -qemu-system-i386 [...OPTIONS...] \ +@value{qemu_system} [...OPTIONS...] \ -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,endpoint=3Dserver,v= erify-peer=3Dyes \ -vnc :1,tls-creds=3Dtls0 -monitor stdio @end example @@ -1140,7 +1144,7 @@ Finally, the previous method can be combined with VNC= password authentication to provide two layers of authentication for clients. =20 @example -qemu-system-i386 [...OPTIONS...] \ +@value{qemu_system} [...OPTIONS...] \ -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,endpoint=3Dserver,v= erify-peer=3Dyes \ -vnc :1,tls-creds=3Dtls0,password -monitor stdio (qemu) change vnc password @@ -1165,7 +1169,7 @@ used for authentication, but assuming use of one supp= orting SSF, then QEMU can be launched with: =20 @example -qemu-system-i386 [...OPTIONS...] -vnc :1,sasl -monitor stdio +@value{qemu_system} [...OPTIONS...] -vnc :1,sasl -monitor stdio @end example =20 @node vnc_sec_certificate_sasl @@ -1179,7 +1183,7 @@ credentials. This can be enabled, by combining the 's= asl' option with the aforementioned TLS + x509 options: =20 @example -qemu-system-i386 [...OPTIONS...] \ +@value{qemu_system} [...OPTIONS...] \ -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,endpoint=3Dserver,v= erify-peer=3Dyes \ -vnc :1,tls-creds=3Dtls0,sasl -monitor stdio @end example @@ -1512,13 +1516,13 @@ To load server credentials with client certificate = validation enabled =20 @example -$QEMU -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,endpoint=3Dserv= er +@value{qemu_system} -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,e= ndpoint=3Dserver @end example =20 while to load client credentials use =20 @example -$QEMU -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,endpoint=3Dclie= nt +@value{qemu_system} -object tls-creds-x509,id=3Dtls0,dir=3D/etc/pki/qemu,e= ndpoint=3Dclient @end example =20 Network services which support TLS will all have a @code{tls-creds} @@ -1526,7 +1530,7 @@ parameter which expects the ID of the TLS credentials= object. For example with VNC: =20 @example -$QEMU -vnc 0.0.0.0:0,tls-creds=3Dtls0 +@value{qemu_system} -vnc 0.0.0.0:0,tls-creds=3Dtls0 @end example =20 @node tls_psk @@ -1574,8 +1578,7 @@ QEMU has a primitive support to work with gdb, so tha= t you can do In order to use gdb, launch QEMU with the '-s' option. It will wait for a gdb connection: @example -qemu-system-i386 -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ - -append "root=3D/dev/hda" +@value{qemu_system} -s -kernel bzImage -hda rootdisk.img -append "root=3D/= dev/hda" Connected to host network interface: tun0 Waiting gdb connection on port 1234 @end example diff --git a/qemu-options.hx b/qemu-options.hx index b2ba7c501d..bbfd936d29 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -254,10 +254,10 @@ This option defines a free-form string that can be us= ed to describe @var{fd}. =20 You can open an image using pre-opened file descriptors from an fd set: @example -qemu-system-i386 --add-fd fd=3D3,set=3D2,opaque=3D"rdwr:/path/to/file" --add-fd fd=3D4,set=3D2,opaque=3D"rdonly:/path/to/file" --drive file=3D/dev/fdset/2,index=3D0,media=3Ddisk +@value{qemu_system} \ + -add-fd fd=3D3,set=3D2,opaque=3D"rdwr:/path/to/file" \ + -add-fd fd=3D4,set=3D2,opaque=3D"rdonly:/path/to/file" \ + -drive file=3D/dev/fdset/2,index=3D0,media=3Ddisk @end example ETEXI =20 @@ -283,7 +283,7 @@ STEXI Set default value of @var{driver}'s property @var{prop} to @var{value}, e.= g.: =20 @example -qemu-system-i386 -global ide-hd.physical_block_size=3D4096 disk-image.img +@value{qemu_system_x86} -global ide-hd.physical_block_size=3D4096 disk-ima= ge.img @end example =20 In particular, you can use this to set driver properties for devices which= are @@ -337,11 +337,11 @@ bootindex options. The default is non-strict boot. =20 @example # try to boot from network first, then from hard disk -qemu-system-i386 -boot order=3Dnc +@value{qemu_system_x86} -boot order=3Dnc # boot from CD-ROM first, switch back to default order after reboot -qemu-system-i386 -boot once=3Dd +@value{qemu_system_x86} -boot once=3Dd # boot with a splash picture for 5 seconds. -qemu-system-i386 -boot menu=3Don,splash=3D/root/boot.bmp,splash-time=3D5000 +@value{qemu_system_x86} -boot menu=3Don,splash=3D/root/boot.bmp,splash-tim= e=3D5000 @end example =20 Note: The legacy format '-boot @var{drives}' is still supported but its @@ -370,7 +370,7 @@ For example, the following command-line sets the guest = startup RAM size to memory the guest can reach to 4GB: =20 @example -qemu-system-x86_64 -m 1G,slots=3D3,maxmem=3D4G +@value{qemu_system} -m 1G,slots=3D3,maxmem=3D4G @end example =20 If @var{slots} and @var{maxmem} are not specified, memory hotplug won't @@ -666,15 +666,15 @@ STEXI @item -soundhw @var{card1}[,@var{card2},...] or -soundhw all @findex -soundhw Enable audio and selected sound hardware. Use 'help' to print all -available sound hardware. +available sound hardware. For example: =20 @example -qemu-system-i386 -soundhw sb16,adlib disk.img -qemu-system-i386 -soundhw es1370 disk.img -qemu-system-i386 -soundhw ac97 disk.img -qemu-system-i386 -soundhw hda disk.img -qemu-system-i386 -soundhw all disk.img -qemu-system-i386 -soundhw help +@value{qemu_system_x86} -soundhw sb16,adlib disk.img +@value{qemu_system_x86} -soundhw es1370 disk.img +@value{qemu_system_x86} -soundhw ac97 disk.img +@value{qemu_system_x86} -soundhw hda disk.img +@value{qemu_system_x86} -soundhw all disk.img +@value{qemu_system_x86} -soundhw help @end example =20 Note that Linux's i810_audio OSS kernel (for AC97) module might @@ -1149,50 +1149,50 @@ is off. =20 Instead of @option{-cdrom} you can use: @example -qemu-system-i386 -drive file=3Dfile,index=3D2,media=3Dcdrom +@value{qemu_system} -drive file=3Dfile,index=3D2,media=3Dcdrom @end example =20 Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you= can use: @example -qemu-system-i386 -drive file=3Dfile,index=3D0,media=3Ddisk -qemu-system-i386 -drive file=3Dfile,index=3D1,media=3Ddisk -qemu-system-i386 -drive file=3Dfile,index=3D2,media=3Ddisk -qemu-system-i386 -drive file=3Dfile,index=3D3,media=3Ddisk +@value{qemu_system} -drive file=3Dfile,index=3D0,media=3Ddisk +@value{qemu_system} -drive file=3Dfile,index=3D1,media=3Ddisk +@value{qemu_system} -drive file=3Dfile,index=3D2,media=3Ddisk +@value{qemu_system} -drive file=3Dfile,index=3D3,media=3Ddisk @end example =20 You can open an image using pre-opened file descriptors from an fd set: @example -qemu-system-i386 --add-fd fd=3D3,set=3D2,opaque=3D"rdwr:/path/to/file" --add-fd fd=3D4,set=3D2,opaque=3D"rdonly:/path/to/file" --drive file=3D/dev/fdset/2,index=3D0,media=3Ddisk +@value{qemu_system} \ + -add-fd fd=3D3,set=3D2,opaque=3D"rdwr:/path/to/file" \ + -add-fd fd=3D4,set=3D2,opaque=3D"rdonly:/path/to/file" \ + -drive file=3D/dev/fdset/2,index=3D0,media=3Ddisk @end example =20 You can connect a CDROM to the slave of ide0: @example -qemu-system-i386 -drive file=3Dfile,if=3Dide,index=3D1,media=3Dcdrom +@value{qemu_system_x86} -drive file=3Dfile,if=3Dide,index=3D1,media=3Dcdrom @end example =20 If you don't specify the "file=3D" argument, you define an empty drive: @example -qemu-system-i386 -drive if=3Dide,index=3D1,media=3Dcdrom +@value{qemu_system_x86} -drive if=3Dide,index=3D1,media=3Dcdrom @end example =20 Instead of @option{-fda}, @option{-fdb}, you can use: @example -qemu-system-i386 -drive file=3Dfile,index=3D0,if=3Dfloppy -qemu-system-i386 -drive file=3Dfile,index=3D1,if=3Dfloppy +@value{qemu_system_x86} -drive file=3Dfile,index=3D0,if=3Dfloppy +@value{qemu_system_x86} -drive file=3Dfile,index=3D1,if=3Dfloppy @end example =20 By default, @var{interface} is "ide" and @var{index} is automatically incremented: @example -qemu-system-i386 -drive file=3Da -drive file=3Db" +@value{qemu_system_x86} -drive file=3Da -drive file=3Db" @end example is interpreted like: @example -qemu-system-i386 -hda a -hdb b +@value{qemu_system_x86} -hda a -hdb b @end example ETEXI =20 @@ -2272,8 +2272,8 @@ The following two example do exactly the same, to sho= w how @option{-nic} can be used to shorten the command line length (note that the e1000 is the def= ault on i386, so the @option{model=3De1000} parameter could even be omitted her= e, too): @example -qemu-system-i386 -netdev user,id=3Dn1,ipv6=3Doff -device e1000,netdev=3Dn1= ,mac=3D52:54:98:76:54:32 -qemu-system-i386 -nic user,ipv6=3Doff,model=3De1000,mac=3D52:54:98:76:54:32 +@value{qemu_system} -netdev user,id=3Dn1,ipv6=3Doff -device e1000,netdev= =3Dn1,mac=3D52:54:98:76:54:32 +@value{qemu_system} -nic user,ipv6=3Doff,model=3De1000,mac=3D52:54:98:76:5= 4:32 @end example =20 @item -nic none @@ -2344,7 +2344,7 @@ can not be resolved. =20 Example: @example -qemu-system-i386 -nic user,dnssearch=3Dmgmt.example.org,dnssearch=3Dexampl= e.org +@value{qemu_system} -nic user,dnssearch=3Dmgmt.example.org,dnssearch=3Dexa= mple.org @end example =20 @item domainname=3D@var{domain} @@ -2368,7 +2368,7 @@ a guest from a local directory. =20 Example (using pxelinux): @example -qemu-system-i386 -hda linux.img -boot n -device e1000,netdev=3Dn1 \ +@value{qemu_system} -hda linux.img -boot n -device e1000,netdev=3Dn1 \ -netdev user,id=3Dn1,tftp=3D/path/to/tftp/files,bootfile=3D/pxelinux.0 @end example =20 @@ -2402,7 +2402,7 @@ screen 0, use the following: =20 @example # on the host -qemu-system-i386 -nic user,hostfwd=3Dtcp:127.0.0.1:6001-:6000 +@value{qemu_system} -nic user,hostfwd=3Dtcp:127.0.0.1:6001-:6000 # this host xterm should open in the guest X11 server xterm -display :1 @end example @@ -2412,7 +2412,7 @@ the guest, use the following: =20 @example # on the host -qemu-system-i386 -nic user,hostfwd=3Dtcp::5555-:23 +@value{qemu_system} -nic user,hostfwd=3Dtcp::5555-:23 telnet localhost 5555 @end example =20 @@ -2431,7 +2431,7 @@ lifetime, like in the following example: @example # open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever # the guest accesses it -qemu-system-i386 -nic user,guestfwd=3Dtcp:10.0.2.100:1234-tcp:10.10.1.1:43= 21 +@value{qemu_system} -nic user,guestfwd=3Dtcp:10.0.2.100:1234-tcp:10.10.1.1= :4321 @end example =20 Or you can execute a command on every TCP connection established by the gu= est, @@ -2440,7 +2440,7 @@ so that QEMU behaves similar to an inetd process for = that virtual server: @example # call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234 # and connect the TCP stream to its stdin/stdout -qemu-system-i386 -nic 'user,id=3Dn1,guestfwd=3Dtcp:10.0.2.100:1234-cmd:ne= tcat 10.10.1.1 4321' +@value{qemu_system} -nic 'user,id=3Dn1,guestfwd=3Dtcp:10.0.2.100:1234-cmd= :netcat 10.10.1.1 4321' @end example =20 @end table @@ -2467,13 +2467,13 @@ Examples: =20 @example #launch a QEMU instance with the default network script -qemu-system-i386 linux.img -nic tap +@value{qemu_system} linux.img -nic tap @end example =20 @example #launch a QEMU instance with two NICs, each one connected #to a TAP device -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -netdev tap,id=3Dnd0,ifname=3Dtap0 -device e1000,netdev=3Dnd0 \ -netdev tap,id=3Dnd1,ifname=3Dtap1 -device rtl8139,netdev=3Dnd1 @end example @@ -2481,7 +2481,7 @@ qemu-system-i386 linux.img \ @example #launch a QEMU instance with the default network helper to #connect a TAP device to bridge br0 -qemu-system-i386 linux.img -device virtio-net-pci,netdev=3Dn1 \ +@value{qemu_system} linux.img -device virtio-net-pci,netdev=3Dn1 \ -netdev tap,id=3Dn1,"helper=3D/path/to/qemu-bridge-helper" @end example =20 @@ -2498,13 +2498,13 @@ Examples: @example #launch a QEMU instance with the default network helper to #connect a TAP device to bridge br0 -qemu-system-i386 linux.img -netdev bridge,id=3Dn1 -device virtio-net,netde= v=3Dn1 +@value{qemu_system} linux.img -netdev bridge,id=3Dn1 -device virtio-net,ne= tdev=3Dn1 @end example =20 @example #launch a QEMU instance with the default network helper to #connect a TAP device to bridge qemubr0 -qemu-system-i386 linux.img -netdev bridge,br=3Dqemubr0,id=3Dn1 -device vir= tio-net,netdev=3Dn1 +@value{qemu_system} linux.img -netdev bridge,br=3Dqemubr0,id=3Dn1 -device = virtio-net,netdev=3Dn1 @end example =20 @item -netdev socket,id=3D@var{id}[,fd=3D@var{h}][,listen=3D[@var{host}]:@= var{port}][,connect=3D@var{host}:@var{port}] @@ -2519,11 +2519,11 @@ specifies an already opened TCP socket. Example: @example # launch a first QEMU instance -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56 \ -netdev socket,id=3Dn1,listen=3D:1234 # connect the network of this instance to the network of the first instance -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn2,mac=3D52:54:00:12:34:57 \ -netdev socket,id=3Dn2,connect=3D127.0.0.1:1234 @end example @@ -2548,15 +2548,15 @@ Use @option{fd=3Dh} to specify an already opened UD= P multicast socket. Example: @example # launch one QEMU instance -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56 \ -netdev socket,id=3Dn1,mcast=3D230.0.0.1:1234 # launch another QEMU instance on same "bus" -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn2,mac=3D52:54:00:12:34:57 \ -netdev socket,id=3Dn2,mcast=3D230.0.0.1:1234 # launch yet another QEMU instance on same "bus" -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn3,mac=3D52:54:00:12:34:58 \ -netdev socket,id=3Dn3,mcast=3D230.0.0.1:1234 @end example @@ -2564,7 +2564,7 @@ qemu-system-i386 linux.img \ Example (User Mode Linux compat.): @example # launch QEMU instance (note mcast address selected is UML's default) -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56 \ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102 # launch UML @@ -2573,7 +2573,7 @@ qemu-system-i386 linux.img \ =20 Example (send packets from host's 1.2.3.4): @example -qemu-system-i386 linux.img \ +@value{qemu_system} linux.img \ -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56 \ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102,localad= dr=3D1.2.3.4 @end example @@ -2633,7 +2633,7 @@ brctl addif br-lan vmtunnel0 # on 4.3.2.1 # launch QEMU instance - if your network has reorder or is very lossy add = ,pincounter =20 -qemu-system-i386 linux.img -device e1000,netdev=3Dn1 \ +@value{qemu_system} linux.img -device e1000,netdev=3Dn1 \ -netdev l2tpv3,id=3Dn1,src=3D4.2.3.1,dst=3D1.2.3.4,udp,srcport=3D16384= ,dstport=3D16384,rxsession=3D0xffffffff,txsession=3D0xffffffff,counter =20 @end example @@ -2650,7 +2650,7 @@ Example: # launch vde switch vde_switch -F -sock /tmp/myswitch # launch QEMU instance -qemu-system-i386 linux.img -nic vde,sock=3D/tmp/myswitch +@value{qemu_system} linux.img -nic vde,sock=3D/tmp/myswitch @end example =20 @item -netdev vhost-user,chardev=3D@var{id}[,vhostforce=3Don|off][,queues= =3Dn] @@ -3107,7 +3107,7 @@ and communicate. Requires the Linux @code{vhci} driv= er installed. Can be used as following: =20 @example -qemu-system-i386 [...OPTIONS...] -bt hci,vlan=3D5 -bt vhci,vlan=3D5 +@value{qemu_system} [...OPTIONS...] -bt hci,vlan=3D5 -bt vhci,vlan=3D5 @end example =20 @item -bt device:@var{dev}[,vlan=3D@var{n}] @@ -3601,7 +3601,7 @@ connections will likely be TCP-based, but also UDP, p= seudo TTY, or even stdio are reasonable use case. The latter is allowing to start QEMU from within gdb and establish the connection via a pipe: @example -(gdb) target remote | exec qemu-system-i386 -gdb stdio ... +(gdb) target remote | exec @value{qemu_system} -gdb stdio ... @end example ETEXI =20 @@ -4578,7 +4578,7 @@ which specify the queue number of cryptodev backend, = the default of =20 @example =20 - # qemu-system-x86_64 \ + # @value{qemu_system} \ [...] \ -object cryptodev-backend-builtin,id=3Dcryptodev0 \ -device virtio-crypto-pci,id=3Dcrypto0,cryptodev=3Dcryptodev0 \ @@ -4598,7 +4598,7 @@ of cryptodev backend for multiqueue vhost-user, the d= efault of @var{queues} is 1 =20 @example =20 - # qemu-system-x86_64 \ + # @value{qemu_system} \ [...] \ -chardev socket,id=3Dchardev0,path=3D/path/to/socket \ -object cryptodev-vhost-user,id=3Dcryptodev0,chardev=3Dchardev0 \ @@ -4634,14 +4634,14 @@ The simplest (insecure) usage is to provide the sec= ret inline =20 @example =20 - # $QEMU -object secret,id=3Dsec0,data=3Dletmein,format=3Draw + # @value{qemu_system} -object secret,id=3Dsec0,data=3Dletmein,format=3Draw =20 @end example =20 The simplest secure usage is to provide the secret via a file =20 # printf "letmein" > mypasswd.txt - # $QEMU -object secret,id=3Dsec0,file=3Dmypasswd.txt,format=3Draw + # @value{qemu_system} -object secret,id=3Dsec0,file=3Dmypasswd.txt,format= =3Draw =20 For greater security, AES-256-CBC should be used. To illustrate usage, consider the openssl command line tool which can encrypt the data. Note @@ -4677,7 +4677,7 @@ and specify that to be used to decrypt the user passw= ord. Pass the contents of @code{iv.b64} to the second secret =20 @example - # $QEMU \ + # @value{qemu_system} \ -object secret,id=3Dsecmaster0,format=3Dbase64,file=3Dkey.b64 \ -object secret,id=3Dsec0,keyid=3Dsecmaster0,format=3Dbase64,\ data=3D$SECRET,iv=3D$(