From nobody Mon Nov 25 09:31:58 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1715759305; cv=none; d=zohomail.com; s=zohoarc; b=aVOI50E+W7a4jb6JUPBsOfDrY2A5aoSCEbM6C5lPGPsLRJdIRc9JOAH8hqLq2E2QxXuAl+b61DuWMOtCCivola2dpz4hMUHZLrgSgxSy3Fkd7RDlgnI0wjKxzwl5ifxW9+c2jhpfZDHlFRk0xp9lctAVzW5yEv2gAJQZQDYTYP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759305; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7O3me2A3EyGgD+KWkf98RQrX1/WsA8xiG3u+UiJbo1c=; b=lvcxLCUHRmImStk/LujA9Kadj2P6fnhKKxPVfgvUF6crx9OKSzKvrAhIARSAzDO8PGdF3O2ObeGt+CbumMmIML45OOtd4GFWmL8auF/X4oMJZUl9EwgSsS8aIwNDFUri/D0B0oQZomnlkMn5kSKjqx7KN04Ji4RJRHxsKAKqiXU= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759305591515.8897010016822; Wed, 15 May 2024 00:48:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79N3-0006i4-F3; Wed, 15 May 2024 03:48:17 -0400 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 1s79N1-0006dX-GH for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:15 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79Mz-0000GI-F3 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:15 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6f449ea8e37so5623159b3a.3 for ; Wed, 15 May 2024 00:48:13 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af2bafsm10389060b3a.162.2024.05.15.00.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715759292; x=1716364092; 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=7O3me2A3EyGgD+KWkf98RQrX1/WsA8xiG3u+UiJbo1c=; b=ImzzoIZX+MtUoeK1Kq4DHUj+980yLaisE2DIQe/C6VLBESOKZdR+M3fRmpKr4g+4FK lDG4G6OoK3fRqiMtdvN23nvLeQf8/diZ8r2/RLnkeWeucMzs2m0mJ7Sn/YZm2Ma+WbGX X4BJJqB6eIonZBZl4YPvnFE94iZPwh4CFMZHzHzN1zn6NeOHepRAzMMMdAC7aMqoduS7 6dcNK6v/i0ovF7hh9tncdKH/lklHrBundIhqjAF0P9ps8cROh4bY6OS9912ogsuwHQVK lrTF4MS9XksX1SiaB30wShId4LyBW7T3EYAkSkWvFMPBW4jBp+S3IdSLkKt2XoB3nz+d jm0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759292; x=1716364092; 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=7O3me2A3EyGgD+KWkf98RQrX1/WsA8xiG3u+UiJbo1c=; b=noyqDVfT2EXWe7X9jMdOZLlA9eU3034QGGNvLsSaXNIldpClfEY8+FjpAHSbOa67Id 6+CUjBxr5W1rBo/Dw6IXy97WHFHIqU/3YrgTN7ay6x4MbtTF4i58AzcM8T44wUPxsIgo ksPVYjIcW9MT/blbaEptKnOeWwxDjRcEZdFh3jpPt+aaVS1ufBQSn0P10a9w14kTld1r Fd/9uUAPN8WEwAN6zumhvejC5f6QTLAWTcjqUHdit9AzGOKY95NBrW8wakGMzDn7w4Cw GtKTUwxH6roUYd0zj3SPwjXgJGuL+voR06sdK+hunPz5A9g+Zqzvh+nmhX1quan4UcjG IHBw== X-Gm-Message-State: AOJu0Yww2PimcsBN3jqbkv3+UTDNGCH6Baomg6kJ8gtLK6/8amfQJmQm V8orryqr3PJ2LcBop89698/+fCJ95jyDGVSCToPtGsjxDuUDGC+V8yovC/gKx+enRSVmE13IfQ+ V9MjDn0yeroxqJ01SG62deJbFfu1qeZK0/IFByakJ71J0LSqg1KE3o/19iWd/9brkCszkKNbt1I n+BkjbRgfnY0IX8DRgo+YPYBgZg4SxRAIOjTnQsw== X-Google-Smtp-Source: AGHT+IFPBW0SUoc0wVgjfqyyMaxv3KF/v7IooigdCtyi6t6VYyi89I/GWWIhMNxRcfWjZIVC2IYdnQ== X-Received: by 2002:a05:6a00:391a:b0:6f3:876a:c029 with SMTP id d2e1a72fcca58-6f4e02ac99bmr21451343b3a.10.1715759291651; Wed, 15 May 2024 00:48:11 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Jim Shu , "Fea . Wang" , Frank Chang , LIU Zhiwei , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Andrew Jones , Max Chou Subject: [PATCH 1/5] target/riscv: Reuse the conversion function of priv_spec Date: Wed, 15 May 2024 15:53:32 +0800 Message-Id: <20240515075340.2675136-2-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075340.2675136-1-fea.wang@sifive.com> References: <20240515075340.2675136-1-fea.wang@sifive.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=2607:f8b0:4864:20::430; envelope-from=fea.wang@sifive.com; helo=mail-pf1-x430.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1715759307251100003 Content-Type: text/plain; charset="utf-8" From: Jim Shu Public the conversion function of priv_spec in cpu.h, so that tcg-cpu.c could also use it. Signed-off-by: Jim Shu Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: LIU Zhiwei --- target/riscv/cpu.c | 2 +- target/riscv/cpu.h | 1 + target/riscv/tcg/tcg-cpu.c | 13 ++++--------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 2946ac298a..6dd3d7f4a3 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1786,7 +1786,7 @@ static int priv_spec_from_str(const char *priv_spec_s= tr) return priv_version; } =20 -static const char *priv_spec_to_str(int priv_version) +const char *priv_spec_to_str(int priv_version) { switch (priv_version) { case PRIV_VERSION_1_10_0: diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 1501868008..140eb43fcb 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -833,4 +833,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool is_32= _bit); /* Implemented in th_csr.c */ void th_register_custom_csrs(RISCVCPU *cpu); =20 +const char *priv_spec_to_str(int priv_version); #endif /* RISCV_CPU_H */ diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index f59b5d7f2d..fa186093fb 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -76,16 +76,11 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uin= t32_t bit, =20 static const char *cpu_priv_ver_to_str(int priv_ver) { - switch (priv_ver) { - case PRIV_VERSION_1_10_0: - return "v1.10.0"; - case PRIV_VERSION_1_11_0: - return "v1.11.0"; - case PRIV_VERSION_1_12_0: - return "v1.12.0"; - } + const char *priv_spec_str =3D priv_spec_to_str(priv_ver); =20 - g_assert_not_reached(); + g_assert(priv_spec_str); + + return priv_spec_str; } =20 static void riscv_cpu_synchronize_from_tb(CPUState *cs, --=20 2.34.1 From nobody Mon Nov 25 09:31:58 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1715759342; cv=none; d=zohomail.com; s=zohoarc; b=KJeOGnPqHzr+u5g37kz1HOMK7DeNdbbtHHMofbyWA86lsI6vqXkgD3TIwYe/KqsDLElmJxnYyh26KMtcmVx49Cr2hKG14I+Ycsv7wBiFsOTaqXjjE4dQj7ZP2Tqr/zBqQClPBTFDbZ2pGAo3DiLgyOh+en9qe2w9JlP/RXhplI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759342; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=plUfPWk1RcWNFeTjma5GTrn41rKUM5YMo9L4XBxNpkk=; b=IB26AokaQlRMRkzYysuqlhnU4QGHedslGuqMBXBZ4Uhv0y77AcrHB3C6sSoXQmSxEhpGiBtHNyreor7G63zLuWG1JsDH7dgFdjl5uOKWcNYWSaGoHmUm+LyjMNQKoYRTjpVv/34jy5MTNpxbSV0fQYbLnwVeNtxDCWDeELRvsO0= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759342161550.0123539008391; Wed, 15 May 2024 00:49:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79NB-00073R-Eg; Wed, 15 May 2024 03:48:25 -0400 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 1s79N8-00070j-H9 for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:22 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79N5-0000J4-OR for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:22 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3c97066a668so2157393b6e.0 for ; Wed, 15 May 2024 00:48:19 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af2bafsm10389060b3a.162.2024.05.15.00.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715759298; x=1716364098; 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=plUfPWk1RcWNFeTjma5GTrn41rKUM5YMo9L4XBxNpkk=; b=cRezQHv6nHcvD+XmTcG6N4I7IQCdMIbxmSimT2cu8AeFHLZL2VGmWfaBhpEh8rwLrK KK1Nvvo7iSAwvacBZUymcDAFlyEC+TDEUOT1eV2EAl0DsX3E04IEJbrJeVq3RiC90vUz qQPNYiDVJGBGtblLka0yA13uT1pIZWCS8maiwBH5StOGEoLqCRtXnxcksZe7z7tXT43s NVMBgPgVoty961F3wC6YP3g0hFRQQGDHI8M+vxq5rjFXjV+ore4pe9mQZqgIkllObNlq mCRzIbZFOCH2RaQhFUEaeeOSzqjM+vNqarA430NFsZdbtyMshxPLVup4JxHC32U0G2rP kBvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759298; x=1716364098; 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=plUfPWk1RcWNFeTjma5GTrn41rKUM5YMo9L4XBxNpkk=; b=Z6gqrXFMn/dVvExHyWXH8YbbZZNr98sIWTIf6LdiuT/taFupxT+W9GqaBO6aApqWXe Rc7hshrRR9L8Smy4betSPNq5hqbYSAsVc4amF7gtbAWlfx8Ddj++Co8BwiPGC6GFmlHL 6oKg+eoEZz1n9XuAZwHOQ/uKZLuB+XeQpIXlxHlUX2U4sDNn1/nT3ePGZlFS6VvS8oXG 88HjTfaERFSHdLOIP+v+QZQOoeBbfgissfE/vDWl7kwQMKWmyCib7+mk9F2hRmOF6+P9 8dL+Le/azzrxRJsKcXxJXjkXC1NW1sQVg4+0PLNyF6JsuNhLCzBqX9fR/zoDP9hiTxgS sC1Q== X-Gm-Message-State: AOJu0YwxGuMeyBKKOnWMk7soOpubibwlOGAUzfeG7wk7HcIYprbz601n 6YTFRwvsrRZe80Z8HLQ/Q6l3tGt7C2Zrgtg1/OTrzrXMPqS2DnVBfClN0KzSeIRV008YkVcagaM JBEVMbb7ZzgJJMYdSgTo9wD7R+TuUY9DcMp1tjnKnXvSakge0tlBMOIqTk16Fomp379QLK3g6q0 98COUjTWskeuHolDnEQ9j0flNWiQbT+0YSTYxZNg== X-Google-Smtp-Source: AGHT+IGSdLo9S2kAFGEymulmO8sO2Ah9DjnEqhhljHBOdA+XL7GuNRFhnm2DTpxm9FZ/KllcrZT1UA== X-Received: by 2002:a05:6808:2b02:b0:3c9:6ba0:e98c with SMTP id 5614622812f47-3c9970d1b29mr14639777b6e.52.1715759296788; Wed, 15 May 2024 00:48:16 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: "Fea.Wang" , Frank Chang , Weiwei Li , LIU Zhiwei , Palmer Dabbelt , Alistair Francis , Bin Meng , Daniel Henrique Barboza , Andrew Jones , Max Chou Subject: [PATCH 2/5] target/riscv: Support the version for ss1p13 Date: Wed, 15 May 2024 15:53:33 +0800 Message-Id: <20240515075340.2675136-3-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075340.2675136-1-fea.wang@sifive.com> References: <20240515075340.2675136-1-fea.wang@sifive.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=2607:f8b0:4864:20::233; envelope-from=fea.wang@sifive.com; helo=mail-oi1-x233.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1715759343352100008 Content-Type: text/plain; charset="utf-8" Add RISC-V privilege 1.13 support. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei --- target/riscv/cpu.c | 6 +++++- target/riscv/cpu.h | 4 +++- target/riscv/cpu_cfg.h | 1 + target/riscv/tcg/tcg-cpu.c | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 6dd3d7f4a3..ee2ec4c4e5 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1775,7 +1775,9 @@ static int priv_spec_from_str(const char *priv_spec_s= tr) { int priv_version =3D -1; =20 - if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) { + if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) { + priv_version =3D PRIV_VERSION_1_13_0; + } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) { priv_version =3D PRIV_VERSION_1_12_0; } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) { priv_version =3D PRIV_VERSION_1_11_0; @@ -1795,6 +1797,8 @@ const char *priv_spec_to_str(int priv_version) return PRIV_VER_1_11_0_STR; case PRIV_VERSION_1_12_0: return PRIV_VER_1_12_0_STR; + case PRIV_VERSION_1_13_0: + return PRIV_VER_1_13_0_STR; default: return NULL; } diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 140eb43fcb..f691c7d828 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[]; #define PRIV_VER_1_10_0_STR "v1.10.0" #define PRIV_VER_1_11_0_STR "v1.11.0" #define PRIV_VER_1_12_0_STR "v1.12.0" +#define PRIV_VER_1_13_0_STR "v1.13.0" enum { PRIV_VERSION_1_10_0 =3D 0, PRIV_VERSION_1_11_0, PRIV_VERSION_1_12_0, + PRIV_VERSION_1_13_0, =20 - PRIV_VERSION_LATEST =3D PRIV_VERSION_1_12_0, + PRIV_VERSION_LATEST =3D PRIV_VERSION_1_13_0, }; =20 #define VEXT_VERSION_1_00_0 0x00010000 diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index e1e4f32698..fb7eebde52 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -136,6 +136,7 @@ struct RISCVCPUConfig { * TCG always implement/can't be user disabled, * based on spec version. */ + bool has_priv_1_13; bool has_priv_1_12; bool has_priv_1_11; =20 diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index fa186093fb..f53422d605 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -318,6 +318,10 @@ static void riscv_cpu_update_named_features(RISCVCPU *= cpu) cpu->cfg.has_priv_1_12 =3D true; } =20 + if (cpu->env.priv_ver >=3D PRIV_VERSION_1_13_0) { + cpu->cfg.has_priv_1_13 =3D true; + } + /* zic64b is 1.12 or later */ cpu->cfg.ext_zic64b =3D cpu->cfg.cbom_blocksize =3D=3D 64 && cpu->cfg.cbop_blocksize =3D=3D 64 && --=20 2.34.1 From nobody Mon Nov 25 09:31:58 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1715759342; cv=none; d=zohomail.com; s=zohoarc; b=mWQbWl0yzh8T7Y1ZSlaIDhqeg+X+NtvqWi9stfao8w07VzBUPAOt7kP8TtZnx4AueKR5BgNw/63gJM+JBjxRLDqYuOta7HCsjU3/NZv4055eSdX8RX6RkPEyG0f6F0oAzSMV1zu6GpRMl4ysgDc/mXV038GwfOitCZZExfs8ZYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759342; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QBqdliMEnz302NXVukyGkGL9Vj4A6ULArkG/4ozIHhk=; b=B4dm7CJ9SUERaa5rZQNjyrKrg1ZRVsO2XnPUe65TU63rUH7jkkzK7baP0MXqhkkz0MsE12AE3sL3DASiXL0pE6DFAidJgOLIMLwI+UL3AXDAF/AoD7rN8kRLmw4CG567/kWPlANUhx9FSxPo/E6/vykirwDl9d1QXWN770p0O4I= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759342427488.51560540191656; Wed, 15 May 2024 00:49:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79NE-0007V5-IN; Wed, 15 May 2024 03:48:29 -0400 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 1s79NB-0007AE-NG for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:25 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79N8-0000Jl-Ui for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:25 -0400 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6f10092c8c7so1966293a34.1 for ; Wed, 15 May 2024 00:48:22 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af2bafsm10389060b3a.162.2024.05.15.00.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715759301; x=1716364101; 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=QBqdliMEnz302NXVukyGkGL9Vj4A6ULArkG/4ozIHhk=; b=UPuJNt69txfk3//ElcALCwR1z1xR+2uJABB6yEV4VOn808hvJtSFQ8H2QPrlIZdHUK HSHBTtYbJPP7k+trB1kcD+TQdlQCT4mHyQJY8qXMWr11ks13VxSWz36XaTUTVdfPPKek Ee6LDvCtYq5ZZceCUtN0OhlQwSnZlhG7BxXh4P7HeT40aB1jzHzndNzuxseQkwV0o3AZ ZTRwOc2+7iOAGppD7zMDWHbaAyfMeRHdtmRaFG8R8nB6393oEIt7CR0B8LF845Ojv3Dn Ub5pJzX4Bmi7lJ+n3jPYm+YpNCi18WiXc+Gg83lHRTeGI3OzQ3uUN3rpponvK4iPlV0C v64A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759301; x=1716364101; 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=QBqdliMEnz302NXVukyGkGL9Vj4A6ULArkG/4ozIHhk=; b=of719KcEcq3hsjZfNHk2RUyXix94+9PH8mRb9GUUcOLj5zadI+CQ/ldDwGdO7dmI5g KBhHXrMR1Kw4khIXEbk+zu29zlFmMumaBjpRuwSSblsJriO5aDnyTIshlquH+NbXlUlH c8I91RsEVF2cLqRTC5p8L9VkZYPAt6ta84mbkhrtuYSvY/O1k5HEmhHFGlI7MMmNMu0D Xhzass8oU6Pt9NXrm4qeoivmqL7kGKqM+rK/Snz2zApYWdznhwuTzNQ0/+vhZvmDkvNN quqSDu9qPQXi5r+N7Ij38JgjhGRj11pmRGZpKsF7LVd9nj+YDYIY1Depu169cuuQBUYx 4Tcw== X-Gm-Message-State: AOJu0Yz8Z0FPqnpJvJcfFCFAUY8FDMy6TI3qG8ur6pH7t1OKYTa0I/rn C9oQgxVXYNrqZoiqCP8zdnmwABrCmfzRCd4Xw70hTDiOf9GaEXrZZ+ZTS1smmXt2LEUAI0/pw09 T69web4Uh/ZT4ZQ6sPAZgfr1D74Rf3nT985ZkX/FX82I7jyxd5P+7vDXHgxnn8MLmvSuDn3AHYh ArDg+FhQmV6uBFXhEfcB3Bm5OaFF7GINHLszY= X-Google-Smtp-Source: AGHT+IHHE0Bkwlhu6ny7kOieP8CgJis1/nbAsd8Kup02DhpHOypjCBL0yQ9LoJdd4ex7x3sQY9eBNA== X-Received: by 2002:a05:6871:891:b0:23c:3afb:eceb with SMTP id 586e51a60fabf-24172a4d896mr23336795fac.1.1715759301109; Wed, 15 May 2024 00:48:21 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: "Fea.Wang" , Frank Chang , Weiwei Li , Palmer Dabbelt , Alistair Francis , Bin Meng , Daniel Henrique Barboza , Liu Zhiwei Subject: [PATCH 3/5] target/riscv: Add 'P1P13' bit in SMSTATEEN0 Date: Wed, 15 May 2024 15:53:34 +0800 Message-Id: <20240515075340.2675136-4-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075340.2675136-1-fea.wang@sifive.com> References: <20240515075340.2675136-1-fea.wang@sifive.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=2607:f8b0:4864:20::335; envelope-from=fea.wang@sifive.com; helo=mail-ot1-x335.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1715759343340100007 Content-Type: text/plain; charset="utf-8" Based on privilege 1.13 spec, there should be a bit56 for 'P1P13' in SMSTATEEN0 that controls access to the hedeleg. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Weiwei Li --- target/riscv/cpu_bits.h | 1 + target/riscv/csr.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 74318a925c..28bd3fb0b4 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -315,6 +315,7 @@ #define SMSTATEEN0_CS (1ULL << 0) #define SMSTATEEN0_FCSR (1ULL << 1) #define SMSTATEEN0_JVT (1ULL << 2) +#define SMSTATEEN0_P1P13 (1ULL << 56) #define SMSTATEEN0_HSCONTXT (1ULL << 57) #define SMSTATEEN0_IMSIC (1ULL << 58) #define SMSTATEEN0_AIA (1ULL << 59) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 6b460ee0e8..bdbc8de0e2 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -2248,6 +2248,10 @@ static RISCVException write_mstateen0(CPURISCVState = *env, int csrno, wr_mask |=3D SMSTATEEN0_FCSR; } =20 + if (env->priv_ver >=3D PRIV_VERSION_1_13_0) { + wr_mask |=3D SMSTATEEN0_P1P13; + } + return write_mstateen(env, csrno, wr_mask, new_val); } =20 @@ -2283,6 +2287,10 @@ static RISCVException write_mstateen0h(CPURISCVState= *env, int csrno, { uint64_t wr_mask =3D SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG; =20 + if (env->priv_ver >=3D PRIV_VERSION_1_13_0) { + wr_mask |=3D SMSTATEEN0_P1P13; + } + return write_mstateenh(env, csrno, wr_mask, new_val); } =20 --=20 2.34.1 From nobody Mon Nov 25 09:31:58 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1715759344; cv=none; d=zohomail.com; s=zohoarc; b=fwIfHbxoW4ortBdCydnIIuTb6Cu8H6ybIDMyXipRVG6QarkGEDdSpJ3tDOnN9+HTqYJPlWo5p1Hw1gdseZWPd6yXNiHUP4l7wg8kBSgWSgnuE3qJ6Dg66bKxCvfZ8vDlcGT7Lsxs9NOiJ5fgBvDhRve+axdWwp6bMI7k7TtQF28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759344; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ldPciugSQGSMOBR5lY12EK6xTqHmCiheKzOXbbN7QuY=; b=dI0zrmY/umzoAqErnG07qKPo1GD7agSe4k2MoIg0lChOzMXOYOcef8efZxU5BKZjbznG1mOqYzsQMTO2mvXQ+FUQIfc8QvxvGGQff8fzhZx0fDS4xAhkgE17H2NgS1XqvFrqjtLcRGezRZc4Rwk/Qoko4rKAPPJR7M3xWx3lGnY= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759344150974.8862873940081; Wed, 15 May 2024 00:49:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79Nk-0000ir-V2; Wed, 15 May 2024 03:49:01 -0400 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 1s79NS-0000KU-2T for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:43 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79NE-0000L9-1K for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:41 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6f43ee95078so6292427b3a.1 for ; Wed, 15 May 2024 00:48:27 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af2bafsm10389060b3a.162.2024.05.15.00.48.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715759306; x=1716364106; 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=ldPciugSQGSMOBR5lY12EK6xTqHmCiheKzOXbbN7QuY=; b=cZUY3kfFiffYfzzxFgsr4puYSviwPFZ1GYKJg/r5SG7SMkCaHMlTDGfdj6tE3GVi8m g1dDaoX9AsN9Hph3aRWXShacdHmN3hKVQthswRWdI0/VN+W72CKmeHgAZL/oi0E9C1IF nRuggxtRLgXKjZ8IE/8sM1eGwkkfMMuB8DZ44akRyOOil5duR9frTCJKGr71OWDWFuGc VBm1UcawvomOp/FEUQuzML4WcBW/DZp5CpWsoaHxRgARgCYUZbFy0Ft88PUZ9Bv9ZH3U OpTZC1IeNxKRB8MDC93zkBb7h/HAOXjGfvvUvTxFKpS8qBjPoYK0z89a/w8saV/9p2KG 4blA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759306; x=1716364106; 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=ldPciugSQGSMOBR5lY12EK6xTqHmCiheKzOXbbN7QuY=; b=eenvFFCUQkc9EVi6xM9I+kz107zGNH1RUB5GTMNkKNbgtIG51nJvyDY1AjIYboCOsJ ekFCnyzX3UyQt4XcKyx2EsJrEMLvFeOTA7vmR5nDREOoNrBJaqY4b4OUOuHbtnFiYWEk qp9tHysjo6WGcL8ZUne6XKTtHie0hAX/yX8XmfUm2iQaByw4Qy1svJXAruCwvijDN2s1 7GH2QhXkxoxFDgcMpI3sPRqeyHpyF1+QGhbUbC2dp6NvyOmIUnekILU9ushrlA+BsUq0 JRo7SAM0pEPDnfv7JUVt7KJGuTOGerU3/yXWtHtT3ADCpKEZxSw9Gh6fouj3SlkgDfY1 1znQ== X-Gm-Message-State: AOJu0YxFcI7nuf3I/mcZH8DXe6VMENLxD2HgQNxmEaf1tIh1L3ruBpFw xVuzljTHK+IjU4EPfbisPlRT41CUzNJyM5xYQ9iVb8n6LxHLR3DeNO0EwaKhpLvqEf/113gQDhU thjQolwJdGivYQk00hU1AcdSv4cW5ZoIpVBR2bFCaryFUySuxgiHcJfcv3/lbGz2xzoL/HVXuVU GRl2CERt0WV6wMLw1lRyxFQi/2baQiZf52Hk8= X-Google-Smtp-Source: AGHT+IG+EfaUSRuCYNgIXCOVGPcSnpvwJpIFchUtzWLs0IluX42Pnng43VG4TYD0syBmYiIbkXtVmQ== X-Received: by 2002:a05:6a00:1943:b0:6ed:de6e:dd24 with SMTP id d2e1a72fcca58-6f4e02cebeamr16918823b3a.16.1715759306103; Wed, 15 May 2024 00:48:26 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: "Fea.Wang" , Frank Chang , LIU Zhiwei , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza Subject: [PATCH 4/5] target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 Date: Wed, 15 May 2024 15:53:35 +0800 Message-Id: <20240515075340.2675136-5-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075340.2675136-1-fea.wang@sifive.com> References: <20240515075340.2675136-1-fea.wang@sifive.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=2607:f8b0:4864:20::42b; envelope-from=fea.wang@sifive.com; helo=mail-pf1-x42b.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1715759345383100016 Content-Type: text/plain; charset="utf-8" Based on privileged spec 1.13, the RV32 needs to implement MEDELEGH and HEDELEGH for exception codes 32-47 for reserving and exception codes 48-63 for custom use. Add the CSR number though the implementation is just reading zero and writing ignore. Besides, for accessing HEDELEGH, it should be controlled by mstateen0 'P1P13' bit. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: LIU Zhiwei --- target/riscv/cpu_bits.h | 2 ++ target/riscv/csr.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 28bd3fb0b4..f888025c59 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -156,6 +156,8 @@ =20 /* 32-bit only */ #define CSR_MSTATUSH 0x310 +#define CSR_MEDELEGH 0x312 +#define CSR_HEDELEGH 0x612 =20 /* Machine Trap Handling */ #define CSR_MSCRATCH 0x340 diff --git a/target/riscv/csr.c b/target/riscv/csr.c index bdbc8de0e2..c5ff40eed8 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3225,6 +3225,33 @@ static RISCVException write_hedeleg(CPURISCVState *e= nv, int csrno, return RISCV_EXCP_NONE; } =20 +static RISCVException read_hedelegh(CPURISCVState *env, int csrno, + target_ulong *val) +{ + RISCVException ret; + ret =3D smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + /* Reserved, now read zero */ + *val =3D 0; + return RISCV_EXCP_NONE; +} + +static RISCVException write_hedelegh(CPURISCVState *env, int csrno, + target_ulong val) +{ + RISCVException ret; + ret =3D smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13); + if (ret !=3D RISCV_EXCP_NONE) { + return ret; + } + + /* Reserved, now write ignore */ + return RISCV_EXCP_NONE; +} + static RISCVException rmw_hvien64(CPURISCVState *env, int csrno, uint64_t *ret_val, uint64_t new_val, uint64_t wr_mask) @@ -4672,6 +4699,10 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] =3D { =20 [CSR_MSTATUSH] =3D { "mstatush", any32, read_mstatush, write_mstatush = }, + [CSR_MEDELEGH] =3D { "medelegh", any32, read_zero, write_ignore, + .min_priv_ver =3D PRIV_VERSION_1_13_0 = }, + [CSR_HEDELEGH] =3D { "hedelegh", hmode32, read_hedelegh, write_he= delegh, + .min_priv_ver =3D PRIV_VERSION_1_13_0 = }, =20 /* Machine Trap Handling */ [CSR_MSCRATCH] =3D { "mscratch", any, read_mscratch, write_mscratch, --=20 2.34.1 From nobody Mon Nov 25 09:31:58 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1715759344; cv=none; d=zohomail.com; s=zohoarc; b=IzK7lQY5Sq1S1JxtiqYmiQi7gC+A4tRa4svi6zQ4mbQ3Y9GbOrzLIrJYLoet3k3s1fzf4bEWeCsI1nddaGwEnC2Ecd0lbB7mgXarWiH8O53ObSSMy5IiaqlNgn9F22UfISfWpXPs/oRW6VqnBUK+fS+CEbqZar5ShU+HBNMZy5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715759344; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=puBYhI34uigvIMwKdPxu7OXATwqoJShcDnpckyqDkpk=; b=lKVbPReiP6jGXBvwiJQmuqbLsNSkEza8NrOuMIjKHvda6JfMZBI2rfW6RHOltQPrydfbnKm4U7t6P25d2NUJMNB0HLD9EoNhoMvis/Sej9UUOzDFvblOJinBXwEoGnmWTUzEEANWPORitsJs59rNukC3vZ6Xf/UDU51wTBnpAAs= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715759344091229.31141152852774; Wed, 15 May 2024 00:49:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s79NN-0008Lm-Dq; Wed, 15 May 2024 03:48:38 -0400 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 1s79NL-0008G6-2i for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:35 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s79NJ-0000Mg-EE for qemu-devel@nongnu.org; Wed, 15 May 2024 03:48:34 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6f4ed9dc7beso2710899b3a.1 for ; Wed, 15 May 2024 00:48:31 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2af2bafsm10389060b3a.162.2024.05.15.00.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 00:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715759310; x=1716364110; 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=puBYhI34uigvIMwKdPxu7OXATwqoJShcDnpckyqDkpk=; b=PxbDRFCGsqCTb7064Xn1x2Misu84yrPKKqC9bjv9jXxx48IJzwdgnW9KeF34hCnBV5 74TYzjIzucD6OTKcupD2dH+32z6O0lkX7OehqQJr+11V+BoGOydexC+mCyZrjFHS5uoT o0z0iE0AXsrVuqXE8nzgbwzUgzLfqtEy8PM4ASb/rK7N4+9DA4Uhh2TRl4lzcIOl5v01 1SY3Hmp8/8KiKgQhxNKUAoYwOCI6Z2bvN93lxLnkInuxGJafkmV6qihDXZd01Ju6Fh35 AJvOmyqBxt0HpQupiwJLkr2NYBZGo9pyclIFHRUtG1Vsu4Kd8mbq5Dgf7IAljTnlon8n rmTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715759310; x=1716364110; 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=puBYhI34uigvIMwKdPxu7OXATwqoJShcDnpckyqDkpk=; b=XLv2eEGJHTdgW3MEki6ssMwE2YMkKJ+ZJjvEt7rGM3gAmJUwEG9di5RDMf4/cfLpU0 PDlaL4GIZEkmmB4ioZg0Io8urpJTxsuCR5cd+SuePkuf3uIS4EJxOCrS0bIga/kF3yrD VYwh3OKE6b7vfNA9PzSo3GkM7+5BE9tSHS98jrg4ifKANjVraLVRVonVIUPpjkxAnrLl SUwNSJbsRizoPMzg6kUlYUMhrWRtw3GrXPdIgYOG038P0TdzD+TH73SBgCgf+dXKrb10 I2YnGLH/rXtc8RboYdHXzRrF9J4pHWlhlAayMWtN6oG/6EcI3Isd2h31M30Kd237o+iG A7rg== X-Gm-Message-State: AOJu0YxLeTvBKaVr/HuLXfCkTjUWDWq18icyFeoFiMndq4+6oO30nx+J IjRPuZ0E/K1W3t2QfBkWiEHe+RVXjGF2sB6pDATYSxyUTseauspGSg6Zj4TeCoKBPIVHYsF7tL5 5KOmoUV3izKhp5U6m2L6UzUbNCrgXVlhCVVAAUL6pEyYSf8ke2aKxcRnyXsi4sbgrCiBEhICpkz VKPOkgC8obMX3re4Ca8ztPqBw1FLmN3sQwvF4= X-Google-Smtp-Source: AGHT+IEAke5BLdsYSlbnHg+sx6yNTpK5RUV1Z0Qtu6pfRwYRjeeuQyo/dCuuB7wXEnDKlIoE1giFCw== X-Received: by 2002:a05:6a00:3d49:b0:6f3:e9bc:cc3d with SMTP id d2e1a72fcca58-6f4c90905a1mr27161537b3a.3.1715759310189; Wed, 15 May 2024 00:48:30 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: "Fea.Wang" , Frank Chang , LIU Zhiwei , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza Subject: [PATCH 5/5] target/riscv: Reserve exception codes for sw-check and hw-err Date: Wed, 15 May 2024 15:53:36 +0800 Message-Id: <20240515075340.2675136-6-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515075340.2675136-1-fea.wang@sifive.com> References: <20240515075340.2675136-1-fea.wang@sifive.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=2607:f8b0:4864:20::42f; envelope-from=fea.wang@sifive.com; helo=mail-pf1-x42f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1715759345349100015 Content-Type: text/plain; charset="utf-8" Based on the priv-1.13.0, add the exception codes for Software-check and Hardware-error. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: LIU Zhiwei --- target/riscv/cpu_bits.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index f888025c59..f037f727d9 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -673,6 +673,8 @@ typedef enum RISCVException { RISCV_EXCP_INST_PAGE_FAULT =3D 0xc, /* since: priv-1.10.0 */ RISCV_EXCP_LOAD_PAGE_FAULT =3D 0xd, /* since: priv-1.10.0 */ RISCV_EXCP_STORE_PAGE_FAULT =3D 0xf, /* since: priv-1.10.0 */ + RISCV_EXCP_SW_CHECK =3D 0x12, /* since: priv-1.13.0 */ + RISCV_EXCP_HW_ERR =3D 0x13, /* since: priv-1.13.0 */ RISCV_EXCP_INST_GUEST_PAGE_FAULT =3D 0x14, RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT =3D 0x15, RISCV_EXCP_VIRT_INSTRUCTION_FAULT =3D 0x16, --=20 2.34.1