From patchwork Tue Oct 1 16:06:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13818430 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 78A81CEACE5 for ; Tue, 1 Oct 2024 16:08:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBC722800B6; Tue, 1 Oct 2024 12:08:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B6FB2280068; Tue, 1 Oct 2024 12:08:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94B522800B6; Tue, 1 Oct 2024 12:08:15 -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 6A83D280068 for ; Tue, 1 Oct 2024 12:08:15 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2F284120A1C for ; Tue, 1 Oct 2024 16:08:15 +0000 (UTC) X-FDA: 82625515350.14.BE75DA9 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf18.hostedemail.com (Postfix) with ESMTP id 4899E1C001C for ; Tue, 1 Oct 2024 16:08:13 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=UrANrm77; spf=pass (imf18.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.53 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=1727798829; 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=pDRRARUH5NR0m5odboasFKobSU5HEbMSIgjuQX6WtUqt5LldSEKxypSnACBE9lVkArRWem 1R04l0enfbWXR6GzcPrMW3MzXgryJu4/yk37L4AEzPWGT+54iQF9JLmNGplGXcrn7bVEe8 CJJUj0O6FxcGquC7cGXH391TiYAZPg4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=UrANrm77; spf=pass (imf18.hostedemail.com: domain of debug@rivosinc.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=debug@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727798829; a=rsa-sha256; cv=none; b=FU954xaXM2WDQBLJ16WRaFZcoAcoUGo82ouPtOjHB9wAQda+CmgtT4ECrIktq3pIjbCcZA SwBAr62EnTHPHRrfP/8GR75fzx3dcONaIU3q+NBUGT9OMkGFL27E+oj1gIkdCcyTLBkN2j YoSvAO/+yIOTWKZcpEbjzByxv9cIU38= Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e0aded661bso4201684a91.1 for ; Tue, 01 Oct 2024 09:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1727798892; x=1728403692; 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=UrANrm77w1ahF+ijLZGrG988hfW+uhFmRnNJH3rzPNdATyfGDgQwF0/VSTqvS4itrk 1XUf/ystX3QSrt4961RniJ21HYv2e8jEkzmGH+3RdLbzwxUR4JgwVVS/nbENs08OZAQH qhGS+gWb96XjDTt/naIDl3QDxhupfq2JfxeL7T5/kTqxCcAhdhlGsPeFO/Pmq5HGPDy9 JSiG0TmWxI894q/VRC0+DcuvPwiMIS2OIc0QwxSnXTcFQawpYw/zSzMdaT9dlWsjjOcl O2HGHGyUzlbweIoWPWtb1GF+EQXh9Y5jZKNTpgQ8fgySDK3XLGwW7H7AlCQ/ZpWenYjo zPgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727798892; x=1728403692; 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=R9TLsxoSDkT6jJSMC9abPIoJVsYQTWgy2lWF1KuovU0Ro6KOF+wk6HdjsZ251N2U2P EhTTFSy35QEfnIEljINAGJh9zH/COkGkk2k7dlx5aWM54HFulnDSV4OS83aNMgF5VzP+ duXlzpedmO5YtrKbC4kSJNqKffvfoGKOeCYKAe06g1FM9I9Dy4Ss884at9uINMs66qbU 69qeragw26AbVerPn4RyEEBugC9JNFOHa7WcGcduXmMUpcBLjCTdctYbAe22195lBGFP 0H5AbXh/0CI7FtEzpGG3u0DKHc9vx3lCLSxRJbhF7eHCHUuLhD3W3dXM+CrOwlCFyp9T m07w== X-Forwarded-Encrypted: i=1; AJvYcCXS8tMgdNbKl2nKvu0rdoJ0i1s+IV0n4R3WNd8MvxbGpr9jjnsiODyQGsSXCJUKYhHjBQq7YA8QIw==@kvack.org X-Gm-Message-State: AOJu0YyyhCpCiU900lArrdTJixZUKsO5J6Teb0QsGpeYb7XiC+nA9CBA X0ymMYfBPn/Ca/uQDr3sE+qGi+xwtRleudk8HKmhbegVlHF0pWE2NXEwPQKA3Oc= X-Google-Smtp-Source: AGHT+IE1mC9nGVWp9Ep/VDB2JSrhkpX0Jq7sG4mPQqlp/n+0JH5ZZvXoSkfUlTtqgO8CiZuzgQPUOQ== X-Received: by 2002:a17:90b:264e:b0:2d8:82da:2627 with SMTP id 98e67ed59e1d1-2e1848f671bmr199013a91.27.1727798892044; Tue, 01 Oct 2024 09:08:12 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e06e1d7d47sm13843973a91.28.2024.10.01.09.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 09:08:11 -0700 (PDT) From: Deepak Gupta Date: Tue, 01 Oct 2024 09:06:32 -0700 Subject: [PATCH 27/33] riscv: Add Firmware Feature SBI extensions definitions MIME-Version: 1.0 Message-Id: <20241001-v5_user_cfi_series-v1-27-3ba65b6e550f@rivosinc.com> References: <20241001-v5_user_cfi_series-v1-0-3ba65b6e550f@rivosinc.com> In-Reply-To: <20241001-v5_user_cfi_series-v1-0-3ba65b6e550f@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, Deepak Gupta X-Mailer: b4 0.14.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 4899E1C001C X-Stat-Signature: bdmt1tkf4gp9c8pu75ar3nrmb5c1i6qn X-HE-Tag: 1727798893-875698 X-HE-Meta: U2FsdGVkX1/m9rBCJwGd7MEMBzGHFWps8EUftsuPVzqufC9C4WaMdbhyQ9FNZr+8LuwSh7Dgd4fSicvKNlyzWvENQfn49s/fQEGPA4lVE9wpvILmyqn6j6nOse+bk9yAOuWwt1gSFtT05QJjl2qd//N/t6u38ZqZB6/k074ZPSdW5VNN8/Jkg0fBTUJ4A6DgNhkn7RSsP8kugQvL6307DMe8DBNHi0BNrE72KzxfS9ZIqy/lnjvA9Sdmd7l1FIVSl6d/jEj7VwryIjPpVjCSz4osj0myucdlPst9bsCuEPQ2erS6SHEXlsq4O+zhEA0e2SNQByEnF0+wahldWkeG59wCKsrgdn574pz2HoF0VRjzSBB7VuDMfpZ19w4GxPsiDmAiuVOi+Ewq8IfxzABIZOSrUcohSDTxz0IJXIUDhrot41YYoC3y+9INTIOtKQJ1FqbfV7kB+ai+dep8ADhM1g0dIdIB9q2CUQFGSkGskoYa/bZH5VvKMq0RbMcuVkLIT78n3Lw5fbWgibneALFyC/oncxToXjb2aoLjTtJVLzKcqjSii/NjtvMny35tkYrnuIsYMirlpd1Wv9TCqk5OfTzI6v/BxFUsYVjNNX4p9VU2I9dzwwc0AbvvB1nhO4Xxc5diAaE2cj9Lgf6fWhdKvfs5PEovnRhPw0Rmwg3nvTOhLaXvZfNJ8aPySE7iNxvTBlz+1O+hV7judvHK76+pUwPrjw5xEMVkGxx+IppFNAg1tMS3jIbC9xf4LcKne5P+d4m2knlxMMundo2Bd/DueuRJkrKSrKPQTgydUKh/07tUo/fuieWiZlx6mCRg1qj20S3CB820RhT2NJcdC4ni6A0AxKbkt2GT3mi905TLG2Xd1gaJZ4iPyPr7yVXczDK1+9XekAeHcwrzUoC8e8vvUmRZNbJ+Hk9XoEVI9K7waTf3KGx3zBErTfQJ8IXCp8GZ5U4ql9U+yAxC/F40vYM YtGbPVEq UgfE3KxA3OGUjvWGrp6KZWDv0iOKorDh1EJnxFyChM0XdNf/dbKSTsC0rS5ThyHOZ7pJhWmTkP2k3GV8u9r9AwMienmIp0C5zo9Vy0CnIpVAiu56Fwi6g2Gt5wfnJQOKMeizdUUEQUlENruN0w8qJ1RZJXirK/gv+dHwg/dCY4K/0bvdx3NNA4fZx+1Tz9JugOeH4JWBYKsIGh4CUYMOJx+rHvExCDZFcHuvi42Lp7QfYvvpy0Ms0bDKjj90eyl+y2y1Lzy3K/iHJ82p/Zs437lDmtol92TzKT6MklE3YzNf0aTxXZav1dyp2veOuK5XeriOJoJqBoBsg3vCyOFGE68wHUxk6j49EuXz8az2A3ZuQyBnUf/5Vj5j+Qk/+PncTLDHcUTK+5SIEMTjKVkYyP7bgeS9QwIPEiOXd2WPMKcoropDHm5fK5xnZc0m34dXExHv0tEpQWxQES9QRsVbdwHV3d0A5thEIdf6ctY2aQiL/tz0= 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