From patchwork Wed Dec 18 12:01:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 11300431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1360139A for ; Wed, 18 Dec 2019 12:07:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 748152072B for ; Wed, 18 Dec 2019 12:07:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AbjDn1Yp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 748152072B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY71-0003n0-Vr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Dec 2019 07:07:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46065) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2q-00066J-1c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2o-0008PP-Na for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:11 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:51499) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2o-0008N6-C4 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: by mail-wm1-x343.google.com with SMTP id d73so1561039wmd.1 for ; Wed, 18 Dec 2019 04:03:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wpdalmmTK/FCoQs/NtWe2+gF7RTn+BqZ+IAbD5CsqGs=; b=AbjDn1YpIIy8iVVP2uw7d3EDL20dZoUDPuC9yuO1mcLnzerfQ/pFd5NyxOcxFbxe6K Kx0YotAPebeuSgwP9j1Ur3gWkVYzX5hhJnD3/aFAIjIVIDdxSz4ZcV0s4XsoGZHkHDB8 sC/ASss97Tp4GRs6B8KJX7q4AbJ7E7tTfaax3txUKkN46McCZAR3C7dUMXlPwzgyIL/p xJFkOpIu0pzOm22dbOhn+O4vTNg4BPOe+ORkDd4qOE33BICKZYN032udiBMN80/rwco/ fdcD/xochb3ruCqfuq71DYDQY5u7MC6f1R+GCY3Xbt9v4WzkJ/jzRUueVND/DiuGiun6 Vo3A== 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:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wpdalmmTK/FCoQs/NtWe2+gF7RTn+BqZ+IAbD5CsqGs=; b=dkz0KS5F7egkSg5fCj7z8VPqGrgBAn6a978t1v6sCnI1vbxhS9+3lm77ljPc12Ht7e L/1Rlc2a0S8Zlf/GOeKJzwO2NuYCUuwCtmiC4sLPndaB8PoubrRXNZPr7uw7GvrXfuQD XQFSVcmpDF0xNehx8qil6vTfuZZcSoRpVqHmUm4r/NDfSe+VsW8TBR0YgQkWo+HyD6h5 PFOc/KJpbhyiLfyn0X4P9bS7ktRSuYyASIgEikWywDeayVGStCsfSSUDWesIWNUtDUYf 5iUO9ezR60A2r4FlfaJuIpzAl33dAqEejOxagy4YkeHFPk/GcDu0Brh7lTQ4UPV3hlM/ lH0w== X-Gm-Message-State: APjAAAU3qDOc7YipPpKfJn+FXadU1ZaUlCdz4bveRGLTvL5YSJUujf1R WTgLiy8eB1htpcPj3kRFHEmFVpfe X-Google-Smtp-Source: APXvYqz1XrF5BAb3px2qnqxZgD89d5G1SgdY/95FQrg9vuKQz7la+FigzgKmJJZfSUWAIAPHJQzgIw== X-Received: by 2002:a7b:c317:: with SMTP id k23mr2884998wmj.75.1576670588532; Wed, 18 Dec 2019 04:03:08 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/87] vl: move icount configuration earlier Date: Wed, 18 Dec 2019 13:01:39 +0100 Message-Id: <1576670573-48048-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Once qemu_tcg_configure is turned into a QOM property setter, it will not be able to set a default value for mttcg_enabled. Setting the default will move to the TCG instance_init function, which currently runs before "-icount" is processed. However, it is harmless to do configure_icount for all accelerators; we will just fail later if a non-TCG accelerator is selected. So do that. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- vl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vl.c b/vl.c index 9450830..6e58c1d 100644 --- a/vl.c +++ b/vl.c @@ -2700,6 +2700,12 @@ static void user_register_global_props(void) global_init_func, NULL, NULL); } +static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp) +{ + configure_icount(opts, errp); + return 0; +} + int main(int argc, char **argv, char **envp) { int i; @@ -4010,6 +4016,8 @@ int main(int argc, char **argv, char **envp) * Note: uses machine properties such as kernel-irqchip, must run * after machine_set_property(). */ + qemu_opts_foreach(qemu_find_opts("icount"), + do_configure_icount, NULL, &error_fatal); configure_accelerator(current_machine, argv[0]); /* @@ -4095,13 +4103,9 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); cpu_ticks_init(); - if (icount_opts) { - if (!tcg_enabled()) { - error_report("-icount is not allowed with hardware virtualization"); - exit(1); - } - configure_icount(icount_opts, &error_abort); - qemu_opts_del(icount_opts); + if (use_icount && !(tcg_enabled() || qtest_enabled())) { + error_report("-icount is not allowed with hardware virtualization"); + exit(1); } if (tcg_enabled()) {