From patchwork Wed Nov 17 14:46:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 12624859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAA2AC433EF for ; Wed, 17 Nov 2021 14:52:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5956E61269 for ; Wed, 17 Nov 2021 14:52:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5956E61269 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:35218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMIR-00088W-FF for qemu-devel@archiver.kernel.org; Wed, 17 Nov 2021 09:52:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME0-0004ej-3L for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:48 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:53822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnMDw-0000nX-Vg for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:47 -0500 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 11AB321C38; Wed, 17 Nov 2021 14:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1637160462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HEF/wAb1+llW8XKuvQxKYWI6Zx+KHs03FFfKagUzjBQ=; b=vKBoIZwcvRzZnwOh2GpzUMzSa6jGOqPHZmzTQ8igpXGany1bdDkO3VgOE+yltkcdedAQBZ PNUiPl4HqB/ypne4sohWOdyAz9d0C4lrPCE3gjTB+T62p/T3IYJ/VEF05BFofGCehAgG/r sYVjAcs0HaOwRsJSHXjXRQmZvgF/VOQ= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 1/5] rename MachineInitPhase enum constants for QAPI compatibility Date: Wed, 17 Nov 2021 15:46:59 +0100 Message-Id: <20211117144703.16305-2-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211117144703.16305-1-damien.hedde@greensocs.com> References: <20211117144703.16305-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes Received-SPF: pass client-ip=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , edgar.iglesias@xilinx.com, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Michael S. Tsirkin" , Eric Blake , Mark Burton , "Dr. David Alan Gilbert" , Markus Armbruster , Eric Auger , Mirela Grujic , Alistair Francis , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mirela Grujic This commit is a preparation to switch to a QAPI definition of the MachineInitPhase enum. QAPI will generate enumeration constants prefixed with the MACHINE_INIT_PHASE_, so rename values accordingly. Signed-off-by: Mirela Grujic Signed-off-by: Damien Hedde Reviewed-by: Alistair Francis --- include/hw/qdev-core.h | 10 +++++----- hw/core/machine-qmp-cmds.c | 2 +- hw/core/machine.c | 6 +++--- hw/core/qdev.c | 2 +- hw/pci/pci.c | 2 +- hw/usb/core.c | 2 +- hw/virtio/virtio-iommu.c | 2 +- monitor/hmp.c | 2 +- softmmu/qdev-monitor.c | 9 +++++---- softmmu/vl.c | 6 +++--- ui/console.c | 3 ++- 11 files changed, 24 insertions(+), 22 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 20d3066595..ef2d612d39 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -849,30 +849,30 @@ bool qdev_should_hide_device(const QDict *opts, bool from_json, Error **errp); typedef enum MachineInitPhase { /* current_machine is NULL. */ - PHASE_NO_MACHINE, + MACHINE_INIT_PHASE_NO_MACHINE, /* current_machine is not NULL, but current_machine->accel is NULL. */ - PHASE_MACHINE_CREATED, + MACHINE_INIT_PHASE_MACHINE_CREATED, /* * current_machine->accel is not NULL, but the machine properties have * not been validated and machine_class->init has not yet been called. */ - PHASE_ACCEL_CREATED, + MACHINE_INIT_PHASE_ACCEL_CREATED, /* * machine_class->init has been called, thus creating any embedded * devices and validating machine properties. Devices created at * this time are considered to be cold-plugged. */ - PHASE_MACHINE_INITIALIZED, + MACHINE_INIT_PHASE_INITIALIZED, /* * QEMU is ready to start CPUs and devices created at this time * are considered to be hot-plugged. The monitor is not restricted * to "preconfig" commands. */ - PHASE_MACHINE_READY, + MACHINE_INIT_PHASE_READY, } MachineInitPhase; extern bool phase_check(MachineInitPhase phase); diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 4f4ab30f8c..ddbdc5212f 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -148,7 +148,7 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) void qmp_set_numa_node(NumaOptions *cmd, Error **errp) { - if (phase_check(PHASE_MACHINE_INITIALIZED)) { + if (phase_check(MACHINE_INIT_PHASE_INITIALIZED)) { error_setg(errp, "The command is permitted only before the machine has been created"); return; } diff --git a/hw/core/machine.c b/hw/core/machine.c index 26ec54e726..8560bb4c42 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1178,7 +1178,7 @@ void machine_run_board_init(MachineState *machine) accel_init_interfaces(ACCEL_GET_CLASS(machine->accelerator)); machine_class->init(machine); - phase_advance(PHASE_MACHINE_INITIALIZED); + phase_advance(MACHINE_INIT_PHASE_INITIALIZED); } static NotifierList machine_init_done_notifiers = @@ -1187,7 +1187,7 @@ static NotifierList machine_init_done_notifiers = void qemu_add_machine_init_done_notifier(Notifier *notify) { notifier_list_add(&machine_init_done_notifiers, notify); - if (phase_check(PHASE_MACHINE_READY)) { + if (phase_check(MACHINE_INIT_PHASE_READY)) { notify->notify(notify, NULL); } } @@ -1210,7 +1210,7 @@ void qdev_machine_creation_done(void) * ok, initial machine setup is done, starting from now we can * only create hotpluggable devices */ - phase_advance(PHASE_MACHINE_READY); + phase_advance(MACHINE_INIT_PHASE_READY); qdev_assert_realized_properly(); /* TODO: once all bus devices are qdevified, this should be done diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 84f3019440..ccfd6f0dc4 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -674,7 +674,7 @@ static void device_initfn(Object *obj) { DeviceState *dev = DEVICE(obj); - if (phase_check(PHASE_MACHINE_READY)) { + if (phase_check(MACHINE_INIT_PHASE_READY)) { dev->hotplugged = 1; qdev_hot_added = true; } diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e5993c1ef5..f77d9e8d57 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1102,7 +1102,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_container_region, pci_dev->name); - if (phase_check(PHASE_MACHINE_READY)) { + if (phase_check(MACHINE_INIT_PHASE_READY)) { pci_init_bus_master(pci_dev); } pci_dev->irq_state = 0; diff --git a/hw/usb/core.c b/hw/usb/core.c index 975f76250a..7a9a81c4fe 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -97,7 +97,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream) USBDevice *dev = ep->dev; USBBus *bus = usb_bus_from_device(dev); - if (!phase_check(PHASE_MACHINE_READY)) { + if (!phase_check(MACHINE_INIT_PHASE_READY)) { /* * This is machine init cold plug. No need to wakeup anyone, * all devices will be reset anyway. And trying to wakeup can diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 1b23e8e18c..b777a80be2 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -948,7 +948,7 @@ static int virtio_iommu_set_page_size_mask(IOMMUMemoryRegion *mr, * accept it. Having a different masks is possible but the guest will use * sub-optimal block sizes, so warn about it. */ - if (phase_check(PHASE_MACHINE_READY)) { + if (phase_check(MACHINE_INIT_PHASE_READY)) { int new_granule = ctz64(new_mask); int cur_granule = ctz64(cur_mask); diff --git a/monitor/hmp.c b/monitor/hmp.c index b20737e63c..3275e7aeed 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -217,7 +217,7 @@ static bool cmd_can_preconfig(const HMPCommand *cmd) static bool cmd_available(const HMPCommand *cmd) { - return phase_check(PHASE_MACHINE_READY) || cmd_can_preconfig(cmd); + return phase_check(MACHINE_INIT_PHASE_READY) || cmd_can_preconfig(cmd); } static void help_cmd_dump_one(Monitor *mon, diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 01f3834db5..1d6a1c4716 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -250,7 +250,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) dc = DEVICE_CLASS(oc); if (!dc->user_creatable || - (phase_check(PHASE_MACHINE_READY) && !dc->hotpluggable)) { + (phase_check(MACHINE_INIT_PHASE_READY) && !dc->hotpluggable)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "a pluggable device type"); return NULL; @@ -660,7 +660,8 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, return NULL; } - if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) { + if (phase_check(MACHINE_INIT_PHASE_READY) && bus && + !qbus_is_hotpluggable(bus)) { error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); return NULL; } @@ -674,7 +675,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, dev = qdev_new(driver); /* Check whether the hotplug is allowed by the machine */ - if (phase_check(PHASE_MACHINE_READY)) { + if (phase_check(MACHINE_INIT_PHASE_READY)) { if (!qdev_hotplug_allowed(dev, errp)) { goto err_del_dev; } @@ -1040,7 +1041,7 @@ int qemu_global_option(const char *str) bool qmp_command_available(const QmpCommand *cmd, Error **errp) { - if (!phase_check(PHASE_MACHINE_READY) && + if (!phase_check(MACHINE_INIT_PHASE_READY) && !(cmd->options & QCO_ALLOW_PRECONFIG)) { error_setg(errp, "The command '%s' is permitted only after machine initialization has completed", cmd->name); diff --git a/softmmu/vl.c b/softmmu/vl.c index 1159a64bce..df19b911e6 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2732,7 +2732,7 @@ static void qemu_machine_creation_done(void) void qmp_x_exit_preconfig(Error **errp) { - if (phase_check(PHASE_MACHINE_INITIALIZED)) { + if (phase_check(MACHINE_INIT_PHASE_INITIALIZED)) { error_setg(errp, "The command is permitted only before machine initialization"); return; } @@ -3715,14 +3715,14 @@ void qemu_init(int argc, char **argv, char **envp) qemu_apply_legacy_machine_options(machine_opts_dict); qemu_apply_machine_options(machine_opts_dict); qobject_unref(machine_opts_dict); - phase_advance(PHASE_MACHINE_CREATED); + phase_advance(MACHINE_INIT_PHASE_MACHINE_CREATED); /* * Note: uses machine properties such as kernel-irqchip, must run * after qemu_apply_machine_options. */ configure_accelerators(argv[0]); - phase_advance(PHASE_ACCEL_CREATED); + phase_advance(MACHINE_INIT_PHASE_ACCEL_CREATED); /* * Beware, QOM objects created before this point miss global and diff --git a/ui/console.c b/ui/console.c index 29a3e3f0f5..df66536a79 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1295,7 +1295,8 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type, if (QTAILQ_EMPTY(&consoles)) { s->index = 0; QTAILQ_INSERT_TAIL(&consoles, s, next); - } else if (console_type != GRAPHIC_CONSOLE || phase_check(PHASE_MACHINE_READY)) { + } else if (console_type != GRAPHIC_CONSOLE || + phase_check(MACHINE_INIT_PHASE_READY)) { QemuConsole *last = QTAILQ_LAST(&consoles); s->index = last->index + 1; QTAILQ_INSERT_TAIL(&consoles, s, next); From patchwork Wed Nov 17 14:47:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 12624877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F413DC433EF for ; Wed, 17 Nov 2021 14:55:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AED9461B2B for ; Wed, 17 Nov 2021 14:55:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AED9461B2B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMLu-0003y0-Qy for qemu-devel@archiver.kernel.org; Wed, 17 Nov 2021 09:55:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME1-0004hL-2R for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:49 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:53840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnMDx-0000ne-Px for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:48 -0500 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 28A0121C47; Wed, 17 Nov 2021 14:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1637160464; 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=QeXguXtnmsKuabKf3dHxd8zxTIKB7+ej5BXyrtvCVxY=; b=ZhmTjTFwFnHPa/3NqWcSmYwOi1UTEQ85Rb03gBJZEDjLVpo9deIiW6pXxxBKYiBuZbC0c3 SjY59Ii5CC/MBFPg6iDCF1JGtT33QlLncGXQC30ZVNEGAA63K5sraMx90F4C/N6lTXCW5M 3PTukulthcwsD4AMWM7sjThRCdHe4vI= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 2/5] qapi: Implement query-machine-phase QMP command Date: Wed, 17 Nov 2021 15:47:00 +0100 Message-Id: <20211117144703.16305-3-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211117144703.16305-1-damien.hedde@greensocs.com> References: <20211117144703.16305-1-damien.hedde@greensocs.com> MIME-Version: 1.0 Received-SPF: pass client-ip=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , edgar.iglesias@xilinx.com, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Michael S. Tsirkin" , Eric Blake , Mark Burton , "Dr. David Alan Gilbert" , Markus Armbruster , Eric Auger , Mirela Grujic , Alistair Francis , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mirela Grujic The command returns current machine initialization phase. From now on, the MachineInitPhase enum is generated from the QAPI schema. Signed-off-by: Mirela Grujic Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- v3: + add 'unstable' feature + bump to version 7.0 --- qapi/machine.json | 60 ++++++++++++++++++++++++++++++++++++++ include/hw/qdev-core.h | 30 ++----------------- hw/core/machine-qmp-cmds.c | 9 ++++++ hw/core/qdev.c | 5 ++++ 4 files changed, 76 insertions(+), 28 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 067e3f5378..8e9a8afb1d 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1557,3 +1557,63 @@ { 'command': 'x-query-usb', 'returns': 'HumanReadableText', 'features': [ 'unstable' ] } + +## +# @MachineInitPhase: +# +# Enumeration of machine initialization phases. +# +# @no-machine: machine does not exist +# +# @machine-created: machine is created, but its accelerator is not +# +# @accel-created: accelerator is created, but the machine properties have not +# been validated and machine initialization is not done yet +# +# @initialized: machine is initialized, thus creating any embedded devices and +# validating machine properties. Devices created at this time are +# considered to be cold-plugged. +# +# @ready: QEMU is ready to start CPUs and devices created at this time are +# considered to be hot-plugged. The monitor is not restricted to +# "preconfig" commands. +# +# Since: 7.0 +## +{ 'enum': 'MachineInitPhase', + 'data': [ 'no-machine', 'machine-created', 'accel-created', 'initialized', + 'ready' ] } + +## +# @MachineInitPhaseStatus: +# +# Information about machine initialization phase +# +# @phase: the machine initialization phase +# +# Since: 7.0 +## +{ 'struct': 'MachineInitPhaseStatus', + 'data': { 'phase': 'MachineInitPhase' } } + +## +# @query-machine-phase: +# +# Return machine initialization phase +# +# Features: +# @unstable: This command is part of the experimental preconfig mode. +# +# Since: 7.0 +# +# Returns: MachineInitPhaseStatus +# +# Example: +# +# -> { "execute": "query-machine-phase" } +# <- { "return": { "phase": "initialized" } } +# +## +{ 'command': 'query-machine-phase', 'returns': 'MachineInitPhaseStatus', + 'features' : ['unstable'], + 'allow-preconfig': true } diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index ef2d612d39..ac856821ab 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -1,6 +1,7 @@ #ifndef QDEV_CORE_H #define QDEV_CORE_H +#include "qapi/qapi-types-machine.h" #include "qemu/queue.h" #include "qemu/bitmap.h" #include "qemu/rcu.h" @@ -847,35 +848,8 @@ void device_listener_unregister(DeviceListener *listener); */ bool qdev_should_hide_device(const QDict *opts, bool from_json, Error **errp); -typedef enum MachineInitPhase { - /* current_machine is NULL. */ - MACHINE_INIT_PHASE_NO_MACHINE, - - /* current_machine is not NULL, but current_machine->accel is NULL. */ - MACHINE_INIT_PHASE_MACHINE_CREATED, - - /* - * current_machine->accel is not NULL, but the machine properties have - * not been validated and machine_class->init has not yet been called. - */ - MACHINE_INIT_PHASE_ACCEL_CREATED, - - /* - * machine_class->init has been called, thus creating any embedded - * devices and validating machine properties. Devices created at - * this time are considered to be cold-plugged. - */ - MACHINE_INIT_PHASE_INITIALIZED, - - /* - * QEMU is ready to start CPUs and devices created at this time - * are considered to be hot-plugged. The monitor is not restricted - * to "preconfig" commands. - */ - MACHINE_INIT_PHASE_READY, -} MachineInitPhase; - extern bool phase_check(MachineInitPhase phase); extern void phase_advance(MachineInitPhase phase); +extern MachineInitPhase phase_get(void); #endif diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index ddbdc5212f..19f9da4c2d 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -244,3 +244,12 @@ HumanReadableText *qmp_x_query_numa(Error **errp) done: return human_readable_text_from_str(buf); } + +MachineInitPhaseStatus *qmp_query_machine_phase(Error **errp) +{ + MachineInitPhaseStatus *status = g_malloc0(sizeof(*status)); + + status->phase = phase_get(); + + return status; +} diff --git a/hw/core/qdev.c b/hw/core/qdev.c index ccfd6f0dc4..f22c050c89 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -921,6 +921,11 @@ void phase_advance(MachineInitPhase phase) machine_phase = phase; } +MachineInitPhase phase_get(void) +{ + return machine_phase; +} + static const TypeInfo device_type_info = { .name = TYPE_DEVICE, .parent = TYPE_OBJECT, From patchwork Wed Nov 17 14:47:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 12624857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 250AFC433EF for ; Wed, 17 Nov 2021 14:52:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC84561B54 for ; Wed, 17 Nov 2021 14:52:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AC84561B54 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMI4-0007aw-MB for qemu-devel@archiver.kernel.org; Wed, 17 Nov 2021 09:52:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME1-0004hK-1J for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:49 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:53870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnMDy-0000oo-T6 for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:48 -0500 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 9C39421C69; Wed, 17 Nov 2021 14:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1637160465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xKDIuZwq+gAsKudbYFrvq0MH7a7EWDom6AXh82DmPE0=; b=zX2BBScleBt6eAEIfbdROvoLUaRf+qryi/wxcVSpsj2AEQ9qtjwrAIE3rH3pcQw/Odl7ye 8lA0njEub89tBDZ3sS1LhV/86UPonzqtxHyoH8u7ajjDqIQt6zXJGXpIN4xX2EFMoib/ay 7AfAAzpdTpdq1TYvYCnlarxLJrUTQks= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 3/5] qapi: Implement x-machine-init QMP command Date: Wed, 17 Nov 2021 15:47:01 +0100 Message-Id: <20211117144703.16305-4-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211117144703.16305-1-damien.hedde@greensocs.com> References: <20211117144703.16305-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes Received-SPF: pass client-ip=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , edgar.iglesias@xilinx.com, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Michael S. Tsirkin" , Eric Blake , Mark Burton , "Dr. David Alan Gilbert" , Markus Armbruster , Eric Auger , Mirela Grujic , Alistair Francis , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mirela Grujic The x-machine-init QMP command is available only if the -preconfig option is used and the current machine initialization phase is accel-created. The command triggers QEMU to enter machine initialized phase and wait for the QMP configuration. In the next commit, we will add the possibility to create devices at this point. To exit the initialized phase, use the existing x-exit-preconfig QMP command. As part of preconfig mode, the command has the 'unstable' feature. Signed-off-by: Mirela Grujic Signed-off-by: Damien Hedde --- Cc: Alistair Francis v3: + add 'unstable' feature + bump the target version to 7.0 + fix the entrance check (and drop alistair ack-by). In previous version we were only checking we were not too early, we now check we are not too late too. --- qapi/machine.json | 27 +++++++++++++++++++++++++++ softmmu/vl.c | 19 +++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 8e9a8afb1d..39c2397629 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1617,3 +1617,30 @@ { 'command': 'query-machine-phase', 'returns': 'MachineInitPhaseStatus', 'features' : ['unstable'], 'allow-preconfig': true } + +## +# @x-machine-init: +# +# Enter machine initialized phase +# +# Features: +# @unstable: This command is part of the experimental preconfig mode. +# +# Since: 7.0 +# +# Returns: nothing +# +# Notes: This command will trigger QEMU to execute initialization steps +# that are required to enter the machine initialized phase. The command +# is available only if the -preconfig command line option was passed and +# if the machine is currently in the accel-created phase. +# +# Example: +# +# -> { "execute": "x-machine-init" } +# <- { "return": {} } +# +## +{ 'command': 'x-machine-init', + 'features' : ['unstable'], + 'allow-preconfig': true } diff --git a/softmmu/vl.c b/softmmu/vl.c index df19b911e6..a3bbe7b249 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -123,6 +123,7 @@ #include "qapi/qapi-visit-qom.h" #include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qdict.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qmp/qerror.h" #include "sysemu/iothread.h" #include "qemu/guest-random.h" @@ -2636,10 +2637,16 @@ static void qemu_init_displays(void) } } -static void qemu_init_board(void) +void qmp_x_machine_init(Error **errp) { MachineClass *machine_class = MACHINE_GET_CLASS(current_machine); + if (phase_get() != MACHINE_INIT_PHASE_ACCEL_CREATED) { + error_setg(errp, "The command is permitted only when " + "the machine is in accel-created phase"); + return; + } + 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); @@ -2732,12 +2739,16 @@ static void qemu_machine_creation_done(void) void qmp_x_exit_preconfig(Error **errp) { - if (phase_check(MACHINE_INIT_PHASE_INITIALIZED)) { - error_setg(errp, "The command is permitted only before machine initialization"); + if (phase_check(MACHINE_INIT_PHASE_READY)) { + error_setg(errp, "The command is permitted only before " + "the machine is ready"); return; } - qemu_init_board(); + if (!phase_check(MACHINE_INIT_PHASE_INITIALIZED)) { + qmp_x_machine_init(errp); + } + qemu_create_cli_devices(); qemu_machine_creation_done(); From patchwork Wed Nov 17 14:47:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 12624875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BB3BC433F5 for ; Wed, 17 Nov 2021 14:55:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E609C61B29 for ; Wed, 17 Nov 2021 14:55:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E609C61B29 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMLe-0003ZJ-0r for qemu-devel@archiver.kernel.org; Wed, 17 Nov 2021 09:55:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME2-0004kN-37 for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:50 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:53892) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME0-0000p3-4j for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:49 -0500 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 1A68421EB6; Wed, 17 Nov 2021 14:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1637160466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3KQLb65SkXZKtlxt5HOSASbo+9p09N+teG3AW4qf7rg=; b=m3tRPgYE7MEeIm0hyszCO4DCkW3avU27gWyDY3GkAZI3cWs8jS57jXwW3jDj3ChRp/RfmW VwtgQbAEC1R5+ag7b+gliI8N9nsQ/cSmLnLTgbYGD8GWa0vCJjjOOJdhz4XsaqTjdmJYJb SAyQEFWsp3wgsrcfco5yRsxp446E6I4= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 4/5] qapi: Allow device_add to execute in machine initialized phase Date: Wed, 17 Nov 2021 15:47:02 +0100 Message-Id: <20211117144703.16305-5-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211117144703.16305-1-damien.hedde@greensocs.com> References: <20211117144703.16305-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes Received-SPF: pass client-ip=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , edgar.iglesias@xilinx.com, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Michael S. Tsirkin" , Eric Blake , Mark Burton , "Dr. David Alan Gilbert" , Markus Armbruster , Eric Auger , Mirela Grujic , Alistair Francis , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mirela Grujic This commit allows to use the QMP command to add a cold-plugged device like we can do with the CLI option -device. Note: for device_add command in qdev.json adding the 'allow-preconfig' option has no effect because the command appears to bypass QAPI (see TODO at qapi/qdev.json:61). The option is added there solely to document the intent. For the same reason, the flags have to be explicitly set in monitor_init_qmp_commands() when the device_add command is registered. Signed-off-by: Mirela Grujic Signed-off-by: Damien Hedde Acked-by: Alistair Francis --- qapi/qdev.json | 3 ++- monitor/misc.c | 2 +- softmmu/qdev-monitor.c | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qapi/qdev.json b/qapi/qdev.json index 69656b14df..51c5b2fbcf 100644 --- a/qapi/qdev.json +++ b/qapi/qdev.json @@ -74,7 +74,8 @@ { 'command': 'device_add', 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'}, 'gen': false, # so we can get the additional arguments - 'features': ['json-cli'] } + 'features': ['json-cli'], + 'allow-preconfig': true } ## # @device_del: diff --git a/monitor/misc.c b/monitor/misc.c index a3a6e47844..fd56dd8f08 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -233,7 +233,7 @@ static void monitor_init_qmp_commands(void) qmp_init_marshal(&qmp_commands); qmp_register_command(&qmp_commands, "device_add", - qmp_device_add, 0, 0); + qmp_device_add, QCO_ALLOW_PRECONFIG, 0); QTAILQ_INIT(&qmp_cap_negotiation_commands); qmp_register_command(&qmp_cap_negotiation_commands, "qmp_capabilities", diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 1d6a1c4716..06729145b7 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -842,6 +842,12 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) QemuOpts *opts; DeviceState *dev; + if (!phase_check(MACHINE_INIT_PHASE_INITIALIZED)) { + error_setg(errp, "The command is permitted only after " + "the machine is initialized"); + return; + } + opts = qemu_opts_from_qdict(qemu_find_opts("device"), qdict, errp); if (!opts) { return; From patchwork Wed Nov 17 14:47:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 12624873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 953A6C433EF for ; Wed, 17 Nov 2021 14:55:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBB8361B29 for ; Wed, 17 Nov 2021 14:55:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EBB8361B29 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMLc-0003Uy-St for qemu-devel@archiver.kernel.org; Wed, 17 Nov 2021 09:55:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME3-0004nR-6H for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:51 -0500 Received: from beetle.greensocs.com ([5.135.226.135]:53912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnME1-0000pV-Cv for qemu-devel@nongnu.org; Wed, 17 Nov 2021 09:47:50 -0500 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id 624AF21EB7; Wed, 17 Nov 2021 14:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1637160468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JBsdMz226FRzvgeaZm+rQwc/P25DSmwFqWH2z4XEGQY=; b=dUbzycmYQkLmTewH5wPv2cxiDIZ4UXtD/OY00lrUx32XKdO0PhCXTiiMBLR1L8TsZ0u7hs geXd2rbe2ow8plJy62fvQkfVde4EAInrZmxjsKf7ih7z1JYx87XwAkK3q9UP6H0mZmqy53 tKRA8nFt2Im6S8su5LRm+cME/fUKNFw= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 5/5] docs/system: improve doc about preconfig Date: Wed, 17 Nov 2021 15:47:03 +0100 Message-Id: <20211117144703.16305-6-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211117144703.16305-1-damien.hedde@greensocs.com> References: <20211117144703.16305-1-damien.hedde@greensocs.com> MIME-Version: 1.0 X-Spam: Yes Received-SPF: pass client-ip=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , edgar.iglesias@xilinx.com, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Michael S. Tsirkin" , Eric Blake , Mark Burton , "Dr. David Alan Gilbert" , Markus Armbruster , Eric Auger , Mirela Grujic , Alistair Francis , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Separate -S / -preconfig sections and improve a bit the preconfig part. Signed-off-by: Damien Hedde Signed-off-by: Mirela Grujic --- docs/system/managed-startup.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/system/managed-startup.rst b/docs/system/managed-startup.rst index 9bcf98ea79..e1cdbb79b1 100644 --- a/docs/system/managed-startup.rst +++ b/docs/system/managed-startup.rst @@ -1,6 +1,9 @@ Managed start up options ======================== +CPU Frezee start +---------------- + In system mode emulation, it's possible to create a VM in a paused state using the ``-S`` command line option. In this state the machine is completely initialized according to command line options and ready @@ -20,7 +23,12 @@ allowing VM code to run. However, at the ``-S`` pause point, it's impossible to configure options that affect initial VM creation (like: ``-smp``/``-m``/``-numa`` ...) or -cold plug devices. The experimental ``--preconfig`` command line option +cold plug devices. + +Preconfig (experimental) +------------------------ + +The experimental ``--preconfig`` command line option allows pausing QEMU before the initial VM creation, in a "preconfig" state, where additional queries and configuration can be performed via QMP before moving on to the resulting configuration startup. In the @@ -32,4 +40,14 @@ machine, including but not limited to: - ``query-qmp-schema`` - ``query-commands`` - ``query-status`` +- ``query-machine-phase`` +- ``x-machine-init`` - ``x-exit-preconfig`` + +Some commands make QEMU to progress along the VM creation procedure: + +- ``x-machine-init`` initializes the machine. Devices can be added only after + this command has been issued. + +- ``x-exit-preconfig`` leaves the preconfig state. It can be issued at any time + during preconfig and it will finish the VM creation.