From patchwork Mon Nov 11 20:54:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13871360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F17CAD3ABF7 for ; Mon, 11 Nov 2024 20:55:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E53AC8D000B; Mon, 11 Nov 2024 15:55:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D8F1F8D0001; Mon, 11 Nov 2024 15:55:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBA378D000B; Mon, 11 Nov 2024 15:55:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 988A58D0001 for ; Mon, 11 Nov 2024 15:55:00 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5E3CEC1910 for ; Mon, 11 Nov 2024 20:55:00 +0000 (UTC) X-FDA: 82775017920.16.FC399A3 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf25.hostedemail.com (Postfix) with ESMTP id E34E9A0003 for ; Mon, 11 Nov 2024 20:54:28 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=RmWkyBce; dmarc=none; spf=pass (imf25.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731358323; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hq3DaQ4YpzTwJN9yZW6Sl3gPyL1m035+b/05XFtk9T8=; b=T1QM+ilWvuEvSun1tHtXjpBQUlKBmvzGJs0C0a3DCl9vV0zMZMSqADE3Hthx9rnSAi/nQS QtK4y0yJn+DkIEAEa/S2WuaKGVE/tuEyP0blTiWQfI/nuKr1HedznF2e/yRNEyENbL7BBk 5vDj89YRrx0Bn5zvy6Hc0np9ZyMKZ9g= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=RmWkyBce; dmarc=none; spf=pass (imf25.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731358323; a=rsa-sha256; cv=none; b=NFhY2vithSKOOhqii7rLOEjyyHWIBF7jbJRLP5zUAUZ2duQ6W/BNj2lQ/U9iLlmLvvFfJ5 qMGnDa8YQftLAXUUSPpS2ec8ji2Z4OjNut89gFMwySFoWHQH/qLGfQiKVi4rQeRmT6gsuw yzR5qjCdODj9YNvexVHlL9lsM4FiWiM= Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2e2e6a1042dso3952569a91.2 for ; Mon, 11 Nov 2024 12:54:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1731358497; x=1731963297; darn=kvack.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hq3DaQ4YpzTwJN9yZW6Sl3gPyL1m035+b/05XFtk9T8=; b=RmWkyBceEmohfbJdQpxJnC4xAyNfrfr5t53oIYdkOs246LREioppM3qJMOqmxjHv41 DKxQXln/L8NKyv/N7ooFLqGsnV57HnR97rYir02fgwDMEhk1mPrsMBLFZ7w4dO5FNT7d QfeQl5LfXsnbr9C16AJVIzZT2EZy3DPYETCHz4xAQRmoeN8eAubOCBjsTABqMncOe/bY w2FL9dIxGly3rcBb6hYXc12A9riUBTTNTnmbfo0Wqr9+J9m7xg76lsLXDT5b0XK53zJc 6B4MpzJmwp3BvYhNFAuVixMeaOfQqr+VXmKGM+HQcQvt47wksSXv6O/gw0q6UH7ERziF yvQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731358497; x=1731963297; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hq3DaQ4YpzTwJN9yZW6Sl3gPyL1m035+b/05XFtk9T8=; b=CCDAOSE5zr4MSqG1GpbW6e+Zj3k6NWVTuPKMpypt3JCrfyZ6rEdqqRmLeHhWkKaeCm raYFJwMCJeV7WOhAWcAN+lzyXb33a/GSJEq/S98a5FORKs1I4IJQ59FIwtMlkAaOZCT0 q3TPDYvyiAbkCENJO7h5BYUis0LotvBUMZAxbUwlqMRdn6GrRZslMHYRvC6xL0+0Iz11 jxliaTr3Q4CyxpM/OUbpnwpNvHJKhLDR70nrfiV2QWnt/d2bVnPZllqCd9BvihPsxuPF SPDlqwD6AVh6vs4otphpCSbg3JZ/jpa1irKPzXcmQuIZd797MoyA/hGaGsZBe9Nb9GEI ujEA== X-Forwarded-Encrypted: i=1; AJvYcCWFykxFzzfm4k6dbR86ZfUam8uN/7iYjRYNTjC5OFvL54kkxKNHfmUA41STenbkqJHMAwRq4GrPPQ==@kvack.org X-Gm-Message-State: AOJu0YzzoXDgC5xHRVU+cS4RiHEhM2xT7cflGZ0athZAqxXwq7tAXtyM rImt3XDFVpSpycoqEIlvB+CPdf3xbPAkvhlXWT2W8Pl0a62KeUFwc5FyxXhzNx8= X-Google-Smtp-Source: AGHT+IEEKaEBcK4MgBqd/tJtgjOiUzsMic6zpl+RlG/WSuE/W94Zyl8KoJt+g6fHJT4sQqdqWl8Dag== X-Received: by 2002:a17:90a:d88d:b0:2cb:5aaf:c12e with SMTP id 98e67ed59e1d1-2e9b1788b6amr17044135a91.37.1731358497234; Mon, 11 Nov 2024 12:54:57 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9a5fd1534sm9059974a91.42.2024.11.11.12.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 12:54:56 -0800 (PST) From: Deepak Gupta Date: Mon, 11 Nov 2024 12:54:08 -0800 Subject: [PATCH v8 23/29] riscv: Add Firmware Feature SBI extensions definitions MIME-Version: 1.0 Message-Id: <20241111-v5_user_cfi_series-v8-23-dce14aa30207@rivosinc.com> References: <20241111-v5_user_cfi_series-v8-0-dce14aa30207@rivosinc.com> In-Reply-To: <20241111-v5_user_cfi_series-v8-0-dce14aa30207@rivosinc.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Arnd Bergmann , Christian Brauner , Peter Zijlstra , Oleg Nesterov , Eric Biederman , Kees Cook , Jonathan Corbet , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, alistair.francis@wdc.com, richard.henderson@linaro.org, jim.shu@sifive.com, andybnac@gmail.com, kito.cheng@sifive.com, charlie@rivosinc.com, atishp@rivosinc.com, evan@rivosinc.com, cleger@rivosinc.com, alexghiti@rivosinc.com, samitolvanen@google.com, broonie@kernel.org, rick.p.edgecombe@intel.com X-Mailer: b4 0.14.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E34E9A0003 X-Stat-Signature: kkpujt1qtm3dsxyi5xkaddy6w88d3by3 X-Rspam-User: X-HE-Tag: 1731358468-480722 X-HE-Meta: U2FsdGVkX1+xYo5sDpu/jp89OdRrCg5NBwGNffFeWvNyVHL+FUj1wBDht545UseSjp0IzBoVyGIsXnqRRwJU8OcWDEBI76yUZLnR3UH9H6uMEKb+OdZqVnIK/am5xaxb7e9eLN5zmQl2hllpMDC/vWBJ+hjYrCAergxI2+mGtbNt7UEIFk8gUcXyRpxprIFGqeVjDOORPg3w+xYZ0Fh7Zx3PH4ThFOl8T+PNMb0ZC+/Ehe8F0RZpZoxLRAhjtWewupq45mGyekwt447WRQ4SfxfX+Bi3HlwQ08hkK6ZE4MVPBljIoMaR557TGmevgvWzsgETWj4vxg7V84bJgACOBD2TcYznrlFuz7Hp+6DNtypdGl3hA9oexXdttdVrmXux5+Z0yK0Vb8yCmAmNqS451AOPlZRXd3u5ibbRvG+j1Y1Us8CbXDetcJf4QtHtruNFhi8f7Xt3OtFzsSt9cMXSIp0IczxHKaMFOMf4IQQBfcROQpRgGi2x9j53Ao8ElTu6+shZYwIUVMIasu3pnkFNMpj9q0jTb1PUMqwkTQO1D/gdp43+YbVx2Q1CtezFUdMrF9E/JtuHkvv0khImLjvtPID3CNwp+FpoogZWn/vj0/bAq8teVpFwZCx4K07alvjqyEyojiVE1bJXepkxnDBSa/JeSS7oDsqXI6CocUgwqMWO57D3UuGoMS6t5EJaBUvIr73xMQL+3Npfbeadp8uPrGZnMaLoN9Jq9fpthC07CgfevgASe/aOwng2QahZUQ3a4FpLFTd7csHrY2fY57FknaFCaEDW8vsezFY3stTdp6T0liOncu0m7irdShbS8RVDPmwpspWmCkOrGNIztqta+FrL/Ern91rBZdigbAGH/KlT4thhjKaZjm0bQwlbJQCKnNOLY+3NAz+0J05Fzllxrk3pbqF6au/P20BepCEqYmApj7EfD5iCUI3TyFyzhjyzPBll8BCXRmYCdYozM3X XpC6yoz/ mWM+FDTCESldr203KuXP1VbdrNlMXESPkaSM1hCms3F6E2VubgS67ObVVS82IoB+1cmElqO21GbBmyHI+IEeKlUWUt7Vw5X2ZIaHMYE1EvoiirWPJmTdwAxDxfB/vALKp1YSRay1BuOvHPUjnKObtgNXVAJwy8um2ymI0N06pfKfCF5p2fJ8PptKzkD2seHxr+76x6u3NTNaurBSlvbUSAcWnrcK2b2Kq2+Ka66lwwf5iLcUQHg/Lxu3yeZgYuHmf5M3oBpqUPeMZEeShX1T0GCj7p6Xf6PXBPr08fJSZlljQgKIgjrflp9i6oBNf45BfhgFMp2tvc9fCFAC7WYbogyU/xEaVe7ZWk4lEwwilPyaEp/UtyMApCmI55KK4U5qgV63DZpmRPw16+qwUpsO58nU7miIqfT4Rt1UhpcH6sayU5NtDYDheRMDgYVulJ/j1qjeW62hN2OPNF/mBO52+Jbck0tP1rbkOcU6pPvTQFOsyO4g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Clément Léger Add necessary SBI definitions to use the FWFT extension. Signed-off-by: Clément Léger --- arch/riscv/include/asm/sbi.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 98f631b051db..754e5cdabf46 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -34,6 +34,7 @@ enum sbi_ext_id { SBI_EXT_PMU = 0x504D55, SBI_EXT_DBCN = 0x4442434E, SBI_EXT_STA = 0x535441, + SBI_EXT_FWFT = 0x46574654, /* Experimentals extensions must lie within this range */ SBI_EXT_EXPERIMENTAL_START = 0x08000000, @@ -281,6 +282,32 @@ struct sbi_sta_struct { #define SBI_SHMEM_DISABLE -1 +/* SBI function IDs for FW feature extension */ +#define SBI_EXT_FWFT_SET 0x0 +#define SBI_EXT_FWFT_GET 0x1 + +enum sbi_fwft_feature_t { + SBI_FWFT_MISALIGNED_EXC_DELEG = 0x0, + SBI_FWFT_LANDING_PAD = 0x1, + SBI_FWFT_SHADOW_STACK = 0x2, + SBI_FWFT_DOUBLE_TRAP = 0x3, + SBI_FWFT_PTE_AD_HW_UPDATING = 0x4, + SBI_FWFT_LOCAL_RESERVED_START = 0x5, + SBI_FWFT_LOCAL_RESERVED_END = 0x3fffffff, + SBI_FWFT_LOCAL_PLATFORM_START = 0x40000000, + SBI_FWFT_LOCAL_PLATFORM_END = 0x7fffffff, + + SBI_FWFT_GLOBAL_RESERVED_START = 0x80000000, + SBI_FWFT_GLOBAL_RESERVED_END = 0xbfffffff, + SBI_FWFT_GLOBAL_PLATFORM_START = 0xc0000000, + SBI_FWFT_GLOBAL_PLATFORM_END = 0xffffffff, +}; + +#define SBI_FWFT_GLOBAL_FEATURE_BIT (1 << 31) +#define SBI_FWFT_PLATFORM_FEATURE_BIT (1 << 30) + +#define SBI_FWFT_SET_FLAG_LOCK (1 << 0) + /* SBI spec version fields */ #define SBI_SPEC_VERSION_DEFAULT 0x1 #define SBI_SPEC_VERSION_MAJOR_SHIFT 24