From patchwork Tue Oct 29 23:44:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13855742 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 850EDD7494E for ; Tue, 29 Oct 2024 23:45:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 885F56B00C2; Tue, 29 Oct 2024 19:45:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8332D6B00C5; Tue, 29 Oct 2024 19:45:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 687756B00C6; Tue, 29 Oct 2024 19:45:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 46E226B00C2 for ; Tue, 29 Oct 2024 19:45:27 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F1CA38046B for ; Tue, 29 Oct 2024 23:45:26 +0000 (UTC) X-FDA: 82728273264.05.BCD7ED2 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf04.hostedemail.com (Postfix) with ESMTP id 29B3340009 for ; Tue, 29 Oct 2024 23:44:52 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=nHlamR92; spf=pass (imf04.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730245365; 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=7vRNSIBiNXIf2UJE+KhXd4ECbBBsrxcPJxpg99mApzo=; b=MPTKUFSPjXu/odNRg4ksnw1s8TAl5RTpLCSSamPa5ts5iNPwO3gwqY3xJ2Z20pyOvUuLiR 18Dyf7nClq9hNEMLubXqVPLcS2KGFSNPvz4X1HQTH9nOPXxu7OpUJblnsfcK3W5iUNetP/ zIcIf7IIvFozP2z/O7cS2JJUpqTTgN4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730245365; a=rsa-sha256; cv=none; b=jqSTVddA7sgGuN6DNdf3a0kJGdAATYCFz29CFAlfZI71zkR4ncr22GRBzkxCgxCY3le4Eb unk/Wo0PJidmcZ+ATWj5KYdoRVHImTEktivCDhIwHSKbAjVA1aNzDJLgS6KHbNuK6oFSaL E3Bc0GSy6lBLCIvZ9AkfBjdZlClnPM8= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=nHlamR92; spf=pass (imf04.hostedemail.com: domain of debug@rivosinc.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7d916b6a73aso3884616a12.1 for ; Tue, 29 Oct 2024 16:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1730245524; x=1730850324; 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=7vRNSIBiNXIf2UJE+KhXd4ECbBBsrxcPJxpg99mApzo=; b=nHlamR92Kd0tZ/ZSxZpZ3mR4IH6A6CDOZrc2Yt1t8hBhpFlV0g5aj7YYl9Rqy4rdIQ xTqIX1FEbOoUTQZNYl4xL6ts6hjwazwzMXGituMVKO5ulikoJQsGOukvEFgON2NkNbWP DHYREatlJwp3kd2RLMfMmotxdvgIOJEkxsRMM6prL1OltP6PI+BR4YGRsA2XBI6w/5UZ OsGgC55jXBSwOc6oZIp3XhxIiK3wCMuDNYLWOJJqhkLZXbeQyyuTQQJgmC/d45NhONIe oYTl8G0p+YSE/6eC9IwWnXI2IIDTAoRPw8oo0wOG5do5OoQGeCZeM/zfufxyxdWSUu9g jWIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730245524; x=1730850324; 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=7vRNSIBiNXIf2UJE+KhXd4ECbBBsrxcPJxpg99mApzo=; b=GNKSvBrijIzX5HJtA4x4hZ8LJMHVw+Eh3bJCWprq4NXyV9BDNrb+mkkXwi+WHC+EIu uMjtGuwCQtXCaaLyfDfUiP6EZCJ1GmneIFhDPVv1auSC3DQ5cNcBv5cJO3uRIrknQVRp A/3LIDo9I/nJVs/BJwrDhjNtvopp5kyfP1fCOWGIQ0sNB4/WqDcOenU2px05djtzCzc3 j3k4EVspzllBTfz/d6Dn/lcb6mTX9va/g4yn2uq+q9cjhL8gElJ85MCs35oz3tUoltrz IaV6bvY6JMkCZJKrpwpvJ3WtYvUB+yjBoLqSzfrVEKKiqShIHTXXU5wRW+DCnUQl4vVP dFOg== X-Forwarded-Encrypted: i=1; AJvYcCWq8qacFsAvV3u5jqdcAzBdVmXebD4Mu/i1U/Mv8gqul+a9x3bO6/y0cIANVy4IjQBNAQIh+ti90g==@kvack.org X-Gm-Message-State: AOJu0YzPlFWROZNoyRCZLvC2+qzIlo2CUBl37YQlRyW1FrnLFjnbCd3Z H4/kA43hQ7h/hwTDgX/cKTwx72BqNkxBhyTbdoGK28I9OqzG80J9rRyjBUe7ERs= X-Google-Smtp-Source: AGHT+IEYWYuZ3O/cciBKJ5slqaSkPGyDa205Q6lm+0Ith+W/z7NIQt+rMOIaCZW78WCxle4V1PPCdg== X-Received: by 2002:a05:6a21:3998:b0:1d9:ab7:a835 with SMTP id adf61e73a8af0-1d9a84d990cmr18634439637.33.1730245523952; Tue, 29 Oct 2024 16:45:23 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72057921863sm8157643b3a.33.2024.10.29.16.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 16:45:23 -0700 (PDT) From: Deepak Gupta Date: Tue, 29 Oct 2024 16:44:26 -0700 Subject: [PATCH v7 26/32] riscv: Add Firmware Feature SBI extensions definitions MIME-Version: 1.0 Message-Id: <20241029-v5_user_cfi_series-v7-26-2727ce9936cb@rivosinc.com> References: <20241029-v5_user_cfi_series-v7-0-2727ce9936cb@rivosinc.com> In-Reply-To: <20241029-v5_user_cfi_series-v7-0-2727ce9936cb@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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 29B3340009 X-Stat-Signature: mpqtb3tq5hch4peqeys88xqed9a3najw X-HE-Tag: 1730245492-419369 X-HE-Meta: U2FsdGVkX18vZ06Il0kDLtW5AGd1qz9cMMPZ5Sy7Iy2cEgx+8r4m7q4IKADJ7bVx0W5Y5QyoY5D2Kmlw1a3/H9FUcyxAiZQ6EE27LrJfQd84tilRHLN6Lg/9VK2jj2JTFArxfe77pPHAXY8X3wv0xxovpZixdTCcX2y4fty9U7g3m3NcmMSavSUJZKMXVwvi5IoQ8xf/rmqHx/eNS91QYxF7qFatbFXa5zalx3Z0pIAeME9nD7eJgTvTsrigUR5Qjuj+zw166Yvxk0nrJ5ZTirVsDGQYewgMfU7mwFAe9oI45mKdArN5hmK84+tTtq/cCeEl5BM5hT7/44FjEH358LuDQTd9WeVg+5rlqh7li96uVeEpQ23koyWfTkzAYxkN15K7yNnvAlwCibkFlzlA6hHyq4kuAeLVOu7OFV32iACoITxMjvRE6mfQHSJqZXQfBVGYeI8MuhTWjvbO7Ra2Tnd9g7jBXfeYoOIIRLF1JxS4NiSctm6Wk0dAVXKnbDNV+yMv842Om5CzzOeJQ7z8y1lYHt5G2Rlc30XOalWoZHIHjeIX8zY7HVXabEimh4DruEl8UVQ/U3zJ+OqJFavX8M7hdgfPrM8PLXjCrNPX/yj3Pa9Br337OGjEJFBqL67JHq3bontcPbZmH8y8nIBdrA9Is5IvxqeSo4999AZOBSL2zBL7NKcvYCgixzU4JdyHPNKR1mSa1JD2bgDc6I6DIx0gP4qEvbY8Fyuo9CIDh9lcA5zn3qD1hqQOaRtrj5EwWkvd0qy3KY+Cfzcp8dJSXVG8vikYEz3VQ8Qf8NoIRo9UH2N9OlZ/fHEZcFLvYQNub0QIXQvEeXMHZsW00ISskTBorI91cb6I1b3qeDnZNPH8btqEhgoGZvuzW+IEf1iFcr97acTsWBE2Il0ifr9k/1a+a+Adf4/hKlWju4V5bQFIJTkDY35iR991IhuhTa7JJmN4KveyJ9fP6PrtIRa azClCTP/ NdngfqPfTHBcyQIsYjGEskVypjfQx5cm825xElbs+JhHp0RkeoyasZjyMBfbIqhL2G+n3EiIJ5jVcHrY1kniYe9ib+RhRsPpK8LDhb8gQ4Axm5lVqWUnMd2PPAy9mfWfmEAUVrnuv7XYaP7rFMOyHeCkxCJ1Bk65XTDRo+RHN2q1REbUGt3v3rcyxJJ3v66uUdlwZzxv3AK3Z/zxiTJJyLAeiyn8X1s3z6XCYTDlLCs/SF1mHC61IenFJ6UVvv5VdHyLoEdWyjlEVqt3mq1KEldi65bOiu0W5Dm2yKbjc4LkN53nRjJms/S/NG6WPweO9CfcPk7+IlO7zfOQf8hZCJDcBR0v96wEh5/ckaxd6yygAecva2aW5Fg2g/EcKWWZE/zO1JxB5tHmgWyRcMALUPKiQ+r4Zx+QCXxBj57TvFpoAWkdx/UIdNT4ei+7l6XQc0aaadYOA7RY1mzW8r7cvUf27zuufLeRCNd/KW7Y8qmahmfk= 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