From patchwork Thu May 19 15:33:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 1633338 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=greensocs.com header.i=@greensocs.com header.a=rsa-sha256 header.s=mail header.b=tePtb47u; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4L3vHK2Gjkz9sPf for ; Fri, 20 May 2022 01:42:05 +1000 (AEST) Received: from localhost ([::1]:44836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nriHq-000856-QJ for incoming@patchwork.ozlabs.org; Thu, 19 May 2022 11:42:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nriAe-0001al-4k for qemu-devel@nongnu.org; Thu, 19 May 2022 11:34:38 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:48996) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nriAY-0007oV-9m for qemu-devel@nongnu.org; Thu, 19 May 2022 11:34:33 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.10]) by beetle.greensocs.com (Postfix) with ESMTPS id B824E20896; Thu, 19 May 2022 15:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1652974465; 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=yn/s3Oq39rzmoejHaHV+Y/8l9ePpuMuVvPWS30BJqRc=; b=tePtb47uxCR+s8BRM3dV4PG45OkcPCEVKVM/+IkXy/ibaM0wtKpVX/5n/VNXniKYej4W18 Vcm5VRQ+zY2c3/BXB0ld5ZxFUu7a1qj2lAWUPcEKDqXag0lZDF236sMDxBIVCceuUEeuiU Oj9M7FmIq9SFwCbDJFZmxBeVaXLbREc= From: Damien Hedde To: qemu-devel@nongnu.org Cc: mark.burton@greensocs.com, edgari@xilinx.com, Damien Hedde , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH v5 1/6] machine: add phase_get() and document phase_check()/advance() Date: Thu, 19 May 2022 17:33:57 +0200 Message-Id: <20220519153402.41540-2-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220519153402.41540-1-damien.hedde@greensocs.com> References: <20220519153402.41540-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, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" phase_get() returns the current phase, we'll use it in next commit. Signed-off-by: Damien Hedde Reviewed-by: Philippe Mathieu-Daudé Tested-by: Jim Shu --- include/hw/qdev-core.h | 19 +++++++++++++++++++ hw/core/qdev.c | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 92c3d65208..e29c705b74 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -887,7 +887,26 @@ typedef enum MachineInitPhase { PHASE_MACHINE_READY, } MachineInitPhase; +/* + * phase_get: + * Returns the current phase + */ +MachineInitPhase phase_get(void); + +/** + * phase_check: + * Test if current phase is at least @phase. + * + * Returns true if this is the case. + */ extern bool phase_check(MachineInitPhase phase); + +/** + * @phase_advance: + * Update the current phase to @phase. + * + * Must only be used to make a single phase step. + */ extern void phase_advance(MachineInitPhase phase); #endif diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 84f3019440..632dc0a4be 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -910,6 +910,11 @@ Object *qdev_get_machine(void) static MachineInitPhase machine_phase; +MachineInitPhase phase_get(void) +{ + return machine_phase; +} + bool phase_check(MachineInitPhase phase) { return machine_phase >= phase;