From patchwork Thu Aug 22 17:48:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 1975667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HwCcKMc/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=V4ltSnYS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WqW2q6pwdz1ygy for ; Fri, 23 Aug 2024 03:50:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CJyPG712ab5YUqxZ7+dD3fNTzYP3fcV66Oo4HebZqcA=; b=HwCcKMc/lHeFUr 53WE+iMXNWPtzX94lZZ3z2zQx+2WfpawAX0tClYw7+/ewzf6L3eSREJz5+S6zagFeefANf7SEF9Md JnjtYvAj3na7K04qLCT40udVvF6lTbC4SSyiHdVH+vcY15fz6mfunxjlIUOmDHAZEpk7XY9ifFT0V GAJEt2tm0/IiWFjXSoZowgEdUTLJNaW5WlHeHYbhwPYCLaeO4Q9xwXbbYzc+mfznkTpum1YftiN2V CILxiwdcr3OkDCRnmn+d4wYguY0jYuvxJarbRPwiUF3YAVPQMYreBEGojBbUOnDa58aFm2Pr/TjrF lZkoOFlgETje4ccXC6sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shBxQ-0000000DrSo-2I40; Thu, 22 Aug 2024 17:50:48 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shBvI-0000000Dr3v-0Tlq for opensbi@lists.infradead.org; Thu, 22 Aug 2024 17:48:37 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7106cf5771bso994987b3a.2 for ; Thu, 22 Aug 2024 10:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1724348914; x=1724953714; darn=lists.infradead.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=ep+etXyj4ZEjmB65w14NCAa5202msQUfrG/DIIPz76s=; b=V4ltSnYSYHO+Dvdq8RSg3wg3rkVfKAZ1BOqeOYoV//Cu0sntQF7KO4hMFgWMlfcMXR Jf7SaAe2f9qDEMTTNyFWGZcUiXVHFrtj3aANL4LR9m9q60xcyLW1pbphddsmc/QwuJc+ poaFOiwpbkpPhEFYDyOllZTASsctPEKNj7igIgjC07YIxucMJkQAey/2OliBsgAuA1K0 K8QwXpbNTAu+TroejI4/lNeo0fiM7bEa5lLnCrBDahJfKQz0bBAlebuDPSRV7IGbc1YM BrD+Klp8NDv3T3tMOr3zexi3e4t5LcRNxRkJcq6kkBF4Phm/zCWnrWnCQFEWlbpZbzSv 5hJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724348914; x=1724953714; 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=ep+etXyj4ZEjmB65w14NCAa5202msQUfrG/DIIPz76s=; b=IaQdwnp7L3xZBB5seUMP+pOSvXTqJWBPPAUwyQCoF3yY1q+DjvSQKvmA5nVLeP7xmV IZtf4zArF3oM3d/bf9KXnHiqRnRRMjOTfsihgTFTW5/BYQWVJRa7aM4IYEmTe+vBRKsF 0qZP1YqNguV8kKdXUvMUUiLoo/V3D1OBBkWlDX4R2NN0ewp0O4FmoajpdMHqKkXc6E9t h2T92hYI9w8fRWzYK0O4U+AeEuYBmDHC/7jA8NOvVyVGW9EOLvWa/GE9NqVEJX5LHqld gMJaaxf8DK86FNKwPX7E4EZ1T19D7N/65z6j8Vn0DQ/AXXaKdFQdhSqwfaxLyxk1lrBp u90w== X-Gm-Message-State: AOJu0YzjXQW4XfVvoyJFF4WMO9c7RI13uCuzuAGddzTa7PR0ADbASfRB AykVIOcBO6uiLClp+0LGwba1RqiTAO9Pzebl/ikeomcYlmUCvtMLIqWifB1phZKGVjIYAsH0SMP G X-Google-Smtp-Source: AGHT+IHmNcD6DKrZc9beMDsxPs86nLJnnFcYty6YQVp5+VbN4CW7ujbYEcW9vIM3vMsT6tx6yf/png== X-Received: by 2002:a05:6a20:7fa2:b0:1ca:dafc:fbab with SMTP id adf61e73a8af0-1cadafcfc0emr6297861637.4.1724348914067; Thu, 22 Aug 2024 10:48:34 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430636esm1650251b3a.165.2024.08.22.10.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 10:48:33 -0700 (PDT) From: Deepak Gupta To: opensbi@lists.infradead.org Subject: [PATCH v3 1/4] include: adding support for Zicfilp / Zicfiss encodings Date: Thu, 22 Aug 2024 10:48:25 -0700 Message-ID: <20240822174828.4031332-2-debug@rivosinc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240822174828.4031332-1-debug@rivosinc.com> References: <20240822174828.4031332-1-debug@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_104836_161972_EC19C6AD X-CRM114-Status: UNSURE ( 7.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Zicfilp / Zicfiss extension (see link) introduces b2 (LPE) in menvcfg CSR to enable landing pads and b3 (SSE) in menvcfg CSR to enable shadow stack and landing pad for privilege less than M. Additiona [...] Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:431 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: apatel@ventanamicro.com, anup@brainfault.org, atishp@rivosinc.com, cleger@rivosinc.com, Deepak Gupta Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Zicfilp / Zicfiss extension (see link) introduces b2 (LPE) in menvcfg CSR to enable landing pads and b3 (SSE) in menvcfg CSR to enable shadow stack and landing pad for privilege less than M. Additionally extension introduces new bits in *status for recording landing pad state and a new exception type `software check exception` with cause=0x12. Link: https://github.com/riscv/riscv-cfi Signed-off-by: Deepak Gupta --- include/sbi/riscv_encoding.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h index 2ed05f2..fa1d373 100644 --- a/include/sbi/riscv_encoding.h +++ b/include/sbi/riscv_encoding.h @@ -32,6 +32,7 @@ #define MSTATUS_TVM _UL(0x00100000) #define MSTATUS_TW _UL(0x00200000) #define MSTATUS_TSR _UL(0x00400000) +#define MSTATUS_SPELP _UL(0x00800000) #define MSTATUS32_SD _UL(0x80000000) #if __riscv_xlen == 64 #define MSTATUS_UXL _ULL(0x0000000300000000) @@ -41,12 +42,14 @@ #define MSTATUS_GVA _ULL(0x0000004000000000) #define MSTATUS_GVA_SHIFT 38 #define MSTATUS_MPV _ULL(0x0000008000000000) +#define MSTATUS_MPELP _ULL(0x0000020000000000) #else #define MSTATUSH_SBE _UL(0x00000010) #define MSTATUSH_MBE _UL(0x00000020) #define MSTATUSH_GVA _UL(0x00000040) #define MSTATUSH_GVA_SHIFT 6 #define MSTATUSH_MPV _UL(0x00000080) +#define MSTATUSH_MPELP _UL(0x00000200) #endif #define MSTATUS32_SD _UL(0x80000000) #define MSTATUS64_SD _ULL(0x8000000000000000) @@ -220,6 +223,8 @@ #define ENVCFG_CBIE_ILL _UL(0x0) #define ENVCFG_CBIE_FLUSH _UL(0x1) #define ENVCFG_CBIE_INV _UL(0x3) +#define ENVCFG_SSE (_UL(1) << 3) +#define ENVCFG_LPE (_UL(1) << 2) #define ENVCFG_FIOM _UL(0x1) /* ===== User-level CSRs ===== */ @@ -228,6 +233,7 @@ #define CSR_USTATUS 0x000 #define CSR_UIE 0x004 #define CSR_UTVEC 0x005 +#define CSR_SSP 0x011 /* User Trap Handling (N-extension) */ #define CSR_USCRATCH 0x040 @@ -763,6 +769,7 @@ #define CAUSE_FETCH_PAGE_FAULT 0xc #define CAUSE_LOAD_PAGE_FAULT 0xd #define CAUSE_STORE_PAGE_FAULT 0xf +#define CAUSE_SW_CHECK_EXCP 0x12 #define CAUSE_FETCH_GUEST_PAGE_FAULT 0x14 #define CAUSE_LOAD_GUEST_PAGE_FAULT 0x15 #define CAUSE_VIRTUAL_INST_FAULT 0x16