From nobody Tue Nov 26 22:23:41 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=1704303739; cv=none; d=zohomail.com; s=zohoarc; b=ivrIxNasSn7Mzo4XAhpnoi8bS5zFVzsn8K9pf6NWfO3qRj0jAA0kZ+P+Nd19JKk0JoHLMKRckhySjXf7kuJ8lMGt+f0bO/Vaw/hHqQxoB1lF8M8e7xhDBcyUiyrno1fHeixRZ5rPNW0IGPe548VuBnzaUDrtuADf7M525l9/Am4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704303739; 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=NKIuukt3Nvj+XBBcPV8KJ+jhjW9YHguYxnCbdEtqjhw=; b=aNzFwSPhwAM/UghL7JN0oOYYnLGf1YngYOytrtT64sUlPzt/meBTE5vmbhIW3BUie+GYi8lBjio5eCdT4IoUxYaRV6WwtaIIPcoYWkygNSj6sgy5OyM3FZOlZ5wvpNn6ZN6jb1P6ihYHgLTaXJm2jQUi47swiX4jfqHEGUwdZNw= 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 1704303739081633.5499948894756; Wed, 3 Jan 2024 09:42:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rL5F7-0006R3-9h; Wed, 03 Jan 2024 12:41:26 -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 1rL5F2-00061D-9n for qemu-devel@nongnu.org; Wed, 03 Jan 2024 12:41:20 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rL5Ex-0001qf-Co for qemu-devel@nongnu.org; Wed, 03 Jan 2024 12:41:19 -0500 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6da202aa138so3723459b3a.2 for ; Wed, 03 Jan 2024 09:41:14 -0800 (PST) Received: from grind.. ([189.79.21.107]) by smtp.gmail.com with ESMTPSA id v3-20020aa78503000000b006d7f1ae421csm24042050pfn.145.2024.01.03.09.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 09:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1704303672; x=1704908472; 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=NKIuukt3Nvj+XBBcPV8KJ+jhjW9YHguYxnCbdEtqjhw=; b=UkDKvKgchoOrOnminPjm8GV/atK6FX6VUx76BxHsNhDCxdgAg8y+p1Gua4Lxh8gXan IisMYevXI06vQy64ecp9ywGf7fDKNvNE43T1arHM/JpqphYysbwVBN8c9nY2NZTzoIZo fG1CPTPz0YWKaX6ApMg6+ZWKz16Eit6H0sTy3arpT2eJp9w6c4XmaKOaOYxmP86yDy5c 7hiyQnPV3Csic2ctaQkdStFZSw7WasqDHNSIW6lGJy8IyPuQgeA/4wMEVSYFCtrbdU/U nBG2Fox059NKKZWsh91Z0AoxWvYOSFdgPZH87d0fSzXmuC054Ah5eiRYrDeFBA3nwg7F bZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704303672; x=1704908472; 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=NKIuukt3Nvj+XBBcPV8KJ+jhjW9YHguYxnCbdEtqjhw=; b=SdNJ/OHfQtcN0Ud5qa4mb4P5k/MlrFGnsVmoRZMB/hpk+BA9UIz5i6OEciFJJ0msqf ZiO/83aQd+0j8/XFw0HeQv25YC26/mZAIDKwkhG2ublGZlvnxsvheCYW+wU3Wt9Ez9jr LDqAqK7t1bf62rZymu+l0p1YNkK5RqD1V+BIrBGyeacL1LKjOE790y5HEOKl397mJYF4 BpZ5U4wQzQa6MnPagIu+2VNNa7hMGdxYjZXfU1+B4XlfLYmOwyzIC6hGQpm8OYl+eKjF 0XB0ziBqJ7up7WoMWKStZO7tbI/61cGET83o08AveYPuWd4dz3GaJK9j0Uud6cbgcfJt 4ZFA== X-Gm-Message-State: AOJu0YyNUhP/1z7GpW8N3NCv3vGcrVBHSKdFy1n2s8hj5Mqx2GgCDffq fWXXFmYXtaVvP9EYXcoCWbA/Tiiarv7/TI+iomvRz2V9op05uA== X-Google-Smtp-Source: AGHT+IHm6XWGTYekTiCb8O/0nso0MsdWXWwSm3L+6nA22k5Im18Y1mNrA0mxUw/sOm/WJPjSoN3enA== X-Received: by 2002:a05:6a00:1acf:b0:6d9:ab70:964c with SMTP id f15-20020a056a001acf00b006d9ab70964cmr16858233pfv.67.1704303672512; Wed, 03 Jan 2024 09:41:12 -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, vladimir.isaev@syntacore.com, Daniel Henrique Barboza Subject: [PATCH v3 15/16] target/riscv/cpu.c: move 'mimpid' to riscv_cpu_properties[] Date: Wed, 3 Jan 2024 14:40:12 -0300 Message-ID: <20240103174013.147279-16-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240103174013.147279-1-dbarboza@ventanamicro.com> References: <20240103174013.147279-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::433; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x433.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=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: 1704303739440100001 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 2fe282d0af..3ea823f5cf 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1929,6 +1929,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 @@ -1948,6 +1983,7 @@ static Property riscv_cpu_properties[] =3D { {.name =3D "cboz_blocksize", .info =3D &prop_cboz_blksize}, =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), @@ -2013,35 +2049,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) { @@ -2122,9 +2129,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