From nobody Tue Feb 10 10:22:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; 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; dmarc=fail(p=none dis=none) header.from=wdc.com ARC-Seal: i=1; a=rsa-sha256; t=1592586608; cv=none; d=zohomail.com; s=zohoarc; b=Umjut5HG4XbzOY6WoOeUAtpEx5nafU4MQoVUKABz0GSlo2VmLg8wK1fIgLaBXCTwMYRoJN/2HLXUUnHmnGL7bFxawwpHR2drEo9Zfhfar5p/wmJphfwfTdhOcav3yw7FdZnNdwHH53lDhHqPsCOWCeke0gY4ZgDyFcSgzuB7y0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592586608; 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=a/lYPit/g39BaAdPfj3JKVgEM7xpI3EeRFuRaLW2rJ0=; b=IHqrdlaVodBvI4niq+GAoSntviFyueviXykKhp8bkSIca8PRz5pHZ0hBAlhap53fHX5F++gl702JEXwInDSCesJD4lCzkwIXhsFHtvLhRBfXQt0gFvJTDK0qWqxCE7KkP+Twgr87UBJyeNTgiZ6ei1mYS6TuCr8lr+sIGKRmbVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@wdc.com; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592586608075932.8294984852271; Fri, 19 Jun 2020 10:10:08 -0700 (PDT) Received: from localhost ([::1]:37722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmKWk-0005Vw-P6 for importer@patchew.org; Fri, 19 Jun 2020 13:10:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmKUD-0000fi-E2 for qemu-devel@nongnu.org; Fri, 19 Jun 2020 13:07:29 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:19125) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmKUB-0004PR-9q for qemu-devel@nongnu.org; Fri, 19 Jun 2020 13:07:29 -0400 Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Jun 2020 01:07:21 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2020 09:55:59 -0700 Received: from unknown (HELO risc6-mainframe.hgst.com) ([10.86.58.142]) by uls-op-cesaip02.wdc.com with ESMTP; 19 Jun 2020 10:07:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1592586447; x=1624122447; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VU9o6OYV0MkgJqJ+P7yL/zRcCvBETb4yUFY3HT80i6k=; b=EX1S/uCarhHy1ygo45RbSwBiIAAy4qSdQm4kLQ8WjTZtlsfZHHc2gqOp 3EAzZHuDxBALQ6YUU7+8TaiYXRaCmkHvswSM3ix+OTxpP41oGpOaX3DYq S6ZndqO2nS9sVKaEqppxaDOdzo75FXGd4IXEh/i1ZnMmBfD+LN+gl3lvv Eqt6JWzMj4DpbKEQsLC8pm/0vl+m+Fz3TLlqRWI/EoU4y96PbYLUC1FK8 TzJ20nUg8DqPPd74uHs43vdzSFIPxlcGzKz4jTmV4nEUPUqeU2g51+BYZ Zosr6tntqIiRcY5fzCNWLhQCDRfOT6l9ZPAAKJ1hvlOu8JWJ2yXetVUVF Q==; IronPort-SDR: l71BXK/rnGw/I1KLwHcNG78hP3tlUE3Q+mNTFcBbRFNai6aK8LUAnYltQZKOXunD2fMG+YLZwD 5ETIpKqozFYcnlGmuuXTxfFkQX5xpWuw5B0Upi6qfKmjv0p+D40YkBw8W/ffvclZY/bpeYNfGK SUxBoPaUSaSyjNI4XFjUNOLcwfuR6uDWBCBti0yqVhzsJmkEXN+smsXWsjsSswXJSSbipCwep5 A8TzZTWpNuXPL2MMtw1OjlZ2TUE4EoMn9NuRgTFbxrr9CtTO/nXUJN9X5AiIheWL5tMVLOh5l5 eOA= X-IronPort-AV: E=Sophos;i="5.75,256,1589212800"; d="scan'208";a="144763304" IronPort-SDR: CamgmRcIaeXfCpsTwDgWSyXeuDoJBVRpUQ99uBm0btUq//37G8cRNxO31ugBeJ0+762U4kYHXL Me7OnNxG12Sh/Jwov3Vg/5/lk4ULgk0ls= IronPort-SDR: NslU3WMGBYWaUDXrA6sWAmVPA8sz07BriKgxT+snsoYTvZrWMupanquYGHt5+Z3+Z5JDa3oXWY pZ6AawrhIA4A== WDCIronportException: Internal From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL v2 03/32] riscv: Generalize CPU init routine for the base CPU Date: Fri, 19 Jun 2020 09:57:48 -0700 Message-Id: <20200619165817.4144200-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619165817.4144200-1-alistair.francis@wdc.com> References: <20200619165817.4144200-1-alistair.francis@wdc.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=216.71.153.141; envelope-from=prvs=4324eb4de=alistair.francis@wdc.com; helo=esa3.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/19 13:07:21 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Bin Meng There is no need to have two functions that have exactly the same codes for 32-bit and 64-bit base CPUs. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-id: 1591837729-27486-1-git-send-email-bmeng.cn@gmail.com Message-Id: <1591837729-27486-1-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Alistair Francis --- target/riscv/cpu.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3a6d202d03..81cdea8680 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -126,9 +126,7 @@ static void riscv_any_cpu_init(Object *obj) set_resetvec(env, DEFAULT_RSTVEC); } =20 -#if defined(TARGET_RISCV32) - -static void riscv_base32_cpu_init(Object *obj) +static void riscv_base_cpu_init(Object *obj) { CPURISCVState *env =3D &RISCV_CPU(obj)->env; /* We set this in the realise function */ @@ -136,6 +134,8 @@ static void riscv_base32_cpu_init(Object *obj) set_resetvec(env, DEFAULT_RSTVEC); } =20 +#if defined(TARGET_RISCV32) + static void rv32gcsu_priv1_10_0_cpu_init(Object *obj) { CPURISCVState *env =3D &RISCV_CPU(obj)->env; @@ -173,14 +173,6 @@ static void rv32imafcu_nommu_cpu_init(Object *obj) =20 #elif defined(TARGET_RISCV64) =20 -static void riscv_base64_cpu_init(Object *obj) -{ - CPURISCVState *env =3D &RISCV_CPU(obj)->env; - /* We set this in the realise function */ - set_misa(env, 0); - set_resetvec(env, DEFAULT_RSTVEC); -} - static void rv64gcsu_priv1_10_0_cpu_init(Object *obj) { CPURISCVState *env =3D &RISCV_CPU(obj)->env; @@ -603,13 +595,13 @@ static const TypeInfo riscv_cpu_type_infos[] =3D { }, DEFINE_CPU(TYPE_RISCV_CPU_ANY, riscv_any_cpu_init), #if defined(TARGET_RISCV32) - DEFINE_CPU(TYPE_RISCV_CPU_BASE32, riscv_base32_cpu_init), + DEFINE_CPU(TYPE_RISCV_CPU_BASE32, riscv_base_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_IBEX, rv32imcu_nommu_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E31, rv32imacu_nommu_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E34, rv32imafcu_nommu_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U34, rv32gcsu_priv1_10_0_cpu_in= it), #elif defined(TARGET_RISCV64) - DEFINE_CPU(TYPE_RISCV_CPU_BASE64, riscv_base64_cpu_init), + DEFINE_CPU(TYPE_RISCV_CPU_BASE64, riscv_base_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E51, rv64imacu_nommu_cpu_init), DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U54, rv64gcsu_priv1_10_0_cpu_in= it), #endif --=20 2.27.0