From patchwork Wed Mar 30 12:56:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Hedde X-Patchwork-Id: 12795812 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 11074C433EF for ; Wed, 30 Mar 2022 13:14:25 +0000 (UTC) Received: from localhost ([::1]:42520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZY9X-0002lN-Ud for qemu-devel@archiver.kernel.org; Wed, 30 Mar 2022 09:14:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZXsf-0006on-Ur; Wed, 30 Mar 2022 08:56:59 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:41062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZXsb-0004Zh-TX; Wed, 30 Mar 2022 08:56:55 -0400 Received: from crumble.bar.greensocs.com (unknown [172.17.10.6]) by beetle.greensocs.com (Postfix) with ESMTPS id A5D9A20780; Wed, 30 Mar 2022 12:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1648645010; 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=yAl9UmQScRePk2SVLTDCbmbb8crA3T3m5WK8Zes84L0=; b=dfO7Ra3dxjxDgRm4zGt6tgvWY84pbYNMVI+E95RBI/Ir8ziXlohCAafkmv37SizYYv7f4n bo8kjQnqwWaMS36AWqckCMc4iqbaw9BkxqV6nDFt4eWmBelMA3HSX/75F8gTUW+VIA1ZeM Th2BdEQK2ixSbGnJUbUPaiz7xNxKEQY= From: Damien Hedde To: qemu-devel@nongnu.org Subject: [RFC PATCH 07/18] hw/cpu/cpus: add a common start-powered-off property Date: Wed, 30 Mar 2022 14:56:28 +0200 Message-Id: <20220330125639.201937-8-damien.hedde@greensocs.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220330125639.201937-1-damien.hedde@greensocs.com> References: <20220330125639.201937-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, 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: , Cc: Damien Hedde , Peter Maydell , Bin Meng , qemu-riscv@nongnu.org, Alistair Francis , mark.burton@greensocs.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Yanan Wang , Eduardo Habkost , qemu-arm@nongnu.org, Palmer Dabbelt , Vijai Kumar K , "Edgar E. Iglesias" , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Can be used to initialize the same property on all cpus. Signed-off-by: Damien Hedde --- include/hw/cpu/cpus.h | 3 +++ hw/cpu/cpus.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/hw/cpu/cpus.h b/include/hw/cpu/cpus.h index 295d7537e2..7e89a0d018 100644 --- a/include/hw/cpu/cpus.h +++ b/include/hw/cpu/cpus.h @@ -46,6 +46,8 @@ OBJECT_DECLARE_TYPE(CpusState, CpusClass, CPUS) * written before realize in order to enable/disable clustering. * @cluster_index: The cluster ID. This value is for internal use only and * should not be exposed directly to the user or to the guest. + * @start_powered_off: Default start power state of all cpus + * (can be modified on a per-cpu basis after realize). */ struct CpusState { /*< private >*/ @@ -59,6 +61,7 @@ struct CpusState { struct { uint16_t cpus; } topology; + bool start_powered_off; CPUState **cpus; }; diff --git a/hw/cpu/cpus.c b/hw/cpu/cpus.c index ed9402c100..d1fe80f0ab 100644 --- a/hw/cpu/cpus.c +++ b/hw/cpu/cpus.c @@ -27,6 +27,7 @@ static Property cpus_properties[] = { * FIXME: remove this property to keep it internal ? */ DEFINE_PROP_INT32("cluster-id", CpusState, cluster_index, -1), + DEFINE_PROP_BOOL("start-powered-off", CpusState, start_powered_off, false), DEFINE_PROP_END_OF_LIST() }; @@ -71,6 +72,10 @@ static void cpus_create_cpus(CpusState *s, Error **errp) cpu->cluster_index = s->cluster_index; } + /* set power start state */ + qdev_prop_set_bit(DEVICE(cpu), "start-powered-off", + s->start_powered_off); + /* let subclass configure the cpu */ if (cgc->configure_cpu) { cgc->configure_cpu(s, cpu, i);