From nobody Tue Feb 10 13:33:09 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=1681129894; cv=none; d=zohomail.com; s=zohoarc; b=QjaeLyRpH3K9EPGbs5A7tDla/2e6L6CBUAlwIzyLpGtgpjhrXlAcOXqvWmHAjhfEVqws5Os/RrM4bw2Ventb+jq+/qH4Hxqp+Fwyt8HYNauRBImxLFCiQDf1NKbbHp4Wp7DiRTCSimo1Z5cqWILwha+pgsyvFJXsmZjEWuKLHXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681129894; 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=QQVAabeAJXG93R9o2+wybfrTUqipz7vwVTHH4p1nQcc=; b=aJeUCO5lPVoYBDR31ttoGll/WSIycU5ARxnclrT9hfO0QU/C/Fc97wNBXaQgSoL4pCEVf9fiWQRxvqh4S4NdM/6q9Qy3/LfkZJlnQt40K7BRuV+P86OfvZ4IqJaxnkSCow3KFsc6qgBxexhNcZBBrHiFN14LrNFSbyfcSBHWdSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1681129894613662.087262509927; Mon, 10 Apr 2023 05:31:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plqfL-0007ST-BS; Mon, 10 Apr 2023 08:30:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plqer-0007Ag-Mb for qemu-devel@nongnu.org; Mon, 10 Apr 2023 08:30:06 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plqeo-0000tq-UE for qemu-devel@nongnu.org; Mon, 10 Apr 2023 08:30:05 -0400 Received: by mail-oi1-x22c.google.com with SMTP id bf5so3050794oib.8 for ; Mon, 10 Apr 2023 05:30:02 -0700 (PDT) Received: from grind.. ([191.255.108.232]) by smtp.gmail.com with ESMTPSA id o13-20020a056808124d00b00387160bcd46sm4297016oiv.46.2023.04.10.05.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 05:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1681129801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QQVAabeAJXG93R9o2+wybfrTUqipz7vwVTHH4p1nQcc=; b=dkiqu/aTnyD3IXaXxzQiOJz2WPJeLXwU5/yfjrucXPCvZyURP9CBZTMGBYe8Xhsm17 TgTSsPGaVjXq/LVBxvfHKj/tv7VnvAf+aITYdTXAlz6ZqlmM85hFszbGWRhfA2TBv2gY tDE5ZofV73oFaf6eLtrm2UYG3cYOHSS0VfkzWOq8Z/O+G5eXWp9sSVjvj5B4lssl0nMg 3mPvHAkgyEY2pw38LVSeRvz1rFvGRHRtaeU0n0SxHAguWnjdlvTSusXhBFa5fyN8t8EG isN50P08Uq3XJ7vkfdwALM0Bcua+WIbUWsHmjlprBaR6EKRPRLQSXGNPhEmQhkVWpYjc 9IgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681129801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QQVAabeAJXG93R9o2+wybfrTUqipz7vwVTHH4p1nQcc=; b=fCxtxcRInJkQauDuH1cA15BOFZZ0hL/bEYFiGrZAXWDXHGQsNM49TnRausUhFj7w36 ECVQcT884Ir9OdTiVeeHL5kPGOeIdw2aRNX8jTSkxLv74RnzKonlAJZafxXVD7dkokMf KL2MoquzBl/dcJNOIAjf8qf2c78BZbfrHdjgiUhl8k+i0bKjpSn96Jh4qylAVAdPxX16 4ze3RmlDcd588NGedX1+T0o2+alW26n8MInt4fS0jfVKimRRHMT21/RrdI5X72x1fIG7 QMnk/K8zHD1BDPwH89QmHTkPkmMoiObBxWbEPRUl4pyfBIjphe5NWGMjW4d8E+KUXjPl Z15A== X-Gm-Message-State: AAQBX9dLYiKuUCwO23HBJZH2KVBe2Tj/wlzMB6ZF646Vxzb3mICNwd1t B2x3if81RFyDGg2yzU+FALcSJdkDJ/gKX0aEHzI= X-Google-Smtp-Source: AKy350b5y/gGpGqg2jB8WE73FEy7r038wHNPXEeQQgzDU42hmzapxIurR8h+5r4PkI6lgw3Sb8QG0g== X-Received: by 2002:a05:6808:1a11:b0:386:e309:cfbf with SMTP id bk17-20020a0568081a1100b00386e309cfbfmr5966386oib.13.1681129801386; Mon, 10 Apr 2023 05:30:01 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH 3/4] target/riscv: add 'static' attribute of query-cpu-definitions Date: Mon, 10 Apr 2023 09:29:44 -0300 Message-Id: <20230410122945.77439-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230410122945.77439-1-dbarboza@ventanamicro.com> References: <20230410122945.77439-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::22c; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x22c.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1681129896826100007 Content-Type: text/plain; charset="utf-8" 'static' is defined in the QMP doc as: "whether a CPU definition is static and will not change depending on QEMU version, machine type, machine options and accelerator options. A static model is always migration-safe." For RISC-V we'll consider all named CPUs as static since their extensions can't be changed by user input. Generic CPUs will be considered non-static. We aren't ready to make the change for generic CPUs yet because we're using the same class init for every CPU. We'll deal with it next. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu-qom.h | 3 +++ target/riscv/cpu.c | 6 ++++++ target/riscv/riscv-qmp-cmds.c | 2 ++ 3 files changed, 11 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index b9318e0783..687cb6f4d0 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -54,6 +54,7 @@ OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CP= U) =20 /** * RISCVCPUClass: + * @static_model: See CpuDefinitionInfo::static * @parent_realize: The parent class' realize handler. * @parent_phases: The parent class' reset phase handlers. * @@ -65,6 +66,8 @@ struct RISCVCPUClass { /*< public >*/ DeviceRealize parent_realize; ResettablePhases parent_phases; + + bool static_model; }; =20 #endif /* RISCV_CPU_QOM_H */ diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index cb68916fce..30a1e74ea6 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1679,6 +1679,12 @@ static void riscv_cpu_class_init(ObjectClass *c, voi= d *data) resettable_class_set_parent_phases(rc, NULL, riscv_cpu_reset_hold, NUL= L, &mcc->parent_phases); =20 + /* + * Consider all models to be static. Each CPU is free to + * set it to false if needed. + */ + mcc->static_model =3D true; + cc->class_by_name =3D riscv_cpu_class_by_name; cc->has_work =3D riscv_cpu_has_work; cc->dump_state =3D riscv_cpu_dump_state; diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index 128677add9..639f2c052e 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -30,6 +30,7 @@ static void riscv_cpu_add_definition(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; + RISCVCPUClass *cc =3D RISCV_CPU_CLASS(oc); CpuDefinitionInfoList **cpu_list =3D user_data; CpuDefinitionInfo *info =3D g_malloc0(sizeof(*info)); const char *typename =3D object_class_get_name(oc); @@ -37,6 +38,7 @@ static void riscv_cpu_add_definition(gpointer data, gpoin= ter user_data) info->name =3D g_strndup(typename, strlen(typename) - strlen("-" TYPE_RISCV_CPU)); info->q_typename =3D g_strdup(typename); + info->q_static =3D cc->static_model; =20 QAPI_LIST_PREPEND(*cpu_list, info); } --=20 2.39.2