From nobody Thu Dec 18 05:04:28 2025 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1675176069; cv=none; d=zohomail.com; s=zohoarc; b=XfwZrTsF/+If8Rq0jB/T+nee8l8alyCPJkdljtPW1rjw64MpqVrXuZLr3sPVJu/peO/jft8gv2s5ifK1V0B8uAwliwHlgA8wY1faLTvAvEV0LL36GNO+EseJvW7vwqsWTyFIF1odqbAz2hkYU2jv1hPbXbfyjtOYC4T8lGZOQMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675176069; 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=/Pu4CS8ZEwxyDoWSGcKVuwnDbAFzTS1eeQ8iquNKhHg=; b=GbQCxraUCqHsDEoO4dJiGLw9DN+p0W1cST1BuVeLoVcs+6qvbeSNlgHY7KMB7j3weGzprxpncRM7hTISPKQEYYNpS8NR/abq7fQEAMrgT0BdDTmTBI6cz18u74lLsVKnau9zNu7p0zDjPwKUgnbk3Tlrh56d4HoTdr7cizUFpsg= 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+importer2=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 1675176069547954.8295429508028; Tue, 31 Jan 2023 06:41:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMqrx-0003MD-Rp; Tue, 31 Jan 2023 08:40:18 -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 1pMqrs-0003Lt-Up for qemu-devel@nongnu.org; Tue, 31 Jan 2023 08:40:12 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMqrr-0005tK-CR for qemu-devel@nongnu.org; Tue, 31 Jan 2023 08:40:12 -0500 Received: by mail-wr1-x42e.google.com with SMTP id q5so14275690wrv.0 for ; Tue, 31 Jan 2023 05:40:10 -0800 (PST) Received: from alex-rivos.ba.rivosinc.com (lfbn-lyo-1-450-160.w2-7.abo.wanadoo.fr. [2.7.42.160]) by smtp.gmail.com with ESMTPSA id m3-20020a056000180300b002755e301eeasm14834867wrh.100.2023.01.31.05.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 05:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; 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=/Pu4CS8ZEwxyDoWSGcKVuwnDbAFzTS1eeQ8iquNKhHg=; b=ORjbnK8Q11fqZXsO26ntc5ZgkDSIIwe8ZSTOFy6jVASD2/vxW+i1nUf2bO/MW5fTo+ JO/HUaBgSTYCy4NoftoQj2C8a3rjLpFu+UVjq/S6P/gMM0AJROwewwJcbguB1wuufJVo KsueWgMjv8ihRupFtln5VKuOTE2V4z3DroVGSmAUslFznaJSysF6E3rDKdv/koDwk2py GPJ0hxe7Bc5mBvqkfW8lHpUBXIEBQJMP6IBCwmECXKoFTV8GxY4txo1BH6us/9f7ynEN e5HDbSqKDrvXEz+A4818Sh95wGkcXR9DisksV2jn1QyIVYRL/41zsFiffQyunezRv7ff vuSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=/Pu4CS8ZEwxyDoWSGcKVuwnDbAFzTS1eeQ8iquNKhHg=; b=5nKEoeeMFehcBZTyA66JX/6J/+jnF3SNgort33+UesPLtvI/h5O8B551/MqsyvZQ2Y UCHh6gn8+1zm86EBtZpLeBa9VJPEdkfCYbLA+M+V5SfOcJAIoczgUlqor/CgLpQ7hrPu y0iGnbH6dFZkWy2xkH/n240jfX956d45pMfyoqoMTBdlV306ubDYUJFkBsw9Kk9wdPch 1cffANGMgqhCq/t8Kh/5S1QDrox1bVzdLv62/5jL6SJW8wLAvKxpycFfVxXZquuC5miu UEbbqECbNWOiea5T8tJzg9cI9Qh2WQ8TFXKnuJJAil9Qvr0eTmMAuvYkgDozhv0f3BuO qBGA== X-Gm-Message-State: AO0yUKUfu08R0IDgkOXpA8Q8s/0z1jH/+H0g3z6j0q2sJTvXHYd4rPok mmJrupy90KITNc41fiKHspw0tA== X-Google-Smtp-Source: AK7set8BugGWSzpcXOF+U8ElZCVmwXxjqW+AUtbFzv/fvfmkxunl6Mx9kBB42SJN7PEw1mabD7MN+Q== X-Received: by 2002:adf:f041:0:b0:2bf:e45d:8e06 with SMTP id t1-20020adff041000000b002bfe45d8e06mr7616475wro.70.1675172409770; Tue, 31 Jan 2023 05:40:09 -0800 (PST) From: Alexandre Ghiti To: Palmer Dabbelt , Alistair Francis , Bin Meng , Andrew Jones , Frank Chang , qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: Alexandre Ghiti , Bin Meng Subject: [PATCH v9 1/5] riscv: Pass Object to register_cpu_props instead of DeviceState Date: Tue, 31 Jan 2023 14:39:02 +0100 Message-Id: <20230131133906.1956228-2-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230131133906.1956228-1-alexghiti@rivosinc.com> References: <20230131133906.1956228-1-alexghiti@rivosinc.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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alexghiti@rivosinc.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1675176071564100001 Content-Type: text/plain; charset="utf-8" One can extract the DeviceState pointer from the Object pointer, so pass the Object for future commits to access other fields of Object. No functional changes intended. Signed-off-by: Alexandre Ghiti Reviewed-by: Alistair Francis Reviewed-by: Frank Chang Reviewed-by: Andrew Jones Reviewed-by: Bin Meng --- target/riscv/cpu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index cc75ca7667..7181b34f86 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -200,7 +200,7 @@ static const char * const riscv_intr_names[] =3D { "reserved" }; =20 -static void register_cpu_props(DeviceState *dev); +static void register_cpu_props(Object *obj); =20 const char *riscv_cpu_get_trap_name(target_ulong cause, bool async) { @@ -238,7 +238,7 @@ static void riscv_any_cpu_init(Object *obj) set_misa(env, MXL_RV64, RVI | RVM | RVA | RVF | RVD | RVC | RVU); #endif set_priv_version(env, PRIV_VERSION_1_12_0); - register_cpu_props(DEVICE(obj)); + register_cpu_props(obj); } =20 #if defined(TARGET_RISCV64) @@ -247,7 +247,7 @@ static void rv64_base_cpu_init(Object *obj) CPURISCVState *env =3D &RISCV_CPU(obj)->env; /* We set this in the realise function */ set_misa(env, MXL_RV64, 0); - register_cpu_props(DEVICE(obj)); + register_cpu_props(obj); /* Set latest version of privileged specification */ set_priv_version(env, PRIV_VERSION_1_12_0); } @@ -280,7 +280,7 @@ static void rv128_base_cpu_init(Object *obj) CPURISCVState *env =3D &RISCV_CPU(obj)->env; /* We set this in the realise function */ set_misa(env, MXL_RV128, 0); - register_cpu_props(DEVICE(obj)); + register_cpu_props(obj); /* Set latest version of privileged specification */ set_priv_version(env, PRIV_VERSION_1_12_0); } @@ -290,7 +290,7 @@ static void rv32_base_cpu_init(Object *obj) CPURISCVState *env =3D &RISCV_CPU(obj)->env; /* We set this in the realise function */ set_misa(env, MXL_RV32, 0); - register_cpu_props(DEVICE(obj)); + register_cpu_props(obj); /* Set latest version of privileged specification */ set_priv_version(env, PRIV_VERSION_1_12_0); } @@ -343,7 +343,7 @@ static void riscv_host_cpu_init(Object *obj) #elif defined(TARGET_RISCV64) set_misa(env, MXL_RV64, 0); #endif - register_cpu_props(DEVICE(obj)); + register_cpu_props(obj); } #endif =20 @@ -1083,9 +1083,10 @@ static Property riscv_cpu_extensions[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 -static void register_cpu_props(DeviceState *dev) +static void register_cpu_props(Object *obj) { Property *prop; + DeviceState *dev =3D DEVICE(obj); =20 for (prop =3D riscv_cpu_extensions; prop && prop->name; prop++) { qdev_property_add_static(dev, prop); --=20 2.37.2