From nobody Fri Dec 19 18:47:37 2025 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=1607978130; cv=none; d=zohomail.com; s=zohoarc; b=KwFQsLAwciWhitBUu0Y3geSHczSUwA4167bJgX/MQoObKxv9zIxz8D4dqFbiOagqAyb7YjNoWmvRUaktSl4IV9DnPG9ZLZb48pwHuh1lJloWYveo3420ySUWrJl6sIsH2UfYntRyOnPjolBS3SBxvYz7Ol9Pl623aEpsU493W1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607978130; 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=R0SuSrjhz6J3AENOi+c1OBH2FpZKJiw+QNCfQwhlO4w=; b=gwVMR6PUtZMTe3gT3FOSp+YPAlkP2nTFkq4ZbD6nS6b9wGWSv0hDQQCoxBwSMrvJxVZQnvTUfAZqDL7yKIo+fZrS7hm+IZqXmYFrNzlGE3BoQjcchOiYR5+BMtBEEJdelDRQs0htpxtkbdNdsdFCz6OldVt7YZTjdIZlOxu/HT0= 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 1607978130605572.5764356047677; Mon, 14 Dec 2020 12:35:30 -0800 (PST) Received: from localhost ([::1]:51826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kouZ7-0002Hf-Hf for importer@patchew.org; Mon, 14 Dec 2020 15:35:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouXj-0000bc-8b; Mon, 14 Dec 2020 15:34:03 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:42384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouXh-0007rn-1e; Mon, 14 Dec 2020 15:34:02 -0500 Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Dec 2020 04:34:00 +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; 14 Dec 2020 12:17:43 -0800 Received: from cnf006900.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.62.52]) by uls-op-cesaip02.wdc.com with ESMTP; 14 Dec 2020 12:33:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1607978041; x=1639514041; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r0ZfNgOdaidiF4AhAMQ3WmwibBw8fNT/SmUP4a+2+iw=; b=CfCrbyB1/2fBDLosa+YTVne14TT7e+/Y0x5PbItpdto45TrhhZXSu6BB PCbaBe9LhkrcFdhA9Xzkpu2PnrYI9hXy/uCR4PNKPBn/1mjfhJz5Cnqbv qAPilE/8DscQYDxp6ZrxDMKcJmBTjSnJEELdobOVrhRVhT1EULtKcBxMy 3yIAXOWj34Obq8nBYQ1y/lerVENFyjmH1LNK3du3YIIySQmXlI+pveL2E sVM2ddWYZuBlmRJUDVo+AHOHUVpH7nnU7oFm92BgM89uGuVHq/OTHOsvP 1UkWHqSD5avL0McPIpczimPZ3ntbw3/bEzjcIkSFZHJPJSKcvYhLN+Rdb Q==; IronPort-SDR: pMAISxWeUcGsge/Frpkq7yWwPV3MN1eCqGamG9aSwcMDzBZQKEihVw7TWwYlLU8Tt+bU5kx7ln FV+H/toJDGRgyhzNmiji0VpZ7EnMHXg6Zkp6Oza679Amen5CZedErEN7g12qaDpC51NprkJb3z fKk7gnvGbifJOXg8LSrciI3IQADucaDasyWIXpfPw8WJox/1mp1x4G92dDXKmXjf4BIVHQ5Yhy FNznkdguNiktU9gT4SUNQFROU3PsqfbrE2t0/uH3RJAJx5P/YaRhGWytjGDkJ7J9Q0Y+CNH0yv /tw= X-IronPort-AV: E=Sophos;i="5.78,420,1599494400"; d="scan'208";a="156338101" IronPort-SDR: 6n3QpVmU1JNb6e0f/kQyNo2EE6sMv7vKqAsZVr7YL02gDY7EZBt64bC+avxJBZw3HEz/mffUxS iJhzkAlx94MPBIBn/vhgi5R5wobStBm2/2t9fQqrX/jLJA9JFaAJHxAAHOMD4v8++vsQfJyxOZ ydHWCTuSN22oxhYf3CpmQmyOqg/zjA+yo5o/cmj8W2GHmmBaZeyYG24MP4jGjjA6j5efQaEes2 9c/OG9EQrBHOXjz4pqda5MrRGgm2N7W53nNnor27+2wlyllPvG6uS/OI4NOUsMdT0ea4rN00UP suY6M81Jen6h19kiLTlWZtb9 IronPort-SDR: JsXFMv4M+7Es7jWNDt6Ne2GiJ9XR8yT05itif7CojIPQER9XGijzyKU+23d7/hCVrvWXpYgNgh amBCAUCYaKoXi4/55ryArE2CRzrgCzBpgYQFCe5q0gw0SNEIgqIfXu7gVJCqbRrEKSWWHEZu97 zygbE4F8WyR504wdCP7Npz6jPhVs72uUkJ0CJKPLpZI5bnCrgsUlJfuPUrfOJraRnQlRBrZPME WPnhUMdBrppWP+8aUnZJqRJYaGm/ut5EtxVHxO+Q3wJYmBQ/rKQuM4IqozCHOcdivJlbe08NTF +UA= WDCIronportException: Internal From: Alistair Francis To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v3 01/15] hw/riscv: Expand the is 32-bit check to support more CPUs Date: Mon, 14 Dec 2020 12:33:58 -0800 Message-Id: <3b6338af937d0d3aa0858ba1a4ad0fd9e759be66.1607967113.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: 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.154.45; envelope-from=prvs=61015ee87=alistair.francis@wdc.com; helo=esa6.hgst.iphmx.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_PASS=-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com, bmeng.cn@gmail.com, palmer@dabbelt.com, alistair23@gmail.com 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" Currently the riscv_is_32_bit() function only supports the generic rv32 CPUs. Extend the function to support the SiFive and LowRISC CPUs as well. Signed-off-by: Alistair Francis --- hw/riscv/boot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c index d62f3dc758..3c70ac75d7 100644 --- a/hw/riscv/boot.c +++ b/hw/riscv/boot.c @@ -41,7 +41,17 @@ =20 bool riscv_is_32_bit(MachineState *machine) { - if (!strncmp(machine->cpu_type, "rv32", 4)) { + /* + * To determine if the CPU is 32-bit we need to check a few different = CPUs. + * + * If the CPU starts with rv32 + * If the CPU is a sifive 3 seriries CPU (E31, U34) + * If it's the Ibex CPU + */ + if (!strncmp(machine->cpu_type, "rv32", 4) || + (!strncmp(machine->cpu_type, "sifive", 6) && + machine->cpu_type[8] =3D=3D '3') || + !strncmp(machine->cpu_type, "lowrisc-ibex", 12)) { return true; } else { return false; --=20 2.29.2