From nobody Sun Feb 8 00:03:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493875551655175.44688211795574; Wed, 3 May 2017 22:25:51 -0700 (PDT) Received: from localhost ([::1]:39768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d69Gv-0007gL-LQ for importer@patchew.org; Thu, 04 May 2017 01:25:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d69Fy-0007DT-PE for qemu-devel@nongnu.org; Thu, 04 May 2017 01:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d69Fv-0007S5-LI for qemu-devel@nongnu.org; Thu, 04 May 2017 01:24:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32926) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d69Fv-0007RR-Cx for qemu-devel@nongnu.org; Thu, 04 May 2017 01:24:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1845B85376; Thu, 4 May 2017 05:24:46 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48B4A5DD67; Thu, 4 May 2017 05:24:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1845B85376 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1845B85376 From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 4 May 2017 07:24:41 +0200 Message-Id: <1493875481-16388-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 04 May 2017 05:24:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] Fix the -accel parameter and the documentation for 'hax' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Vincent Palatin , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since 'hax' is a possible accelerator nowadays, too, the '-accel' option should support it and we should mention this accelerator in the documentation, too. Signed-off-by: Thomas Huth --- v2: - Use qemu_opt_set() instead of qemu_opts_parse_noisily() - Improve the documentation of the -accel option qemu-options.hx | 18 +++++++++--------- vl.c | 23 +++++++++-------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 787b9c3..21f8ff2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -31,7 +31,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ "-machine [type=3D]name[,prop[=3Dvalue][,...]]\n" " selects emulated machine ('-machine help' for list)\n" " property accel=3Daccel1[:accel2[:...]] selects accele= rator\n" - " supported accelerators are kvm, xen, tcg (default: tc= g)\n" + " supported accelerators are kvm, xen, hax or tcg (defa= ult: tcg)\n" " kernel_irqchip=3Don|off|split controls accelerated ir= qchip support (default=3Doff)\n" " vmport=3Don|off|auto controls emulation of vmport (de= fault: auto)\n" " kvm_shadow_mem=3Dsize of KVM shadow MMU in bytes\n" @@ -52,9 +52,9 @@ available machines. Supported machine properties are: @table @option @item accel=3D@var{accels1}[:@var{accels2}[:...]] This is used to enable an accelerator. Depending on the target architectur= e, -kvm, xen, or tcg can be available. By default, tcg is used. If there is mo= re -than one accelerator specified, the next one is used if the previous one f= ails -to initialize. +kvm, xen, hax or tcg can be available. By default, tcg is used. If there is +more than one accelerator specified, the next one is used if the previous = one +fails to initialize. @item kernel_irqchip=3Don|off Controls in-kernel irqchip support for the chosen accelerator when availab= le. @item gfx_passthru=3Don|off @@ -97,15 +97,15 @@ ETEXI =20 DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=3D]accelerator[,thread=3Dsingle|multi]\n" - " select accelerator ('-accel help for list')\n" - " thread=3Dsingle|multi (enable multi-threaded TCG)", QE= MU_ARCH_ALL) + " select accelerator (kvm, xen, hax or tcg; use 'help' = for a list)\n" + " thread=3Dsingle|multi (enable multi-threaded TCG)", Q= EMU_ARCH_ALL) STEXI @item -accel @var{name}[,prop=3D@var{value}[,...]] @findex -accel This is used to enable an accelerator. Depending on the target architectur= e, -kvm, xen, or tcg can be available. By default, tcg is used. If there is mo= re -than one accelerator specified, the next one is used if the previous one f= ails -to initialize. +kvm, xen, hax or tcg can be available. By default, tcg is used. If there is +more than one accelerator specified, the next one is used if the previous = one +fails to initialize. @table @option @item thread=3Dsingle|multi Controls number of TCG threads. When the TCG is multi-threaded there will = be one diff --git a/vl.c b/vl.c index f46e070..0a1b931 100644 --- a/vl.c +++ b/vl.c @@ -3725,26 +3725,21 @@ int main(int argc, char **argv, char **envp) qdev_prop_register_global(&kvm_pit_lost_tick_policy); break; } - case QEMU_OPTION_accel: + case QEMU_OPTION_accel: { + QemuOpts *accel_opts; + accel_opts =3D qemu_opts_parse_noisily(qemu_find_opts("acc= el"), optarg, true); optarg =3D qemu_opt_get(accel_opts, "accel"); - - olist =3D qemu_find_opts("machine"); - if (strcmp("kvm", optarg) =3D=3D 0) { - qemu_opts_parse_noisily(olist, "accel=3Dkvm", false); - } else if (strcmp("xen", optarg) =3D=3D 0) { - qemu_opts_parse_noisily(olist, "accel=3Dxen", false); - } else if (strcmp("tcg", optarg) =3D=3D 0) { - qemu_opts_parse_noisily(olist, "accel=3Dtcg", false); - } else { - if (!is_help_option(optarg)) { - error_printf("Unknown accelerator: %s", optarg); - } - error_printf("Supported accelerators: kvm, xen, tcg\n"= ); + if (!optarg || is_help_option(optarg)) { + error_printf("Possible accelerators: kvm, xen, hax, tc= g\n"); exit(1); } + accel_opts =3D qemu_opts_create(qemu_find_opts("machine"),= NULL, + false, &error_abort); + qemu_opt_set(accel_opts, "accel", optarg, &error_abort); break; + } case QEMU_OPTION_usb: olist =3D qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "usb=3Don", false); --=20 1.8.3.1