From patchwork Tue Jan 14 18:59:58 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: 13939373 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 B32B2C02183 for ; Tue, 14 Jan 2025 19:03:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXm9f-000790-0V; Tue, 14 Jan 2025 14:00:48 -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 1tXm9J-0006Te-RI for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:30 -0500 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXm9D-00035Y-2V for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:22 -0500 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-71e36b27b53so2983367a34.1 for ; Tue, 14 Jan 2025 11:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736881217; x=1737486017; 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=PZZZDsxp4Yq1BeiK9IM2+BJpQcPkzEPLLh01DbCxFOm0jmTzOiKSOJmrumqtlom5a8 s1aXQ0llSC7xP4lLIGa8C29r1e/uVeIsv3wxtJLyZw2lShCiDZgMidIu4D1kZZLBJmnG DQ08SrMQe92OC0bQTqu1YqlUwyYze0AHvml5SLCN+NLsp9/+A9ckVlMP8icVTz91kkUn cbud9Lg3KfYeHcRycjaOXb0PdeyxzF0O4jyNiTAsWKKgNqSPXXYCJqhXZJqhAPDdPW54 Ov3+l5F4NRpKKeyGo/1PLQAJLYPsdLPzmdqrZvd3EDJd7BeFc52SYG95czSOf3X1U8D2 kxMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736881217; x=1737486017; 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=aZBl6XCt3pOfymtdaOUKQOnJvoFpAyBsaGAggtYdU3cRoeC6H9+wjnIKg6SCEwmfRf A2Z8v4onI6M4tnUEncd4zIT3nh6Ze6HO2b8Vr1Xf7VU8SMYDG1NRLQIWq9HEeTq9Xi9w HxhTFJwQI69/bkiZGzDcKoy9Y3bemIzb3sl2aTNkF2OKFWlQWiyu5yuJtCvyT/fblYg8 l4NT1cWNkU2uDN/vC3Bnv2Kioo9UlCSShpB7ymAb3BdU8cHcWmsxjQVfNqI2hMEABokU Gd/VNL72MKK9IutIfN7C37H2UXhtpErbKNaeVELGC3YadSmAYGTE0ExcIbkkAfHcvieH RbXg== X-Gm-Message-State: AOJu0YwYqAiFI6qbWTpZMSPZE7d+0X4X/gK/yWx5uHZfSDXw7tVcX+5h F9q5EHgLzd6LuOfa/FUF2K21Amuf9L1pSchv1s/kfzi1Yc6zOTR6Gy7dKcoZ6OP4sCC1HTJsrw+ Ck9o= X-Gm-Gg: ASbGnctTSMvT25889V0yhdXKn8fkZ/xJhpRqpta3+W34reYMoueZxneXvDJuoVuamj8 09tdKhfF0+y5elYgQTbGhcbz9f+XXLkGzWeFGs7HdKnAYxDMWxnN1tBcDLawxfat8Lp1i02JeBg 8uVHURCKORMi8rcqqfoEtP2zT+xh3viIm6W4JuI7d2H4FvAWBOm0FLuf7dQy3QQ5yxT5uvDULrS kwvJCBVHpkz6gZ1En1Rt05QNhzyql7wFCl6NtQaivD7PDkctFWCbU6rucz1lwsD/hTnwBs4Bkt9 GyfNCYQTyg== X-Google-Smtp-Source: AGHT+IFz5wUxtqY35Cq38ArxHHJTZr6YEffZGKJ33hfqh9/dxDeXGUuGvPfZwZT2mC9jTsQ96Ny5OQ== X-Received: by 2002:a05:6830:3509:b0:71d:6221:d4b7 with SMTP id 46e09a7af769-721e2ef58a3mr18402737a34.28.1736881217515; Tue, 14 Jan 2025 11:00:17 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7231855ee1esm4875647a34.32.2025.01.14.11.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 11:00:17 -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, Daniel Henrique Barboza Subject: [PATCH v2 1/4] target/riscv: add ssu64xl Date: Tue, 14 Jan 2025 15:59:58 -0300 Message-ID: <20250114190001.1650942-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114190001.1650942-1-dbarboza@ventanamicro.com> References: <20250114190001.1650942-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32e.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=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+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 Reviewed-by: Andrew Jones --- 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 18:59:59 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: 13939363 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 C3B5DE77188 for ; Tue, 14 Jan 2025 19:00:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXm9d-00070d-6t; Tue, 14 Jan 2025 14:00:46 -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 1tXm9N-0006To-6y for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:30 -0500 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXm9J-00035u-J0 for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:27 -0500 Received: by mail-ot1-x343.google.com with SMTP id 46e09a7af769-71e181fb288so3267721a34.2 for ; Tue, 14 Jan 2025 11:00:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736881222; x=1737486022; 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=m6vq2sosVGVcjMUAGcKq1UGGLY86FU4I8V25OFJTASo=; b=Fmg/I2rTFWdhpEavlmPyjewO+01OQasv3NvVsEKASiz1EFfLAmkEpuS1T9Fy/7aIoJ m3s2SHITFiKOQOE0Th7x6YrTGVJMwT+HEDyIwpA9UoH3KM5dmPXJsSYKMJ/k3QnUVrAR Vq6hZAgcc+RtG5gdD6nB5/DcrasBeTyxQscZR2sPpgF4WNTSiU6OGYjGkDKkXUdMS9qU UfwbrSXry/l3vGC9SGW0/xY6DoYq0mFQgnV3+a7za0E/hUuE6VGlb8xxxFpDtt74fGEb g6VZh7Jhx2Ohmt8u50lkQIHxOxEq3ga4ZD8tekz3D04RZ1OCZPzjDf6DhvHQxmMjcAKa T/vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736881222; x=1737486022; 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=m6vq2sosVGVcjMUAGcKq1UGGLY86FU4I8V25OFJTASo=; b=f8VNSblEV+JPjjZNjzQO8GNmO+JPwxJogQHkkGd/zbY6edlzbSAyQMvGTD3WO83ScQ ungUXpxKBtNHQFqlHcwutkshDXs1+fSyj/rAwQ3TK9AYR/sPfU9MYrnz30/OF3m+hy1R dqwDK3PKjytxWWMbBZZ3Wq5So2aDUBRS5cEEnHSq0PyTp/8Q5GOhs7EqGvzhTzLh6M8p gdEI94uNpBOtOOwDyEXnyTo861FeBHUA+P6p1FxLvGlDKF6jzxxHYmKyZ5m+PjRhn/XM caSqVTuy1drFOdG8YMI4fQPgj+YEHMO1kztUH2PHfE9P9Vszf0Gu8Mzqnw6wnWfzJESK GSWw== X-Gm-Message-State: AOJu0YySGPhKUEiDgKxgjlK20GKOjZfBda+qJNrBe3wVTh8RBZ1/yTO5 EjWFDq8Sc/qGjg0UBX6je2JH06saO31OKeua+ZbA4PdmQUW71fIwjE44cRw5vkppAyftuH80i/y +2VkBEw== X-Gm-Gg: ASbGnctyZ/KwPZOcJ8fBao6y9tworUUXqT2+BSnZzNJMuVTD5batY5cuDVLRL6fYrzT wBCWJ76gXi+y4pbY8/CegXipBXfekQk+aRUEZv50S5XvwzdQqxGFJYRQXqNaPPpt1P202PL4vKK +8rxJKxzg4Qh9XURZL8V6MUSz1/o+j5Zwbu2rCOQY+BlbTVmSU7cRlyIEVn0hqdSr9yK0jugEaq ajdPXbJsYGT9Yq/ybWo4sS/OB6z+kVZhWjxZTMuk19EY8lo/25kbOM71h/iF26EVQDIx0wizwbp v6ep+4sRNA== X-Google-Smtp-Source: AGHT+IH+9w/4FHpO9Zml+ejdTgh0xHG3lBqclREnDR9vKs/fwhmoI9q6jgY/8X0u1xHqbvxYTaqXgA== X-Received: by 2002:a05:6830:6107:b0:71e:17c1:45e with SMTP id 46e09a7af769-721e2e9a53dmr22239436a34.21.1736881220883; Tue, 14 Jan 2025 11:00:20 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7231855ee1esm4875647a34.32.2025.01.14.11.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 11:00:20 -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, Daniel Henrique Barboza Subject: [PATCH v2 2/4] target/riscv: use RVB in RVA22U64 Date: Tue, 14 Jan 2025 15:59:59 -0300 Message-ID: <20250114190001.1650942-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114190001.1650942-1-dbarboza@ventanamicro.com> References: <20250114190001.1650942-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::343; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x343.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. (bios-tables-test change: RVB added to 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 Reviewed-by: Andrew Jones --- target/riscv/cpu.c | 2 +- tests/data/acpi/riscv64/virt/RHCT | Bin 398 -> 400 bytes 2 files changed, 1 insertion(+), 1 deletion(-) 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..6fb4d5f374 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2351,7 +2351,7 @@ 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 = { From patchwork Tue Jan 14 19:00:00 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: 13939364 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 0BF7CC02185 for ; Tue, 14 Jan 2025 19:00:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXm9l-0007jw-VV; Tue, 14 Jan 2025 14:00:54 -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 1tXm9P-0006Vl-Mi for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:31 -0500 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXm9M-00036g-FV for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:31 -0500 Received: by mail-ot1-x343.google.com with SMTP id 46e09a7af769-71e35be77b5so1583755a34.1 for ; Tue, 14 Jan 2025 11:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736881226; x=1737486026; 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=YiYlxwHXUU3zuaz/O7pjImuUFKQ8yguanE/cPjiFeRA=; b=RyQwiwRETqFIbhs3010C6dXQT/jht63xzolmG08UDJnwhb6CuU7UkyP9/TGwLUJhrX L1z6tTiVaxHGjctxRK3fPYy9JOLkeccuY+KYSjiNnsgThdSOqO0IW6EquWRDArDwt+Kw lE+vxhTVcczjzkqwwnbmapXlaq5LkKPLh3s/KlYSiT4y/UPGYoiZYMLKb1m6nB8w1RQT El4zBSENH16GunAPpM4chpci9axnchyVgMdRmUnJqOz1wtXK5jVekmb1QdqLn5CkduFq PUbXPctBd7439s5kN7oAMQhd9b/i6IHfETSkSzH5wkxCeWOXc24GTIFs1hMo56O5Tcyv Ubuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736881226; x=1737486026; 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=YiYlxwHXUU3zuaz/O7pjImuUFKQ8yguanE/cPjiFeRA=; b=MXULqYYTaPDU8zylaf+CuMI7Vx/6v/8tmzWGpByFpcS60ZEERRqyXFnUnrTpW9XbYD MIoR/7yUJ8ywVNT9iYTErz7Uer2FB+lVFY5ZnPLhqB68XKgwwWuQmnRf66ljaba3HkV+ GpA4RlNfSH2ZXcIto+pTGLFcSQPYuNisO9gHkAcReWIyrzLsvjAS1eKEBYQlOl1Bh4Y/ 1iO7JLbHki0zF9aWZgKvnLh1XNwtKrFZd2tjTz1fYJ3PJj0EgI5JsRlRryGqE70G+P8T qnejebejUO8pade8QaVzvOGcykqLya7ZzGvSvnErG9nXwrmCh7cnbL5nhFnpCGo+cayz 3nFw== X-Gm-Message-State: AOJu0Yy/enb5XULpqjunFBCxMZZN13w86x2HMSCg3ZRWpKAlde+ARNaC gbQzRQhj07g2B+vQLRGh5iuPUFxhmWs7SfY9U9H1MV5Swl27v4TkPNJFoBCrKQEnnQU7CMQPqBM ucUfMag== X-Gm-Gg: ASbGnctgkJUVntULwBuAX7RlKk79pB6YFE6w+StKfoNNM+GAmgcszsBPEnHFB9nuP44 myOW17FqaBKaj1Wocw7AuhBYyx3szcJnBvx4c0/GTClB4Y/yvxViSgeD1OTiswOJyZskH8hZXCs TvBfLAe9u3KgeM4o9Z6W8U+MfkZOydsvggW9h1petUTn0jd+v5a2ViMwBsZ6EHPZDHXni/DE/qm +pZn6ZbGAbGDolMzFTVz91kNBtkdjCEQbYaxwX+jTRRyXpXzA8cRb+fSe0uAqzNQzRnAJz8kEt+ pC2GorrluA== X-Google-Smtp-Source: AGHT+IFVR9sjTY7YrBBztzQ83pIyMP+Kfe/jsQbvdwXkUevtaoZ1zPeKIuo/IGEod8JC/PJ6zm9Lhw== X-Received: by 2002:a05:6830:6994:b0:71d:f21b:a447 with SMTP id 46e09a7af769-721e2e5b5a6mr16337156a34.17.1736881224261; Tue, 14 Jan 2025 11:00:24 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7231855ee1esm4875647a34.32.2025.01.14.11.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 11:00:23 -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, Daniel Henrique Barboza Subject: [PATCH v2 3/4] target/riscv: add RVA23U64 profile Date: Tue, 14 Jan 2025 16:00:00 -0300 Message-ID: <20250114190001.1650942-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114190001.1650942-1-dbarboza@ventanamicro.com> References: <20250114190001.1650942-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::343; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x343.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]. Add it as a child of RVA22U64 since all RVA22U64 mandatory extensions are also present in RVA23U64. What's left then is to list the mandatory extensions that are RVA23 only. 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 Reviewed-by: Andrew Jones --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 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 6fb4d5f374..371a7d63fa 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2395,9 +2395,33 @@ 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), + CPU_CFG_OFFSET(ext_supm), + + RISCV_PROFILE_EXT_LIST_END + } +}; + RISCVCPUProfile *riscv_profiles[] = { &RVA22U64, &RVA22S64, + &RVA23U64, NULL, }; @@ -2884,6 +2908,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) @@ -3163,6 +3194,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 19:00:01 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: 13939368 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 C9CCAC02183 for ; Tue, 14 Jan 2025 19:01:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXm9z-0008To-6h; Tue, 14 Jan 2025 14:01:07 -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 1tXm9R-0006XZ-PM for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:35 -0500 Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXm9O-00037S-RK for qemu-devel@nongnu.org; Tue, 14 Jan 2025 14:00:32 -0500 Received: by mail-oo1-xc41.google.com with SMTP id 006d021491bc7-5f32f5b0631so3831534eaf.3 for ; Tue, 14 Jan 2025 11:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1736881229; x=1737486029; 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=OKCFz+uu23qiBxrqSpXC9+MkA/Y8BAUjLzzQw3XWciY=; b=QTu0sXhcQaCO3xQZ6owVnAtGkSef23+JMtELIUjdcnByFhglbSrA+CD4cx7Yqg43kD 2ki3JMy5W9dEnIT3Wi3nAe+SW4SM6BX6VgkKQDRKc3VI46mg0yLdnN4vVY5oToOWYinX yf4dMfFlT5bVAMXGlhC6jgrQa8QKEOQx+l9o+GK0I8XW5CFHTexsbBiB0psmlq09nFNn 8nDVHYzz0FjyolHHmarUF9+RR1FGyUVqEErRnkgAzgKILDBo0F1SvGpFD7wtoaJ1qI2/ oI5M3XJ1bdf59BLNvhY51/cNG+srn0Vbf+6qPeKOY+duTJwkiQ9IF7IIWlAwXtju/4x2 snAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736881229; x=1737486029; 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=OKCFz+uu23qiBxrqSpXC9+MkA/Y8BAUjLzzQw3XWciY=; b=GGMhhrdJoDabnmB4t5j5I0i7tOWxWpXfbeGejB7hu72yvCOMI8lLt1TkC5lb0PeHof B5y8X+cJIKhxY8zJuLflUJR3RKH6KP7DT+qoUux4BqmXFAqXJk4SOBb1ZKHkhMD1PDPP AVS3b1U+bRR3+gqUoqGlqRqvxPioyiN5zr6oXhFaRIrghM8S7UXbbo7J+Awi6UK8OONd HN/CITqAVAkszp77B2EXsSKRAITk2BaGfPKDvQab0I7l8kv+/Oh6TynstS6FKD8sHFzi u9TkD+qiuf9ZuVVPArSIyVN/RE7tuFWUWC3Qy3SKWBS107BjgJOCkpBeWek5PsjaXV4z 6pjg== X-Gm-Message-State: AOJu0YxybP9gSuH4Jw0MgLFIc4a1KfjcFMKtbtgXoXPV4LddEnjxlvoh Anppib9b3AcwKB0II/83VVXbmiMpDQVpxzyByUzgXHbTRVdhe7fkKuJf5qcasntY8T6gUN09sgf AtrWr9A== X-Gm-Gg: ASbGncsCNEIm3+0ejQ9vQnlHr9B73C+6uf4hnch7SZxD2fjWXyNZ2vnYQiWPXB0NdK4 mYNI20plXcT/0NU4qQfrRUZ09V9E6sD9hxl9cEaUs1icimvIbMYj0RxcTFAfYa2x1lTuzD4j6+d ZTwXOKy59FLjYvB/62Y4itA+IUkN1EJ/L0YwySHcyM5wHNdT4Bc56M3gs7T5SJ4YjE8S7pi9tz4 JZqBHjkMK/UKz6hrd/uMXgN8ZYvBQBaljmb8lzMDhtRNKQGFeMMGCKh287zO3VVlwKCGBvgHISM 5/VA8b7BnA== X-Google-Smtp-Source: AGHT+IG7Am4duzLF6oXhYE2Tn8zsH/ZtR5a5KwTTtDJuF1aC4WTnHtK8KSfglKZE3Eed78rfYu9p5w== X-Received: by 2002:a05:6820:c8e:b0:5f6:6547:8a0f with SMTP id 006d021491bc7-5f730929358mr19844057eaf.6.1736881227641; Tue, 14 Jan 2025 11:00:27 -0800 (PST) Received: from grind.dc1.ventanamicro.com ([189.110.107.205]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7231855ee1esm4875647a34.32.2025.01.14.11.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 11:00:27 -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, Daniel Henrique Barboza Subject: [PATCH v2 4/4] target/riscv: add RVA23S64 profile Date: Tue, 14 Jan 2025 16:00:01 -0300 Message-ID: <20250114190001.1650942-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250114190001.1650942-1-dbarboza@ventanamicro.com> References: <20250114190001.1650942-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c41; envelope-from=dbarboza@ventanamicro.com; helo=mail-oo1-xc41.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=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+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_zifencei_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 | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 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 371a7d63fa..9225459bf8 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2418,10 +2418,44 @@ 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_zifencei), 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), CPU_CFG_OFFSET(ext_ssnpm), + + /* Named features: Sha */ + CPU_CFG_OFFSET(ext_sha), + + RISCV_PROFILE_EXT_LIST_END + } +}; + RISCVCPUProfile *riscv_profiles[] = { &RVA22U64, &RVA22S64, &RVA23U64, + &RVA23S64, NULL, }; @@ -2915,6 +2949,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) @@ -3195,6 +3236,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 */ };