From patchwork Wed Aug 21 23:55:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 1975151 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=ApUCO9R/; 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=VMq+M5MI; 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 4Wq3Bb4Ksrz1ygy for ; Thu, 22 Aug 2024 09:56:06 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xjufBCYN5dl4qxlemWml799XyPA6/pMJokMOHqhWdmE=; b=ApUCO9R/XhnYuk O5NAanCEPkWG1rm8OY51jMhxw1L+rFZN28orsIQ3ZCsQbrUOpiEXgFxu//JnJYmt5ttxUvEfGNCGy UQlg6dvTO7BjCC8AwJx/9NlTuT/IA9F1+iWu5OHhuR87QvNDlEPt9Uf8PFumUk9kmyRN1gW9YCFVo p/Ilt4RKqsh3jRSCo0mflhq1u3gv1Sg8fAAE5m/BHXGrmNVLkriNvUB+G3vb/uP9AGh3amBSstE0z TAaOP4bJMUrk+kG6y0NvXWNjIP/qUFd2GwNfUy+eRf4cv+FpvpQFP7l7qReUCXVyogKc4S7HbUX6m MYwd011HQihZuxNzNMUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgvBD-0000000AiBZ-1a0j; Wed, 21 Aug 2024 23:55:55 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgvB9-0000000AiA9-41fN for opensbi@lists.infradead.org; Wed, 21 Aug 2024 23:55:53 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-201ee6b084bso2154945ad.2 for ; Wed, 21 Aug 2024 16:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1724284551; x=1724889351; 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=yt/ja22AZlw8G8xLQ8KXWBxub4Dabw1+saL7fWD69mo=; b=VMq+M5MI/DSVljC4hL8OIZpFtEIyFoe4Rg6ymSa176NNVpaWcJh7OX+RinGcQrExOI Budk/Z7UCjkw8oq9BJPk/xsSOc6rfeSz4yODUX+/fhpXdNrePY7r5OrqSLycTOsy8yct GcxxOByirRCn2WdKqWWYPh/gSIMaWB1woCsuBLpcsYPlz6sHbs1JzgAXGcWOEWqnvweY /WL4p/OyMGnZTR9o7xFPTBfwidzGWdHneNVdDOwbrghI3Q0Vdufhh1ZkO/lcbfsRfpsH qqwCbbLPPtgcS/FYsZU0T8t00rRCNYR+TsGgzdkyVW1xI6xbKCXsnQ/ys6YegMa0mFds d7FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724284551; x=1724889351; 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=yt/ja22AZlw8G8xLQ8KXWBxub4Dabw1+saL7fWD69mo=; b=RPlfajo7b85f1oKoS6SpuBl6zD17I334dwCpJAO4isu6PcEqBGWat6UYup5YBEs6EY I9kqnnxuIMuOvX4vTHD/36ncMAA1WU9h8TEyPZG0ywnL43kztr4kcpl4ojOKcSXff+B7 NbpMbm+7J8xQc6ml6VfQ0x+YX1lsbQ6ZZcCvOb7ce9DnKHyXr+aaPk2RKQBKWgtqb+/k WdWCG0z9ihezz+J0sBw+Z2jLQkO5ghNdlir4+ECqX5rqdHhB6sa32G1lxrpjvDjZlw95 Ff9N8AIEM8FdkK2VQhxDDkSLR3a1cwLkpIgWPPQlIvnzr4MzAr1vpKgM0H07L64rdUPZ 9c7g== X-Gm-Message-State: AOJu0YzeKQAFfjL0bj+7O9UJh4epCVaaljVMO6DboUprUCNzbxJAKEKv dZ8a7lEdwlMSSSQ/ev2Om3xtAkzS7MSpHRbib2thoxGTdYw0X6lpnS1rL7QN+a6gNjjX8FNoRFk D X-Google-Smtp-Source: AGHT+IHf+Cqj6SdTghrzaty85bha5/dp/NdazIb3pK3EIaXpU457tlzOXBweVEghGy7bYs9mSsMztA== X-Received: by 2002:a17:903:22c7:b0:1fd:aa8d:acde with SMTP id d9443c01a7336-20367d48109mr58035815ad.36.1724284550725; Wed, 21 Aug 2024 16:55:50 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2038556661csm1515495ad.24.2024.08.21.16.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 16:55:50 -0700 (PDT) From: Deepak Gupta To: opensbi@lists.infradead.org Cc: atishp@rivosinc.com, apatel@ventanamicro.com, Deepak Gupta Subject: [PATCH 1/3] include: adding support for Zicfilp / Zicfiss encodings Date: Wed, 21 Aug 2024 16:55:44 -0700 Message-ID: <20240821235546.3876172-2-debug@rivosinc.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240821235546.3876172-1-debug@rivosinc.com> References: <20240821235546.3876172-1-debug@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_165552_021039_A6B55155 X-CRM114-Status: UNSURE ( 8.72 ) 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:632 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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: , 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 | 6 ++++++ include/sbi/sbi_hart.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h index 2ed05f2..64cd9ab 100644 --- a/include/sbi/riscv_encoding.h +++ b/include/sbi/riscv_encoding.h @@ -32,6 +32,8 @@ #define MSTATUS_TVM _UL(0x00100000) #define MSTATUS_TW _UL(0x00200000) #define MSTATUS_TSR _UL(0x00400000) +#define MSTATUS_SPELP _UL(0x00800000) +#define MSTATUS_MPELP _UL(0x020000000000) #define MSTATUS32_SD _UL(0x80000000) #if __riscv_xlen == 64 #define MSTATUS_UXL _ULL(0x0000000300000000) @@ -213,6 +215,8 @@ #define ENVCFG_PBMTE (_ULL(1) << 62) #define ENVCFG_ADUE (_ULL(1) << 61) #define ENVCFG_CDE (_ULL(1) << 60) +#define ENVCFG_SSE (_ULL(1) << 3) +#define ENVCFG_LPE (_ULL(1) << 2) #define ENVCFG_CBZE (_UL(1) << 7) #define ENVCFG_CBCFE (_UL(1) << 6) #define ENVCFG_CBIE_SHIFT 4 @@ -228,6 +232,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 +768,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 diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 81ec061..2aa6867 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -67,6 +67,9 @@ enum sbi_hart_extensions { SBI_HART_EXT_SVADE, /** Hart has Svadu extension */ SBI_HART_EXT_SVADU, + /** HART has zicfiss & zicfilp extension */ + SBI_HART_EXT_ZICFILP, + SBI_HART_EXT_ZICFISS, /** Maximum index of Hart extension */ SBI_HART_EXT_MAX,