From patchwork Mon Dec 9 15:01:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1206329 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aVt1heXP"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Wmjq0ZLzz9sP6 for ; Tue, 10 Dec 2019 02:06:23 +1100 (AEDT) Received: from localhost ([::1]:41194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieKc8-00077Q-NB for incoming@patchwork.ozlabs.org; Mon, 09 Dec 2019 10:06:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47057) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieKXq-0003L7-Ci for qemu-devel@nongnu.org; Mon, 09 Dec 2019 10:01:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieKXp-0001Ey-A4 for qemu-devel@nongnu.org; Mon, 09 Dec 2019 10:01:54 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51800) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieKXp-0001EM-4H for qemu-devel@nongnu.org; Mon, 09 Dec 2019 10:01:53 -0500 Received: by mail-wm1-x342.google.com with SMTP id g206so15857664wme.1 for ; Mon, 09 Dec 2019 07:01:53 -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=4/2rFG2uQPrnJ3NY/tRy/zI0rCDFvW24BIkyj5B4cS8=; b=aVt1heXPjfklF8r5JXHDoRMl1pjQ+Qcg3kziIyQElXzTT6N3IgAOAbs71zqQMSORDI 6vr2nUdUdlAkzBmS9QddlhUB9HKS/2XuMjvD0jekW6C3Pe6zR/kwxYAi53HtX5jHI6Lo hKVNT1yh7E8zux9EFZT0ig2HP6QzaeEGgbJhAgBhFmxaPIWDeG7eLnY5GWGJSkFJdiXW FIYP6yxTTn1GLotZi75nO2pZQzmvidxDVZnyhnSx0s8w6u+d4pwnm4IpyshOhR+0nGNy bdYQSHKgBrA62ftD9tLaM15txlApqwRv2zw5j5UMyKS5s6Dx4ySC8iAM5IUNvDzkGgI7 im6Q== 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=4/2rFG2uQPrnJ3NY/tRy/zI0rCDFvW24BIkyj5B4cS8=; b=pmhmOqAIKrDapHase1Ij/6G7pE217vv18TnFbqtjkV2J8XG9KHdy4C8pWIdqBvSwB4 UEZ18PW0luFmXgbefOx4xMLJDj+Kj6sTD/oft23rToMDhlVbSNPYhXlqjPJGxT1o6GnG 74VEg9LcSK1Fhac/vdWj3M6qUVibCmoyU5M3OlAZc1IrjT5/OmkYh6Pr+udTZP1UuaV1 Bb2gN+uYs5oczBfQbEMSRh5/q8cLC3DT4hH21j6ngbcuxAkJfD/2i/kLXLFdRJMX9G0C 9BaqQZHwmTdQG/tHFev5u8+qXOcqXF3vWOR2iRoNLtKW0/6rl4ELgmj1w/OeuYehh0o/ mcmA== X-Gm-Message-State: APjAAAUQKAERLSjM40QgECLC22eaXKKl83Pu6KCptDJFttfJfr922wPA 5Ezz66hVkXjURhWuypNDWvKuezxz X-Google-Smtp-Source: APXvYqzzoTQHMLsSext7/G6Hc3Cyqw9mYv8UFHrMXvFldX0VkxQj2irJggTRYPjJwLQMZB8a+dutTA== X-Received: by 2002:a1c:dcd5:: with SMTP id t204mr26540735wmg.34.1575903711884; Mon, 09 Dec 2019 07:01:51 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id g9sm27219371wro.67.2019.12.09.07.01.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Dec 2019 07:01:51 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 04/18] vl: extract accelerator option processing to a separate function Date: Mon, 9 Dec 2019 16:01:31 +0100 Message-Id: <1575903705-12925-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1575903705-12925-1-git-send-email-pbonzini@redhat.com> References: <1575903705-12925-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::342 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, elmarco@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" As a first step towards supporting multiple "-accel" options, push the late processing of -icount and -accel into a new function, and use qemu_opts_foreach to retrieve -accel options instead of stashing them into globals. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- vl.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/vl.c b/vl.c index f69fea1..1ad6dfb 100644 --- a/vl.c +++ b/vl.c @@ -2831,6 +2831,25 @@ static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp) 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("accel"), + do_configure_accelerator, NULL, &error_fatal); + + if (!tcg_enabled() && use_icount) { + error_report("-icount is not allowed with hardware virtualization"); + exit(1); + } +} + int main(int argc, char **argv, char **envp) { int i; @@ -4258,14 +4277,7 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); cpu_ticks_init(); - if (!tcg_enabled() && use_icount) { - error_report("-icount is not allowed with hardware virtualization"); - exit(1); - } - - if (tcg_enabled()) { - qemu_tcg_configure(accel_opts, &error_fatal); - } + configure_accelerators(); if (default_net) { QemuOptsList *net = qemu_find_opts("net");