From patchwork Fri Mar 14 21:39:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 14017578 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB1CFC35FFB for ; Fri, 14 Mar 2025 22:51:20 +0000 (UTC) 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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8KVkPAbp4TIk5uhdL3pVS13PRt3ZJdo9EOUC3duI/Pk=; b=qskdtvmMq9o1PW YHg8yaVkJIblX2Z4G4HTwr6QxCkVw7mhglbh2hlVpWSFfOvQqlw7WcXLiCfpGoAQ7njzFTOY5vrs+ 9gKBblnLxNtpjA/M4nvP1cl8zGx5vhcKQRy5b9+rmhaBtd0q1e5BpDyb5DItG14xkhPxhGgN1tWIv fvM5915/zKwvod3YwkLy9PkWWEQRY7xRMVAbPjvNHfRa3tpWxTnqzZotHQlQGpsokQ3pwAzoJzT1+ n5JMnioricn0P+Xi6dUP4ARlaSqwTHWI8S/8V3I5S++pQ78SJa91sy7hKbfWsOv1dPlexDeM2g8XC HiGfcxFQpwgLFsl2O+Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1ttDs3-0000000FSyd-48hu; Fri, 14 Mar 2025 22:51:16 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ttCm5-0000000FLcD-2GAK for linux-riscv@bombadil.infradead.org; Fri, 14 Mar 2025 21:41:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Cc:To:In-Reply-To:References:Message-Id :Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender :Reply-To:Content-ID:Content-Description; bh=wxaplZUgROh7QEyvXgaGSGBpfUL9KoHoiOWsJ+5Erjg=; b=VjtuFaVwKDkAPkO6WsbMgvP+mn lPF4wQgkeCUN7cJGuzmT8R98/MxfUxVaLGxYjetBrxH9zEeRSxUlmwpRXb7Q0a8/b2ZG8SS+M5pCc EYd7GoZS0t0Xm+3VRoZXF/u9DuvhBzUGt6386PA06kQ3geHeJ1Xy69F3Pbn4mQ8zy0GYiVdt8Sdo1 MpQNngOLN8PJbIf3sSztn2xntWt7gIORy1CmzuQcRIRbHOYwl98LmMzGJaokQyz84uWuXEkYibcL7 83HiqBtphB8eaifIBXhtQKvR8+XuHHCutTx8xCW69z4Mm3zXDk1qTa3PuTEDEbmN8V/vPNjNGPofa 88RpSgAw==; Received: from mail-pl1-f171.google.com ([209.85.214.171]) by casper.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1ttClv-000000073zl-45tD for linux-riscv@lists.infradead.org; Fri, 14 Mar 2025 21:40:59 +0000 Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-22401f4d35aso50707715ad.2 for ; Fri, 14 Mar 2025 14:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1741988422; x=1742593222; darn=lists.infradead.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=wxaplZUgROh7QEyvXgaGSGBpfUL9KoHoiOWsJ+5Erjg=; b=kJY0ZdLdnSB6hkf82M5tcaaSbAqEuHIzeB+iaysiTyScuiXocTJKO9fMdl306BmO4L ft+ulAfzXOQtDylRjfEXuT9Cm+/qG/IEwrX2KG1r6K4tVq/MYDgynkCO1eb4BI4ic74i UYUirJCQ2cMRxLcB3ExqA6i/OWrbUkzc+52XbcFxjF0K+ku9RQa0Cu19KCtjVXIiUNFI hbCRLN4CyYw2Fb2L3xQso/gO7WHQCR/3OAwoyfsbUFLJzWtZm4UFPuNAqjbqHVpu+F3K GTOxrrG8T7e3xVrRHEzq0PSCCleq5xlo/ooss1CuOSuFIfMkTGbeVXWaNS+yVCQ3dgbv rEsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741988422; x=1742593222; 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=wxaplZUgROh7QEyvXgaGSGBpfUL9KoHoiOWsJ+5Erjg=; b=UCcb++U0S9TLOEcPlQB9pdPdj+u/rG3bxXEbiFDRM9FXm4zgsfpEWsetQZ0c+32PLj CoGi9BGVRnKXSVEdH644K/JY/9suFEiEGDYHoheDwZNOc/aVGJe4xaB2ZpkSHFBZRq1O w0YOjzQPQM8he0eCFJF17AahDvacqitgh6KKwjrqXXO5XVhNwKG2l1+8EP9xF29um8RT V4V1nvRpYCE833sjcpl0b7ld3eHOJW7WYCfXEiKWXPiH5JKwbNH+VaZLQFyrm8wblZ1c xgPih1RAsiXLio1BZowLFfJPzvli6Z1MOKZ+lFWeQi0iXiUFnqNXWpxmk4iOand6fukU ZyMA== X-Forwarded-Encrypted: i=1; AJvYcCWWKfeyoB7ieZElMMF608uV6vHtKZlB5/12Tic6WxWeEz/bhgh1A2gZ2O+9cFs6x9txjWSZbIAYbf3xOA==@lists.infradead.org X-Gm-Message-State: AOJu0Yx3AChAbbiBY7F4Rgmn1XH9JfVBgHNY29RAVpV40Hx4983Fc8vS 4+9LgTSqkB5VcU7F84bCNYB+Mgy8FX0tEOa0vzXAdXe6cjryPOjVpwvJMWr8ARw= X-Gm-Gg: ASbGncve6bGmsTWVf12XTx0Ant82KXFMxutR8BKTGvycHhEYbUHdYJqSRA/kYGCf1QT pRh1mUr2hQUVW/M+n047mA3J1XKYINAfOZaUH/TR1oBbJ+G3jr0HV3+qYl0zUAlyv5EPlFAqpez ahGgLfyols8Mp7KPauM42z96zUYhJ1AYUOMQf7m6Olxr+g8nquX1kYLbtC/6moSm5xbDyAazGlU UpaDb3M9EkuwZo7LpT09n8BdMyb/cKyG2HP7S9+y98cZ5l8bKVzfFZeJTt8tBmw4nEfDa0rEumH DWpU8FqYCw7Jg8wO7Gevmh17ZbZ1XY6xKN2LsW/CsYD+1kps/UMkW0I= X-Google-Smtp-Source: AGHT+IFnWo7zLhMGwvu4KurXEf7kIkAyH1HMaWOYapOqu0jjJNCjRbXuH7ozNEXPbffeeQud8LolDg== X-Received: by 2002:a17:902:fc84:b0:223:fb3a:8647 with SMTP id d9443c01a7336-225e0aee9c6mr56406685ad.41.1741988422612; Fri, 14 Mar 2025 14:40:22 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-225c68a6e09sm33368855ad.55.2025.03.14.14.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 14:40:22 -0700 (PDT) From: Deepak Gupta Date: Fri, 14 Mar 2025 14:39:40 -0700 Subject: [PATCH v12 21/28] riscv: Add Firmware Feature SBI extensions definitions MIME-Version: 1.0 Message-Id: <20250314-v5_user_cfi_series-v12-21-e51202b53138@rivosinc.com> References: <20250314-v5_user_cfi_series-v12-0-e51202b53138@rivosinc.com> In-Reply-To: <20250314-v5_user_cfi_series-v12-0-e51202b53138@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 , Jann Horn , Conor Dooley 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, Zong Li X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250314_214053_158570_1E67FDE0 X-CRM114-Status: UNSURE ( 9.39 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Clément Léger Add necessary SBI definitions to use the FWFT extension. Signed-off-by: Clément Léger Reviewed-by: Zong Li --- arch/riscv/include/asm/sbi.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 3d250824178b..23bfb254e3f4 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -35,6 +35,7 @@ enum sbi_ext_id { SBI_EXT_DBCN = 0x4442434E, SBI_EXT_STA = 0x535441, SBI_EXT_NACL = 0x4E41434C, + SBI_EXT_FWFT = 0x46574654, /* Experimentals extensions must lie within this range */ SBI_EXT_EXPERIMENTAL_START = 0x08000000, @@ -401,6 +402,31 @@ enum sbi_ext_nacl_feature { #define SBI_NACL_SHMEM_SRET_X(__i) ((__riscv_xlen / 8) * (__i)) #define SBI_NACL_SHMEM_SRET_X_LAST 31 +/* 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