From nobody Mon Nov 25 06:49:29 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=1717482235; cv=none; d=zohomail.com; s=zohoarc; b=URBKRJxHN5JY1BBh60gnURpSOo8PSmnQ2y+lmIA5xxc4veDslfL6cRETx/PoNfN1OGw6UqLvLDj/uxzVTTmgf2+qzk1k8RhTrzzlyjFtbAx5dPq0+ujCR/qD4HGXAQUv/Rs6RSB1DKFzIjSeU2kYCbPxO6qceYFhE6zS2f6EJ+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717482235; 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=nmHsMUz/pX/ZNVmgFEjShgDAW9pA0BGkng6p8nimz/0=; b=C84F39SuwCFZKjM5T74JSwvpO/kbyDA+67osa2iMyGXnYSI9JeUlffuL7hpVsBS5eCS3Lz4g5pye8ub0qEXt8iws6fqh8NkMauGGLoKKFYzKsxD6b1iXaiUakbDuvMgpEOlj3xWKmZ5pLXOb9a6YJHQ/xudUhsd+4kQF582ZUxg= 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 1717482235592838.2759368404716; Mon, 3 Jun 2024 23:23:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sENZH-00078A-7v; Tue, 04 Jun 2024 02:22:47 -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 1sENZF-00077R-FS for qemu-devel@nongnu.org; Tue, 04 Jun 2024 02:22:45 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sENZE-0006f8-0e for qemu-devel@nongnu.org; Tue, 04 Jun 2024 02:22:45 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-681bc7f50d0so3717802a12.0 for ; Mon, 03 Jun 2024 23:22:43 -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 98e67ed59e1d1-2c1dcb56014sm7115617a91.25.2024.06.03.23.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 23:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717482162; x=1718086962; 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=nmHsMUz/pX/ZNVmgFEjShgDAW9pA0BGkng6p8nimz/0=; b=MJ8XF/eGIPxYDh1V8+dwOdTcUeGIpv9jWZjs2mTM7ctMsSD0BTB++W6TNjI8RwuFOj W8qoFktr1vGx6jezCZmVYp2PZYofLv820n6FNVSqTtHbuLKQv24D6GwV9aHTcwUpg3UU 1QJRP5NEjO4oOwZSPn0UmFCLsufH/ZtO+aChK+IY4/v7eWYmVtpk3G2WUHBfcBE46Uu+ seK4zGvkA8/5/G10l2jHOB5hmMKmqd06/rjca4hvm+MELR215+ZhvmtgkEFlm6CEadUo xHQioChB3kvJsgbUyPRAHnzHoNg1bxw5AFB1GsfDK8WeutRcYkhlDbRzUcinhJq/c+uQ yhTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717482162; x=1718086962; 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=nmHsMUz/pX/ZNVmgFEjShgDAW9pA0BGkng6p8nimz/0=; b=J6DEt3BzZgwHn31Aw9G5tSWAXIHaAmgedUzad6dyPZAMCkFDe//aWviBeDFWvaQsIx psyMJhG38o45Uj1KK77cqTtsBiXBbAsCsCt7fcN7RFlrGe3vkFiHK6+Kh+SCwgnP7koo wvEJ7e/5nSZDmuxyJlpGSj5Lwj05dCSLjYuautBpvcb2a+it6kqm2KTT77YZMJBkHou0 2uzbUZExvpfOuxX9i5SSwtsXXurAHzm+Wiq/3b3VJvBRsePAjVqaNeqtxSLze8Ht3vPu WBgEFxvkH4R/W5squ6sW12vM7OQgaSIeiPx+/lyzeu1h1uvucLzbmdmLtI9Nm25NW8dJ I3Mg== X-Gm-Message-State: AOJu0YxcvajESobokmI4sNDQLlev8uWWIzC8tssTB7eN9NTD1VUwnAWa sKNPWi73e4+3cG3fjMEUb2i3Xb0shLvLegTLuIKQyF+dB9zUDown8dRUQQzPAkueBK+XGzzBXch RvqcOryNN8TpfTZNy4zQbq6qu0WrfMErbfdxQj5TllQcOf8Irr3Gl37NAZexTZGRYemMH13UiZs VydXtRFIYFgqmG8Bx47ouv66Jj0mu2ibJ8+04= X-Google-Smtp-Source: AGHT+IHwrIBPeu8ZA4jxr+7tSS0LNAvYWM8ligKABX8KT4oNDKXAocPojh0HibtDWbkvHKCqGGk+zQ== X-Received: by 2002:a17:90a:d150:b0:2c0:93e:df44 with SMTP id 98e67ed59e1d1-2c2530b584emr2600172a91.17.1717482162127; Mon, 03 Jun 2024 23:22:42 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , "Fea.Wang" , Frank Chang Subject: [PATCH v3 3/6] target/riscv: Support the version for ss1p13 Date: Tue, 4 Jun 2024 14:27:44 +0800 Message-Id: <20240604062747.9212-4-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604062747.9212-1-fea.wang@sifive.com> References: <20240604062747.9212-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::535; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x535.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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1717482237485100009 Content-Type: text/plain; charset="utf-8" Add RISC-V privilege 1.13 support. Signed-off-by: Fea.Wang Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei --- target/riscv/cpu.c | 6 +++++- target/riscv/tcg/tcg-cpu.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index e9e69b9863..02c1e12a03 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/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 60fe0fd060..595d3b5b8f 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