From patchwork Tue Jan 14 13:20:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13938768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49E3FC02183 for ; Tue, 14 Jan 2025 13:22:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXgqR-0008Ms-Vh; Tue, 14 Jan 2025 08:20:36 -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 1tXgqJ-0008Kx-Q3 for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:31 -0500 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXgqI-0003rZ-6S for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:27 -0500 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-2a9ef75a20dso2686958fac.2 for ; Tue, 14 Jan 2025 05:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736860824; x=1737465624; 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=iZO0MHW2C4CbxTJs7lkrSc3hq/cnXciHDtgsOH5i4QM=; b=X0bcaQa8cqYIQ7D2W4FsyhneUk2UGFCzw1HZjl5g17gE0sRsiYmYglV2X79Doi777T tZ3GkLeeijUZsCU5hBjLfu54l4u7mSmmmMmyIbl2dTWQXUXc40fTQB1ZLbjDFGsxFMHL VsVhMu4yemdXF7N17OAvnwOmM5cqhs1gbvnjrKH2Tgu4kIIcSPd4DVCgpinWlVHa7/NP rVSrmHzYDiiVdKwN17xM8M3ADyb4MDlY9NP4E/jruwQBe0IXa9VPvG9GPqfMBl1lTh5F 9C9veu4vkUP0EyPrdZqTRtpPzD0pH92ew4qyNzwyEEn7Ag1wIhz9/LDjUhWaIXYiDtTU qTww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736860824; x=1737465624; 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=iZO0MHW2C4CbxTJs7lkrSc3hq/cnXciHDtgsOH5i4QM=; b=bYXAH6xqOPAr55IDgdrKJkmVqqljvbrm8hjt/cerWifnSYsl1yrdl+1loxA8mV2Iie qz4qzcsBr/G3lcJnS2Ewbb+AzduqpN0HK0i2+QPdiJ6MJdJB5yz1x30kJvkHipkUuKGT 8nkB4wzmSvvb1lCLQ3+grXBfZFfYM17vPqVj3baIrdoIPZI7q2NBiZONb7wP6OAujQ/M gUWrE2du89gu9yQ1SvAccvOK0JeN4NMGpfh6lzFvWdJV2U3QBAjNmS7vHmmI/+D+pdu/ LNbTpADVwoMa1IxbpgZZrnk7PWnbMNm9z/rbIIO1D8wNrYdI63STXkDlLZk7EYGVuYkG fy4A== X-Gm-Message-State: AOJu0Yw6rcaj0kW4H0K+lUqEecq3/JQ6z6VTrz6sqqQtFdLB8+aTrBAH uZQ8GDxPdsovr6MmRZg9So0kbuFMLEpJDBoZBqwREm9jaBFf4hTDFD5vgMAOJRCPn0GsXrIrva5 5P8c= X-Gm-Gg: ASbGncvUCM/5AW4iVso6EJ8I2djOx9Nm80zRf0RLu7Y+rr39Z8Et7qGgFGU7iymosM7 AZP3bqv7wcmGe68VQmi5WgtAXfCs34imcLC1os0C4P/Y7m8zJVzu7+9bRED/8zQaC8ZyssnY7OD 4eRAQ/dbViDOnZWd4eIpxDIcroCPnCsFP2PE+zyYK1m9Hr5y6u29jQQBZiD4vlE9NV6dhLGLP0b lvxR3673jAzVTaAtH++/Zjr42/EdTBH+pGH53SS7HIPwzgSO7kFIdCegGDDVNtXOzj/OJE6k62D wMF2YmGIIA== X-Google-Smtp-Source: AGHT+IED0BDUA1OTbVWTRlcscr5NVh0ehFhUWzXKwNxsm0ViE5yWeuNKTRYy/okFSRfEhn0UpFZqSw== X-Received: by 2002:a05:6870:ce91:b0:29e:19ee:4832 with SMTP id 586e51a60fabf-2aa066fbbeamr12964334fac.18.1736860823916; Tue, 14 Jan 2025 05:20:23 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2ad809b10e4sm5052411fac.35.2025.01.14.05.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 05:20:22 -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, Daniel Henrique Barboza Subject: [PATCH 1/4] target/riscv: add ssu64xl Date: Tue, 14 Jan 2025 10:20:09 -0300 Message-ID: <20250114132012.1224941-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114132012.1224941-1-dbarboza@ventanamicro.com> References: <20250114132012.1224941-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x29.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org ssu64xl is defined in RVA22 as: "sstatus.UXL must be capable of holding the value 2 (i.e., UXLEN=64 must be supported)." This is always true in TCG and it's mandatory for RVA23, so claim support for it. Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 1 + tests/data/acpi/riscv64/virt/RHCT | Bin 390 -> 398 bytes 2 files changed, 1 insertion(+) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index 695022d56c4ac16607d4c622955ad339fbbfe997..b14ec15e553200760a63aad65586913d31ea2edc 100644 GIT binary patch delta 48 zcmZo;?qlW(@^B96V`N}pOqj@Jz^cQ@$e^;(o|BQSxYW#~B4@H2qXkC_BLhPoBLf2f D`wIz- delta 41 wcmeBUZe!*O@^B7mV`N}poG_8gfK`Q&kwIpoJtyPj07f&87)Az$G)4vn0JA^`U;qFB diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3d4bd157d2..b187ef2e4b 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -213,6 +213,7 @@ const RISCVIsaExtData isa_edata_arr[] = { ISA_EXT_DATA_ENTRY(sstc, PRIV_VERSION_1_12_0, ext_sstc), ISA_EXT_DATA_ENTRY(sstvala, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(sstvecd, PRIV_VERSION_1_12_0, has_priv_1_12), + ISA_EXT_DATA_ENTRY(ssu64xl, PRIV_VERSION_1_12_0, has_priv_1_12), ISA_EXT_DATA_ENTRY(supm, PRIV_VERSION_1_13_0, ext_supm), ISA_EXT_DATA_ENTRY(svade, PRIV_VERSION_1_11_0, ext_svade), ISA_EXT_DATA_ENTRY(svadu, PRIV_VERSION_1_12_0, ext_svadu), From patchwork Tue Jan 14 13:20:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13938765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDE73C02183 for ; Tue, 14 Jan 2025 13:21:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXgqV-0008O8-RB; Tue, 14 Jan 2025 08:20:40 -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 1tXgqO-0008Lm-5Y for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:33 -0500 Received: from mail-oi1-x242.google.com ([2607:f8b0:4864:20::242]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXgqL-0003su-4K for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:31 -0500 Received: by mail-oi1-x242.google.com with SMTP id 5614622812f47-3eb3c143727so3304474b6e.1 for ; Tue, 14 Jan 2025 05:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736860827; x=1737465627; 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=mynXJ5IrYfy9NgRkzBtm75h5rsWmg3+Z5xI7zKtSYPg=; b=XYS3pxSLcFseftCX2414RH5AxXyUoLLBHSUXqszaw4rh9Yc+CkUUoIwJJe9596eEKV Yerf1I16ifQHz6AlK7zzOT5JtE3+/wqs4x7Ta2i4SRMilA32avvsQrwdwzJkvj8KblYx kgZJf0Jt2/dlfzrOax8gREUNH3tJEXxQ2wbvhUirPKjM6r0hDmQ+TGdJX760wsG5oHLZ FYYcQsok5PWVfvvyD3RYVfDjRunYknIbGFa06YLDANfBU6zUbmpE48Sy9adMaAs8nKnd BApMcLR9PA7nzZjyzKuObU9bWkAJTWUzG2WunBlal6Vz+fy40fuF0f8EoWCspnvsCJsE cEBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736860827; x=1737465627; 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=mynXJ5IrYfy9NgRkzBtm75h5rsWmg3+Z5xI7zKtSYPg=; b=ajagVuK+ZK29hJ4krHdzucAYypR8XcoF+yN0o8dizixwDTSpVNzFhVIctM0D2BoKp8 eURWLUPoZjRavosyR5/q+gRknOGc5n4S93lwN5yIG/mk2zlekm2hLwaxd57r/5lFzAdK lKMnaAAi+EuA97qU4q+Jpm7tsMHZ0RKn6BvQZD8pVMXdiUQOV5R79jZcdHwi601IbXkd JPMfdDCteMrSLr5J8SLPv4iaOkWNML6w0jmZl/HmRPY2cNv/zgmGx7N6W/FoY/NSuJVK unZpiV8UnDHvpF2BTzCLFtoqMZXjTS0RGcoKjsefzZhE0BcvCnvv4xg0QJnKt9kXD2Pt SAgQ== X-Gm-Message-State: AOJu0YwepQy61TGh6RlhS7E9Fl3hCb0Kn5ywbrOiUJxAsGzlqYq9suvr +948q8qbmAQwgE71VNgPNHkGknxUkChCFl4e4u391fbayMFNB/+xkaiPaWJKtcL7DkcBxrwQ8Ds UKWCKtw== X-Gm-Gg: ASbGncthvmw2P4lrQailxdLaqkKMIeenE1wn+Ar2O90WrH7ywj4Q5Z4cveacPsGGR9v nZy9RpSxT0nGDRQgzRMXtV5URK5k4VyK1W2IMKw+rOQly6j0FUHwjFp43kd15yTkZEAEv6Ghnj3 Dv4obQDlNiQyt0fPsTZzn26MkJEccDgZNRTMuLJtF75FF8Mwn2d9gcCKj7fNpEibld68qrt/9J0 RxDiCABYH1EY2ujPCvueD3lCBVZ42VtzXOrY+ZAK3b0tZxc1R0b2jRqR9fgATo5VdU89lsDdTCp gFNLGx8F3A== X-Google-Smtp-Source: AGHT+IH9GEM07NrUQO5QW5qlgUiKy6kyt5794f3uDyRbSk64cnDkglA67Jp3+mM8ve9rPbmMjj9c3Q== X-Received: by 2002:a05:6871:4f0e:b0:2ab:99ac:250e with SMTP id 586e51a60fabf-2ab99ac2699mr9656070fac.11.1736860827334; Tue, 14 Jan 2025 05:20:27 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2ad809b10e4sm5052411fac.35.2025.01.14.05.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 05:20:26 -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, Daniel Henrique Barboza Subject: [PATCH 2/4] target/riscv: use RVB in RVA22U64 Date: Tue, 14 Jan 2025 10:20:10 -0300 Message-ID: <20250114132012.1224941-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114132012.1224941-1-dbarboza@ventanamicro.com> References: <20250114132012.1224941-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::242; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x242.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From the time we added RVA22U64 until now the spec didn't declare 'RVB' as a dependency, using zba/zbb/zbs instead. Since then the RVA22 spec [1] added the following in the 'RVA22U64 Mandatory Extensions' section: "B Bit-manipulation instructions Note: The B extension comprises the Zba, Zbb, and Zbs extensions. At the time of RVA22U64's ratification, the B extension had not yet been defined, and so RVA22U64 explicitly mandated Zba, Zbb, and Zbs instead. Mandating B is equivalent." It is also equivalent to QEMU (see riscv_cpu_validate_b() in target/riscv/tcg/tcg-cpu.c). Finally, RVA23U64 [2] directly mentions RVB as a mandatory extension, not citing zba/zbb/zbs. To make it clear that RVA23U64 will extend RVA22U64 (i.e. RVA22 is a parent of RVA23), use RVB in RVA22U64 as well. As a bonus we can also exclude zba/zbb/zbs from 'ext_offsets' and make it a bit shorter. (bios-tables-test change: zba/zbb/zbs no longer on riscv,isa) [1] https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc#61-rva22u64-profile [2] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc#rva23u64-profile Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 5 ++--- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/data/acpi/riscv64/virt/RHCT b/tests/data/acpi/riscv64/virt/RHCT index b14ec15e553200760a63aad65586913d31ea2edc..13c8025b868051485be5ba62974a22971a07bc6a 100644 GIT binary patch delta 53 zcmeBUp1{l%JqB1j+%-qDZl;ot1UQ&#clNpsc(ij;S I3K$s}0ARKZK>z>% delta 52 zcmbQh+{ern6Im@tvcKtP9)kwJyAsLaeHGdD3UC3&N_6yxMHMkS6EMh1pF HMg|4|IwT82 diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index b187ef2e4b..8d0563527f 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2351,13 +2351,12 @@ static const PropertyInfo prop_marchid = { static RISCVCPUProfile RVA22U64 = { .parent = NULL, .name = "rva22u64", - .misa_ext = RVI | RVM | RVA | RVF | RVD | RVC | RVU, + .misa_ext = RVI | RVM | RVA | RVF | RVD | RVC | RVB | RVU, .priv_spec = RISCV_PROFILE_ATTR_UNUSED, .satp_mode = RISCV_PROFILE_ATTR_UNUSED, .ext_offsets = { CPU_CFG_OFFSET(ext_zicsr), CPU_CFG_OFFSET(ext_zihintpause), - CPU_CFG_OFFSET(ext_zba), CPU_CFG_OFFSET(ext_zbb), - CPU_CFG_OFFSET(ext_zbs), CPU_CFG_OFFSET(ext_zfhmin), + CPU_CFG_OFFSET(ext_zfhmin), CPU_CFG_OFFSET(ext_zkt), CPU_CFG_OFFSET(ext_zicntr), CPU_CFG_OFFSET(ext_zihpm), CPU_CFG_OFFSET(ext_zicbom), CPU_CFG_OFFSET(ext_zicbop), CPU_CFG_OFFSET(ext_zicboz), From patchwork Tue Jan 14 13:20:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13938767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA59EE77188 for ; Tue, 14 Jan 2025 13:21:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXgqT-0008N2-8i; Tue, 14 Jan 2025 08:20:37 -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 1tXgqR-0008Mr-RN for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:35 -0500 Received: from mail-oa1-x42.google.com ([2001:4860:4864:20::42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXgqQ-0003uR-3T for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:35 -0500 Received: by mail-oa1-x42.google.com with SMTP id 586e51a60fabf-29fad34bb62so2938753fac.1 for ; Tue, 14 Jan 2025 05:20:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736860831; x=1737465631; 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=abnY8U3wK6nUZ8NcZvVZddJMO8Mh8IA8tUD5yUUM9ig=; b=XuKg/SUnDeidGAHAqz19OJP3PUQthMdlPxwrjCOX44xLGclD3t/F6bhOGpf1TKwjuW K+vSyjeYmEb4YcnRR0DmF1pDJaHC/Hp7Y5IQNdj7uiTYz7FVpYsN3KbGpAxog66PkV9u FC/p5TcXzdGKygFCRfDJ52DjPEOYnZ/Hf2eqY0TQWR0r5YUXjhHLQg8Cjy0iClZFj4mR IjLD4WsCDlyDepVobydY6bCf+xDe8Il1S0uRnejc8warYLTuhWeSVoE3Z1YK8IVk9Bpy qlMiPgRyf4/LRNbUWcwrHxHW0na48Y3IMlWw7BJxWSMI26w/BU1MkfvMtfzfvfzh5mqE R4kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736860831; x=1737465631; 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=abnY8U3wK6nUZ8NcZvVZddJMO8Mh8IA8tUD5yUUM9ig=; b=IvkKB34+rkNVFrFoq5acp4LkZ36l8nRsmRBZjPUwGwFu1mcFJDjNTFaoFCpr6Kd5b4 KuPoQM3Bza9sqfHTFkxsmE1Ih2bA+bTjG3FpIb29IVKphi21tdcIqgGoRTIj4is1al4d Cn0F0VhLVz6q4FLcYmaM27n98RYYQVc1caK4DwN4ngqKyzgyljpqMOTHaLmYNtQ6I1eq t6h7tqUtb3jZrWm1IXubmsZVQWkDuTteYWlkZzjRE1xHrmG5I8T2MjZA1VPMHCOmcwPQ Jd0U5+k9C06JIbV3OtmZj5om0dxQ8wjeXGoTU5wppNx86WMaInTuHaJGL2LGYY/ha+kx iLMg== X-Gm-Message-State: AOJu0YwvMYIi31ADdwl5BLf7/nOXVxcOsZP7pqogTgWGGS42HtRB07jl OEDN1tHjjjhSrxQYcjPa1/ismQ5cX9Skyc6wh3v6ck24e1vx7SLf76MCzNmeG0LR9Tk2bYoXYNu 1jhVLRQ== X-Gm-Gg: ASbGncvnRfOE42wQPzGGIeeM6cnAaZMjO64lpwIG+rvNKTRIJ3zBMfPe114lFaI78/s UykJGX7EFwOAe3UUZxfnNXZU3ZVIbZJKfQIoTt74XByz86w9xr0vXpCeelxCDSsKFMcLO3kfNsE FFadqXm4bFyBPBpP991SDde2gKp6OiEd1O1qHJKnWJjupDmJXFW+3xZZS9HsMN7cLUBQPgqpiGW 9wdg7N28DYzeHHhWOF1tCOn7bCmrdDkyhtMpJgtqO+K9MlJfGtH4uO3iNpFeyQWnO/2GoBOS17o pnd/lOOCzQ== X-Google-Smtp-Source: AGHT+IF1FkJz4nkwEkYMR1eM/GccftNxCVP+lemCrr5mmwmA/3sB/VweWAQ7w+V17wqflDzRf2z6iw== X-Received: by 2002:a05:6870:6f14:b0:29e:5897:e9ed with SMTP id 586e51a60fabf-2aa06982ebcmr16110105fac.35.1736860831086; Tue, 14 Jan 2025 05:20:31 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2ad809b10e4sm5052411fac.35.2025.01.14.05.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 05:20:29 -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, Daniel Henrique Barboza Subject: [PATCH 3/4] target/riscv: add RVA23U64 profile Date: Tue, 14 Jan 2025 10:20:11 -0300 Message-ID: <20250114132012.1224941-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114132012.1224941-1-dbarboza@ventanamicro.com> References: <20250114132012.1224941-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::42; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x42.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add RVA23U64 as described in [1]. This profile does not share all mandatory RVA22U64 extensions so we can't use RVA22U64 as a parent. We need to declare all mandatory extensions from scratch. A new "rva23u64" CPU is also added. [1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index d56b067bf2..53ead481a9 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -40,6 +40,7 @@ #define TYPE_RISCV_CPU_RV64E RISCV_CPU_TYPE_NAME("rv64e") #define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64") #define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") +#define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") #define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex") #define TYPE_RISCV_CPU_SHAKTI_C RISCV_CPU_TYPE_NAME("shakti-c") #define TYPE_RISCV_CPU_SIFIVE_E31 RISCV_CPU_TYPE_NAME("sifive-e31") diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 8d0563527f..e10ecc4ece 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2394,9 +2394,35 @@ static RISCVCPUProfile RVA22S64 = { } }; +/* + * All mandatory extensions from RVA22U64 are present + * in RVA23U64 so set RVA22 as a parent. We need to + * declare just the newly added mandatory extensions. + */ +static RISCVCPUProfile RVA23U64 = { + .parent = &RVA22U64, + .name = "rva23u64", + .misa_ext = RVV, + .priv_spec = RISCV_PROFILE_ATTR_UNUSED, + .satp_mode = RISCV_PROFILE_ATTR_UNUSED, + .ext_offsets = { + CPU_CFG_OFFSET(ext_zvfhmin), CPU_CFG_OFFSET(ext_zvbb), + CPU_CFG_OFFSET(ext_zvkt), CPU_CFG_OFFSET(ext_zihintntl), + CPU_CFG_OFFSET(ext_zicond), CPU_CFG_OFFSET(ext_zimop), + CPU_CFG_OFFSET(ext_zcmop), CPU_CFG_OFFSET(ext_zcb), + CPU_CFG_OFFSET(ext_zfa), CPU_CFG_OFFSET(ext_zawrs), + + /* mandatory named features for this profile */ + CPU_CFG_OFFSET(ext_supm), + + RISCV_PROFILE_EXT_LIST_END + } +}; + RISCVCPUProfile *riscv_profiles[] = { &RVA22U64, &RVA22S64, + &RVA23U64, NULL, }; @@ -2883,6 +2909,13 @@ static void rva22s64_profile_cpu_init(Object *obj) RVA22S64.enabled = true; } + +static void rva23u64_profile_cpu_init(Object *obj) +{ + rv64i_bare_cpu_init(obj); + + RVA23U64.enabled = true; +} #endif static const gchar *riscv_gdb_arch_name(CPUState *cs) @@ -3162,6 +3195,7 @@ static const TypeInfo riscv_cpu_type_infos[] = { DEFINE_BARE_CPU(TYPE_RISCV_CPU_RV64E, MXL_RV64, rv64e_bare_cpu_init), DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22U64, MXL_RV64, rva22u64_profile_cpu_init), DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22S64, MXL_RV64, rva22s64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23U64, MXL_RV64, rva23u64_profile_cpu_init), #endif /* TARGET_RISCV64 */ }; From patchwork Tue Jan 14 13:20:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13938766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64383C02183 for ; Tue, 14 Jan 2025 13:21:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXgqY-0008PN-PQ; Tue, 14 Jan 2025 08:20:42 -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 1tXgqX-0008Oy-C5 for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:41 -0500 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXgqV-0003w9-8I for qemu-devel@nongnu.org; Tue, 14 Jan 2025 08:20:40 -0500 Received: by mail-oi1-x244.google.com with SMTP id 5614622812f47-3ebbec36900so2868848b6e.1 for ; Tue, 14 Jan 2025 05:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736860836; x=1737465636; 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=aTyPIerGUIEfsS1Bk4TYFsywTIjidQ+fbn9jtfE2APQ=; b=I6LdVTGCtkg7MpfvXu9K2E2TD5N9FTlAoqxbGS+RnVo6m8p24KF/AOC/3bEcAlVm7O ek1Njo1KGkW/g/0MEPF2JjokQzGA158LuRU80MgSSe9YjTQdvbS2Ihszzhx5XYPxNM/B LqpEFPJVOxgLg6tkSLyl91ui0I0ueIaCh9GHgTPPshlkMGtIHFIh1QvYmjQZLCLWNrTT VpWP42PdsNlw41AGIF81Dl3p9Qx1DdnoKJ+cVrls5QsAfTtsGqd6ANxReyaTsAbZFR8I BRjrC+Amz6/FZQ6NhQrI5O+j1PtsomIq/ak1AogXax41CCkn/xeaWO/Ga51MRdybYcHs vXig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736860836; x=1737465636; 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=aTyPIerGUIEfsS1Bk4TYFsywTIjidQ+fbn9jtfE2APQ=; b=mWOyuyGo1eVXE8jbumbw4zNBN7YKq8gRNtaTmXLYKJcgDGms1JAF1OTbYNYGmspyvV 34yyySym+5Z4vT/U4pMjePtb91th7e0RL3qNAtBNdthU6Hu5KyewP0oGkxQXFmgprufJ +KOSGEQl/69uyW1tcGSoIwjOnSIHTnLmb/dHmjvP+P1LtBdRIdhoXySlyDuP8jT5y9rb c82TwugSpMqJJ+Svpbh4oKlLSteGma/41yxDizyh4quYOUnspU6RAU/kOLkx1dvPsKIa EkiIZ41ElYW/fR42uNTx65EabCU0IZo1d9bNPaR1adpW4Qml6Lkxzk5hz8RiTcMWOQOK z4HQ== X-Gm-Message-State: AOJu0Yyf3hmBUigS0muhQWhMC5hyTHdzuJnRg3+90cSxzbWTx1vN7t2x lmKoo1bXMrpi8FNsckcFcbpVBSaOaHfJCycltjPlH1/UjWXHZwOGhu96CZJuD8XClfCEKTkoXmd dqxKl4A== X-Gm-Gg: ASbGncsMTaKJ336z1+29G/gnNPMP8GGAHzRRGLGJfz0GJyholmwDuR44b+L4f72J4w8 BWY5dJ5rjQoI8kpMSkS1HrjCTL97q3eJ2l68NSBi02acpRwPr3NAHcU3kdV6UeuTGnMai0/cWPu +GSqYu4Sno72izBJ9tHG5nd81wvPc46Bgu5AG7DBSxL31AVPzRmbfvvX8QQkIdqvgm+NBZv+eIK 0ikJzC5a+nKBerRki90PCxGd/Gmk75PHnrsX01/Zr1WM6rqZ+oNhb8RZv7h8eAaeEs2+wfzOEVA ThbrPhRdgQ== X-Google-Smtp-Source: AGHT+IED66TTs3EzlGgM4Xe2jAN5WtfwfiZxkyUanhRxparGyiqo1UD0l7+4ag4pbaKRPwdpyjnIsQ== X-Received: by 2002:a05:6870:718d:b0:29e:8068:e089 with SMTP id 586e51a60fabf-2aa0670be27mr15035250fac.19.1736860835153; Tue, 14 Jan 2025 05:20:35 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2ad809b10e4sm5052411fac.35.2025.01.14.05.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 05:20:33 -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, Daniel Henrique Barboza Subject: [PATCH 4/4] target/riscv: add RVA23S64 profile Date: Tue, 14 Jan 2025 10:20:12 -0300 Message-ID: <20250114132012.1224941-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114132012.1224941-1-dbarboza@ventanamicro.com> References: <20250114132012.1224941-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::244; envelope-from=dbarboza@ventanamicro.com; helo=mail-oi1-x244.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add RVA23S64 as described in [1]. This profile inherits all mandatory extensions of RVA23U64, making it a child of the U64 profile. A new "rva23s64" profile CPU is also added. This is the generated riscv,isa for it (taken via -M dumpdtb): rv64imafdcbvh_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ ziccrse_zicond_zicntr_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_ za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_ zvbb_zve32f_zve32x_zve64f_zve64d_zve64x_zvfhmin_zvkb_zvkt_shcounterenw_ sha_shgatpa_shtvala_shvsatpa_shvstvala_shvstvecd_smnpm_smstateen_ssccptr_ sscofpmf_sscounterenw_ssnpm_ssstateen_sstc_sstvala_sstvecd_ssu64xl_ supm_svade_svinval_svnapot_svpbmt [1] https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc Signed-off-by: Daniel Henrique Barboza --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/target/riscv/cpu-qom.h b/target/riscv/cpu-qom.h index 53ead481a9..4cfdb74891 100644 --- a/target/riscv/cpu-qom.h +++ b/target/riscv/cpu-qom.h @@ -41,6 +41,7 @@ #define TYPE_RISCV_CPU_RVA22U64 RISCV_CPU_TYPE_NAME("rva22u64") #define TYPE_RISCV_CPU_RVA22S64 RISCV_CPU_TYPE_NAME("rva22s64") #define TYPE_RISCV_CPU_RVA23U64 RISCV_CPU_TYPE_NAME("rva23u64") +#define TYPE_RISCV_CPU_RVA23S64 RISCV_CPU_TYPE_NAME("rva23s64") #define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex") #define TYPE_RISCV_CPU_SHAKTI_C RISCV_CPU_TYPE_NAME("shakti-c") #define TYPE_RISCV_CPU_SIFIVE_E31 RISCV_CPU_TYPE_NAME("sifive-e31") diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index e10ecc4ece..14af141349 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2419,10 +2419,45 @@ static RISCVCPUProfile RVA23U64 = { } }; +/* + * As with RVA23U64, RVA23S64 also defines 'named features'. + * + * Cache related features that we consider enabled since we don't + * implement cache: Ssccptr + * + * Other named features that we already implement: Sstvecd, Sstvala, + * Sscounterenw, Ssu64xl + * + * The remaining features/extensions comes from RVA23U64. + */ +static RISCVCPUProfile RVA23S64 = { + .parent = &RVA23U64, + .name = "rva23s64", + .misa_ext = RVS, + .priv_spec = PRIV_VERSION_1_13_0, + .satp_mode = VM_1_10_SV39, + .ext_offsets = { + /* These were present in RVA22S64 */ + CPU_CFG_OFFSET(ext_svade), CPU_CFG_OFFSET(ext_svpbmt), + CPU_CFG_OFFSET(ext_svinval), + + /* New in RVA23S64 */ + CPU_CFG_OFFSET(ext_svnapot), CPU_CFG_OFFSET(ext_sstc), + CPU_CFG_OFFSET(ext_sscofpmf), + + /* Named features: Sha, ssu64xl, ssnpm */ + CPU_CFG_OFFSET(ext_sha), + CPU_CFG_OFFSET(ext_ssnpm), + + RISCV_PROFILE_EXT_LIST_END + } +}; + RISCVCPUProfile *riscv_profiles[] = { &RVA22U64, &RVA22S64, &RVA23U64, + &RVA23S64, NULL, }; @@ -2916,6 +2951,13 @@ static void rva23u64_profile_cpu_init(Object *obj) RVA23U64.enabled = true; } + +static void rva23s64_profile_cpu_init(Object *obj) +{ + rv64i_bare_cpu_init(obj); + + RVA23S64.enabled = true; +} #endif static const gchar *riscv_gdb_arch_name(CPUState *cs) @@ -3196,6 +3238,7 @@ static const TypeInfo riscv_cpu_type_infos[] = { DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22U64, MXL_RV64, rva22u64_profile_cpu_init), DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22S64, MXL_RV64, rva22s64_profile_cpu_init), DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23U64, MXL_RV64, rva23u64_profile_cpu_init), + DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23S64, MXL_RV64, rva23s64_profile_cpu_init), #endif /* TARGET_RISCV64 */ };