From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603313952; cv=none; d=zohomail.com; s=zohoarc; b=mg8otG/aXWlTFVQV7SgWMOr/DA+J9dzlnC6CSvl3KuMNS0I5yHhRrFD1O11reiNuuq0UUM9TXJX7td96lcRTzJrjpaXabDzktfpBDR5d/FuxiFJ4pdPeCF74MUEsGfIwuQJHvmuVz8SFHE125EROloCyKQ3y3QfTXm7Tbgw9uw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603313952; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WGr2zrfGyqftWBpF5ZVoBd91ihPhB/CBzX/ru9n2bC4=; b=leeTekuEOco7ITrDfT6iI20FztA/+scs0qqqcqUScnyQFQGL78L84Qowc3vweUAab2p68IunEO8ea5JI9gq2LjXO1zTkKJ2kwhvbvZo168akBsw/lwW/aL6qXaJxzzpjAhtqpe6e7VvYRQGbE1w2o/my7xssuuiLgvVLrnJbD18= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603313952535729.6075175470655; Wed, 21 Oct 2020 13:59:12 -0700 (PDT) Received: from localhost ([::1]:37796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLCR-0007Nj-DS for importer@patchew.org; Wed, 21 Oct 2020 16:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAy-0005Yi-ET for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAh-0006ef-Jf for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194--r_UCunkMG27L25kcetI_w-1; Wed, 21 Oct 2020 16:57:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F0801868431 for ; Wed, 21 Oct 2020 20:57:18 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 321066EF62; Wed, 21 Oct 2020 20:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WGr2zrfGyqftWBpF5ZVoBd91ihPhB/CBzX/ru9n2bC4=; b=TLL5ZrM1g2j3FVydkMu+fHMHGPHoHYzDqcjZ0gkT6F1UBq7zL7dHrZdhqpnEXzSqTe7yxf qZq4hajUI7U6ujQ8ty9f3G+pKkZypKo85Bd581Kj/7hzJB/FEvlaDp2Gs6tDuap71ij4nh 5gVANsH6YGKP5ZWuVnqeVtSeTzQRl8s= X-MC-Unique: -r_UCunkMG27L25kcetI_w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 01/22] semihosting: fix order of initialization functions Date: Wed, 21 Oct 2020 16:56:55 -0400 Message-Id: <20201021205716.2359430-2-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" qemu_semihosting_console_init uses semihosting.chardev which is set by qemu_semihosting_connect_chardevs. Thus qemu_semihosting_connect_charde= vs has to be called first. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 6f5b000f07..42314e6ff9 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4288,7 +4288,8 @@ void qemu_init(int argc, char **argv, char **envp) qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, &error_fatal); =20 - /* connect semihosting console input if requested */ + /* now chardevs have been created we may have semihosting to connect */ + qemu_semihosting_connect_chardevs(); qemu_semihosting_console_init(); =20 if (foreach_device_config(DEV_SERIAL, serial_parse) < 0) @@ -4298,9 +4299,6 @@ void qemu_init(int argc, char **argv, char **envp) if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) exit(1); =20 - /* now chardevs have been created we may have semihosting to connect */ - qemu_semihosting_connect_chardevs(); - /* If no default VGA is requested, the default is "none". */ if (default_vga) { vga_model =3D get_default_vga_model(machine_class); --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314165; cv=none; d=zohomail.com; s=zohoarc; b=lf+pe06iiIhBmvvpm3wJgMmrhWCUK+8q6QzrK+wTY6yDwCxNNmAa+nMH2YEtU0o8xoyiz2N6yyRvD79a5h/Aj0XOjLWnw19I11pY7hsYK8G9QEhjHr8vS4l5hOmQl2iDaoVu27joJgPmhKgMASgVcV+gdEb4nKGzmuCDpExInCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314165; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Bk7OcrGv2Bhi0vHJasD1ougOCtytCjn0scl9nnODkDg=; b=NZW4Xiu3fKlmwm4KyH1tRIRLHMwEkwsJhIR5f4r2KqQbyRoGFlbUkA7Qb+Od4W15ASZ1FrHzIPKODQc838q46NkO241Zn2N7brDuoo1ruoxAvc8lwiZXj11qISX63mi2nRbnh768KB/at+ondZqPgRhSY92aagCTjkNV71zSZF4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314165282168.7274280832546; Wed, 21 Oct 2020 14:02:45 -0700 (PDT) Received: from localhost ([::1]:45676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLFg-0002St-IJ for importer@patchew.org; Wed, 21 Oct 2020 17:02:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0005UW-Lc for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAh-0006ei-Jq for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:37 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-f2KVkNySMQK-kTyEs2icIg-1; Wed, 21 Oct 2020 16:57:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 498AA800050 for ; Wed, 21 Oct 2020 20:57:19 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id D04CD6EF62; Wed, 21 Oct 2020 20:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Bk7OcrGv2Bhi0vHJasD1ougOCtytCjn0scl9nnODkDg=; b=YtFAfj61ir8r1zaLGhL6GlBJ3Li0I/ZUBSQAmjnmdH+bB/rRxvXu4+B5AqfOkHIIM5KOLA Q9etWYtImlEUvMt+04EYU/c6TCBhKIAuxOPbsd1aoRrfDeOihibGHj12wGPaK3WGY+q1wY TEoHUwWVcXb35ExRPy9zpm62Fz3/m0A= X-MC-Unique: f2KVkNySMQK-kTyEs2icIg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 02/22] machine: remove deprecated -machine enforce-config-section option Date: Wed, 21 Oct 2020 16:56:56 -0400 Message-Id: <20201021205716.2359430-3-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Deprecated since 3.1 and complicates the initialization sequence, remove it. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- docs/system/deprecated.rst | 12 ++++++------ hw/core/machine.c | 24 +----------------------- include/hw/boards.h | 1 - migration/migration.c | 10 ---------- qemu-options.hx | 8 -------- 5 files changed, 7 insertions(+), 48 deletions(-) diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 895433c356..0ebce37a19 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -21,12 +21,6 @@ deprecated. System emulator command line arguments -------------------------------------- =20 -``-machine enforce-config-section=3Don|off`` (since 3.1) -'''''''''''''''''''''''''''''''''''''''''''''''''''''' - -The ``enforce-config-section`` parameter is replaced by the -``-global migration.send-configuration=3D{on|off}`` option. - ``-usbdevice`` (since 2.10.0) ''''''''''''''''''''''''''''' =20 @@ -689,6 +683,12 @@ Support for invalid topologies is removed, the user mu= st ensure topologies described with -smp include all possible cpus, i.e. *sockets* * *cores* * *threads* =3D *maxcpus*. =20 +``-machine enforce-config-section=3Don|off`` (removed 5.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The ``enforce-config-section`` property was replaced by the +``-global migration.send-configuration=3D{on|off}`` option. + Block devices ------------- =20 diff --git a/hw/core/machine.c b/hw/core/machine.c index d740a7e963..80a918895a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -26,6 +26,7 @@ #include "sysemu/qtest.h" #include "hw/pci/pci.h" #include "hw/mem/nvdimm.h" +#include "migration/misc.h" #include "migration/vmstate.h" =20 GlobalProperty hw_compat_5_1[] =3D { @@ -411,24 +412,6 @@ static bool machine_get_suppress_vmdesc(Object *obj, E= rror **errp) return ms->suppress_vmdesc; } =20 -static void machine_set_enforce_config_section(Object *obj, bool value, - Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - warn_report("enforce-config-section is deprecated, please use " - "-global migration.send-configuration=3Don|off instead"); - - ms->enforce_config_section =3D value; -} - -static bool machine_get_enforce_config_section(Object *obj, Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - return ms->enforce_config_section; -} - static char *machine_get_memory_encryption(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -857,11 +840,6 @@ static void machine_class_init(ObjectClass *oc, void *= data) object_class_property_set_description(oc, "suppress-vmdesc", "Set on to disable self-describing migration"); =20 - object_class_property_add_bool(oc, "enforce-config-section", - machine_get_enforce_config_section, machine_set_enforce_config_sec= tion); - object_class_property_set_description(oc, "enforce-config-section", - "Set on to enforce configuration section migration"); - object_class_property_add_str(oc, "memory-encryption", machine_get_memory_encryption, machine_set_memory_encryption); object_class_property_set_description(oc, "memory-encryption", diff --git a/include/hw/boards.h b/include/hw/boards.h index bf53e8a16e..a49e3a6b44 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -268,7 +268,6 @@ struct MachineState { char *firmware; bool iommu; bool suppress_vmdesc; - bool enforce_config_section; bool enable_graphics; char *memory_encryption; char *ram_memdev_id; diff --git a/migration/migration.c b/migration/migration.c index 0575ecb379..deb6005b8d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -145,7 +145,6 @@ static void migrate_fd_cancel(MigrationState *s); =20 void migration_object_init(void) { - MachineState *ms =3D MACHINE(qdev_get_machine()); Error *err =3D NULL; =20 /* This can only be called once. */ @@ -170,15 +169,6 @@ void migration_object_init(void) error_report_err(err); exit(1); } - - /* - * We cannot really do this in migration_instance_init() since at - * that time global properties are not yet applied, then this - * value will be definitely replaced by something else. - */ - if (ms->enforce_config_section) { - current_migration->send_configuration =3D true; - } } =20 void migration_shutdown(void) diff --git a/qemu-options.hx b/qemu-options.hx index 9e1ace04f7..2c83390504 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -34,7 +34,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " dea-key-wrap=3Don|off controls support for DEA key wr= apping (default=3Don)\n" " suppress-vmdesc=3Don|off disables self-describing mig= ration (default=3Doff)\n" " nvdimm=3Don|off controls NVDIMM support (default=3Dof= f)\n" - " enforce-config-section=3Don|off enforce configuration= section migration (default=3Doff)\n" " memory-encryption=3D@var{} memory encryption object t= o use (default=3Dnone)\n" " hmat=3Don|off controls ACPI HMAT support (default=3Do= ff)\n", QEMU_ARCH_ALL) @@ -91,13 +90,6 @@ SRST ``nvdimm=3Don|off`` Enables or disables NVDIMM support. The default is off. =20 - ``enforce-config-section=3Don|off`` - If ``enforce-config-section`` is set to on, force migration code - to send configuration section even if the machine-type sets the - ``migration.send-configuration`` property to off. NOTE: this - parameter is deprecated. Please use ``-global`` - ``migration.send-configuration``\ =3Don\|off instead. - ``memory-encryption=3D`` Memory encryption object to use. The default is none. =20 --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603313946; cv=none; d=zohomail.com; s=zohoarc; b=hydDiG7YwpAR2DcZPzdyIOQRw4727JsyWYginjeglEhCnIPx81swJDuk8yHMj7rqMCYRuIFbc54n2Jrx7AFHGIxAZPWdbe3WBGgpNa2ILtJKhXljWTX+7c3Fk28rgTMxvy/afHxN3srXNS63ti+0r97iVHdE+EXmWlR7LYijUXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603313946; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xsRFiIN1PeYLuXwm9621UgCML5X3cOzx9xwX2BS2mAE=; b=B1FRmz7Az4ju5fi9k1uH3o2Add3A2sIZ+wuBj0f8vE8QcQVMYRi8jyZr4N24CS/8g9ZdnyR/9lfvECquUZftIq64UdKUH0Gwgc0rWdrmVtjs4CJMVPStGRN9RkIlD/8Z2CXyBD7aXZYp2M7m/uHk1pm5vOEYeC7sHSawBxeaPg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603313946102863.1006129247718; Wed, 21 Oct 2020 13:59:06 -0700 (PDT) Received: from localhost ([::1]:37056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLCK-00075S-NP for importer@patchew.org; Wed, 21 Oct 2020 16:59:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAq-0005Su-1v for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42284) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAh-0006eq-Jq for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-BHO0pe9vOmuQh3IbwJ3g7Q-1; Wed, 21 Oct 2020 16:57:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF757835B92 for ; Wed, 21 Oct 2020 20:57:19 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 729E96EF62; Wed, 21 Oct 2020 20:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xsRFiIN1PeYLuXwm9621UgCML5X3cOzx9xwX2BS2mAE=; b=Ba4oPfaWilcaqkokQtV7Uc1E84jUeHLxY1LXEfys167oMgSo/VpLEzIVjSMsa8oSz7NM5j x0UYqSNFJr2oLpZ/0b0YobaEKxzdTxbsY/W6zH+uaP1M6KMLy9wZvOR+Chjt9CleuKbxbc esGLRCzdMDgX/shAmINiAaYWEqPFvrU= X-MC-Unique: BHO0pe9vOmuQh3IbwJ3g7Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 03/22] machine: move UP defaults to class_base_init Date: Wed, 21 Oct 2020 16:56:57 -0400 Message-Id: <20201021205716.2359430-4-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Clean up vl.c, default min/max/default_cpus to uniprocessor directly in the QOM class initialization code. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- hw/core/machine.c | 6 +++++- softmmu/vl.c | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 80a918895a..d3a8450b1f 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -854,8 +854,12 @@ static void machine_class_init(ObjectClass *oc, void *= data) =20 static void machine_class_base_init(ObjectClass *oc, void *data) { + MachineClass *mc =3D MACHINE_CLASS(oc); + mc->max_cpus =3D mc->max_cpus ?: 1; + mc->min_cpus =3D mc->min_cpus ?: 1; + mc->default_cpus =3D mc->default_cpus ?: 1; + if (!object_class_is_abstract(oc)) { - MachineClass *mc =3D MACHINE_CLASS(oc); const char *cname =3D object_class_get_name(oc); assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX)); mc->name =3D g_strndup(cname, diff --git a/softmmu/vl.c b/softmmu/vl.c index 42314e6ff9..75bc686397 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3966,11 +3966,6 @@ void qemu_init(int argc, char **argv, char **envp) exit(0); } =20 - /* machine_class: default to UP */ - machine_class->max_cpus =3D machine_class->max_cpus ?: 1; - machine_class->min_cpus =3D machine_class->min_cpus ?: 1; - machine_class->default_cpus =3D machine_class->default_cpus ?: 1; - /* default to machine_class->default_cpus */ current_machine->smp.cpus =3D machine_class->default_cpus; current_machine->smp.max_cpus =3D machine_class->default_cpus; --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314148; cv=none; d=zohomail.com; s=zohoarc; b=KLXnIfhPORMWMz8IXDWYyEFKBsZRWC7NrAt8HWz+OzVv1e4rFo7d/YxMPLP6ta5xl+O7ouZz24Q3An2uSNUkHX0exAnKgRO+9wjGaU+OCk3OrbF9iZLOOlG6u55T86+kSAlVaQq2Y3OzzCu6zArv3mnemeGejffpsDCS5AD5JWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314148; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FDqH/sBJn/80Lhr0h8LxhXgjheMXH4gfSukABjUgxwA=; b=GJiZwbal+GmkFB7qDFnktYqgUGM0ozfPLIKyo6gxtcgk0TARxcvOckjqYNbvZowZsDKipYmJXBzkb4zRByk3MBNqjkv259of7c/bEuQbkgrRN49rA5LE3Mc9wg3NUCJ8Nz5dXEj/igYlVj8jvk5zYdmhJB5W9+vRR4GA9EkLl0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314148706719.7337367523241; Wed, 21 Oct 2020 14:02:28 -0700 (PDT) Received: from localhost ([::1]:45522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLFb-0002PC-4n for importer@patchew.org; Wed, 21 Oct 2020 17:02:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAt-0005TV-Hd for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAm-0006ew-NS for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-ltO41byjPdKAzKWcsGoTAQ-1; Wed, 21 Oct 2020 16:57:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71256186843A for ; Wed, 21 Oct 2020 20:57:20 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04ED16EF6B; Wed, 21 Oct 2020 20:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FDqH/sBJn/80Lhr0h8LxhXgjheMXH4gfSukABjUgxwA=; b=C8GLzaNJ4gIPoXbeG42RiSYIduq39gj6mjvEDzcFR1PMTbWu1rNf10Eo5x52tGN7Zf3N3R rSqzFeehyYSRVS8Q5BUK19k5KVSRwrO6IcQbEcL1kKSygWF7rjWdKq18XECX9CxpDbwuEi WYuK6jPG5SMiSMf54ueubjNnjDfVGms= X-MC-Unique: ltO41byjPdKAzKWcsGoTAQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 04/22] machine: move SMP initialization from vl.c Date: Wed, 21 Oct 2020 16:56:58 -0400 Message-Id: <20201021205716.2359430-5-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Initialize the object's values from the class when the object is created, no need to have vl.c do it for us. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/machine.c | 7 +++++++ softmmu/vl.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index d3a8450b1f..7efeac03b3 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -908,6 +908,13 @@ static void machine_initfn(Object *obj) /* Register notifier when init is done for sysbus sanity checks */ ms->sysbus_notifier.notify =3D machine_init_notify; qemu_add_machine_init_done_notifier(&ms->sysbus_notifier); + + /* default to mc->default_cpus */ + ms->smp.cpus =3D mc->default_cpus; + ms->smp.max_cpus =3D mc->default_cpus; + ms->smp.cores =3D 1; + ms->smp.threads =3D 1; + ms->smp.sockets =3D 1; } =20 static void machine_finalize(Object *obj) diff --git a/softmmu/vl.c b/softmmu/vl.c index 75bc686397..05422a15ee 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3966,13 +3966,6 @@ void qemu_init(int argc, char **argv, char **envp) exit(0); } =20 - /* default to machine_class->default_cpus */ - current_machine->smp.cpus =3D machine_class->default_cpus; - current_machine->smp.max_cpus =3D machine_class->default_cpus; - current_machine->smp.cores =3D 1; - current_machine->smp.threads =3D 1; - current_machine->smp.sockets =3D 1; - machine_class->smp_parse(current_machine, qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); =20 --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314156; cv=none; d=zohomail.com; s=zohoarc; b=exiHY4FhioBAlzjICsAs+kDCntLTzTHvNEDX0US5JU5DaKQ5oJOdyuVaooHsbOf2B+Q55xjJO63tO/Aop+gL6GOZVQWPsA9moOKfrm9eM3b2pkuG/unP7OsGYznM+m4ODNIDjDp7baZxFx6BgJTnFyMqHhifx8cTPlh3EY8cePE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314156; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UxOaKWQIo5EvktT7G1cSMndSN819NS7u5edOwbE8ebw=; b=neyaSBAdhumGCpGpqPa4eHfz2b3MRB01QwW6P1ImtVjMrDr3VeQRn3v96ZffUGlWuVyWfD0pu7iYfQONmBHHBSdhnuqW5v5slGzIVS73uODNT9JzhEE3X26MDTdkx6N97OQQi83a0feX8fEtNP8BRcQ5cafjJTFyd5oEj8dPTF4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314156824654.9917202361626; Wed, 21 Oct 2020 14:02:36 -0700 (PDT) Received: from localhost ([::1]:45822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLFj-0002Wc-GT for importer@patchew.org; Wed, 21 Oct 2020 17:02:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0005Xa-Qr for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAs-0006f1-3D for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-nFGCVHw3M-mwFNTuH2dT8Q-1; Wed, 21 Oct 2020 16:57:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03DE4804B62 for ; Wed, 21 Oct 2020 20:57:21 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AF3F6EF62; Wed, 21 Oct 2020 20:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UxOaKWQIo5EvktT7G1cSMndSN819NS7u5edOwbE8ebw=; b=a6/8k5kjCP0BB+TCUaYXCCCpbQg3elev/jsbKkSaR17/VrvF7guP+S98nwGI/3KilmxAFM VujX5tG6Ddf2ySXhHYVs14lOj3WBK6ZVjn7mqUPh6WDtDCkWiRnq1saddxg58sP3eSIh5a 5lpnOXhSlKK+HaDSzVDlVtvxfQb+lCU= X-MC-Unique: nFGCVHw3M-mwFNTuH2dT8Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 05/22] vl: extract validation of -smp to machine.c Date: Wed, 21 Oct 2020 16:56:59 -0400 Message-Id: <20201021205716.2359430-6-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Once smp_parse is done, the validation operates on the MachineState. There is no reason for that code to be in vl.c. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 23 +++++++++++++++++++++++ include/hw/boards.h | 1 + softmmu/vl.c | 20 ++------------------ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 7efeac03b3..70b1e5e8e8 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1073,6 +1073,29 @@ MemoryRegion *machine_consume_memdev(MachineState *m= achine, return ret; } =20 +bool machine_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp) +{ + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + + mc->smp_parse(ms, opts); + + /* sanity-check smp_cpus and max_cpus against mc */ + if (ms->smp.cpus < mc->min_cpus) { + error_setg(errp, "Invalid SMP CPUs %d. The min CPUs " + "supported by machine '%s' is %d", + ms->smp.cpus, + mc->name, mc->min_cpus); + return false; + } else if (ms->smp.max_cpus > mc->max_cpus) { + error_setg(errp, "Invalid SMP CPUs %d. The max CPUs " + "supported by machine '%s' is %d", + current_machine->smp.max_cpus, + mc->name, mc->max_cpus); + return false; + } + return true; +} + void machine_run_board_init(MachineState *machine) { MachineClass *machine_class =3D MACHINE_GET_CLASS(machine); diff --git a/include/hw/boards.h b/include/hw/boards.h index a49e3a6b44..4537cfb5c6 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -26,6 +26,7 @@ OBJECT_DECLARE_TYPE(MachineState, MachineClass, MACHINE) extern MachineState *current_machine; =20 void machine_run_board_init(MachineState *machine); +bool machine_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp); bool machine_usb(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); diff --git a/softmmu/vl.c b/softmmu/vl.c index 05422a15ee..8a7d11ef05 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3966,24 +3966,8 @@ void qemu_init(int argc, char **argv, char **envp) exit(0); } =20 - machine_class->smp_parse(current_machine, - qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); - - /* sanity-check smp_cpus and max_cpus against machine_class */ - if (current_machine->smp.cpus < machine_class->min_cpus) { - error_report("Invalid SMP CPUs %d. The min CPUs " - "supported by machine '%s' is %d", - current_machine->smp.cpus, - machine_class->name, machine_class->min_cpus); - exit(1); - } - if (current_machine->smp.max_cpus > machine_class->max_cpus) { - error_report("Invalid SMP CPUs %d. The max CPUs " - "supported by machine '%s' is %d", - current_machine->smp.max_cpus, - machine_class->name, machine_class->max_cpus); - exit(1); - } + machine_smp_parse(current_machine, + qemu_opts_find(qemu_find_opts("smp-opts"), NULL), &error_fatal); =20 if (mem_prealloc) { char *val; --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603313949; cv=none; d=zohomail.com; s=zohoarc; b=n0Mp7z/iNroq/h62O1M79FqImNxMUpQtFen+2dfPfqieeaZ51aqODNgFNq7I1jn2OF0qe6XvLHtx8hUAfToWPzAOgpPoaE8kPCzrMwZvlXDm7HqEqQhaGoNClcE5rsRyf8s6sGuLmTZfDsVQkrzVBYN88dLhdVx60lDSnqLNqQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603313949; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lbX2ReBca6guWuzIMmhC8r3u3SrTIY1t9q1oICrcSw0=; b=eloO/vwFjFd22kAv1PdscrAtjF8lfow09z1V1bszG9k08g9dNtQXM1AcGY6gG1ywCsURaR94PH9/Suo0gmwuWNaVNs2jCWCQ2gmq8DrK3e9IyKHLYDCNmSiYJ6oCoqcrH/rSqepeEv460TedDAzyzznRxKUBpq5AmCDSC/4lzwY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 16033139490254.265078757923334; Wed, 21 Oct 2020 13:59:09 -0700 (PDT) Received: from localhost ([::1]:37404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLCN-0007Dp-TL for importer@patchew.org; Wed, 21 Oct 2020 16:59:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAy-0005YN-9Q for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43410) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006f4-8y for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-211-8HH49Ct2MM2Kd2QUXpfr0Q-1; Wed, 21 Oct 2020 16:57:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8B9971006C9E for ; Wed, 21 Oct 2020 20:57:21 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E2BB6EF62; Wed, 21 Oct 2020 20:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lbX2ReBca6guWuzIMmhC8r3u3SrTIY1t9q1oICrcSw0=; b=XWn1GzUlyWX+Wb9ToLc/WnooUM1FqfQklByNdc626YArIVnaNOpb+s4AyEJmf//oF9UbkQ UDGZIJw11FnWstdeci6G/fLkGzhR7A73YHFnUULmb5e0XZUvTul5Frh4FqjTeoK5hs/YrX 8NL+Yqe2b1rjAgmW7lY6B9vNqnNjtQ0= X-MC-Unique: 8HH49Ct2MM2Kd2QUXpfr0Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 06/22] vl: remove bogus check Date: Wed, 21 Oct 2020 16:57:00 -0400 Message-Id: <20201021205716.2359430-7-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" There is no reason to prevent -preconfig -daemonize. Of course if no monitor is defined there will be no way to start the VM, but that is a user error. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 8a7d11ef05..3def5f3688 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4022,12 +4022,6 @@ void qemu_init(int argc, char **argv, char **envp) } =20 if (is_daemonized()) { - if (!preconfig_exit_requested) { - error_report("'preconfig' and 'daemonize' options are " - "mutually exclusive"); - exit(EXIT_FAILURE); - } - /* According to documentation and historically, -nographic redirec= ts * serial port, parallel port and monitor to stdio, which does not= work * with -daemonize. We can redirect these to null instead, but si= nce --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314320; cv=none; d=zohomail.com; s=zohoarc; b=Elh+Qj8GYrBvuiIFVCQBpaletWTV7kfND11An0lARBv9h1m0ZfBUl2hVXX+gUeR3B2FdKBB4HqEN3YaqEf2LMs5FRet62fq3F2NilpbgjiGYc04n+3GVqijli1JvV605D7LHJFo4EIVQdzMNTP8paBbYMgQ+KsTJHkVnQVDpZAE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZO1IFZ7TKMg2Fkr7uEyDIP7zNsvkOq/AXngsVSUhMPU=; b=KmO+jNIL0qRHnOH5AYRbn9cfKF60nJ9+6+4vS9bO5CkewKTjsH1w+HQEx4aI+UMzjqHQVsp4ObnnyrpJzL9wmo87J5fSAA5ikNYvhqwi56uyBFF+IiMwD5+m5R8C6dogVKC+Xul2eQe8F1FdFyvA4toz3WBiaIyEU+bxisu8X7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314320363761.2252693747997; Wed, 21 Oct 2020 14:05:20 -0700 (PDT) Received: from localhost ([::1]:54000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLIN-0005vB-5N for importer@patchew.org; Wed, 21 Oct 2020 17:05:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0005XN-NN for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAo-0006fC-O1 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-oV5YPEkzMla2ASY0BwkM3Q-1; Wed, 21 Oct 2020 16:57:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E035835B91 for ; Wed, 21 Oct 2020 20:57:22 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id A53486EF62; Wed, 21 Oct 2020 20:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZO1IFZ7TKMg2Fkr7uEyDIP7zNsvkOq/AXngsVSUhMPU=; b=jOT67r4n2U5m78R+cG3I9t4lULl5MWRgWr5hU9Vx69riLHQbS9gu+0F/GftVbcR4M3NcZN CrMJ1SDr/YxmV5hriACJFgwoj24DKrVp/l1j96MmxwC6oYZimDB3Jfjb073R/81S1tMlgn R/q0Ewnisr2lupGyxawd+P4YTlyRBVI= X-MC-Unique: oV5YPEkzMla2ASY0BwkM3Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 07/22] trace: remove argument from trace_init_file Date: Wed, 21 Oct 2020 16:57:01 -0400 Message-Id: <20201021205716.2359430-8-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" It is not needed, all the callers are just saving what was retrieved from -trace and trace_init_file can retrieve it on its own. Signed-off-by: Paolo Bonzini --- bsd-user/main.c | 6 ++---- linux-user/main.c | 6 ++---- qemu-img.c | 6 ++---- qemu-io.c | 6 ++---- qemu-nbd.c | 6 ++---- scsi/qemu-pr-helper.c | 6 ++---- softmmu/vl.c | 6 ++---- storage-daemon/qemu-storage-daemon.c | 9 +++------ trace/control.c | 10 ++++------ trace/control.h | 12 +++--------- 10 files changed, 24 insertions(+), 49 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index ac40d79bfa..0a918e8f74 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -745,7 +745,6 @@ int main(int argc, char **argv) const char *gdbstub =3D NULL; char **target_environ, **wrk; envlist_t *envlist =3D NULL; - char *trace_file =3D NULL; bsd_type =3D target_openbsd; =20 if (argc <=3D 1) @@ -851,8 +850,7 @@ int main(int argc, char **argv) } else if (!strcmp(r, "strace")) { do_strace =3D 1; } else if (!strcmp(r, "trace")) { - g_free(trace_file); - trace_file =3D trace_opt_parse(optarg); + trace_opt_parse(optarg); } else { usage(); } @@ -880,7 +878,7 @@ int main(int argc, char **argv) if (!trace_init_backends()) { exit(1); } - trace_init_file(trace_file); + trace_init_file(); =20 /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs)); diff --git a/linux-user/main.c b/linux-user/main.c index 75c9785157..24d1eb73ad 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -386,11 +386,9 @@ static void handle_arg_version(const char *arg) exit(EXIT_SUCCESS); } =20 -static char *trace_file; static void handle_arg_trace(const char *arg) { - g_free(trace_file); - trace_file =3D trace_opt_parse(arg); + trace_opt_parse(arg); } =20 #if defined(TARGET_XTENSA) @@ -672,7 +670,7 @@ int main(int argc, char **argv, char **envp) if (!trace_init_backends()) { exit(1); } - trace_init_file(trace_file); + trace_init_file(); if (qemu_plugin_load_list(&plugins)) { exit(1); } diff --git a/qemu-img.c b/qemu-img.c index 2103507936..ccfdf1f48d 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -5434,7 +5434,6 @@ int main(int argc, char **argv) const img_cmd_t *cmd; const char *cmdname; Error *local_error =3D NULL; - char *trace_file =3D NULL; int c; static const struct option long_options[] =3D { {"help", no_argument, 0, 'h'}, @@ -5484,8 +5483,7 @@ int main(int argc, char **argv) printf(QEMU_IMG_VERSION); return 0; case 'T': - g_free(trace_file); - trace_file =3D trace_opt_parse(optarg); + trace_opt_parse(optarg); break; } } @@ -5503,7 +5501,7 @@ int main(int argc, char **argv) if (!trace_init_backends()) { exit(1); } - trace_init_file(trace_file); + trace_init_file(); qemu_set_log(LOG_TRACE); =20 /* find the command */ diff --git a/qemu-io.c b/qemu-io.c index 7cc832b3d6..ac88d8bd40 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -536,7 +536,6 @@ int main(int argc, char **argv) Error *local_error =3D NULL; QDict *opts =3D NULL; const char *format =3D NULL; - char *trace_file =3D NULL; bool force_share =3D false; =20 #ifdef CONFIG_POSIX @@ -601,8 +600,7 @@ int main(int argc, char **argv) } break; case 'T': - g_free(trace_file); - trace_file =3D trace_opt_parse(optarg); + trace_opt_parse(optarg); break; case 'V': printf("%s version " QEMU_FULL_VERSION "\n" @@ -653,7 +651,7 @@ int main(int argc, char **argv) if (!trace_init_backends()) { exit(1); } - trace_init_file(trace_file); + trace_init_file(); qemu_set_log(LOG_TRACE); =20 /* initialize commands */ diff --git a/qemu-nbd.c b/qemu-nbd.c index bc644a0670..37adeb0596 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -573,7 +573,6 @@ int main(int argc, char **argv) const char *tlscredsid =3D NULL; bool imageOpts =3D false; bool writethrough =3D true; - char *trace_file =3D NULL; bool fork_process =3D false; bool list =3D false; int old_stderr =3D -1; @@ -767,8 +766,7 @@ int main(int argc, char **argv) imageOpts =3D true; break; case 'T': - g_free(trace_file); - trace_file =3D trace_opt_parse(optarg); + trace_opt_parse(optarg); break; case QEMU_NBD_OPT_TLSAUTHZ: tlsauthz =3D optarg; @@ -815,7 +813,7 @@ int main(int argc, char **argv) if (!trace_init_backends()) { exit(1); } - trace_init_file(trace_file); + trace_init_file(); qemu_set_log(LOG_TRACE); =20 socket_activation =3D check_socket_activation(); diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index d26faaf91e..2733d92f2d 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -884,7 +884,6 @@ int main(int argc, char **argv) int quiet =3D 0; int ch; Error *local_err =3D NULL; - char *trace_file =3D NULL; bool daemonize =3D false; bool pidfile_specified =3D false; bool socket_path_specified =3D false; @@ -968,8 +967,7 @@ int main(int argc, char **argv) ++loglevel; break; case 'T': - g_free(trace_file); - trace_file =3D trace_opt_parse(optarg); + trace_opt_parse(optarg); break; case 'V': version(argv[0]); @@ -992,7 +990,7 @@ int main(int argc, char **argv) if (!trace_init_backends()) { exit(EXIT_FAILURE); } - trace_init_file(trace_file); + trace_init_file(); qemu_set_log(LOG_TRACE); =20 #ifdef CONFIG_MPATH diff --git a/softmmu/vl.c b/softmmu/vl.c index 3def5f3688..05e661abb8 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2883,7 +2883,6 @@ void qemu_init(int argc, char **argv, char **envp) int display_remote =3D 0; const char *log_mask =3D NULL; const char *log_file =3D NULL; - char *trace_file =3D NULL; ram_addr_t maxram_size; uint64_t ram_slots =3D 0; FILE *vmstate_dump_file =3D NULL; @@ -3684,8 +3683,7 @@ void qemu_init(int argc, char **argv, char **envp) xen_domid_restrict =3D true; break; case QEMU_OPTION_trace: - g_free(trace_file); - trace_file =3D trace_opt_parse(optarg); + trace_opt_parse(optarg); break; case QEMU_OPTION_plugin: qemu_plugin_opt_parse(optarg, &plugin_list); @@ -3931,7 +3929,7 @@ void qemu_init(int argc, char **argv, char **envp) if (!trace_init_backends()) { exit(1); } - trace_init_file(trace_file); + trace_init_file(); =20 /* Open the logfile at this point and set the log mask if necessary. */ diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-sto= rage-daemon.c index e419ba9f19..7c914b0dc1 100644 --- a/storage-daemon/qemu-storage-daemon.c +++ b/storage-daemon/qemu-storage-daemon.c @@ -180,12 +180,9 @@ static void process_options(int argc, char *argv[]) help(); exit(EXIT_SUCCESS); case 'T': - { - char *trace_file =3D trace_opt_parse(optarg); - trace_init_file(trace_file); - g_free(trace_file); - break; - } + trace_opt_parse(optarg); + trace_init_file(); + break; case 'V': printf("qemu-storage-daemon version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); diff --git a/trace/control.c b/trace/control.c index b35e512dce..7a57fa7dd5 100644 --- a/trace/control.c +++ b/trace/control.c @@ -221,8 +221,10 @@ static void trace_init_events(const char *fname) loc_pop(&loc); } =20 -void trace_init_file(const char *file) +void trace_init_file(void) { + QemuOpts *opts =3D qemu_find_opts_singleton("trace"); + const char *file =3D qemu_opt_get(opts, "file"); #ifdef CONFIG_TRACE_SIMPLE st_set_trace_file(file); st_set_trace_file_enabled(true); @@ -286,9 +288,8 @@ bool trace_init_backends(void) return true; } =20 -char *trace_opt_parse(const char *optarg) +void trace_opt_parse(const char *optarg) { - char *trace_file; QemuOpts *opts =3D qemu_opts_parse_noisily(qemu_find_opts("trace"), optarg, true); if (!opts) { @@ -298,10 +299,7 @@ char *trace_opt_parse(const char *optarg) trace_enable_events(qemu_opt_get(opts, "enable")); } trace_init_events(qemu_opt_get(opts, "events")); - trace_file =3D g_strdup(qemu_opt_get(opts, "file")); qemu_opts_del(opts); - - return trace_file; } =20 uint32_t trace_get_vcpu_event_count(void) diff --git a/trace/control.h b/trace/control.h index 1f81c491b6..05b95ea453 100644 --- a/trace/control.h +++ b/trace/control.h @@ -167,8 +167,6 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, =20 /** * trace_init_backends: - * @file: Name of trace output file; may be NULL. - * Corresponds to commandline option "--trace file=3D...". * * Initialize the tracing backend. * @@ -178,14 +176,12 @@ bool trace_init_backends(void); =20 /** * trace_init_file: - * @file: Name of trace output file; may be NULL. - * Corresponds to commandline option "--trace file=3D...". * * Record the name of the output file for the tracing backend. * Exits if no selected backend does not support specifying the - * output file, and a non-NULL file was passed. + * output file, and a file was specified with "-trace file=3D...". */ -void trace_init_file(const char *file); +void trace_init_file(void); =20 /** * trace_init_vcpu: @@ -229,10 +225,8 @@ extern QemuOptsList qemu_trace_opts; * @optarg: A string argument of --trace command line argument * * Initialize tracing subsystem. - * - * Returns the filename to save trace to. It must be freed with g_free(). */ -char *trace_opt_parse(const char *optarg); +void trace_opt_parse(const char *optarg); =20 /** * trace_get_vcpu_event_count: --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314546; cv=none; d=zohomail.com; s=zohoarc; b=GqwwNk6KqvrjgpsbDajfqQ4pPN1WrRVW0VT7tOpR9Z/Kpf0FFLPgFHJIs1VXy8BEjceH73QlcsbLDFmZ4fVJ98GSo2lhqJZIY07b/ABH2mLpVHEOTMbRctChIIAnc5SJaN5txd+7VfaaEaZo2gU/+b3PNvP3LPmTKObB1MhKHbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314546; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JNJ//7TfZxMDLeWnhifDKB4WgSkrgnH3VTrzXvyu7NQ=; b=AM/xQcMEzMoe3pZ/hHOAUC2I2h+L8+EMYlVccg5TuOgEcWGbhe0gmxrYJ6RA/aDn8bAQ0t72czjjylzsM+jHZdajVQNUju3vKXpk27ix7Zsq4cYMmmzUHa0vdup3gzQxuIibRQhYM28JKeUfaCE0l4npH5FzZ7UiLXgKXW+aE7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314546566407.66685228757194; Wed, 21 Oct 2020 14:09:06 -0700 (PDT) Received: from localhost ([::1]:34348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLM1-0001c1-7z for importer@patchew.org; Wed, 21 Oct 2020 17:09:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB0-0005cY-3a for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006fG-Cp for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-299-1iucuMnFPTmk2eNkPWG2gA-1; Wed, 21 Oct 2020 16:57:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A60C2186DD39 for ; Wed, 21 Oct 2020 20:57:22 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3809F6EF62; Wed, 21 Oct 2020 20:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JNJ//7TfZxMDLeWnhifDKB4WgSkrgnH3VTrzXvyu7NQ=; b=bRBx6uv9burLf5KG5iexwkxdzFR59FOdLKfavDxFbCeUM0GGlUcaibzfZRNsXEZxiKALBV REPVO0QJM8oyoV8vmD4oT1u8pfE946teyTkAjA+jqu2cKbUOhRv2dMoAGiieZWK0OFmflR clnRTTIpqfwIDGwliOOV/biSbRw7fhk= X-MC-Unique: 1iucuMnFPTmk2eNkPWG2gA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 08/22] vl: split various early command line options to a separate function Date: Wed, 21 Oct 2020 16:57:02 -0400 Message-Id: <20201021205716.2359430-9-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Various options affect the global state of QEMU including the rest of qemu_init, and they need to be called very early. Group them together in a function that is called at the beginning. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 202 ++++++++++++++++++++++++++++----------------------- 1 file changed, 113 insertions(+), 89 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 05e661abb8..2e1714d7a4 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -117,6 +117,7 @@ =20 #define MAX_VIRTIO_CONSOLES 1 =20 +static const char *cpu_option; static const char *data_dir[16]; static int data_dir_idx; const char *bios_name =3D NULL; @@ -143,6 +144,9 @@ int vga_interface_type =3D VGA_NONE; static DisplayOptions dpy; static int num_serial_hds; static Chardev **serial_hds; +static const char *log_mask =3D NULL; +static const char *log_file =3D NULL; +static bool list_data_dirs =3D false; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; int win2k_install_hack =3D 0; int singlestep =3D 0; @@ -2859,6 +2863,106 @@ static char *find_datadir(void) return get_relocated_path(CONFIG_QEMU_DATADIR); } =20 +static void qemu_process_early_options(void) +{ + char **dirs; + int i; + +#ifdef CONFIG_SECCOMP + QemuOptsList *olist =3D qemu_find_opts_err("sandbox", NULL); + if (olist) { + qemu_opts_foreach(olist, parse_sandbox, NULL, &error_fatal); + } +#endif + + qemu_opts_foreach(qemu_find_opts("name"), + parse_name, NULL, &error_fatal); + +#ifndef _WIN32 + qemu_opts_foreach(qemu_find_opts("add-fd"), + parse_add_fd, NULL, &error_fatal); + + qemu_opts_foreach(qemu_find_opts("add-fd"), + cleanup_add_fd, NULL, &error_fatal); +#endif + + if (!trace_init_backends()) { + exit(1); + } + trace_init_file(); + + /* Open the logfile at this point and set the log mask if necessary. + */ + qemu_set_log_filename(log_file, &error_fatal); + if (log_mask) { + int mask; + mask =3D qemu_str_to_log_mask(log_mask); + if (!mask) { + qemu_print_log_usage(stdout); + exit(1); + } + qemu_set_log(mask); + } else { + qemu_set_log(0); + } + + /* add configured firmware directories */ + dirs =3D g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S= , 0); + for (i =3D 0; dirs[i] !=3D NULL; i++) { + qemu_add_data_dir(get_relocated_path(dirs[i])); + } + g_strfreev(dirs); + + /* try to find datadir relative to the executable path */ + qemu_add_data_dir(find_datadir()); +} + +static void qemu_process_help_options(void) +{ + int i; + + /* + * Check for -cpu help and -device help before we call select_machine(= ), + * which will return an error if the architecture has no default machi= ne + * type and the user did not specify one, so that the user doesn't need + * to say '-cpu help -machine something'. + */ + if (cpu_option && is_help_option(cpu_option)) { + list_cpus(cpu_option); + exit(0); + } + + if (qemu_opts_foreach(qemu_find_opts("device"), + device_help_func, NULL, NULL)) { + exit(0); + } + + /* -L help lists the data directories and exits. */ + if (list_data_dirs) { + for (i =3D 0; i < data_dir_idx; i++) { + printf("%s\n", data_dir[i]); + } + exit(0); + } +} + +static void qemu_maybe_daemonize(const char *pid_file) +{ + Error *err; + + os_daemonize(); + rcu_disable_atfork(); + + if (pid_file && !qemu_write_pidfile(pid_file, &err)) { + error_reportf_err(err, "cannot create PID file: "); + exit(1); + } + + qemu_unlink_pidfile_notifier.notify =3D qemu_unlink_pidfile; + qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier); +} + + void qemu_init(int argc, char **argv, char **envp) { int i; @@ -2875,21 +2979,16 @@ void qemu_init(int argc, char **argv, char **envp) const char *optarg; const char *loadvm =3D NULL; MachineClass *machine_class; - const char *cpu_option; const char *vga_model =3D NULL; const char *incoming =3D NULL; bool userconfig =3D true; bool nographic =3D false; int display_remote =3D 0; - const char *log_mask =3D NULL; - const char *log_file =3D NULL; ram_addr_t maxram_size; uint64_t ram_slots =3D 0; FILE *vmstate_dump_file =3D NULL; Error *main_loop_err =3D NULL; Error *err =3D NULL; - bool list_data_dirs =3D false; - char **dirs; const char *mem_path =3D NULL; bool have_custom_ram_size; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); @@ -3833,20 +3932,17 @@ void qemu_init(int argc, char **argv, char **envp) */ loc_set_none(); =20 - /* - * Check for -cpu help and -device help before we call select_machine(= ), - * which will return an error if the architecture has no default machi= ne - * type and the user did not specify one, so that the user doesn't need - * to say '-cpu help -machine something'. + /* These options affect everything else and should be processed + * before daemonizing. */ - if (cpu_option && is_help_option(cpu_option)) { - list_cpus(cpu_option); - exit(0); - } + qemu_process_early_options(); =20 - if (qemu_opts_foreach(qemu_find_opts("device"), - device_help_func, NULL, NULL)) { - exit(0); + qemu_process_help_options(); + qemu_maybe_daemonize(pid_file); + + if (qemu_init_main_loop(&main_loop_err)) { + error_report_err(main_loop_err); + exit(1); } =20 user_register_global_props(); @@ -3867,40 +3963,6 @@ void qemu_init(int argc, char **argv, char **envp) have_custom_ram_size =3D set_memory_options(&ram_slots, &maxram_size, machine_class); =20 - os_daemonize(); - rcu_disable_atfork(); - - if (pid_file && !qemu_write_pidfile(pid_file, &err)) { - error_reportf_err(err, "cannot create PID file: "); - exit(1); - } - - qemu_unlink_pidfile_notifier.notify =3D qemu_unlink_pidfile; - qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier); - - if (qemu_init_main_loop(&main_loop_err)) { - error_report_err(main_loop_err); - exit(1); - } - -#ifdef CONFIG_SECCOMP - olist =3D qemu_find_opts_err("sandbox", NULL); - if (olist) { - qemu_opts_foreach(olist, parse_sandbox, NULL, &error_fatal); - } -#endif - - qemu_opts_foreach(qemu_find_opts("name"), - parse_name, NULL, &error_fatal); - -#ifndef _WIN32 - qemu_opts_foreach(qemu_find_opts("add-fd"), - parse_add_fd, NULL, &error_fatal); - - qemu_opts_foreach(qemu_find_opts("add-fd"), - cleanup_add_fd, NULL, &error_fatal); -#endif - current_machine =3D MACHINE(object_new_with_class(OBJECT_CLASS(machine= _class))); if (machine_help_func(qemu_get_machine_opts(), current_machine)) { exit(0); @@ -3926,44 +3988,6 @@ void qemu_init(int argc, char **argv, char **envp) qemu_set_hw_version(machine_class->hw_version); } =20 - if (!trace_init_backends()) { - exit(1); - } - trace_init_file(); - - /* Open the logfile at this point and set the log mask if necessary. - */ - qemu_set_log_filename(log_file, &error_fatal); - if (log_mask) { - int mask; - mask =3D qemu_str_to_log_mask(log_mask); - if (!mask) { - qemu_print_log_usage(stdout); - exit(1); - } - qemu_set_log(mask); - } else { - qemu_set_log(0); - } - - /* add configured firmware directories */ - dirs =3D g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S= , 0); - for (i =3D 0; dirs[i] !=3D NULL; i++) { - qemu_add_data_dir(get_relocated_path(dirs[i])); - } - g_strfreev(dirs); - - /* try to find datadir relative to the executable path */ - qemu_add_data_dir(find_datadir()); - - /* -L help lists the data directories and exits. */ - if (list_data_dirs) { - for (i =3D 0; i < data_dir_idx; i++) { - printf("%s\n", data_dir[i]); - } - exit(0); - } - machine_smp_parse(current_machine, qemu_opts_find(qemu_find_opts("smp-opts"), NULL), &error_fatal); =20 --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314417; cv=none; d=zohomail.com; s=zohoarc; b=ID5n7jaKaoVuHF5ygacvtRv23NP40oDH6RY+nJZ+tQTjz/PhDZ3F0NUpzm0ntz9Vfpcmnskb17G/dj6byblPJ61ndG2Vsp8goXq7bgXjl0nNEiD7g+E6ol/oXBRQleVfdOKbO403fxEkZ9UdV2c8+SqCIUoN9l3O0wSJK3mXJTo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314417; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=joMLROSh5hWNvzYW2mRufD5bQKbfXZEfJ+2cbsoVqIk=; b=ILlmHGlWry3Kke6bnxGAQZWbwkE3d05u7HHDYzAEcFYkg8kzdwEt9wpiXnzp9BxPIG364ocCkD6lg2vTPaznrU93dVP4ct2YZK06d4sEPNgQoehjThnc8v70wdi3UfGhbdH7VRxmruWXXKuwka0ddnQiz1BPLx82adDh16KKLKg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314417303778.6524231780434; Wed, 21 Oct 2020 14:06:57 -0700 (PDT) Received: from localhost ([::1]:57640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLJw-0007rV-4w for importer@patchew.org; Wed, 21 Oct 2020 17:06:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB3-0005lc-H1 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006fK-CB for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-evHRjnNqOKq-TFnj-vvSAQ-1; Wed, 21 Oct 2020 16:57:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 398B35F9C6 for ; Wed, 21 Oct 2020 20:57:23 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C04CA6EF62; Wed, 21 Oct 2020 20:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=joMLROSh5hWNvzYW2mRufD5bQKbfXZEfJ+2cbsoVqIk=; b=GrGtn2yeGPQck0cr+D3ojOAWGFPM/DVmzp0nHhdUujp3KYcX6tLaiv76jkr4IULMi0sshb i/buDz9vJyx3CpNxleod6va94tbFI+Q/OvBZEHW8HXuNZeGe+MOMkAIHADeSloVAiNKNmP 1KciPK/Oryx0/ZmcVfV98keA8/vv3Hw= X-MC-Unique: evHRjnNqOKq-TFnj-vvSAQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 09/22] vl: move various initialization routines out of qemu_init Date: Wed, 21 Oct 2020 16:57:03 -0400 Message-Id: <20201021205716.2359430-10-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Some very simple initialization routines can be nested in existing subsystem-level functions, do that to simplify qemu_init. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 3 +++ include/hw/qdev-core.h | 8 -------- migration/migration.c | 4 ++++ softmmu/qdev-monitor.c | 6 ------ softmmu/vl.c | 5 ----- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 70b1e5e8e8..3c674bb05e 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -873,6 +873,9 @@ static void machine_initfn(Object *obj) MachineState *ms =3D MACHINE(obj); MachineClass *mc =3D MACHINE_GET_CLASS(obj); =20 + container_get(obj, "/peripheral"); + container_get(obj, "/peripheral-anon"); + ms->dump_guest_core =3D true; ms->mem_merge =3D true; ms->enable_graphics =3D true; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 868973319e..56ce7f2d7f 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -769,14 +769,6 @@ BusState *sysbus_get_default(void); char *qdev_get_fw_dev_path(DeviceState *dev); char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *de= v); =20 -/** - * @qdev_machine_init - * - * Initialize platform devices before machine init. This is a hack until = full - * support for composition is added. - */ -void qdev_machine_init(void); - /** * device_legacy_reset: * diff --git a/migration/migration.c b/migration/migration.c index deb6005b8d..f48b03cac2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -169,6 +169,10 @@ void migration_object_init(void) error_report_err(err); exit(1); } + + blk_mig_init(); + ram_mig_init(); + dirty_bitmap_mig_init(); } =20 void migration_shutdown(void) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index bcfb90a08f..bcfcbac181 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -943,12 +943,6 @@ BlockBackend *blk_by_qdev_id(const char *id, Error **e= rrp) return blk; } =20 -void qdev_machine_init(void) -{ - qdev_get_peripheral_anon(); - qdev_get_peripheral(); -} - QemuOptsList qemu_device_opts =3D { .name =3D "device", .implied_opt_name =3D "driver", diff --git a/softmmu/vl.c b/softmmu/vl.c index 2e1714d7a4..a9f69a7d11 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4269,10 +4269,6 @@ void qemu_init(int argc, char **argv, char **envp) exit(1); } =20 - blk_mig_init(); - ram_mig_init(); - dirty_bitmap_mig_init(); - qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, &error_fatal); =20 @@ -4305,7 +4301,6 @@ void qemu_init(int argc, char **argv, char **envp) reading from the other reads, because timer polling functions query clock values from the log. */ replay_checkpoint(CHECKPOINT_INIT); - qdev_machine_init(); =20 current_machine->boot_order =3D boot_order; =20 --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314945; cv=none; d=zohomail.com; s=zohoarc; b=gcQhCVtMRXue6rNwHnwywFsciCaiGh9s+bqj7pW0ea5ro196+kRfPI6eaMoN9BNmXeVlOn0D5PKd7Fabpw6/zTqR3zNUkqPcGui2hugbl2Y4UtlkHcm/TID/qfmeZGK34jCcgwPRqazDCyI58HBhaZ6It/H48Z2ERlLyxtljopg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iB6qv4a+aDu0BX/0RS/j/Wdxsua155FSRJWNDGQTqBk=; b=jQHE+lntbtGlgDWEIwlE87yzq+cvRoe3NmptG43PVai/BHnDqG5X8j+81Zs+2hRsU6WkCGiVWq7b/MUMru3lCPa7G9AJ539lBVSsPaTHWPkR1HAv3BeRlCCr047kTMXf6hLEVRXmJc4jB9tN2ZXD85jfBpA4Ai2wRxWa1wS77hw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314945921272.95584366383616; Wed, 21 Oct 2020 14:15:45 -0700 (PDT) Received: from localhost ([::1]:49576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLSR-0008OX-Hk for importer@patchew.org; Wed, 21 Oct 2020 17:15:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB3-0005kx-B2 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:29695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006fP-CD for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-238-u815ppS1PtSyQ40Oy-IUsQ-1; Wed, 21 Oct 2020 16:57:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63AC15F9C1 for ; Wed, 21 Oct 2020 20:57:24 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2B936EF62; Wed, 21 Oct 2020 20:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iB6qv4a+aDu0BX/0RS/j/Wdxsua155FSRJWNDGQTqBk=; b=cVQnbSD8uuVyrcBhUMIPCpRrXB6ubmhvkK1dHYpGQZjzQ+CvOWEm9NFbj3xJe9DT/M2I2c 1oxXs8K2DwJem67RmNqnPTEO9B8RRd5lqQjxlFcG4WRcJWOtwrAFE7x1dYrGHD9ZVy1kuc OACUsCZtLhPeKCjRk7789MMyn7FUigE= X-MC-Unique: u815ppS1PtSyQ40Oy-IUsQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 10/22] vl: extract qemu_init_subsystems Date: Wed, 21 Oct 2020 16:57:04 -0400 Message-Id: <20201021205716.2359430-11-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Group a bunch of subsystem initializations that can be done right after command line parsing. Remove initializations that can be done simply as global variable initializers. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 94 ++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index a9f69a7d11..e731d754ec 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -129,7 +129,7 @@ bool enable_mlock =3D false; bool enable_cpu_pm =3D false; int nb_nics; NICInfo nd_table[MAX_NICS]; -int autostart; +int autostart =3D 1; static enum { RTC_BASE_UTC, RTC_BASE_LOCALTIME, @@ -1229,7 +1229,8 @@ struct VMChangeStateEntry { int priority; }; =20 -static QTAILQ_HEAD(, VMChangeStateEntry) vm_change_state_head; +static QTAILQ_HEAD(, VMChangeStateEntry) vm_change_state_head =3D + QTAILQ_HEAD_INITIALIZER(vm_change_state_head); =20 /** * qemu_add_vm_change_state_handler_prio: @@ -2962,11 +2963,45 @@ static void qemu_maybe_daemonize(const char *pid_fi= le) qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier); } =20 +static void qemu_init_subsystems(void) +{ + Error *err; + + os_set_line_buffering(); + + module_call_init(MODULE_INIT_TRACE); + + qemu_init_cpu_list(); + qemu_init_cpu_loop(); + qemu_mutex_lock_iothread(); + + atexit(qemu_run_exit_notifiers); + + module_call_init(MODULE_INIT_QOM); + module_call_init(MODULE_INIT_MIGRATION); + + runstate_init(); + precopy_infrastructure_init(); + postcopy_infrastructure_init(); + monitor_init_globals(); + + if (qcrypto_init(&err) < 0) { + error_reportf_err(err, "cannot initialize crypto: "); + exit(1); + } + + os_setup_early_signal_handling(); + + bdrv_init_with_whitelist(); + page_size_init(); + socket_init(); +} =20 void qemu_init(int argc, char **argv, char **envp) { int i; - int snapshot, linux_boot; + int snapshot =3D 0; + int linux_boot; const char *initrd_filename; const char *kernel_filename, *kernel_cmdline; const char *boot_order =3D NULL; @@ -2987,7 +3022,6 @@ void qemu_init(int argc, char **argv, char **envp) ram_addr_t maxram_size; uint64_t ram_slots =3D 0; FILE *vmstate_dump_file =3D NULL; - Error *main_loop_err =3D NULL; Error *err =3D NULL; const char *mem_path =3D NULL; bool have_custom_ram_size; @@ -2995,22 +3029,6 @@ void qemu_init(int argc, char **argv, char **envp) QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); int mem_prealloc =3D 0; /* force preallocation of physical target memo= ry */ =20 - os_set_line_buffering(); - - error_init(argv[0]); - module_call_init(MODULE_INIT_TRACE); - - qemu_init_cpu_list(); - qemu_init_cpu_loop(); - - qemu_mutex_lock_iothread(); - - atexit(qemu_run_exit_notifiers); - qemu_init_exec_dir(argv[0]); - - module_call_init(MODULE_INIT_QOM); - module_call_init(MODULE_INIT_MIGRATION); - qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); qemu_add_drive_opts(&qemu_common_drive_opts); @@ -3045,27 +3063,10 @@ void qemu_init(int argc, char **argv, char **envp) qemu_add_opts(&qemu_fw_cfg_opts); module_call_init(MODULE_INIT_OPTS); =20 - runstate_init(); - precopy_infrastructure_init(); - postcopy_infrastructure_init(); - monitor_init_globals(); - - if (qcrypto_init(&err) < 0) { - error_reportf_err(err, "cannot initialize crypto: "); - exit(1); - } - - QTAILQ_INIT(&vm_change_state_head); - os_setup_early_signal_handling(); - - cpu_option =3D NULL; - snapshot =3D 0; - - nb_nics =3D 0; - - bdrv_init_with_whitelist(); + error_init(argv[0]); + qemu_init_exec_dir(argv[0]); =20 - autostart =3D 1; + qemu_init_subsystems(); =20 /* first pass of option parsing */ optind =3D 1; @@ -3940,13 +3941,10 @@ void qemu_init(int argc, char **argv, char **envp) qemu_process_help_options(); qemu_maybe_daemonize(pid_file); =20 - if (qemu_init_main_loop(&main_loop_err)) { - error_report_err(main_loop_err); - exit(1); - } + qemu_init_main_loop(&error_fatal); + cpu_timers_init(); =20 user_register_global_props(); - replay_configure(icount_opts); =20 if (incoming && !preconfig_exit_requested) { @@ -4125,9 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp) exit(1); } =20 - page_size_init(); - socket_init(); - qemu_opts_foreach(qemu_find_opts("object"), user_creatable_add_opts_foreach, object_create_initial, &error_fatal); @@ -4245,9 +4240,6 @@ void qemu_init(int argc, char **argv, char **envp) semihosting_arg_fallback(kernel_filename, kernel_cmdline); } =20 - /* initialize cpu timers and VCPU throttle modules */ - cpu_timers_init(); - if (default_net) { QemuOptsList *net =3D qemu_find_opts("net"); qemu_opts_set(net, NULL, "type", "nic", &error_abort); --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314757; cv=none; d=zohomail.com; s=zohoarc; b=oH1dO2/TC9HzHyeYE0kBO2s1e/d6W9cW4TyLF/wDC/7l4MTJ86XcqP1q3+NLHqPlw9EfNs6ehYggW74+o7Ra7XrSJRwwErwetM4izyJPg3ZoGuUSNZSZYjdo+oOSls8sUhJEty0GspKtVOxBhxnF5UFLwS3umHxLkw1n1uDk9vo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C03ZrjuUMwkEt5mkfe2qY3qEEuJCfrYlmiCZCkQ0wzA=; b=K6u26pBGmE9MkIXfnz/ExO0xs52bMPALcJwa6XEB5taap0462gC/p6voyRvThFzhJwdFqE8iOI2Mt5/C7KEgfD1ds2kg87WzShi8XFyQxZ2FT7RkjGaenV1l9LRuEcrNV/v1r5P0t1hwvf6pOI0OfUoux+SktXuZzJPLJPt963o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314757245872.016432547604; Wed, 21 Oct 2020 14:12:37 -0700 (PDT) Received: from localhost ([::1]:41522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLPP-0004z1-UO for importer@patchew.org; Wed, 21 Oct 2020 17:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAz-0005bv-RW for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006fT-Ba for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-wkJ36850OlePL8yuQud95w-1; Wed, 21 Oct 2020 16:57:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 146C71005E77 for ; Wed, 21 Oct 2020 20:57:25 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 846416EF62; Wed, 21 Oct 2020 20:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C03ZrjuUMwkEt5mkfe2qY3qEEuJCfrYlmiCZCkQ0wzA=; b=WB1vMB+MCtLn4J7JuohkRNAHHTcnQ5t++vZDQ3E4zZL3hKvPJe4nmxeFG6lWkN7wSQn/Mj qskcnLyF9psGcLbpORJiAfvm/DcuBd++0KOu5HDPZQMObczPah5heK0quOV5DC2jYNqTn4 Q52V/ZCBwXyLWuASM7SZGl70KJWjj8w= X-MC-Unique: wkJ36850OlePL8yuQud95w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 11/22] vl: move prelaunch part of qemu_init to a new function Date: Wed, 21 Oct 2020 16:57:05 -0400 Message-Id: <20201021205716.2359430-12-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" The final part of qemu_init, starting with the completion of board init, is already relatively clean. Split it out of qemu_init so that qemu_init keeps only the messy parts. Signed-off-by: Paolo Bonzini --- include/sysemu/sysemu.h | 1 + softmmu/vl.c | 238 +++++++++++++++++++++------------------- 2 files changed, 124 insertions(+), 115 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 817ff4cf75..9f47b2a354 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -112,6 +112,7 @@ QemuOpts *qemu_get_machine_opts(void); bool defaults_enabled(void); =20 void qemu_init(int argc, char **argv, char **envp); +void qemu_finish_machine_init(void); void qemu_main_loop(void); void qemu_cleanup(void); =20 diff --git a/softmmu/vl.c b/softmmu/vl.c index e731d754ec..52e7d317d7 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -120,6 +120,9 @@ static const char *cpu_option; static const char *data_dir[16]; static int data_dir_idx; +static const char *mem_path; +static const char *boot_order; +static const char *boot_once; const char *bios_name =3D NULL; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int display_opengl; @@ -2997,6 +3000,125 @@ static void qemu_init_subsystems(void) socket_init(); } =20 +/* Called after leaving preconfig state. */ +void qemu_finish_machine_init(void) +{ + MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); + DisplayState *ds; + + if (machine_class->default_ram_id && current_machine->ram_size && + numa_uses_legacy_mem() && !current_machine->ram_memdev_id) { + create_default_memdev(current_machine, mem_path); + } + + /* from here on runstate is RUN_STATE_PRELAUNCH */ + machine_run_board_init(current_machine); + + /* + * TODO To drop support for deprecated bogus if=3D..., move + * drive_check_orphaned() here, replacing this call. Also drop + * its deprecation warning, along with DriveInfo member + * @claimed_by_board. + */ + drive_mark_claimed_by_board(); + + realtime_init(); + + soundhw_init(); + + if (hax_enabled()) { + hax_sync_vcpus(); + } + + qemu_opts_foreach(qemu_find_opts("fw_cfg"), + parse_fw_cfg, fw_cfg_find(), &error_fatal); + + /* init USB devices */ + if (machine_usb(current_machine)) { + if (foreach_device_config(DEV_USB, usb_parse) < 0) + exit(1); + } + + /* init generic devices */ + rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE); + qemu_opts_foreach(qemu_find_opts("device"), + device_init_func, NULL, &error_fatal); + + cpu_synchronize_all_post_init(); + + rom_reset_order_override(); + + /* Did we create any drives that we failed to create a device for? */ + drive_check_orphaned(); + + /* Don't warn about the default network setup that you get if + * no command line -net or -netdev options are specified. There + * are two cases that we would otherwise complain about: + * (1) board doesn't support a NIC but the implicit "-net nic" + * requested one + * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic" + * sets up a nic that isn't connected to anything. + */ + if (!default_net && (!qtest_enabled() || has_defaults)) { + net_check_clients(); + } + + if (boot_once) { + qemu_boot_set(boot_once, &error_fatal); + qemu_register_reset(restore_boot_order, g_strdup(boot_order)); + } + + /* init local displays */ + ds =3D init_displaystate(); + qemu_display_init(ds, &dpy); + + /* must be after terminal init, SDL library changes signal handlers */ + os_setup_signal_handling(); + + /* init remote displays */ +#ifdef CONFIG_VNC + qemu_opts_foreach(qemu_find_opts("vnc"), + vnc_init_func, NULL, &error_fatal); +#endif + + if (using_spice) { + qemu_spice_display_init(); + } + + if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) { + exit(1); + } + + qdev_machine_creation_done(); + + /* TODO: once all bus devices are qdevified, this should be done + * when bus is created by qdev.c */ + /* + * TODO: If we had a main 'reset container' that the whole system + * lived in, we could reset that using the multi-phase reset + * APIs. For the moment, we just reset the sysbus, which will cause + * all devices hanging off it (and all their child buses, recursively) + * to be reset. Note that this will *not* reset any Device objects + * which are not attached to some part of the qbus tree! + */ + qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default()); + qemu_run_machine_init_done_notifiers(); + + if (rom_check_and_register_reset() !=3D 0) { + error_report("rom check and register reset failed"); + exit(1); + } + + replay_start(); + + /* This checkpoint is required by replay to separate prior clock + reading from the other reads, because timer polling functions query + clock values from the log. */ + replay_checkpoint(CHECKPOINT_RESET); + qemu_system_reset(SHUTDOWN_CAUSE_NONE); + register_global_state(); +} + void qemu_init(int argc, char **argv, char **envp) { int i; @@ -3004,9 +3126,6 @@ void qemu_init(int argc, char **argv, char **envp) int linux_boot; const char *initrd_filename; const char *kernel_filename, *kernel_cmdline; - const char *boot_order =3D NULL; - const char *boot_once =3D NULL; - DisplayState *ds; QemuOpts *opts, *machine_opts; QemuOpts *icount_opts =3D NULL, *accel_opts =3D NULL; QemuOptsList *olist; @@ -3023,7 +3142,6 @@ void qemu_init(int argc, char **argv, char **envp) uint64_t ram_slots =3D 0; FILE *vmstate_dump_file =3D NULL; Error *err =3D NULL; - const char *mem_path =3D NULL; bool have_custom_ram_size; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); @@ -4340,117 +4458,8 @@ void qemu_init(int argc, char **argv, char **envp) /* do monitor/qmp handling at preconfig state if requested */ qemu_main_loop(); =20 - if (machine_class->default_ram_id && current_machine->ram_size && - numa_uses_legacy_mem() && !current_machine->ram_memdev_id) { - create_default_memdev(current_machine, mem_path); - } - - /* from here on runstate is RUN_STATE_PRELAUNCH */ - machine_run_board_init(current_machine); - - /* - * TODO To drop support for deprecated bogus if=3D..., move - * drive_check_orphaned() here, replacing this call. Also drop - * its deprecation warning, along with DriveInfo member - * @claimed_by_board. - */ - drive_mark_claimed_by_board(); - - realtime_init(); - - soundhw_init(); - - if (hax_enabled()) { - hax_sync_vcpus(); - } - - qemu_opts_foreach(qemu_find_opts("fw_cfg"), - parse_fw_cfg, fw_cfg_find(), &error_fatal); - - /* init USB devices */ - if (machine_usb(current_machine)) { - if (foreach_device_config(DEV_USB, usb_parse) < 0) - exit(1); - } - - /* init generic devices */ - rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE); - qemu_opts_foreach(qemu_find_opts("device"), - device_init_func, NULL, &error_fatal); - - cpu_synchronize_all_post_init(); - - rom_reset_order_override(); - - /* Did we create any drives that we failed to create a device for? */ - drive_check_orphaned(); - - /* Don't warn about the default network setup that you get if - * no command line -net or -netdev options are specified. There - * are two cases that we would otherwise complain about: - * (1) board doesn't support a NIC but the implicit "-net nic" - * requested one - * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic" - * sets up a nic that isn't connected to anything. - */ - if (!default_net && (!qtest_enabled() || has_defaults)) { - net_check_clients(); - } - - if (boot_once) { - qemu_boot_set(boot_once, &error_fatal); - qemu_register_reset(restore_boot_order, g_strdup(boot_order)); - } + qemu_finish_machine_init(); =20 - /* init local displays */ - ds =3D init_displaystate(); - qemu_display_init(ds, &dpy); - - /* must be after terminal init, SDL library changes signal handlers */ - os_setup_signal_handling(); - - /* init remote displays */ -#ifdef CONFIG_VNC - qemu_opts_foreach(qemu_find_opts("vnc"), - vnc_init_func, NULL, &error_fatal); -#endif - - if (using_spice) { - qemu_spice_display_init(); - } - - if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) { - exit(1); - } - - qdev_machine_creation_done(); - - /* TODO: once all bus devices are qdevified, this should be done - * when bus is created by qdev.c */ - /* - * TODO: If we had a main 'reset container' that the whole system - * lived in, we could reset that using the multi-phase reset - * APIs. For the moment, we just reset the sysbus, which will cause - * all devices hanging off it (and all their child buses, recursively) - * to be reset. Note that this will *not* reset any Device objects - * which are not attached to some part of the qbus tree! - */ - qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default()); - qemu_run_machine_init_done_notifiers(); - - if (rom_check_and_register_reset() !=3D 0) { - error_report("rom check and register reset failed"); - exit(1); - } - - replay_start(); - - /* This checkpoint is required by replay to separate prior clock - reading from the other reads, because timer polling functions query - clock values from the log. */ - replay_checkpoint(CHECKPOINT_RESET); - qemu_system_reset(SHUTDOWN_CAUSE_NONE); - register_global_state(); if (loadvm) { Error *local_err =3D NULL; if (load_snapshot(loadvm, &local_err) < 0) { @@ -4469,7 +4478,6 @@ void qemu_init(int argc, char **argv, char **envp) dump_vmstate_json_to_file(vmstate_dump_file); exit(0); } - if (incoming) { Error *local_err =3D NULL; qemu_start_incoming_migration(incoming, &local_err); --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603315178; cv=none; d=zohomail.com; s=zohoarc; b=UfAmhNMACTG6z+8avWHKRgpYuedx5cKtOIEfemJuXp7fdBR4vokAFYPxZhVy5Hy4RCc3secgAx1O4w+UtNmDt3jmc/iWRJdHBQRC7W9m5nUJByHrFVXv7xL9Y3JyUipXC2BBX1s/g5Kv3LLOW6yZyUnykHKIeQM7qCogNQ4pPQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603315178; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e0egizT1LhBTypV0Z8jUS6/aYGmVEDSIu03qH+texvk=; b=GEBFWdCtJ+ib8JAI/qH5N08LQhh7fxrCzJc6khoFPAFGlYfsoCl/i2J5U1PYGmhWeZgeFRW+Dky0+XgwgqJBPETPTyqazj0mGN6pLufRwl8LpB+y1jNtGCc33pDdfMzgZTFXKW3nd0zY0Ro387RH5HkqkaoGWk4+yEBkxoYqWi4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 160331517841941.41418490832382; Wed, 21 Oct 2020 14:19:38 -0700 (PDT) Received: from localhost ([::1]:57612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLWC-0003WF-Ly for importer@patchew.org; Wed, 21 Oct 2020 17:19:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB4-0005nc-A5 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:23688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006gP-Cw for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-EsPWbHgVNbKl-iQGy-ONqg-1; Wed, 21 Oct 2020 16:57:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4CA4186DD48 for ; Wed, 21 Oct 2020 20:57:28 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 353326EF62; Wed, 21 Oct 2020 20:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e0egizT1LhBTypV0Z8jUS6/aYGmVEDSIu03qH+texvk=; b=K3GajrGLKgcpe8xr9tiepTUUAUE1Ld6bPleBTtBd3h/cSicHgHwMlJeKZQnbmterQ3Mg/H u5Byf++idpzaZdlesWzUDqtDgQQs23sJeBXpZ2UtNui3sjtOZsOX1a2NtgPT5VmnDqkkYa fXc6fxotmmIHMTN1vZqd9T/PIaShb08= X-MC-Unique: EsPWbHgVNbKl-iQGy-ONqg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 12/22] vl: move bios_name out of softmmu/vl.c Date: Wed, 21 Oct 2020 16:57:06 -0400 Message-Id: <20201021205716.2359430-13-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" bios_name is a legacy variable used by machine code. Hide it from softmmu/vl.c. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/machine.c | 5 +++++ softmmu/vl.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 3c674bb05e..e4dac350d4 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -212,6 +212,8 @@ GlobalProperty hw_compat_2_1[] =3D { }; const size_t hw_compat_2_1_len =3D G_N_ELEMENTS(hw_compat_2_1); =20 +const char *bios_name =3D NULL; + static char *machine_get_kernel(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -396,6 +398,9 @@ static void machine_set_firmware(Object *obj, const cha= r *value, Error **errp) =20 g_free(ms->firmware); ms->firmware =3D g_strdup(value); + + /* HACK */ + bios_name =3D ms->firmware; } =20 static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **e= rrp) diff --git a/softmmu/vl.c b/softmmu/vl.c index 52e7d317d7..e32e209a82 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -123,7 +123,6 @@ static int data_dir_idx; static const char *mem_path; static const char *boot_order; static const char *boot_once; -const char *bios_name =3D NULL; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int display_opengl; const char* keyboard_layout =3D NULL; @@ -4314,7 +4313,6 @@ void qemu_init(int argc, char **argv, char **envp) kernel_filename =3D qemu_opt_get(machine_opts, "kernel"); initrd_filename =3D qemu_opt_get(machine_opts, "initrd"); kernel_cmdline =3D qemu_opt_get(machine_opts, "append"); - bios_name =3D qemu_opt_get(machine_opts, "firmware"); =20 opts =3D qemu_opts_find(qemu_find_opts("boot-opts"), NULL); if (opts) { --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314944; cv=none; d=zohomail.com; s=zohoarc; b=MqMF9mIExW6dLzSPBRphjBqJnhHOaoUhmaxz0zKFuuJTEuRSCjCicf0mFb0YQdWeTjvP+lARAGY3M91fGoL3++IpPN3GMCOaIYdh9XY72LHBWn0CbfJo7lIGIet/0WshAsRwv6CvnLlHBDFz+eRdH2dwIZExqRBXpnd9nDtYYkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dRvr5vK9gyZ3cW3q+3aqjtBHNka0CgHWp9sdX69KnyE=; b=I8cVoKapkYg0gHSZZPoHbe7LO7rTe+e+6aaFKM+vlvuInN5LMlYIc3PCTveSQVbuJ1lh4LKgbQwbaRjLlYU+O0roylC8855nLEFJXBL4kLQQB9WWBYhlWl1Ro4zpUSYds/TNDy1OSux5DaLJvXOr6PKu+COiF1ebZExZ2dRDOIM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314944256633.1819726185381; Wed, 21 Oct 2020 14:15:44 -0700 (PDT) Received: from localhost ([::1]:49540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLSR-0008Ne-1C for importer@patchew.org; Wed, 21 Oct 2020 17:15:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB1-0005gV-MG for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006gl-CU for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-544-lkO0AsEwM1KG7oGQbjEMUw-1; Wed, 21 Oct 2020 16:57:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74DF5804B68 for ; Wed, 21 Oct 2020 20:57:29 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C53296EF62; Wed, 21 Oct 2020 20:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dRvr5vK9gyZ3cW3q+3aqjtBHNka0CgHWp9sdX69KnyE=; b=S4cmQ0EVlU+dmaWH0sl6P78gopuUTcKWhDgV7aXkFNMJzdRsif6MrKitv2MGeQp74GDzf7 hPZdoTDH6/gVElLfCKIAKwLOumnWfcz9XTm4DhFFGMcsNDGajIswA+ZLvyLb5vb62a2K9T udqXbq7m2DzGsA68h4rcvEFGiJC6jRE= X-MC-Unique: lkO0AsEwM1KG7oGQbjEMUw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 13/22] vl: extract various command line validation snippets to a new function Date: Wed, 21 Oct 2020 16:57:07 -0400 Message-Id: <20201021205716.2359430-14-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 78 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index e32e209a82..f8b1ffb46e 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -123,6 +123,7 @@ static int data_dir_idx; static const char *mem_path; static const char *boot_order; static const char *boot_once; +static const char *incoming; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int display_opengl; const char* keyboard_layout =3D NULL; @@ -2866,6 +2867,39 @@ static char *find_datadir(void) return get_relocated_path(CONFIG_QEMU_DATADIR); } =20 +static void qemu_validate_options(void) +{ + QemuOpts *machine_opts =3D qemu_get_machine_opts(); + const char *kernel_filename =3D qemu_opt_get(machine_opts, "kernel"); + const char *initrd_filename =3D qemu_opt_get(machine_opts, "initrd"); + const char *kernel_cmdline =3D qemu_opt_get(machine_opts, "append"); + + if (kernel_filename =3D=3D NULL) { + if (kernel_cmdline !=3D NULL) { + error_report("-append only allowed with -kernel option"); + exit(1); + } + + if (initrd_filename !=3D NULL) { + error_report("-initrd only allowed with -kernel option"); + exit(1); + } + } + + if (incoming && !preconfig_exit_requested) { + error_report("'preconfig' and 'incoming' options are " + "mutually exclusive"); + exit(EXIT_FAILURE); + } + +#ifdef CONFIG_CURSES + if (is_daemonized() && dpy.type =3D=3D DISPLAY_TYPE_CURSES) { + error_report("curses display cannot be used with -daemonize"); + exit(1); + } +#endif +} + static void qemu_process_early_options(void) { char **dirs; @@ -3122,9 +3156,6 @@ void qemu_init(int argc, char **argv, char **envp) { int i; int snapshot =3D 0; - int linux_boot; - const char *initrd_filename; - const char *kernel_filename, *kernel_cmdline; QemuOpts *opts, *machine_opts; QemuOpts *icount_opts =3D NULL, *accel_opts =3D NULL; QemuOptsList *olist; @@ -3133,7 +3164,6 @@ void qemu_init(int argc, char **argv, char **envp) const char *loadvm =3D NULL; MachineClass *machine_class; const char *vga_model =3D NULL; - const char *incoming =3D NULL; bool userconfig =3D true; bool nographic =3D false; int display_remote =3D 0; @@ -4050,6 +4080,8 @@ void qemu_init(int argc, char **argv, char **envp) */ loc_set_none(); =20 + qemu_validate_options(); + /* These options affect everything else and should be processed * before daemonizing. */ @@ -4064,12 +4096,6 @@ void qemu_init(int argc, char **argv, char **envp) user_register_global_props(); replay_configure(icount_opts); =20 - if (incoming && !preconfig_exit_requested) { - error_report("'preconfig' and 'incoming' options are " - "mutually exclusive"); - exit(EXIT_FAILURE); - } - configure_rtc(qemu_find_opts_singleton("rtc")); =20 machine_class =3D select_machine(); @@ -4173,12 +4199,6 @@ void qemu_init(int argc, char **argv, char **envp) error_report("-nographic cannot be used with -daemonize"); exit(1); } -#ifdef CONFIG_CURSES - if (dpy.type =3D=3D DISPLAY_TYPE_CURSES) { - error_report("curses display cannot be used with -daemonize"); - exit(1); - } -#endif } =20 if (nographic) { @@ -4309,11 +4329,6 @@ void qemu_init(int argc, char **argv, char **envp) qtest_server_init(qtest_chrdev, qtest_log, &error_fatal); } =20 - machine_opts =3D qemu_get_machine_opts(); - kernel_filename =3D qemu_opt_get(machine_opts, "kernel"); - initrd_filename =3D qemu_opt_get(machine_opts, "initrd"); - kernel_cmdline =3D qemu_opt_get(machine_opts, "append"); - opts =3D qemu_opts_find(qemu_find_opts("boot-opts"), NULL); if (opts) { boot_order =3D qemu_opt_get(opts, "order"); @@ -4334,24 +4349,9 @@ void qemu_init(int argc, char **argv, char **envp) boot_order =3D machine_class->default_boot_order; } =20 - if (!kernel_cmdline) { - kernel_cmdline =3D ""; - current_machine->kernel_cmdline =3D (char *)kernel_cmdline; - } - - linux_boot =3D (kernel_filename !=3D NULL); - - if (!linux_boot && *kernel_cmdline !=3D '\0') { - error_report("-append only allowed with -kernel option"); - exit(1); - } - - if (!linux_boot && initrd_filename !=3D NULL) { - error_report("-initrd only allowed with -kernel option"); - exit(1); - } - - if (semihosting_enabled() && !semihosting_get_argc() && kernel_filenam= e) { + if (semihosting_enabled() && !semihosting_get_argc()) { + const char *kernel_filename =3D qemu_opt_get(machine_opts, "kernel= "); + const char *kernel_cmdline =3D qemu_opt_get(machine_opts, "append"= ); /* fall back to the -kernel/-append */ semihosting_arg_fallback(kernel_filename, kernel_cmdline); } --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314322; cv=none; d=zohomail.com; s=zohoarc; b=kKnh69knP+0JDazwl/X9mC1YFWsXkonlRf6iUjBic7nvNj8bs8h9ZOThdEwKsWRgybVfO2YrSutvq9VDhg5eE18WR0g700OMXSGWThepyMIQWe6Cg0khMgUmsLH8M8WfhG508/w+Z5/V35c6eW+DttOKBa0dKYmQ7buSxunQtik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314322; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hEmG+5DMurtuugiP1AkAOY/uZr4pKnlUz7Ec9go+dTg=; b=QzVO1PNNKZIMAHk/80ybBKnDKtZAlRd3QqCCB6OtQg4fgRaaa0GHKKqMDP8JksVwvhoygMTx9yGEbecak7pCJBiifRaFi29gYHz6mUe04+ggi2ds/cWLzPQsVRiVXAERmp31M6pcll/rv86obMGpcTKmjYtpFSyUXKF0t4Xvekc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 160331432252127.47893190426862; Wed, 21 Oct 2020 14:05:22 -0700 (PDT) Received: from localhost ([::1]:54142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLIP-0005ye-EI for importer@patchew.org; Wed, 21 Oct 2020 17:05:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAz-0005Zq-2R for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39558) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006gs-9e for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-557-OrkrzfU3M9GNMWIMwXdP2w-1; Wed, 21 Oct 2020 16:57:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04E31186DD23 for ; Wed, 21 Oct 2020 20:57:30 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7571D6EF6E; Wed, 21 Oct 2020 20:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hEmG+5DMurtuugiP1AkAOY/uZr4pKnlUz7Ec9go+dTg=; b=ElyAGYKSzuc5aKlcRRte/BFmfSz2Yei3lvli4xYdcxbK7JJVaO6XGgftoza3hXnmbd5XBs Om5yOsoA02x98tubYmE5vWXI3vCqNJQwb8pgDVuHxw5DpZ4V698AU+eCROd+YIgV2kVbaL 3UqT2IdGGPbm6zqRXy10venU49O4mPc= X-MC-Unique: OrkrzfU3M9GNMWIMwXdP2w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 14/22] vl: preconfig and loadvm are mutually exclusive Date: Wed, 21 Oct 2020 16:57:08 -0400 Message-Id: <20201021205716.2359430-15-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Just like -incoming. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index f8b1ffb46e..3607cd4357 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -124,6 +124,7 @@ static const char *mem_path; static const char *boot_order; static const char *boot_once; static const char *incoming; +static const char *loadvm; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int display_opengl; const char* keyboard_layout =3D NULL; @@ -2886,6 +2887,11 @@ static void qemu_validate_options(void) } } =20 + if (loadvm && !preconfig_exit_requested) { + error_report("'preconfig' and 'loadvm' options are " + "mutually exclusive"); + exit(EXIT_FAILURE); + } if (incoming && !preconfig_exit_requested) { error_report("'preconfig' and 'incoming' options are " "mutually exclusive"); @@ -3161,7 +3167,6 @@ void qemu_init(int argc, char **argv, char **envp) QemuOptsList *olist; int optind; const char *optarg; - const char *loadvm =3D NULL; MachineClass *machine_class; const char *vga_model =3D NULL; bool userconfig =3D true; --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314546; cv=none; d=zohomail.com; s=zohoarc; b=CV81Bq82s9rerUSajdctl6FaHxSRztbL/OqOH2mmPBMMLNx9BBnBH89aYEZgeqegtk3TWEsrPi5zVu6LN+h7m/1tyywzc4fcmAvVVX6vJwK2BYt+x84OOMGmTI9QUiTRHNVBioc3u8yBoO4sCvjEND7ZUAmcJUaha3Kv2fE3oYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314546; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sjO3LEWU1B+vyfhOtmKRmrtOL9ZWXQ7OGar1eX5wPng=; b=HHQUsbQKEqM8RlacKV8wKKMEZyRnCc/yPXdUftaiV6RefCB3dtFKDtfv66gnWKhW6q+tA6CVsKNpGZFb1zEweeOlRTRi3vus8W3hj9H1kmJZOc4KPH88P1UmJypmZluWR13iDTOn1xNWJwBlSiwCUK2DZKTXhYLJg5J6aYuzb9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314546009582.5060627977504; Wed, 21 Oct 2020 14:09:06 -0700 (PDT) Received: from localhost ([::1]:34304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLM0-0001at-NE for importer@patchew.org; Wed, 21 Oct 2020 17:09:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLAz-0005aE-7o for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:26257) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006gz-AU for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-482-s-xvwK2dM72ao_u5E8FBYQ-1; Wed, 21 Oct 2020 16:57:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A88E2107AFA5 for ; Wed, 21 Oct 2020 20:57:30 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25C596EF62; Wed, 21 Oct 2020 20:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sjO3LEWU1B+vyfhOtmKRmrtOL9ZWXQ7OGar1eX5wPng=; b=RWZQMCJsdK9YIWS9Ckqk9PAje6Ha5QmAVTpwd/gqmbEXHk+jX8yJRxpSz8c1DUKX8qgfsm 0Z9dJxB2Nf+3hisXrTl4CfHp46GGCUITaBtKhPxUxPHyigbMfdXpKu0zLYNHKGpUPxICty 0clC+mO2B5BCjd4gk7X0e7e7/kbMJjo= X-MC-Unique: s-xvwK2dM72ao_u5E8FBYQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 15/22] vl: extract various command line desugaring snippets to a new function Date: Wed, 21 Oct 2020 16:57:09 -0400 Message-Id: <20201021205716.2359430-16-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 3607cd4357..122bf1821b 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -126,6 +126,7 @@ static const char *boot_once; static const char *incoming; static const char *loadvm; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; +int mem_prealloc; /* force preallocation of physical target memory */ int display_opengl; const char* keyboard_layout =3D NULL; ram_addr_t ram_size; @@ -159,7 +160,7 @@ int fd_bootchk =3D 1; static int no_reboot; int no_shutdown =3D 0; int graphic_rotate =3D 0; -const char *watchdog; +static const char *watchdog; QEMUOptionRom option_rom[MAX_OPTION_ROMS]; int nb_option_roms; int old_param =3D 0; @@ -2906,6 +2907,24 @@ static void qemu_validate_options(void) #endif } =20 +static void qemu_process_sugar_options(void) +{ + if (mem_prealloc) { + char *val; + + val =3D g_strdup_printf("%ld", qemu_opt_get_number(qemu_find_opts_= singleton("smp-opts"), "cpus", 1)); + object_register_sugar_prop("memory-backend", "prealloc-threads", v= al); + g_free(val); + object_register_sugar_prop("memory-backend", "prealloc", "on"); + } + + if (watchdog) { + int i =3D select_watchdog(watchdog); + if (i > 0) + exit (i =3D=3D 1 ? 1 : 0); + } +} + static void qemu_process_early_options(void) { char **dirs; @@ -3160,7 +3179,6 @@ void qemu_finish_machine_init(void) =20 void qemu_init(int argc, char **argv, char **envp) { - int i; int snapshot =3D 0; QemuOpts *opts, *machine_opts; QemuOpts *icount_opts =3D NULL, *accel_opts =3D NULL; @@ -3179,7 +3197,6 @@ void qemu_init(int argc, char **argv, char **envp) bool have_custom_ram_size; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); - int mem_prealloc =3D 0; /* force preallocation of physical target memo= ry */ =20 qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); @@ -4086,6 +4103,7 @@ void qemu_init(int argc, char **argv, char **envp) loc_set_none(); =20 qemu_validate_options(); + qemu_process_sugar_options(); =20 /* These options affect everything else and should be processed * before daemonizing. @@ -4137,15 +4155,6 @@ void qemu_init(int argc, char **argv, char **envp) machine_smp_parse(current_machine, qemu_opts_find(qemu_find_opts("smp-opts"), NULL), &error_fatal); =20 - if (mem_prealloc) { - char *val; - - val =3D g_strdup_printf("%d", current_machine->smp.cpus); - object_register_sugar_prop("memory-backend", "prealloc-threads", v= al); - g_free(val); - object_register_sugar_prop("memory-backend", "prealloc", "on"); - } - /* * Get the default machine options from the machine if it is not alrea= dy * specified either by the configuration file or by the command line. @@ -4404,12 +4413,6 @@ void qemu_init(int argc, char **argv, char **envp) select_vgahw(machine_class, vga_model); } =20 - if (watchdog) { - i =3D select_watchdog(watchdog); - if (i > 0) - exit (i =3D=3D 1 ? 1 : 0); - } - /* This checkpoint is required by replay to separate prior clock reading from the other reads, because timer polling functions query clock values from the log. */ --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314757; cv=none; d=zohomail.com; s=zohoarc; b=YtckZN29+2nGNGlEMS0Mq6oLu54hNPIqBsVMzMLbpVOH8/RgH8zyWRL1TLIHKz5XLTfE4hvCQ1rtTgruSY8bZo97vWeLxpj5sxuUGeuexFjyh2a0fsJ/W76Q5GcYH7SwXIP2JIArHunZFZvB003zSkvaFliGVuEKsCrXJxWFqq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2KB3v8ZGUPVDT5YIRiKIKLRFaZ18xMqBQEX9ptXmwuA=; b=V3OgftkyDY9Fk9V+sS7MdLgE6wLjdN9BnB5CQO955M4PXFMnMJ65uiYUNvL2jCRdrtkA0SrTEH9i26gESws9jXR0ZOpK6QRO7g3B/ZZt5pZ18BkdaGLz4vW5MIG3OWRChT6Y9IR5g3kDUaDg9YS83AyME3XU8x1T85mWTwyCbUs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314757089691.444365575101; Wed, 21 Oct 2020 14:12:37 -0700 (PDT) Received: from localhost ([::1]:41596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLPP-00050p-U3 for importer@patchew.org; Wed, 21 Oct 2020 17:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB3-0005ju-0M for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:23255) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006hE-Cq for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-mPyNkLK0Pt66FxCnPbG-Pw-1; Wed, 21 Oct 2020 16:57:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59B06835B8E for ; Wed, 21 Oct 2020 20:57:31 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C98FD6EF66; Wed, 21 Oct 2020 20:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2KB3v8ZGUPVDT5YIRiKIKLRFaZ18xMqBQEX9ptXmwuA=; b=fI5NPR1iMf2Hiu6jZT6bsPdZ4eh61+vVuZfNf5/J3kUhr71DUxeb8WfisxF8LklHgcYoK3 WJqTlND1Pqo+xcwtXEfGWz7Ncg6H20z4ZLpgr5KNZbt6PUuhD8MyGitm4cX7BiSzkyD78P J+eIjKs4mWyLL/KHEWDlFMKJH2P9A6o= X-MC-Unique: mPyNkLK0Pt66FxCnPbG-Pw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 16/22] vl: create "-net nic -net user" default earlier Date: Wed, 21 Oct 2020 16:57:10 -0400 Message-Id: <20201021205716.2359430-17-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Create it together with other default backends, even though the processing = is done later. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 122bf1821b..8577667b8f 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4235,6 +4235,14 @@ void qemu_init(int argc, char **argv, char **envp) monitor_parse("vc:80Cx24C", "readline", false); } =20 + if (default_net) { + QemuOptsList *net =3D qemu_find_opts("net"); + qemu_opts_set(net, NULL, "type", "nic", &error_abort); +#ifdef CONFIG_SLIRP + qemu_opts_set(net, NULL, "type", "user", &error_abort); +#endif + } + #if defined(CONFIG_VNC) if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) { display_remote++; @@ -4370,14 +4378,6 @@ void qemu_init(int argc, char **argv, char **envp) semihosting_arg_fallback(kernel_filename, kernel_cmdline); } =20 - if (default_net) { - QemuOptsList *net =3D qemu_find_opts("net"); - qemu_opts_set(net, NULL, "type", "nic", &error_abort); -#ifdef CONFIG_SLIRP - qemu_opts_set(net, NULL, "type", "user", &error_abort); -#endif - } - if (net_init_clients(&err) < 0) { error_report_err(err); exit(1); --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314324; cv=none; d=zohomail.com; s=zohoarc; b=Mn5mpbLnjBIuviNINkyTVSjTL4t0GHbQ0Vf1O/EMUoRbVzA7a3XmlreCLhHcVGzN3alyfdCMlS0eVUQiUKIEiwCTuNiKAsfX9DQCcxT5+6oeV4eyEnGCzdc/iW7VynKm3MAzUOju4OXo41MRcZj8A3LGcuCnZDVEi1KjQfpa+aU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314324; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kdzKqU40Mrkt2ehEsXWNYxvEj9MX/Xb2GS8n9gTpND4=; b=L05xqmxGypZ+vE51rZRWvSdjI1ru+csYzpMWeVsHw2ii9BTms4mAZHkNqQHyGRl7eMOSfihOek19HVm3BwfF21g/Ieww+LPcEWQ8UAlZzD89VKGCm1pyi6miOMvPT7QP0KN+KL1JFCPf5a8wjEOcWviWIuMitv3DxK0Dzg63vTc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 160331432464538.94824376342285; Wed, 21 Oct 2020 14:05:24 -0700 (PDT) Received: from localhost ([::1]:54326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLIR-000637-G5 for importer@patchew.org; Wed, 21 Oct 2020 17:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB1-0005fc-C8 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006hM-J0 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-580-9VBGNAs1OxmaGqDCZxfwDQ-1; Wed, 21 Oct 2020 16:57:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 096641006C94 for ; Wed, 21 Oct 2020 20:57:32 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 796196EF62; Wed, 21 Oct 2020 20:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313854; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kdzKqU40Mrkt2ehEsXWNYxvEj9MX/Xb2GS8n9gTpND4=; b=CYB5ofy/ioQiDaAvEzwjkCKCaF1Vw1qm6PjZQl2jd+bJ1G9qnM360aN2ucIgkJfZmUSm1K zb2Qh306WdvtUSPSlNS2s4HiJS6mEpvwGOcWtyR1jykmQhhnJJmIFEvJCAvCtQobbdWuMA 5NxbP5qHS12ldAM2t236mbSCG3kLvnA= X-MC-Unique: 9VBGNAs1OxmaGqDCZxfwDQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 17/22] vl: load plugins as late as possible Date: Wed, 21 Oct 2020 16:57:11 -0400 Message-Id: <20201021205716.2359430-18-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" There is no need to load plugins in the middle of default device processing, move -plugin handling just before preconfig is entered. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- softmmu/vl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 8577667b8f..75e57133ad 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -125,6 +125,7 @@ static const char *boot_order; static const char *boot_once; static const char *incoming; static const char *loadvm; +static QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int mem_prealloc; /* force preallocation of physical target memory */ int display_opengl; @@ -3064,12 +3065,18 @@ void qemu_finish_machine_init(void) MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); DisplayState *ds; =20 + /* from here on runstate is RUN_STATE_PRELAUNCH */ + if (machine_class->default_ram_id && current_machine->ram_size && numa_uses_legacy_mem() && !current_machine->ram_memdev_id) { create_default_memdev(current_machine, mem_path); } =20 - /* from here on runstate is RUN_STATE_PRELAUNCH */ + /* process plugin before CPUs are created, but once -smp has been pars= ed */ + if (qemu_plugin_load_list(&plugin_list)) { + exit(1); + } + machine_run_board_init(current_machine); =20 /* @@ -3196,7 +3203,6 @@ void qemu_init(int argc, char **argv, char **envp) Error *err =3D NULL; bool have_custom_ram_size; BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); - QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); =20 qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); @@ -4164,11 +4170,6 @@ void qemu_init(int argc, char **argv, char **envp) machine_class->default_machine_opts, 0); } =20 - /* process plugin before CPUs are created, but once -smp has been pars= ed */ - if (qemu_plugin_load_list(&plugin_list)) { - exit(1); - } - qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, NULL); qemu_opts_foreach(qemu_find_opts("global"), --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314757; cv=none; d=zohomail.com; s=zohoarc; b=O2ln94tZGWGlDLSb16ofN53BbWXGwzRM+ZJ0SUMaQHP0BPE2Ft+h92BWs41wPbmf2di9jJLd2dN+Tq1K3X4FjfQxGdotctjVJ7oDbUihjP0vQGcqB40l/1vliw1YH9+iHgewshKsMz2GnhZqeqNC22bOwgA2RhTaVvaKPvFD+48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yUI3M4ipd89OmxngsbbB8zIQpi1LjWQ0a+wUYL8SpBM=; b=lMpR+HLgeL0vjWN61E7QGuk/R8n7SBl94de1KquJ+bOGeV1UeiDT+mAvOnOvmF9Xy+Q12iz0P6tgLwVJIaSL/ne63rq/BqdW3jJj0/a+OEzdLWtePAbwaKTQpyElcTKdtF7FSMpx5NPBj+jbu7Kz/30uoYy8gJQQu4s/G+Ka6sQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314757165361.5302011427958; Wed, 21 Oct 2020 14:12:37 -0700 (PDT) Received: from localhost ([::1]:41558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLPQ-000504-0Z for importer@patchew.org; Wed, 21 Oct 2020 17:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB1-0005g2-F1 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21085) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006iI-AZ for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-8AQQP2oIMbCIkaCTFAHxrQ-1; Wed, 21 Oct 2020 16:57:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC8A6186DD23 for ; Wed, 21 Oct 2020 20:57:32 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2996F6EF62; Wed, 21 Oct 2020 20:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yUI3M4ipd89OmxngsbbB8zIQpi1LjWQ0a+wUYL8SpBM=; b=bsRqYHsuuyYsxeIkKrKdJhUDmEpi7kcYcgXsTCfiVxycYkuAxup9UzTdeqaMO8IeK6X/ow eUScOOIwy9xBJJ0H7UsWLur3Gh2sKK/Sn2HaSTTkFVn2Bu0OtGfBdsTJjcBQyN9JkzdX3y qhiEH1+nkiZb99Qdf5jIeiP0H4ydBLA= X-MC-Unique: 8AQQP2oIMbCIkaCTFAHxrQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 18/22] vl: move semihosting command line fallback to qemu_finish_machine_init Date: Wed, 21 Oct 2020 16:57:12 -0400 Message-Id: <20201021205716.2359430-19-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Move more sane parts of the huge qemu_init function out of it. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 75e57133ad..e58572dbd8 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3067,6 +3067,11 @@ void qemu_finish_machine_init(void) =20 /* from here on runstate is RUN_STATE_PRELAUNCH */ =20 + if (semihosting_enabled() && !semihosting_get_argc() && current_machin= e->kernel_filename) { + /* fall back to the -kernel/-append */ + semihosting_arg_fallback(current_machine->kernel_filename, current= _machine->kernel_cmdline); + } + if (machine_class->default_ram_id && current_machine->ram_size && numa_uses_legacy_mem() && !current_machine->ram_memdev_id) { create_default_memdev(current_machine, mem_path); @@ -4372,13 +4377,6 @@ void qemu_init(int argc, char **argv, char **envp) boot_order =3D machine_class->default_boot_order; } =20 - if (semihosting_enabled() && !semihosting_get_argc()) { - const char *kernel_filename =3D qemu_opt_get(machine_opts, "kernel= "); - const char *kernel_cmdline =3D qemu_opt_get(machine_opts, "append"= ); - /* fall back to the -kernel/-append */ - semihosting_arg_fallback(kernel_filename, kernel_cmdline); - } - if (net_init_clients(&err) < 0) { error_report_err(err); exit(1); --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314946; cv=none; d=zohomail.com; s=zohoarc; b=Xa23N5lCylRLsMnFq0WNxu3dnblHJc8HBDEWxqPTwFTTSJPcENgfLztLGg3/OEMPMhfnibiOornZo5M8lONYO8WSfku3TrldtUjaWtn+EZ+yrVaE1RcX6WugU/pWD9W4gqn7oV1d6H1DrPnXPoEtSE63wAUrxPP84hQ5adoYrXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314946; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fOwKZw0DWZYQF9wa0fjiKsE3u8waOcPPFhZMYYukGM0=; b=iqd9ihCGozAH7PB4SZ4zzguQWVPiDs85qXQfghZieDH2Nt1x68fZxYjxl/ID53+AR3i3T5qfF129/rhaoRUUsh9OJSiJhz6EJvo1kugDYwyJVNtgP+lB330PeXNjh9YczK5T5moL1sqdNysTgXddo6+etrkexbc2IpUXB+tyzDg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314946316426.81818716365353; Wed, 21 Oct 2020 14:15:46 -0700 (PDT) Received: from localhost ([::1]:49634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLST-0008Pq-3j for importer@patchew.org; Wed, 21 Oct 2020 17:15:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB1-0005fQ-9E for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAv-0006iO-Cn for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-106-o4hbjHshP26wAcgvcDefnQ-1; Wed, 21 Oct 2020 16:57:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F46D107AFA5 for ; Wed, 21 Oct 2020 20:57:33 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFDA16EF6B; Wed, 21 Oct 2020 20:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fOwKZw0DWZYQF9wa0fjiKsE3u8waOcPPFhZMYYukGM0=; b=OING+xcMlto/nni5apoGdu7wspEDVBbH3mhCzmtqvslGfM1OjGinLgstO4r/LeI95S+H9r U+5RzZ6zMxCIlzD4lMeKl3iHnZDtlv1pmuHHWs4/ldF9bL1IVdMDrU4goLPY6kTwHe7JWc EczgKV2Kj3pl95DfAQhGZy01MTBImSA= X-MC-Unique: o4hbjHshP26wAcgvcDefnQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 19/22] vl: extract default devices to separate functions Date: Wed, 21 Oct 2020 16:57:13 -0400 Message-Id: <20201021205716.2359430-20-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 22:12:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 216 +++++++++++++++++++++++++++------------------------ 1 file changed, 114 insertions(+), 102 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index e58572dbd8..0a6f47e7d6 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -125,7 +125,9 @@ static const char *boot_order; static const char *boot_once; static const char *incoming; static const char *loadvm; +static int display_remote; static QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); +static bool nographic =3D false; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int mem_prealloc; /* force preallocation of physical target memory */ int display_opengl; @@ -147,6 +149,7 @@ static int rtc_host_datetime_offset =3D -1; /* valid & = used only with RTC_BASE_DATETIME */ QEMUClockType rtc_clock; int vga_interface_type =3D VGA_NONE; +static const char *vga_model =3D NULL; static DisplayOptions dpy; static int num_serial_hds; static Chardev **serial_hds; @@ -2224,6 +2227,115 @@ static int foreach_device_config(int type, int (*fu= nc)(const char *cmdline)) return 0; } =20 +static void qemu_disable_default_devices(void) +{ + MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); + + qemu_opts_foreach(qemu_find_opts("device"), + default_driver_check, NULL, NULL); + qemu_opts_foreach(qemu_find_opts("global"), + default_driver_check, NULL, NULL); + + if (!vga_model && !default_vga) { + vga_interface_type =3D VGA_DEVICE; + } + if (!has_defaults || machine_class->no_serial) { + default_serial =3D 0; + } + if (!has_defaults || machine_class->no_parallel) { + default_parallel =3D 0; + } + if (!has_defaults || machine_class->no_floppy) { + default_floppy =3D 0; + } + if (!has_defaults || machine_class->no_cdrom) { + default_cdrom =3D 0; + } + if (!has_defaults || machine_class->no_sdcard) { + default_sdcard =3D 0; + } + if (!has_defaults) { + default_monitor =3D 0; + default_net =3D 0; + default_vga =3D 0; + } +} + +static void qemu_create_default_devices(void) +{ + MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); + + if (is_daemonized()) { + /* According to documentation and historically, -nographic redirec= ts + * serial port, parallel port and monitor to stdio, which does not= work + * with -daemonize. We can redirect these to null instead, but si= nce + * -nographic is legacy, let's just error out. + * We disallow -nographic only if all other ports are not redirect= ed + * explicitly, to not break existing legacy setups which uses + * -nographic _and_ redirects all ports explicitly - this is valid + * usage, -nographic is just a no-op in this case. + */ + if (nographic + && (default_parallel || default_serial || default_monitor)) { + error_report("-nographic cannot be used with -daemonize"); + exit(1); + } + } + + if (nographic) { + if (default_parallel) + add_device_config(DEV_PARALLEL, "null"); + if (default_serial && default_monitor) { + add_device_config(DEV_SERIAL, "mon:stdio"); + } else { + if (default_serial) + add_device_config(DEV_SERIAL, "stdio"); + if (default_monitor) + monitor_parse("stdio", "readline", false); + } + } else { + if (default_serial) + add_device_config(DEV_SERIAL, "vc:80Cx24C"); + if (default_parallel) + add_device_config(DEV_PARALLEL, "vc:80Cx24C"); + if (default_monitor) + monitor_parse("vc:80Cx24C", "readline", false); + } + + if (default_net) { + QemuOptsList *net =3D qemu_find_opts("net"); + qemu_opts_set(net, NULL, "type", "nic", &error_abort); +#ifdef CONFIG_SLIRP + qemu_opts_set(net, NULL, "type", "user", &error_abort); +#endif + } + +#if defined(CONFIG_VNC) + if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) { + display_remote++; + } +#endif + if (dpy.type =3D=3D DISPLAY_TYPE_DEFAULT && !display_remote) { + if (!qemu_display_find_default(&dpy)) { + dpy.type =3D DISPLAY_TYPE_NONE; +#if defined(CONFIG_VNC) + vnc_parse("localhost:0,to=3D99,id=3Ddefault", &error_abort); +#endif + } + } + if (dpy.type =3D=3D DISPLAY_TYPE_DEFAULT) { + dpy.type =3D DISPLAY_TYPE_NONE; + } + + /* If no default VGA is requested, the default is "none". */ + if (default_vga) { + vga_model =3D get_default_vga_model(machine_class); + } + if (vga_model) { + select_vgahw(machine_class, vga_model); + } +} + static int serial_parse(const char *devname) { int index =3D num_serial_hds; @@ -3198,10 +3310,7 @@ void qemu_init(int argc, char **argv, char **envp) int optind; const char *optarg; MachineClass *machine_class; - const char *vga_model =3D NULL; bool userconfig =3D true; - bool nographic =3D false; - int display_remote =3D 0; ram_addr_t maxram_size; uint64_t ram_slots =3D 0; FILE *vmstate_dump_file =3D NULL; @@ -4175,97 +4284,8 @@ void qemu_init(int argc, char **argv, char **envp) machine_class->default_machine_opts, 0); } =20 - qemu_opts_foreach(qemu_find_opts("device"), - default_driver_check, NULL, NULL); - qemu_opts_foreach(qemu_find_opts("global"), - default_driver_check, NULL, NULL); - - if (!vga_model && !default_vga) { - vga_interface_type =3D VGA_DEVICE; - } - if (!has_defaults || machine_class->no_serial) { - default_serial =3D 0; - } - if (!has_defaults || machine_class->no_parallel) { - default_parallel =3D 0; - } - if (!has_defaults || machine_class->no_floppy) { - default_floppy =3D 0; - } - if (!has_defaults || machine_class->no_cdrom) { - default_cdrom =3D 0; - } - if (!has_defaults || machine_class->no_sdcard) { - default_sdcard =3D 0; - } - if (!has_defaults) { - default_monitor =3D 0; - default_net =3D 0; - default_vga =3D 0; - } - - if (is_daemonized()) { - /* According to documentation and historically, -nographic redirec= ts - * serial port, parallel port and monitor to stdio, which does not= work - * with -daemonize. We can redirect these to null instead, but si= nce - * -nographic is legacy, let's just error out. - * We disallow -nographic only if all other ports are not redirect= ed - * explicitly, to not break existing legacy setups which uses - * -nographic _and_ redirects all ports explicitly - this is valid - * usage, -nographic is just a no-op in this case. - */ - if (nographic - && (default_parallel || default_serial || default_monitor)) { - error_report("-nographic cannot be used with -daemonize"); - exit(1); - } - } - - if (nographic) { - if (default_parallel) - add_device_config(DEV_PARALLEL, "null"); - if (default_serial && default_monitor) { - add_device_config(DEV_SERIAL, "mon:stdio"); - } else { - if (default_serial) - add_device_config(DEV_SERIAL, "stdio"); - if (default_monitor) - monitor_parse("stdio", "readline", false); - } - } else { - if (default_serial) - add_device_config(DEV_SERIAL, "vc:80Cx24C"); - if (default_parallel) - add_device_config(DEV_PARALLEL, "vc:80Cx24C"); - if (default_monitor) - monitor_parse("vc:80Cx24C", "readline", false); - } - - if (default_net) { - QemuOptsList *net =3D qemu_find_opts("net"); - qemu_opts_set(net, NULL, "type", "nic", &error_abort); -#ifdef CONFIG_SLIRP - qemu_opts_set(net, NULL, "type", "user", &error_abort); -#endif - } - -#if defined(CONFIG_VNC) - if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) { - display_remote++; - } -#endif - if (dpy.type =3D=3D DISPLAY_TYPE_DEFAULT && !display_remote) { - if (!qemu_display_find_default(&dpy)) { - dpy.type =3D DISPLAY_TYPE_NONE; -#if defined(CONFIG_VNC) - vnc_parse("localhost:0,to=3D99,id=3Ddefault", &error_abort); -#endif - } - } - if (dpy.type =3D=3D DISPLAY_TYPE_DEFAULT) { - dpy.type =3D DISPLAY_TYPE_NONE; - } - + qemu_disable_default_devices(); + qemu_create_default_devices(); if ((alt_grab || ctrl_grab) && dpy.type !=3D DISPLAY_TYPE_SDL) { error_report("-alt-grab and -ctrl-grab are only valid " "for SDL, ignoring option"); @@ -4404,14 +4424,6 @@ void qemu_init(int argc, char **argv, char **envp) if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) exit(1); =20 - /* If no default VGA is requested, the default is "none". */ - if (default_vga) { - vga_model =3D get_default_vga_model(machine_class); - } - if (vga_model) { - select_vgahw(machine_class, vga_model); - } - /* This checkpoint is required by replay to separate prior clock reading from the other reads, because timer polling functions query clock values from the log. */ --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314256; cv=none; d=zohomail.com; s=zohoarc; b=Ww1LK91tMJ69F7tDOsk4Axw/oVh4AbxU0kESMgYNoZdJvmC0c5wLCEOhCrL33jMIPhE499n0TlhYi2Fxwpk5+9P1JVVpbSzEkU7DzQ+FIofI/tIuU2jGgPCGqSIjbzYYtAhcc+xIWptuSpVXXIj9mEeVg7vhF86R0P8Gqn2EWBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314256; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xB+pW8wMlRiDeT88aB17Knd4JTsxOyNUrcHOEWW+0Ws=; b=cyO/i4b6V6fytH8FtxSMEGh3x2mSQK6VQIadbd/5uJuK7sfkhiHzMzqbg5UPbj1YWIIuwmZhNyghX+nlOfUNNK+wfHIl1ddzkwiUJQEbofnJKFEfqxzJWppmI5FTAVAosE3tBmjdTYX0ly+qJ3Ny+v2wi3fiZm81mZrJ6F6eUao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603314256517978.3197831148404; Wed, 21 Oct 2020 14:04:16 -0700 (PDT) Received: from localhost ([::1]:49134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLHL-0003u5-8V for importer@patchew.org; Wed, 21 Oct 2020 17:04:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB2-0005hj-3c for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006iS-BF for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-y3KvK72wPGu7IwKAyxJ-Nw-1; Wed, 21 Oct 2020 16:57:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 401B91005E77 for ; Wed, 21 Oct 2020 20:57:34 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C326F6EF62; Wed, 21 Oct 2020 20:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xB+pW8wMlRiDeT88aB17Knd4JTsxOyNUrcHOEWW+0Ws=; b=fSy2OgmHUdJuqIjK47lSZQoHHR1hsrIpIUu1b0Ts13ar8QVI1Z7zgi4+8gWtrcKeMau9xO IR3gbTTXi+teRxOSKCD8Rlr+XQbu0dNbrtZRqObFidrNkzn9kv8wUDMvQNFvjAy1rZYzru h27l2W87ZhCFfzlKJK2iLD4Tmr7Ijh8= X-MC-Unique: y3KvK72wPGu7IwKAyxJ-Nw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 20/22] vl: move CHECKPOINT_INIT after preconfig Date: Wed, 21 Oct 2020 16:57:14 -0400 Message-Id: <20201021205716.2359430-21-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" Move CHECKPOINT_INIT right before the machine initialization is completed. Everything before is essentially an extension of command line parsing. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- softmmu/vl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 0a6f47e7d6..e9391929f6 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3194,6 +3194,11 @@ void qemu_finish_machine_init(void) exit(1); } =20 + /* This checkpoint is required by replay to separate prior clock + reading from the other reads, because timer polling functions query + clock values from the log. */ + replay_checkpoint(CHECKPOINT_INIT); + machine_run_board_init(current_machine); =20 /* @@ -4424,11 +4429,6 @@ void qemu_init(int argc, char **argv, char **envp) if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) exit(1); =20 - /* This checkpoint is required by replay to separate prior clock - reading from the other reads, because timer polling functions query - clock values from the log. */ - replay_checkpoint(CHECKPOINT_INIT); - current_machine->boot_order =3D boot_order; =20 /* parse features once if machine provides default cpu_type */ --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603315178; cv=none; d=zohomail.com; s=zohoarc; b=PK46MeNW64fVv9QkO0AdWpbVxXNHYKV3pXBjuH1PKWdmLsfvj+X+HTpAIwWHB9pSzHgkoC2rbdzaAXGm9/ZNW5wdBKqcQCQgrT+zRf01llaBMr02DNtWacQzu3Kc3eDTTad0yvsI+LTrQedOOv399HBzfnyW9cntQrYiWYqahmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603315178; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bK4gylZUGKfaKRmWvnQi9V/BTgaNzQabt2jQ7n87MRU=; b=B8L1k6PXv5W9gYQimx8S8xfnB4N/yyBLleLVYBaYBIhEuUah5BC0BDPLsAD4KIcAuOJWLdueqaubIIw9wGVNd6M9RDmL9IFh4lqdf6cwArYttUS0yefEJIpfya7u0Sio4GTHv+Kl04hG7GcVkVmXAk/cUKUEDe4x4IR4aBYKK/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1603315178464962.7218134722774; Wed, 21 Oct 2020 14:19:38 -0700 (PDT) Received: from localhost ([::1]:57656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLWD-0003XL-1d for importer@patchew.org; Wed, 21 Oct 2020 17:19:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB3-0005ml-V3 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006il-D5 for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-279-utUJDYgqNMWhhDbTXH9p5A-1; Wed, 21 Oct 2020 16:57:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE10B835B8E for ; Wed, 21 Oct 2020 20:57:34 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C3746EF62; Wed, 21 Oct 2020 20:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bK4gylZUGKfaKRmWvnQi9V/BTgaNzQabt2jQ7n87MRU=; b=HkOWynpxVXXA41lnxKMyWgKmQbkHhZpNrgQ6Hl+0SVMa3NmusKWYM2qBPb56/fFY3TQ9XT RN1CZY+lT001PsY9ShNANLd+dggcrazvsTOvH3JBMyb35a7cHWVeAQ7ZL+8vvcPB5i8QxK Y+lwvh84mfKrmxu4q5NdiB5XaN7EgFA= X-MC-Unique: utUJDYgqNMWhhDbTXH9p5A-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 21/22] vl: separate qemu_create_early_backends Date: Wed, 21 Oct 2020 16:57:15 -0400 Message-Id: <20201021205716.2359430-22-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" "Early" backends are created before the machine and can be used as machine options. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 123 +++++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index e9391929f6..866df5bb7c 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -117,6 +117,14 @@ =20 #define MAX_VIRTIO_CONSOLES 1 =20 +typedef struct BlockdevOptionsQueueEntry { + BlockdevOptions *bdo; + Location loc; + QSIMPLEQ_ENTRY(BlockdevOptionsQueueEntry) entry; +} BlockdevOptionsQueueEntry; + +typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue; + static const char *cpu_option; static const char *data_dir[16]; static int data_dir_idx; @@ -126,7 +134,9 @@ static const char *boot_once; static const char *incoming; static const char *loadvm; static int display_remote; +static int snapshot; static QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); +static BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_qu= eue); static bool nographic =3D false; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int mem_prealloc; /* force preallocation of physical target memory */ @@ -1043,14 +1053,6 @@ static void default_drive(int enable, int snapshot, = BlockInterfaceType type, =20 } =20 -typedef struct BlockdevOptionsQueueEntry { - BlockdevOptions *bdo; - Location loc; - QSIMPLEQ_ENTRY(BlockdevOptionsQueueEntry) entry; -} BlockdevOptionsQueueEntry; - -typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue; - static void configure_blockdev(BlockdevOptionsQueue *bdo_queue, MachineClass *machine_class, int snapshot) { @@ -2640,7 +2642,7 @@ static int machine_set_property(void *opaque, * cannot be created here, as it depends on the chardev * already existing. */ -static bool object_create_initial(const char *type, QemuOpts *opts) +static bool object_create_early(const char *type, QemuOpts *opts) { if (user_creatable_print_help(type, opts)) { exit(0); @@ -2692,6 +2694,58 @@ static bool object_create_initial(const char *type, = QemuOpts *opts) return true; } =20 +static void qemu_create_early_backends(void) +{ + MachineClass *machine_class =3D MACHINE_GET_CLASS(current_machine); + + if ((alt_grab || ctrl_grab) && dpy.type !=3D DISPLAY_TYPE_SDL) { + error_report("-alt-grab and -ctrl-grab are only valid " + "for SDL, ignoring option"); + } + if (dpy.has_window_close && + (dpy.type !=3D DISPLAY_TYPE_GTK && dpy.type !=3D DISPLAY_TYPE_SDL)= ) { + error_report("-no-quit is only valid for GTK and SDL, " + "ignoring option"); + } + + qemu_display_early_init(&dpy); + qemu_console_early_init(); + + if (dpy.has_gl && dpy.gl !=3D DISPLAYGL_MODE_OFF && display_opengl =3D= =3D 0) { +#if defined(CONFIG_OPENGL) + error_report("OpenGL is not supported by the display"); +#else + error_report("OpenGL support is disabled"); +#endif + exit(1); + } + + qemu_opts_foreach(qemu_find_opts("object"), + user_creatable_add_opts_foreach, + object_create_early, &error_fatal); + + /* spice needs the timers to be initialized by this point */ + /* spice must initialize before audio as it changes the default auiode= v */ + /* spice must initialize before chardevs (for spicevmc and spiceport) = */ + qemu_spice_init(); + + qemu_opts_foreach(qemu_find_opts("chardev"), + chardev_init_func, NULL, &error_fatal); + +#ifdef CONFIG_VIRTFS + qemu_opts_foreach(qemu_find_opts("fsdev"), + fsdev_init_func, NULL, &error_fatal); +#endif + + /* + * Note: we need to create audio and block backends before + * machine_set_property(), so machine properties can refer to + * them. + */ + configure_blockdev(&bdo_queue, machine_class, snapshot); + audio_init_audiodevs(); +} + =20 /* * The remainder of object creation happens after the @@ -2699,7 +2753,7 @@ static bool object_create_initial(const char *type, Q= emuOpts *opts) */ static bool object_create_delayed(const char *type, QemuOpts *opts) { - return !object_create_initial(type, opts); + return !object_create_early(type, opts); } =20 =20 @@ -3308,7 +3362,6 @@ void qemu_finish_machine_init(void) =20 void qemu_init(int argc, char **argv, char **envp) { - int snapshot =3D 0; QemuOpts *opts, *machine_opts; QemuOpts *icount_opts =3D NULL, *accel_opts =3D NULL; QemuOptsList *olist; @@ -3321,7 +3374,6 @@ void qemu_init(int argc, char **argv, char **envp) FILE *vmstate_dump_file =3D NULL; Error *err =3D NULL; bool have_custom_ram_size; - BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_queue= ); =20 qemu_add_opts(&qemu_drive_opts); qemu_add_drive_opts(&qemu_legacy_drive_opts); @@ -4291,52 +4343,7 @@ void qemu_init(int argc, char **argv, char **envp) =20 qemu_disable_default_devices(); qemu_create_default_devices(); - if ((alt_grab || ctrl_grab) && dpy.type !=3D DISPLAY_TYPE_SDL) { - error_report("-alt-grab and -ctrl-grab are only valid " - "for SDL, ignoring option"); - } - if (dpy.has_window_close && - (dpy.type !=3D DISPLAY_TYPE_GTK && dpy.type !=3D DISPLAY_TYPE_SDL)= ) { - error_report("-no-quit is only valid for GTK and SDL, " - "ignoring option"); - } - - qemu_display_early_init(&dpy); - qemu_console_early_init(); - - if (dpy.has_gl && dpy.gl !=3D DISPLAYGL_MODE_OFF && display_opengl =3D= =3D 0) { -#if defined(CONFIG_OPENGL) - error_report("OpenGL is not supported by the display"); -#else - error_report("OpenGL support is disabled"); -#endif - exit(1); - } - - qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_initial, &error_fatal); - - /* spice needs the timers to be initialized by this point */ - /* spice must initialize before audio as it changes the default auiode= v */ - /* spice must initialize before chardevs (for spicevmc and spiceport) = */ - qemu_spice_init(); - - qemu_opts_foreach(qemu_find_opts("chardev"), - chardev_init_func, NULL, &error_fatal); - -#ifdef CONFIG_VIRTFS - qemu_opts_foreach(qemu_find_opts("fsdev"), - fsdev_init_func, NULL, &error_fatal); -#endif - - /* - * Note: we need to create audio and block backends before - * machine_set_property(), so machine properties can refer to - * them. - */ - configure_blockdev(&bdo_queue, machine_class, snapshot); - audio_init_audiodevs(); + qemu_create_early_backends(); =20 machine_opts =3D qemu_get_machine_opts(); qemu_opt_foreach(machine_opts, machine_set_property, current_machine, --=20 2.26.2 From nobody Sat May 18 17:34:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1603314547; cv=none; d=zohomail.com; s=zohoarc; b=ACnQHLP0IlWHdz6pNVZ90cWNQbsj0oEY4OGXyNM4iQQ8iub80D/hqjeFqIDhyXJwq2eR13sRlKu1KZKK4rxY0/7KBtEMkxp4NxyurVqSjWnv12yHuQOSdYmzsHrbKL0JcylmMIHQ7n0yr28iTsWRYE45qbFBB/Gnyj4KKpy7fvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603314547; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1b85d42vwX8iTxar+RM0i1tY3ljNgs7N/FTdg/zYyto=; b=giS8bKF2njztIiry5eO35DButkD0Cw5xAIUVa1FlX0dlE/yeFPPQ2ySmLazn08WjZvPDN6kk6G/qxIsnXEhMg1hPbsK2SjMmGhpI6Pz9fDC2QGN+RET+D+OLfN7dFvBi4bMUWljZeesQgifBdhw2qL2k74s5cmd/mLXrif+x7es= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 16033145473701018.7486334225822; Wed, 21 Oct 2020 14:09:07 -0700 (PDT) Received: from localhost ([::1]:34522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVLM2-0001gC-5S for importer@patchew.org; Wed, 21 Oct 2020 17:09:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVLB2-0005jA-Oh for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kVLAx-0006ip-BN for qemu-devel@nongnu.org; Wed, 21 Oct 2020 16:57:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-383-1GrUYk1AP7CT7-rmh-36ww-1; Wed, 21 Oct 2020 16:57:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6657C1006718 for ; Wed, 21 Oct 2020 20:57:35 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id E98D96EF62; Wed, 21 Oct 2020 20:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603313858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1b85d42vwX8iTxar+RM0i1tY3ljNgs7N/FTdg/zYyto=; b=UNDzNwor6BTti/GPPvOkyZTfz9i79i7zuMbTiWlhfKIJ+T/Sets+GVM/ehXVsDArkdsOz2 OCisZ69cgG42xgj1gX01jYqO7L7FhbJqUF1vuOOwuM3vPi2AVeIysTZK7v719scPCgHr0V 90+QldT7q5BCcyQV/hu+ZvEgTrGunh0= X-MC-Unique: 1GrUYk1AP7CT7-rmh-36ww-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 22/22] vl: separate qemu_create_late_backends Date: Wed, 21 Oct 2020 16:57:16 -0400 Message-Id: <20201021205716.2359430-23-pbonzini@redhat.com> In-Reply-To: <20201021205716.2359430-1-pbonzini@redhat.com> References: <20201021205716.2359430-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:16:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: jsnow@redhat.com, berrange@redhat.com, ehabkost@redhat.com, imammedo@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-Type: text/plain; charset="utf-8" "Late" backends are created after the machine. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 866df5bb7c..f36ec16cad 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2751,11 +2751,41 @@ static void qemu_create_early_backends(void) * The remainder of object creation happens after the * creation of chardev, fsdev, net clients and device data types. */ -static bool object_create_delayed(const char *type, QemuOpts *opts) +static bool object_create_late(const char *type, QemuOpts *opts) { return !object_create_early(type, opts); } =20 +static void qemu_create_late_backends(void) +{ + if (qtest_chrdev) { + qtest_server_init(qtest_chrdev, qtest_log, &error_fatal); + } + + net_init_clients(&error_fatal); + + qemu_opts_foreach(qemu_find_opts("object"), + user_creatable_add_opts_foreach, + object_create_late, &error_fatal); + + if (tpm_init() < 0) { + exit(1); + } + + qemu_opts_foreach(qemu_find_opts("mon"), + mon_init_func, NULL, &error_fatal); + + /* now chardevs have been created we may have semihosting to connect */ + qemu_semihosting_connect_chardevs(); + qemu_semihosting_console_init(); + + if (foreach_device_config(DEV_SERIAL, serial_parse) < 0) + exit(1); + if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0) + exit(1); + if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) + exit(1); +} =20 static bool set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_siz= e, MachineClass *mc) @@ -3372,7 +3402,6 @@ void qemu_init(int argc, char **argv, char **envp) ram_addr_t maxram_size; uint64_t ram_slots =3D 0; FILE *vmstate_dump_file =3D NULL; - Error *err =3D NULL; bool have_custom_ram_size; =20 qemu_add_opts(&qemu_drive_opts); @@ -4385,10 +4414,6 @@ void qemu_init(int argc, char **argv, char **envp) */ migration_object_init(); =20 - if (qtest_chrdev) { - qtest_server_init(qtest_chrdev, qtest_log, &error_fatal); - } - opts =3D qemu_opts_find(qemu_find_opts("boot-opts"), NULL); if (opts) { boot_order =3D qemu_opt_get(opts, "order"); @@ -4409,32 +4434,7 @@ void qemu_init(int argc, char **argv, char **envp) boot_order =3D machine_class->default_boot_order; } =20 - if (net_init_clients(&err) < 0) { - error_report_err(err); - exit(1); - } - - qemu_opts_foreach(qemu_find_opts("object"), - user_creatable_add_opts_foreach, - object_create_delayed, &error_fatal); - - if (tpm_init() < 0) { - exit(1); - } - - qemu_opts_foreach(qemu_find_opts("mon"), - mon_init_func, NULL, &error_fatal); - - /* now chardevs have been created we may have semihosting to connect */ - qemu_semihosting_connect_chardevs(); - qemu_semihosting_console_init(); - - if (foreach_device_config(DEV_SERIAL, serial_parse) < 0) - exit(1); - if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0) - exit(1); - if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0) - exit(1); + qemu_create_late_backends(); =20 current_machine->boot_order =3D boot_order; =20 --=20 2.26.2