From nobody Wed Nov 27 00:25:05 2024 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=1703247899; cv=none; d=zohomail.com; s=zohoarc; b=l/mKvP8VJZFJj3sMyW5M+vKFyJp4ZpSua+IFGOqMT/r81l5ulO9JmlNL656YeSLm/u5w5EnZB1nq0dufS0/5xU9bAYG9aCFY2JF1vZ7EGVmYGfqcIuLfQ0mg6PCH1bzYABHo/4MQ58NQCwkGNuaTCM54Ml435Fh1Xyob/Bc/9pM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703247899; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7xgzruWaiL2ijKyy0M+AlR7DmJC0Qfumng5s9SdhQIo=; b=bZNmIfrRhl3UH9rjP9Xtwo77xRljs0QuR3aY0UZApQetm8yMSdX4nMc56nO+tdf/pO5LJEoN4T7wiNNPe5DOnV2Ui+BGbOxnm6NBj3x15I9w/hcV1LgEOJp2ysbttpcPuHaOeXl3X+wHZhweBlMACUi0NW8hEbhzHmeHbR1WF+0= 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 1703247899346887.7646583392675; Fri, 22 Dec 2023 04:24:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGeYs-00020D-Tv; Fri, 22 Dec 2023 07:23:30 -0500 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 1rGeYr-0001y0-65 for qemu-devel@nongnu.org; Fri, 22 Dec 2023 07:23:29 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGeYp-0006KK-DG for qemu-devel@nongnu.org; Fri, 22 Dec 2023 07:23:28 -0500 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6d267461249so1083162b3a.3 for ; Fri, 22 Dec 2023 04:23:27 -0800 (PST) Received: from grind.dc1.ventanamicro.com (201-69-66-51.dial-up.telesp.net.br. [201.69.66.51]) by smtp.gmail.com with ESMTPSA id g14-20020aa7874e000000b006ce7ad8c14esm3274901pfo.164.2023.12.22.04.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 04:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1703247806; x=1703852606; darn=nongnu.org; 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=7xgzruWaiL2ijKyy0M+AlR7DmJC0Qfumng5s9SdhQIo=; b=fEoAAoV8ZdaTHQeEHcOFEKh4F8It1AHLq+QjXVOzjh9g0Pt9C4gSzZzWhteFO+HNta DR8KbIwlvrHVPzoD17iwYhJ+UqNgH3owGoCZZ0Km9TNlOYIEdHKUDBIjlY3CC0hqm+uq HnL80Bb3VxsB0Nhp65pu5kG+Wm8CZ8VH6Y0QEKvMFeFOjsZUppAaF5nhMSOf/Wjs6dQz 9liPciOjEhQuL6mf2eEWnqnJaJ4sY2UW0LSd5bsmPus7McYiyf7fSI+hm0HWB9jYsbt0 fFs/lR0JCqFAuf6wD1qVc7LMc9xXxF+xFU2lj0n7L1SGueCs2s89A6/lqzr+w4wWVAnS SPFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703247806; x=1703852606; 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=7xgzruWaiL2ijKyy0M+AlR7DmJC0Qfumng5s9SdhQIo=; b=hO72ID23M+e0l3PfscvZqTW3uzNaNn7jMEuApqyZTCzqGZx27J0M8dQzpb4+ghdG7K by9WpfJtYpRmmFyzSg5NiGsNM7GjijyPU9nbDBCNFSBN+6WlG5wYnKkQMCdq7CvLAGof BMhKCiigAvdbp1a/z1xJTv+FxVeqfWksdI/bCxk4gqFzBAMgicinkNAciddH2sbLBhh4 yFPxT1dCOWT6VLlnkf1mZNBvtY0A75C5zdT4wyZyvcqH/J/HQ1O+cUuj466kAI+h+wBw EHfqwTtJhIRI4oD0mjXnOtBz7/t74EV1PPhx7+bqWe3Oh94M9v8AKIyPkNGhD9fIHZzY vZlg== X-Gm-Message-State: AOJu0YyceZyaXMjQ/kxZ7B8A3YxiqL03BYY35tamWRf8l5xz8kkOSZpS DA8AB3VYUm56ih+NX2/8FxODGvi4HIO4LYHuA5ehN1FSskKAjQ== X-Google-Smtp-Source: AGHT+IFsU93+27EGlJDMSMArPD1LkuWhySHKrcaj41iJPwM1Qwu92kldpkiPhB6Yq58Vt0nIBhC7tw== X-Received: by 2002:a05:6a00:1c8b:b0:6d8:840a:6d22 with SMTP id y11-20020a056a001c8b00b006d8840a6d22mr905002pfw.60.1703247805837; Fri, 22 Dec 2023 04:23:25 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH v2 15/16] target/riscv/cpu.c: move 'mimpid' to riscv_cpu_properties[] Date: Fri, 22 Dec 2023 09:22:34 -0300 Message-ID: <20231222122235.545235-16-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222122235.545235-1-dbarboza@ventanamicro.com> References: <20231222122235.545235-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::429; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x429.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1703247900303100009 Content-Type: text/plain; charset="utf-8" Keep all class properties in riscv_cpu_properties[]. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 68 ++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 260932e117..613e8d5ddc 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1895,6 +1895,41 @@ static const PropertyInfo prop_mvendorid =3D { .set =3D prop_mvendorid_set, }; =20 +static void prop_mimpid_set(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + bool dynamic_cpu =3D riscv_cpu_is_dynamic(obj); + RISCVCPU *cpu =3D RISCV_CPU(obj); + uint64_t prev_val =3D cpu->cfg.mimpid; + uint64_t value; + + if (!visit_type_uint64(v, name, &value, errp)) { + return; + } + + if (!dynamic_cpu && prev_val !=3D value) { + error_setg(errp, "Unable to change %s mimpid (0x%" PRIu64 ")", + object_get_typename(obj), prev_val); + return; + } + + cpu->cfg.mimpid =3D value; +} + +static void prop_mimpid_get(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + uint64_t value =3D RISCV_CPU(obj)->cfg.mimpid; + + visit_type_uint64(v, name, &value, errp); +} + +static const PropertyInfo prop_mimpid =3D { + .name =3D "mimpid", + .get =3D prop_mimpid_get, + .set =3D prop_mimpid_set, +}; + static Property riscv_cpu_properties[] =3D { DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true), =20 @@ -1920,6 +1955,7 @@ static Property riscv_cpu_properties[] =3D { .set_default =3D true, .defval.u =3D 64}, =20 {.name =3D "mvendorid", .info =3D &prop_mvendorid}, + {.name =3D "mimpid", .info =3D &prop_mimpid}, =20 #ifndef CONFIG_USER_ONLY DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC), @@ -1985,35 +2021,6 @@ static const struct SysemuCPUOps riscv_sysemu_ops = =3D { }; #endif =20 -static void cpu_set_mimpid(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - bool dynamic_cpu =3D riscv_cpu_is_dynamic(obj); - RISCVCPU *cpu =3D RISCV_CPU(obj); - uint64_t prev_val =3D cpu->cfg.mimpid; - uint64_t value; - - if (!visit_type_uint64(v, name, &value, errp)) { - return; - } - - if (!dynamic_cpu && prev_val !=3D value) { - error_setg(errp, "Unable to change %s mimpid (0x%" PRIu64 ")", - object_get_typename(obj), prev_val); - return; - } - - cpu->cfg.mimpid =3D value; -} - -static void cpu_get_mimpid(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - uint64_t value =3D RISCV_CPU(obj)->cfg.mimpid; - - visit_type_uint64(v, name, &value, errp); -} - static void cpu_set_marchid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -2094,9 +2101,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void= *data) cc->gdb_arch_name =3D riscv_gdb_arch_name; cc->gdb_get_dynamic_xml =3D riscv_gdb_get_dynamic_xml; =20 - object_class_property_add(c, "mimpid", "uint64", cpu_get_mimpid, - cpu_set_mimpid, NULL, NULL); - object_class_property_add(c, "marchid", "uint64", cpu_get_marchid, cpu_set_marchid, NULL, NULL); =20 --=20 2.43.0