From nobody Tue Feb 10 20:50:09 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1620895299; cv=none; d=zohomail.com; s=zohoarc; b=av+RVKgP3qhkXCm/ti3X3RTyzRbO0P3dWrd14F1Xhf6iYNF4ntYzPEe89L2vvzJ1ANfv9Ul4oxbNTxRW5qRITVI5DAeQ5f7+r0MoovQN6Ku1Y6mTnqCKG1bW29SXKuSguSEQnVcDFGmfi7O9U7yTrBRDfVK7xGcXq+iAUTOh4HM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620895299; h=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=0L9WVsHpVsn+U2PyClRd9i7mpiz97H6Qub00HmSwQSE=; b=ghacHbE0UZ7YXh8TrdTM6Go17GGPDtnWWq7tjztqlzwRYNjmua0sazUYsTxQAPfhn02Set56EfhlgUCiRDSantfpOBSP591XFEToloCnH6BcgOkoYh0f5uRoHg5pcdVlCHiXJzxVlwgY1aSNgZ0vrc3QDgx6iB5Wd1V+HRHYgns= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620895299161465.15870460865096; Thu, 13 May 2021 01:41:39 -0700 (PDT) Received: from localhost ([::1]:37658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lh6uX-0002s5-T6 for importer@patchew.org; Thu, 13 May 2021 04:41:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lh6gT-000578-Q1 for qemu-devel@nongnu.org; Thu, 13 May 2021 04:27:05 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:56710) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lh6gR-0001Lq-RL for qemu-devel@nongnu.org; Thu, 13 May 2021 04:27:05 -0400 Received: from localhost.localdomain (cable-24-135-22-90.dynamic.sbb.rs [24.135.22.90]) by beetle.greensocs.com (Postfix) with ESMTPSA id 41C3721CCE; Thu, 13 May 2021 08:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1620894422; 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=0L9WVsHpVsn+U2PyClRd9i7mpiz97H6Qub00HmSwQSE=; b=2Vlx9oSJGolKPfctJ0VAuWkd245ExgVz58AF9KHlbGTgNVFXAqF4QYImM0C6JpMrN0N8vA 4Vc0c+0OG6ZBi+jSH7yUNzhl5rNN9nOVj5EJ6QhN7VNfbTzBbOQhoWX9Bjl63QD1wiU9yi dOGo3LKxgySvQxpD4ZHjTAqG0UkKlgQ= From: Mirela Grujic To: qemu-devel@nongnu.org Subject: [RFC PATCH 5/9] qapi: Implement 'next-machine-phase' command Date: Thu, 13 May 2021 10:25:45 +0200 Message-Id: <20210513082549.114275-6-mirela.grujic@greensocs.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210513082549.114275-1-mirela.grujic@greensocs.com> References: <20210513082549.114275-1-mirela.grujic@greensocs.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam: Yes 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=5.135.226.135; envelope-from=mirela.grujic@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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: damien.hedde@greensocs.com, edgar.iglesias@xilinx.com, Eduardo Habkost , mark.burton@greensocs.com, Markus Armbruster , Mirela Grujic , Paolo Bonzini 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" This command will be used to control via QMP the advancing of machine through initialization phases. The feature is needed to enable the machine configuration via QMP. The command triggers QEMU to advance the machine to the next init phase, i.e. to execute initialization steps required to enter the next phase. The command is used in combination with -preconfig command line option. Note: advancing the machine to the final phase has the same effect as executing 'x-exit-preconfig' command. Signed-off-by: Mirela Grujic --- qapi/machine.json | 24 ++++++++++++++++++++++++ include/sysemu/sysemu.h | 3 +++ hw/core/machine-qmp-cmds.c | 12 ++++++++++++ softmmu/vl.c | 3 +-- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 47bdbec817..968d67dd95 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1328,3 +1328,27 @@ ## { 'command': 'query-machine-phase', 'returns': 'MachineInitPhaseStatus', 'allow-preconfig': true } + +## +# @next-machine-phase: +# +# Increment machine initialization phase +# +# Since: #FIXME +# +# Returns: If successful, nothing +# +# Notes: This command will trigger QEMU to execute initialization steps +# that are required to enter the next machine initialization phase. +# If by incrementing the initialization phase the machine reaches +# the final phase, the guest will start running immediately unless +# the -S option is used. The command is available only if the +# -preconfig command line option was passed. +# +# Example: +# +# -> { "execute": "next-machine-phase" } +# <- { "return": {} } +# +## +{ 'command': 'next-machine-phase', 'allow-preconfig': true } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 8fae667172..0df06d095d 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -2,6 +2,7 @@ #define SYSEMU_H /* Misc. things related to the system emulator. */ =20 +#include "hw/qdev-core.h" #include "qemu/timer.h" #include "qemu/notify.h" #include "qemu/uuid.h" @@ -20,6 +21,8 @@ void qemu_run_machine_init_done_notifiers(void); void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); =20 +void qemu_machine_enter_phase(MachineInitPhase target_phase, Error **errp); + void configure_rtc(QemuOpts *opts); =20 void qemu_init_subsystems(void); diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 23f837dadb..8aa743d59b 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -207,3 +207,15 @@ MachineInitPhaseStatus *qmp_query_machine_phase(Error = **errp) =20 return status; } + +void qmp_next_machine_phase(Error **errp) +{ + MachineInitPhase target_phase =3D phase_get() + 1; + + if (target_phase >=3D MACHINE_INIT_PHASE__MAX) { + error_setg(errp, "Cannot increment machine init phase any further"= ); + return; + } + + qemu_machine_enter_phase(target_phase, errp); +} diff --git a/softmmu/vl.c b/softmmu/vl.c index 88f504aff9..0f402806f5 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2578,8 +2578,7 @@ static void qemu_machine_creation_done(void) } } =20 -static void qemu_machine_enter_phase(MachineInitPhase target_phase, - Error **errp) +void qemu_machine_enter_phase(MachineInitPhase target_phase, Error **errp) { /* target phases before initialization are not handled here */ if (target_phase < MACHINE_INIT_PHASE_INITIALIZED) { --=20 2.25.1