From nobody Mon Feb 9 10:30:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573656070; cv=none; d=zoho.com; s=zohoarc; b=bNffLO4tbI9R2tHy+rD6UaeFxSdrPw4SfCSyledOlb/pPP6t2Y2/qxvl1TC2mfUfgoJV8eoFZtorX/KI82URNY617RrqXJPzG/yMl6PwtX/dOep+IUlYMULcb7lSOPMRNcufRYuIN0F3UnoaUb8HvnUmj/1ddfNo+ZcR64sYKVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573656070; 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; bh=wetGOwL6w9T5KqZky8gH8g8gUVnF2w1GmxQs/cFXJ4g=; b=MQnv4fuhWHP4nUPi8R2wcyy00uA6WPd4w/MmWpXvONG3MLELp/hd0hxGwEY4LTIlRsvWdsE65XDnbUWW8yPeuH68HATDIo+1oD3/J0GNNfaNBQJXgV9i5W9fIKxFhNWit72IyKMmwXImcoRXxNm1cXSq558f28RBth1UoU3Gi9E= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 157365607089857.483806044358744; Wed, 13 Nov 2019 06:41:10 -0800 (PST) Received: from localhost ([::1]:45638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUtpS-0007Yj-GC for importer@patchew.org; Wed, 13 Nov 2019 09:41:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54457) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUtnb-0005i5-P2 for qemu-devel@nongnu.org; Wed, 13 Nov 2019 09:39:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUtna-0006IX-Mo for qemu-devel@nongnu.org; Wed, 13 Nov 2019 09:39:11 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:35909) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iUtna-0006I4-Gg for qemu-devel@nongnu.org; Wed, 13 Nov 2019 09:39:10 -0500 Received: by mail-wr1-x443.google.com with SMTP id r10so2658770wrx.3 for ; Wed, 13 Nov 2019 06:39:10 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id s11sm2965823wrr.43.2019.11.13.06.39.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2019 06:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=wetGOwL6w9T5KqZky8gH8g8gUVnF2w1GmxQs/cFXJ4g=; b=JA/121bL7xwyBhWiY7Vz+uiS9W1+Qdz7XpsqwRfsuE7oH61I8EQUwuhwsKW17uNac2 WJmDbffmVIklxgVWG6XYdSR5btBVlyRn/1FqMyPL5g6/+yneMvtewa3AtmTQNC63NO2a VJSpbk4wVMrhSwe8vJissyhH0IFtwMARVO8NntgqM7OL4iw0bpKWHidjy9YE8aRPpkiQ cV4vWjopJoUDXWyLqjkUToxJoLm93MkRiwMaJUEeVHtAVYztmU5KWpG2/c7T8W994itB 9OhgEDsne1J0iRfFZ1uzTR40aBDWMtp5cWw7vMpeSdhpiO1p5GCTU7L0YqvtD8sAgiIa 02KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=wetGOwL6w9T5KqZky8gH8g8gUVnF2w1GmxQs/cFXJ4g=; b=BwW49CUd6DK0J2itkoPEz+ieEIjDuHTIfedr8CTjayjmy1LoQLKMPX1OupU7+04jqH qBsI1IOZjwKPsbL2RJ4XlDoyKvOijYlgOSEMVT6aiFvImbCwGaWdVXo81E/KsJVUzQD/ wpFVh5FA6yGJnrMKet2shVAo7YuFSUZJp9dIW5tA3BsPdeSWv0DpjIEc6oOU+qX7vjg2 GH2A6jvI4H5F1W26MknVN5eEiw9cE3c62qlH97eKM80IahG9ohPujl6Bpp1Y0VKbe9A6 18IHzo8OxVl/F4WT0PVsxs8fvDMe7E5gVa4u4O97CISqZnuTbO7Oz8eCyQfudkPj27N7 8Lig== X-Gm-Message-State: APjAAAVYUxFkKNdrcfWo+NtZ+40EpODeuwWcwSDwwo/0eWeLknEZG74Q EGeUgjzyIg//ICxqKlUBE28AVCE2 X-Google-Smtp-Source: APXvYqxo3kzQoLQTYvCv8BpHpYI37fs/h410Vy/RCwpcVTgwAjjJG7fhY4j+wSq9m3e8IFLmoXuy7g== X-Received: by 2002:a5d:526f:: with SMTP id l15mr3077923wrc.169.1573655949155; Wed, 13 Nov 2019 06:39:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 02/16] vl: extract accelerator option processing to a separate function Date: Wed, 13 Nov 2019 15:38:51 +0100 Message-Id: <1573655945-14912-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1573655945-14912-1-git-send-email-pbonzini@redhat.com> References: <1573655945-14912-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 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: thuth@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As a first step towards supporting multiple "-accel" options, push -icount and -accel semantics into a new function, and use qemu_opts_foreach to retrieve the key/value lists instead of stashing them into globals. Signed-off-by: Paolo Bonzini --- vl.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/vl.c b/vl.c index 841fdae..5367f23 100644 --- a/vl.c +++ b/vl.c @@ -2827,6 +2827,33 @@ static void user_register_global_props(void) global_init_func, NULL, NULL); } =20 +static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp) +{ + if (tcg_enabled()) { + configure_icount(opts, errp); + } else { + error_setg(errp, "-icount is not allowed with hardware virtualizat= ion"); + } + return 0; +} + +static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **= errp) +{ + if (tcg_enabled()) { + qemu_tcg_configure(opts, &error_fatal); + } + return 0; +} + +static void configure_accelerators(void) +{ + qemu_opts_foreach(qemu_find_opts("icount"), + do_configure_icount, NULL, &error_fatal); + + qemu_opts_foreach(qemu_find_opts("accel"), + do_configure_accelerator, NULL, &error_fatal); +} + int main(int argc, char **argv, char **envp) { int i; @@ -4241,18 +4268,7 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); =20 cpu_ticks_init(); - if (icount_opts) { - if (!tcg_enabled()) { - error_report("-icount is not allowed with hardware virtualizat= ion"); - exit(1); - } - configure_icount(icount_opts, &error_abort); - qemu_opts_del(icount_opts); - } - - if (tcg_enabled()) { - qemu_tcg_configure(accel_opts, &error_fatal); - } + configure_accelerators(); =20 if (default_net) { QemuOptsList *net =3D qemu_find_opts("net"); --=20 1.8.3.1