From nobody Sat Nov 23 19:46:40 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=1731402777; cv=none; d=zohomail.com; s=zohoarc; b=VX3hq/4l1xvr2wLimxexo2irSFGyJmRD3WS/JIDP9j+gLP1DqHfTcSF6Mh1hkGtwRvxDXUk5/A1AJrobRtw5hvjTyHl1dVnVP8F8D3cn9IW/dWcIL7/Hc4DQAxLgrQE2sHYlcgy2CaTJ1EhZAs6FFlWe5J59w1MpRxCXUaNx3Mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731402777; 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=1E42IsZBE7HGFFYOrQ3x+O3byf38/OjcoUURin3swXE=; b=d6aadgZ5aRed80hNVHBcJTvWH/p3+OdXbzlxy323DZerl9bBn8dwzYjsRFVyrWfmrnEP/1kmrq4rZhBFiySTJKhHqne4rUTkMQsQIdfzZVPYxgtc6bH9nErUlH0FRybkCg1aAP4Dotk33/8r6KkKlX5P1FZJDMOsFJIvvI2yusw= 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 1731402777455745.7383547555279; Tue, 12 Nov 2024 01:12:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAmwd-0007X5-Ku; Tue, 12 Nov 2024 04:12:20 -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 1tAmwS-0007WK-4N for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:08 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAmwQ-0007jO-FV for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:07 -0500 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7ee4c57b037so3954124a12.0 for ; Tue, 12 Nov 2024 01:12:06 -0800 (PST) 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-2e99a4f6c96sm13495347a91.2.2024.11.12.01.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 01:12:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1731402724; x=1732007524; 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=1E42IsZBE7HGFFYOrQ3x+O3byf38/OjcoUURin3swXE=; b=NhxkXzws6VF0gwD7QHckW6cYBQjj9aBhaeEtUK/RmGLX2AOlCTNLlNpTkMQ2dUFgVE DbLxQ6b/fiOz9msQULgkJFEHLSJ9zk39xMxzcOT/D0UMoJyHDfx/f81t/k/jvtq2ZroH mk62PLl4ofFvpXWr9fvYchwkp89Og/xB85LZZwGyw9C4ell2wbq5AQSYPpzB8F+vvYTc cLwRaB9if6P5aPC5PEvvoQKfmRunKtCLe3KRcGc3D8ASvUDkhq0erpZUsTTbIAk7cPeC 0KytaH8nVs6SUNws4qux8m82zJgWt2CWCzdpNNsvHAuwGul2gjx43JqczzK5F0nCo26s aZeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731402724; x=1732007524; 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=1E42IsZBE7HGFFYOrQ3x+O3byf38/OjcoUURin3swXE=; b=EMPFhNbF6EXWuhB+Opx0b7ObHcNslfE6+uS5egL47UliG+HXcba1jqZzQYv4Ca+PMN eP2aB8QOUgNMuwhjJSaNKQ7LRpcGB49blU1h0qMxuNcjqW0KEto3WB0aEskzzMlzyE6t e9eZAbhQ3ypz+dEPnkWYJXBaBV222pfo+0VwJMfTdLnuojXkwcJnEmLLKLLnBbImvCcZ xRHP7hW8Pc/83x/vEz6wzxfAoHUUC36kg5jw/CTCcbrt1GbF8VmEOueLsqmSo5/AnxaI kqIY2riSO0/4bV7k5nWkIrdgmTXDH80ua4L3J5GEv6JSbS2zB//4xBCduD+/r4na/6fA VZcA== X-Gm-Message-State: AOJu0Yy3OFJqQx7mTJ6V7uUZKlbudQQn9JT9hOahwZbLDt38edLRlDP/ ADHTlSpMkJQO7rOhEEJcCtvDajdEtds1I6GsZGXSn9/ZiLPi0/l6iLDSrWvjH2TVF+CVv75WUF/ bHywFgD02n1Y5vXqPGg2uKDude720O4mlEjTKErwGkCeYbjOFbjbDcbPIfo3n9/PsiAigvNnc0r hvscQRwFPdUKxP1dZBXgc5Kv6coAMvEaTGyV8= X-Google-Smtp-Source: AGHT+IFm6DmEv77h3jMrkVTytuLwa/AhmZuDeu6IpjIjoQKiHPFt96PL1sno/O8pICd2xJRNPsiF0w== X-Received: by 2002:a17:90b:35c1:b0:2e2:af52:a7b7 with SMTP id 98e67ed59e1d1-2e9b1785684mr21068570a91.34.1731402724477; Tue, 12 Nov 2024 01:12:04 -0800 (PST) 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 , Jim Shu Subject: [PATCH v3 1/5] target/riscv: Add svukte extension capability variable Date: Tue, 12 Nov 2024 17:14:19 +0800 Message-Id: <20241112091423.2529583-2-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112091423.2529583-1-fea.wang@sifive.com> References: <20241112091423.2529583-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::532; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x532.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: 1731402779730116600 Content-Type: text/plain; charset="utf-8" Refer to the draft of svukte extension from: https://github.com/riscv/riscv-isa-manual/pull/1564 Svukte provides a means to make user-mode accesses to supervisor memory raise page faults in constant time, mitigating attacks that attempt to discover the supervisor software's address-space layout. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Jim Shu Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu_cfg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h index 59d6fc445d..d8771ca641 100644 --- a/target/riscv/cpu_cfg.h +++ b/target/riscv/cpu_cfg.h @@ -84,6 +84,7 @@ struct RISCVCPUConfig { bool ext_svnapot; bool ext_svpbmt; bool ext_svvptc; + bool ext_svukte; bool ext_zdinx; bool ext_zaamo; bool ext_zacas; --=20 2.34.1 From nobody Sat Nov 23 19:46:40 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=1731402834; cv=none; d=zohomail.com; s=zohoarc; b=IvA+khBBTIzbqRj2vNAF0M7JWvKV0oMqDDhBak82sQ4QLbYZUhv/LHhMUery91IS116bnO/3uA1wuSkJAkVhXsxUR9Ub31DNWmCt0Zc6f1iAnp9KhRyrthtv4XATu/uuT9OuvCQ/mTjke3AQY9oZwvpqwjZTUn+2Dy43cpDYEHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731402834; 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=0c34hxrwlKiDfAhthRfad0+IjKl7JigOsGotvoYbcI0=; b=QTC4aSIOGDp9P62tQ8igbVFIwaBzdFCrNih4EX3cJImo87G2OlF9iKdPdKRtCWa1PiTa/udUFjOVrSbTJY8o/aWOpVK5KnztnEwvJ9HyA3ew3S+bjC2baZsqXaALchVRiEtp5fbyH9ZbhSGIxVI3WJseZeu4ncPfkBJBBWePfHY= 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 1731402834935512.2961158892289; Tue, 12 Nov 2024 01:13:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAmwi-0007ca-St; Tue, 12 Nov 2024 04:12:25 -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 1tAmwW-0007X2-AD for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:12 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAmwT-0007kF-JX for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:11 -0500 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-7e9e38dd5f1so4088682a12.0 for ; Tue, 12 Nov 2024 01:12:08 -0800 (PST) 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-2e99a4f6c96sm13495347a91.2.2024.11.12.01.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 01:12:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1731402727; x=1732007527; 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=0c34hxrwlKiDfAhthRfad0+IjKl7JigOsGotvoYbcI0=; b=SXvc4HLnGczTRaDZjUlvM/3BqA9e32hPKGbk+7sBJJMa1CuCKsst423QhQUEzqY/Bf wdFdYpvCqZI4ygs4QNYle9iITYIpR/IYDx+je+mBQW134JlSIPMBV/kYA3bfHVnG+6HW njvlKPK/uru5kwFSP1DUFqj1MI17KtuepNjiqr63La6LLM54e+Qjvk47zWJtTBbBg4eh NKZKZ4msdcJqX54ioI6HD3E6ySwwM1JYJKAfVi1+ZVaOeNz499ABLzaZQJG3K7/BvSKZ xk0Cm6ewnkWzT5VA/f2tq/RE91dExeM2drhbvzJ42Hml7fnAkXC5D24Hf5I1Rup4wYn+ c4HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731402727; x=1732007527; 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=0c34hxrwlKiDfAhthRfad0+IjKl7JigOsGotvoYbcI0=; b=MuzqabORkuk2xCW1aOn8qBgLEqNQx8RqXOxnCBBrDGWt0cR7swvtkFcmsiPS4JnYsD ewAEIPnV9imsXV1UtcrOsOcPgIBgggWeD7lXJCoQwTeTKoWdtxHjKAbj3fOrxyG//lB3 tdCAFL45jZEl1ZHEcrN5gdoqfH7v1CLU+JWwRw5Sul7iNb5fWbUXRxbpfUoWva1Sy0qp waJJNPY+E0UEpVMPt88Kxj/+vuY8RnAEBhCGLKrAZwC88f/aAEBRKL7uEMeYaxMiuVYG p1lUxGomhhkzxyZx8iPvr9W5LqIDQuR8pd6RWjE52Hfe+dKh5+TqnBa9eRIMyG/xL4KM 8A9w== X-Gm-Message-State: AOJu0YxsJLJdOOu0i/yWJ6tS3IPOTwU9G9OPoV9QWidTHGbfO7UYM/I9 Q421ZVt4rGNqa1/DGaAR1bEk+tatonMCsfL2oAersDaIcS9GnIZ/iovEvBzXcIdUZHsZ0ulSN4n ejCveXLoViJ7FdJG1EEpq6QuUv6XROqM7YVIfCBwCNVRcBMYd8VqPFNqek0KHHNkayeufrfF+Un hbtHaEcRFBbR7UzR0ObabWZCVhWishmfNGYXE= X-Google-Smtp-Source: AGHT+IEYW3KgrEsOWfQXzP2K/rvNfxQfm8dV2eTEteoVeB1kLHOPkpOz0g/jtVAcJ4+L4WGSTk+/sA== X-Received: by 2002:a17:90b:4b91:b0:2e2:b46f:d92c with SMTP id 98e67ed59e1d1-2e9b172023bmr19677440a91.14.1731402727448; Tue, 12 Nov 2024 01:12:07 -0800 (PST) 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 , Jim Shu Subject: [PATCH v3 2/5] target/riscv: Support senvcfg[UKTE] bit when svukte extension is enabled Date: Tue, 12 Nov 2024 17:14:20 +0800 Message-Id: <20241112091423.2529583-3-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112091423.2529583-1-fea.wang@sifive.com> References: <20241112091423.2529583-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::534; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x534.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: 1731402835942116600 Content-Type: text/plain; charset="utf-8" Svukte extension add UKTE bit, bit[8] in senvcfg CSR. The bit will be supported when the svukte extension is enabled. When senvcfg[UKTE] bit is set, the memory access from U-mode should do the svukte check only except HLV/HLVX/HSV H-mode instructions which depend on hstatus[HUKTE]. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Jim Shu Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu_bits.h | 1 + target/riscv/csr.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 385a2c67c2..4b9f899217 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -785,6 +785,7 @@ typedef enum RISCVException { #define SENVCFG_CBIE MENVCFG_CBIE #define SENVCFG_CBCFE MENVCFG_CBCFE #define SENVCFG_CBZE MENVCFG_CBZE +#define SENVCFG_UKTE BIT(8) =20 #define HENVCFG_FIOM MENVCFG_FIOM #define HENVCFG_LPE MENVCFG_LPE diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 9846770820..1936a6f32a 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -2453,6 +2453,10 @@ static RISCVException write_senvcfg(CPURISCVState *e= nv, int csrno, mask |=3D SENVCFG_SSE; } =20 + if (env_archcpu(env)->cfg.ext_svukte) { + mask |=3D SENVCFG_UKTE; + } + env->senvcfg =3D (env->senvcfg & ~mask) | (val & mask); return RISCV_EXCP_NONE; } --=20 2.34.1 From nobody Sat Nov 23 19:46:40 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=1731402846; cv=none; d=zohomail.com; s=zohoarc; b=gA/ojtlV1XadFAY4DkvAbmzV+NeGybkLHa8evn0gdA2AU1349E5fxKfJ2FyO/O4R0NV55r0vpFr22etONhVguJV92yg3WvxSwLzUJXA3QLl2dmvFAeq/iAjZ6MiCLnakszA+WcRa9qQPy32lB9qNjG5P5qmXH31xDtY7GdCZ4A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731402846; 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=ta9zlJxceH6xvI0lTGE/GAG3tOR+/5oYHysvex7gkPA=; b=UBSePdPXLxtvPLABWl0vP5eZ7AnuGDO7HjC/JpcwHifmh8KvwJ6kG0YVYG/jvzyLlWUm4qcz9NR7TLmc13xn9oamha2j6b6RDUY77EYAJluk1PAGNMf1ZyF2H6PqV+5ov3cReu8L4m3pBxsx0IHoTClDeVjSZqAEgeoCQ0QJ9Tk= 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 1731402846950876.9103045147244; Tue, 12 Nov 2024 01:14:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAmwm-0007dI-QW; Tue, 12 Nov 2024 04:12:28 -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 1tAmwX-0007XU-TJ for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:17 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAmwV-0007ki-TI for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:13 -0500 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2e9b55b83d2so3075839a91.3 for ; Tue, 12 Nov 2024 01:12:11 -0800 (PST) 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-2e99a4f6c96sm13495347a91.2.2024.11.12.01.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 01:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1731402730; x=1732007530; 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=ta9zlJxceH6xvI0lTGE/GAG3tOR+/5oYHysvex7gkPA=; b=MNxk4F2sYqAUGV/7tdIYEfAl8Mm3QZMJEIjVSWg3UB2pDJyVwyqrMXJudc4CytwyHd EQD1NnK9L/WT+o0VPOtBLjXzI6ifLb0XTIe1RoQSczaB75At+GKZLIuZUXfnJ6WVkb6K ZTNat1b20M8QM9xd4RWviWNu2kQe2AUzM3I9QkAqHqqa7CaCYWsw7xSugINJ5ImVkOAz Logveqlak7nle9B28C0Z4dWoBnG8dee6HjTmvf0Jpu62Svhz4FJTA9OW3DHl4MwfLsme M0/ZAWgzjDnlNDNQSnSFaVd0aiqnUbgZ3WUo9LYf2RafopAdcx4NFoJHSdmRl0+B4XJ5 kVCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731402730; x=1732007530; 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=ta9zlJxceH6xvI0lTGE/GAG3tOR+/5oYHysvex7gkPA=; b=ZUEcpwGQbjRnnVy9STr8qlDoYOmgbt8ZtKZ2nJHVKIGYSqEHysop6AUVyrHViu+HIS UDW4VBVedRykNS03/9vXN7yd5GnK1Bdh52Gr3Yea6PczunuoEwuR5ZU7JhnuwX8+eUJG B6yfSfN/xHdb2s9iqIdMikqQo8u1MNHkCVYCBoLapXrzgECEHqyrGJ3oyodPuk4ZRaUA IqiP3uNn6GptnAEOAB7D1yA5v4FznV+xIHvBXPRFPEWP8nejfgHf4CO0oNvsutc+dbt6 15MxvUqOFTnhYdRVSHztszclU2gWCFkcnYXmIYoIApis02FxifrEytNjyw7wQroLzYUQ NVSg== X-Gm-Message-State: AOJu0Yy6/LYTiPuFuz6kFVnP1+wC+EPWUNT72JTOBYL42jVIdqIF6U5R dRg9kpEXaG8F44vLbkQ++8B9TaG9TYBpvvNhxP44vjUCY8hd+k5YL4P8rNn345NqkhVts6nE+QN IhGa8IEAaRkpjWPwdQhi1Nwzdnp28B6Wy/Ehl0z5qlc/vU0UjdVR4xc2UeJNDHRk6wMnYIZWX5X wqX8v87Pr5+igmSAXalUALm0hnHRcmF/M99Rk= X-Google-Smtp-Source: AGHT+IGG6YUoo8cyGL2W+pkYbQX+8vHpSZ5U0MkHdyeX1Fb1XCMofv8St8FOawzptzLBPVC6scLKPw== X-Received: by 2002:a17:90b:3d09:b0:2da:8e9b:f37b with SMTP id 98e67ed59e1d1-2e9b172af1fmr19875487a91.24.1731402729920; Tue, 12 Nov 2024 01:12:09 -0800 (PST) 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 , Jim Shu Subject: [PATCH v3 3/5] target/riscv: Support hstatus[HUKTE] bit when svukte extension is enabled Date: Tue, 12 Nov 2024 17:14:21 +0800 Message-Id: <20241112091423.2529583-4-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112091423.2529583-1-fea.wang@sifive.com> References: <20241112091423.2529583-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::1031; envelope-from=fea.wang@sifive.com; helo=mail-pj1-x1031.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: 1731402847862116600 Content-Type: text/plain; charset="utf-8" Svukte extension add HUKTE bit, bit[24] in hstatus CSR. The written value will be masked when the svukte extension is not enabled. When hstatus[HUKTE] bit is set, HLV/HLVX/HSV work in the U-mode should do svukte check. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Jim Shu Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/cpu_bits.h | 1 + target/riscv/csr.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 4b9f899217..fe4e34c64a 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -604,6 +604,7 @@ typedef enum { #define HSTATUS_VTVM 0x00100000 #define HSTATUS_VTW 0x00200000 #define HSTATUS_VTSR 0x00400000 +#define HSTATUS_HUKTE 0x01000000 #define HSTATUS_VSXL 0x300000000 =20 #define HSTATUS32_WPRI 0xFF8FF87E diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 1936a6f32a..b6fa8ae53f 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -3540,6 +3540,9 @@ static RISCVException read_hstatus(CPURISCVState *env= , int csrno, static RISCVException write_hstatus(CPURISCVState *env, int csrno, target_ulong val) { + if (!env_archcpu(env)->cfg.ext_svukte) { + val =3D val & (~HSTATUS_HUKTE); + } env->hstatus =3D val; if (riscv_cpu_mxl(env) !=3D MXL_RV32 && get_field(val, HSTATUS_VSXL) != =3D 2) { qemu_log_mask(LOG_UNIMP, --=20 2.34.1 From nobody Sat Nov 23 19:46:40 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=1731402823; cv=none; d=zohomail.com; s=zohoarc; b=miuAyy1hKegTHZboKQwJZS8jeHBWpgjJTPcMDpcd+GMIp9QG8g4BOoBYAsMwehZ4kFcfGqB3pEqcNPsS/rEy6OqhKBZ5rCp3Fur/mwDPnRAll5TgKDWZ6ks2SBOn/PVYSnoUqzpKCzL24+JTwMSy8U9X6s3/ZKX05LVbc8/hWfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731402823; 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=Or39Asyq2WcOevg1FvpeaHy7EaesyoBx5lPamPpthoM=; b=bBIrau7uQYn4jdP1gt66h5vp8MQ4+L6VPtZ1mgZBV+2hVGAWKLt3rzQ+0sIXxgxCUYULDXOXgzUBjpSmdB5KLKNIWmIjTNL6oL8OBDB5liL4/KmF2wqpqMCqwi4j28u8zGNt+ZkKix4tnjjl4MdvOYP5qEIQ5Nahst09GVdRkxQ= 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 17314028234641020.923353698462; Tue, 12 Nov 2024 01:13:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAmwp-0007gE-Jg; Tue, 12 Nov 2024 04:12:31 -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 1tAmwa-0007XX-RH for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:19 -0500 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAmwY-0007lV-E1 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:16 -0500 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7f3da2c2cb5so3785550a12.2 for ; Tue, 12 Nov 2024 01:12:14 -0800 (PST) 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-2e99a4f6c96sm13495347a91.2.2024.11.12.01.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 01:12:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1731402733; x=1732007533; 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=Or39Asyq2WcOevg1FvpeaHy7EaesyoBx5lPamPpthoM=; b=CNOjSwLUSB5LDdleNyaOfsusjmsph8VgEIrfYtbcM6Xx6g69fQ1LLPm5bQqGnwYTWy MYjfysNr3OLycQqXOXdLn/D/kA8jpUVAoq8bHh3DAnYyQ17GqjT2TM2i6CPfXoNleLa5 il8njviSjN+tdG1+PLbpwryyBBbF7wfGL/hyTHJxDPRSVLWMczlkBeEC4BB8vzjygWn5 WX/5AMmSzCjJ/KGx+wn6iXZvrMbVpADdMJMNRlGj3d77i+zLynK0R2FXKT18ve3O4v4Y IUu8sRDiMHVUtDlUEudT7z7UsFn40vn97IitHtfTZATQRGJkzbDfSKnzvNYcygEyQNZO FwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731402733; x=1732007533; 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=Or39Asyq2WcOevg1FvpeaHy7EaesyoBx5lPamPpthoM=; b=Ok/mP9g80VTIj645M/trT71TEvNemcPv4c8F4tEQnYAaxt+LqagKv/CzqyULXW9kh4 AKUWmFOep2KkgIhURn31E2wzIxV7pW44Hx5cs9IZY9QFbDG1usKuRuiPlCnlw//Ef5W1 WBwtmbQo6nZPFpA/S3vkEfpGApDanzKc+a7jCHuW06ExItqBUHWlJQ7WR1dLk/Xm4YJj f5SVq0nbFOOrP40+theowNG5FS6yP7yPWdIsHQ5K5cvqhLqoT6G883SUZYRQbYluR6GT RAfjJQjHFdUxhvsmpy14HL9QUVqQOgyTQ9NMD20Y6gTfKmk+NLoT5/bbm00PNcbvf+op HDxQ== X-Gm-Message-State: AOJu0YxskkIehV73aZlyaDqOO36AQ+sz0pM5Yxmggm5i/JawxFEfc7CJ lLr+N8r2ScSqjCgg4KNncxBfdgt6M030PYlM0zDmVPL3FI34z8Tvcwfju/ZbsyBaRHlPED0pA1v bhWH6+qiihl5qbjf4BLef9yohcDB1aRJGUqxCfPo0/czS+V/1gbAyFO5TdfEZIlKGrwxXcVm4si ueIxDMVKBWg3egeRh3uy8HqnGyMyeaM745968= X-Google-Smtp-Source: AGHT+IGhp/SBPIH6KNAvbjUW72Fx7Irq+8fYAD7u9t9cbEn+/GAom3C0zk+Ta/aXIRkIQvUeLdXeLQ== X-Received: by 2002:a17:90b:3811:b0:2e2:bf7f:3369 with SMTP id 98e67ed59e1d1-2e9b16eb57bmr21010199a91.5.1731402732509; Tue, 12 Nov 2024 01:12:12 -0800 (PST) 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 , Jim Shu Subject: [PATCH v3 4/5] target/riscv: Check memory access to meet svukte rule Date: Tue, 12 Nov 2024 17:14:22 +0800 Message-Id: <20241112091423.2529583-5-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112091423.2529583-1-fea.wang@sifive.com> References: <20241112091423.2529583-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::52f; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x52f.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: 1731402823832116600 Content-Type: text/plain; charset="utf-8" Follow the Svukte spec, do the memory access address checking 1. Include instruction fetches or explicit memory accesses 2. System run in effective privilege U or VU 3. Check senvcfg[UKTE] being set, or hstatus[HUKTE] being set if instruction is HLV, HLVX, HSV and execute from U mode to VU mode 4. Depend on Sv39 and check virtual addresses bit[SXLEN-1] 5. Raises a page-fault exception corresponding to the original access type. Ref: https://github.com/riscv/riscv-isa-manual/pull/1564/files Signed-off-by: Frank Chang Signed-off-by: Fea.Wang Signed-off-by: Daniel Henrique Barboza Reviewed-by: Jim Shu Reviewed-by: Daniel Henrique Barboza --- target/riscv/cpu_helper.c | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 0a3ead69ea..5b29344c4f 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -857,6 +857,61 @@ static int get_physical_address_pmp(CPURISCVState *env= , int *prot, hwaddr addr, return TRANSLATE_SUCCESS; } =20 +/* Returns 'true' if a svukte address check is needed */ +static bool do_svukte_check(CPURISCVState *env, bool first_stage, + int mode, bool virt) +{ + bool ukte; + + /* Svukte extension depends on Sv39. */ + if (!(env_archcpu(env)->cfg.ext_svukte || + !first_stage || + VM_1_10_SV39 !=3D get_field(env->satp, SATP64_MODE))) { + return false; + } + + /* + * Check hstatus.HUKTE if the effective mode is switched to VU-mode by + * executing HLV/HLVX/HSV in U-mode. + * For other cases, check senvcfg.UKTE. + */ + if (env->priv =3D=3D PRV_U && !env->virt_enabled && virt) { + ukte =3D !!(env->hstatus & HSTATUS_HUKTE); + } else { + ukte =3D !!(env->senvcfg & SENVCFG_UKTE); + } + + if (!ukte) { + return false; + } + + /* + * Svukte extension is qualified only in U or VU-mode. + * + * Effective mode can be switched to U or VU-mode by: + * - M-mode + mstatus.MPRV=3D1 + mstatus.MPP=3DU-mode. + * - Execute HLV/HLVX/HSV from HS-mode + hstatus.SPVP=3D0. + * - U-mode. + * - VU-mode. + * - Execute HLV/HLVX/HSV from U-mode + hstatus.HU=3D1. + */ + if (mode !=3D PRV_U) { + return false; + } + + return true; +} + +static bool check_svukte_addr(CPURISCVState *env, vaddr addr) +{ + uint32_t sxl =3D riscv_cpu_sxl(env); + sxl =3D (sxl =3D=3D 0) ? MXL_RV32 : sxl; + uint32_t sxlen =3D 32 * sxl; + uint64_t high_bit =3D addr & (1UL << (sxlen - 1)); + + return !high_bit; +} + /* * get_physical_address - get the physical address for this virtual address * @@ -894,6 +949,7 @@ static int get_physical_address(CPURISCVState *env, hwa= ddr *physical, MemTxResult res; MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; int mode =3D mmuidx_priv(mmu_idx); + bool virt =3D mmuidx_2stage(mmu_idx); bool use_background =3D false; hwaddr ppn; int napot_bits =3D 0; @@ -901,6 +957,11 @@ static int get_physical_address(CPURISCVState *env, hw= addr *physical, bool is_sstack_idx =3D ((mmu_idx & MMU_IDX_SS_WRITE) =3D=3D MMU_IDX_SS= _WRITE); bool sstack_page =3D false; =20 + if (do_svukte_check(env, first_stage, mode, virt) && + !check_svukte_addr(env, addr)) { + return TRANSLATE_FAIL; + } + /* * Check if we should use the background registers for the two * stage translation. We don't need to check if we actually need --=20 2.34.1 From nobody Sat Nov 23 19:46:40 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=1731402756; cv=none; d=zohomail.com; s=zohoarc; b=OL2BqGzYBB1qVbgaNUgAT6i9lofYj41+qbkvNdcN4evS2aIQBHtMNLnYxs7VB3Y+bnaV/DiOBEuFTXSEnDWlU5x98EP9TKnBnaDjQqHfH6jpwKpDnx0pCf5qE/jpAym5IK3fnPERM6javJk8pH+/aANpf7D86XhKEzHgy7k3qss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731402756; 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=/2idqT13QPvUk3XVWjtSkj7B7YJJ2J9H2nJZEXZzEVI=; b=PnvTRCxbIvI5MRcRyHVt5Xk/EuXsaJyhmi20m/irkJqrRUkRSY+SD3FpPl9fu5ngVm0cOffiyUGWB9zAtirpzSUky8Jj5800zqym4OU4PlmP0GOSlNlIqE+Bo1pzt5uuIyVzYmKEAM1IcKYlVFdDpos+9NafNAyvc4ykYBbxScU= 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 1731402756441608.5769633605767; Tue, 12 Nov 2024 01:12:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAmwi-0007cM-QL; Tue, 12 Nov 2024 04:12:24 -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 1tAmwc-0007Xo-Rh for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:19 -0500 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAmwa-0007m2-PY for qemu-devel@nongnu.org; Tue, 12 Nov 2024 04:12:18 -0500 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-720d5ada03cso5448177b3a.1 for ; Tue, 12 Nov 2024 01:12:16 -0800 (PST) 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-2e99a4f6c96sm13495347a91.2.2024.11.12.01.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 01:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1731402735; x=1732007535; 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=/2idqT13QPvUk3XVWjtSkj7B7YJJ2J9H2nJZEXZzEVI=; b=g4LdPZGOCGgu8mS5v93+0T8icaV7VeSbvSjvz0eKaSBBftYBeN9OB7daT9nFRtreGg v6DadDtdPK0blaFj9GhwVpnhsAfremVpwqZvd7Vk8wKuS0KGzVU17hPPQmCKFcKR0DlN caEnkLoe4nqL25dKwUGGvcCbKTcDhnZ/39Me/ry4Gbmk2Wcmwg6Gg7aTWm+GpwNfjx9n 4RcyolSVm0+//cvaUldqotuslXwy7smC2k2Drj6jfkX9as1M9fgLhNayiErvnPpCtJKl JZ9NfNd03IUMQhkRjijlM/SlAEv/yNLOGzXDxwLFU+sLmUHqumd3/pr26DCikBJIVnKU fMtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731402735; x=1732007535; 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=/2idqT13QPvUk3XVWjtSkj7B7YJJ2J9H2nJZEXZzEVI=; b=gW3S3CiKolwfTkbgINNE/sPjU85YyiCNkIEzdF7GM4BpbkqADMCU4y1DmUJd9E+1ZR IA1TdIQE4tjbqXd02Nwa7+5hU6ltmOo58UiLVBpwGG8qCt+FQfdp0rHm3sk/5+d/IrxE lWzlXie5zJVQCMCH47uauFcMwKyacPOHKdCameq7XoZWZJEh3u1U/CI2sq65ym5uJ7uL F4jHy4wEuQaiAtf8clPqrv/U/rTGkc2jyMK93Pl8QykeWYah1iO4NEh/4ldcbkMUrh++ J1DMD09U/VyKA0W0qHF4N69J8x89GBbwrahq0xVvn5jPh5VcEZ0qE/vn0PwLaY+BBup3 YR1Q== X-Gm-Message-State: AOJu0YxvdmDA7yuReSf/W51JI8t8tXgkbVckX2LiZHKqBOxfNKGVdBYt T66CkFG4UrpydIz3Rkm2G1Ty05YZ67XtwaQ0F27rVSCs7wCET1e3L02ZtZndNJKokYrbApL5sW1 77wh25fwO73Ma7CCuaJhQPcn7O/QdaAIDdcoPOOmhO5GhZaLBlCGho1t0EHdMCVLNXlCwIH7Zqn D/8/dTYIruL7HFh1X2LtGS75zwRi9prM0waW4= X-Google-Smtp-Source: AGHT+IHoJ2sRzkUZ8/zP31ZvbTnw9jYyNXPIzwNYiN6cZn1zEfAavOFVqO245cT2/0YyWAm3xdDSLA== X-Received: by 2002:a05:6a20:7f92:b0:1db:92be:1276 with SMTP id adf61e73a8af0-1dc228ebf86mr22709910637.6.1731402735058; Tue, 12 Nov 2024 01:12:15 -0800 (PST) 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 , Jim Shu Subject: [PATCH v3 5/5] target/riscv: Expose svukte ISA extension Date: Tue, 12 Nov 2024 17:14:23 +0800 Message-Id: <20241112091423.2529583-6-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112091423.2529583-1-fea.wang@sifive.com> References: <20241112091423.2529583-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::42c; envelope-from=fea.wang@sifive.com; helo=mail-pf1-x42c.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: 1731402757783116600 Content-Type: text/plain; charset="utf-8" Add "svukte" in the ISA string when svukte extension is enabled. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Jim Shu Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f219f0c3b5..6d3e9d563d 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -199,6 +199,7 @@ const RISCVIsaExtData isa_edata_arr[] =3D { ISA_EXT_DATA_ENTRY(svinval, PRIV_VERSION_1_12_0, ext_svinval), ISA_EXT_DATA_ENTRY(svnapot, PRIV_VERSION_1_12_0, ext_svnapot), ISA_EXT_DATA_ENTRY(svpbmt, PRIV_VERSION_1_12_0, ext_svpbmt), + ISA_EXT_DATA_ENTRY(svukte, PRIV_VERSION_1_13_0, ext_svukte), ISA_EXT_DATA_ENTRY(svvptc, PRIV_VERSION_1_13_0, ext_svvptc), ISA_EXT_DATA_ENTRY(xtheadba, PRIV_VERSION_1_11_0, ext_xtheadba), ISA_EXT_DATA_ENTRY(xtheadbb, PRIV_VERSION_1_11_0, ext_xtheadbb), @@ -1595,6 +1596,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_vendor_exts[] = =3D { =20 /* These are experimental so mark with 'x-' */ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] =3D { + MULTI_EXT_CFG_BOOL("x-svukte", ext_svukte, false), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.34.1