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: 13855774 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 C0CA5D7494D for ; Tue, 29 Oct 2024 23:46:27 +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=q+WX8IZQuQx1N1Px69HXH8wrWrm7upwgCyu7sjNE1xk=; b=y25VdvNsDgZg4h cZICnw7R68HvFnUeNn8NUQkqtYUI2COLBoEvh+B6PtZpNzfNlUcj1jSXC/cqqSe6stkX2jiDQ5p3j /dvMDkNlzKDbLl5pD1EYFhMY+/g63QbmWwSnh4X5g6mYtoy/MPsePWapCXSY6613f5W8WKGUTzsH3 ceNvPt6MfunUucGTGb3EM+dk1GxxH7LQBbWBEo3n/rnNPjQqd9KEdG4141LU7wq/V8QSKP/++FwDM GBvuDlnV2aFx4vavmg2qYkCWiCgoSbAVgCAKkOiiTo9H1Hg+FlzPIWgY4ajG3VivNU4L5rJiv90vn qY5bOIzaRmBe+BUdOC5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5vun-0000000GEvn-3OdK; Tue, 29 Oct 2024 23:46:21 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5vu6-0000000GEKJ-13UG for linux-riscv@bombadil.infradead.org; Tue, 29 Oct 2024 23:45:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=7vRNSIBiNXIf2UJE+KhXd4ECbBBsrxcPJxpg99mApzo=; b=cd4WOkYwBRnTjjb7gxGPmZZhwI O6REJxvX+wOli4spdKj8gz9tgTbcnlpNlo4Gzk2yAnC64BnCptEqZMkdYYjBCVmYmIxdGGpl9x8CD jCWmTDw6qeWBz+A+d3bQyAhWfffslljBHm8M1Bkq/umz3rYrA1cnNKMk6+ofqnCeld+AhVX5tc7tb a6rsNzdXqUpKaOIKVWeABfP/csh+MwgcTqeTfLi9RmammM0kUwhYaU09Z0lm8SqmBQN3K6TvVjJka sBUfwRt/4mSaprFbSNBHaAEaG7sdF3ro7L1uwsUBEO5znuT5m6CkBkRVGOTEDN9Czg+tLGXflfR+R 8g8s0tZw==; Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5vtu-0000000A1O0-2lpO for linux-riscv@lists.infradead.org; Tue, 29 Oct 2024 23:45:34 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-71e74900866so4572177b3a.1 for ; Tue, 29 Oct 2024 16:45:25 -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=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=7vRNSIBiNXIf2UJE+KhXd4ECbBBsrxcPJxpg99mApzo=; b=KqxRQ7P7EXkn53JCD8YFGpSFkkKoA2RKxJ6OuYo/OHN9d+LTLtgsoTZrxH+YxhoiLC OBvtc6WXA5xMXlrZG2fOqUJhcBTZ/g7CqAgJpO1ziHlU+KWSCk8eypSqhnvNMbcFycC6 VCXW/PiCCK7nvtgMM6vcrwhYx/7jJ4P4vJo6k48+XGbFhkeA8noweIZJBfIjdioPFp29 RHzsmQ1ljc1/nA6K3FaWiqpRuO2mU4q4gBQXX4xVNPJ3RqASloawjFKQiD0LNPnMdBpQ pLZmkoKnC/gkQDwQ0mBVb3uXDz5Q6GbsA5F+QrxC3WicjOurd6iEy4fmtORuB50y84zs hoUA== 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=FmPGlHY3zwRycW1f0gie9gczxyXPXPwEufgzAN7uFPVWw/68XtPxXDg6ePpXa1rWUq jnaCSegWwBYFCC3NhA75yYWA8pPKeGLMxhtI+kpwbMLOdy5jMfEKK2DvyITqWdK/x1uR cXROOrESZa+/4hYhKUxMcgJaj1/ip3H6kc4Ru6WF+WiO7qZxFrJw9jMG/SOal2FKJuGN JnM02LozY60MuvPPrjzKAYMdsyITqsPJQSH8o0Ky3r7bG3F6mVwZQBSm9sIuwZP5Ndpi oHqxczvuE3FGaKdU58D0Bs1GSpy1gxTRdMwD3fg6ZNpbNs09ZdzmOpXZLTxpgVAsfNIP GV5A== X-Forwarded-Encrypted: i=1; AJvYcCW850kc5uOIsl6Jj5iafN5dFVvcFpZEvInajbihiKIdQHOtSbVgJim0zTOE0mhJ3nzz6l+38V1lraGAiA==@lists.infradead.org X-Gm-Message-State: AOJu0YxSRRFKv24F9Ui2MzGTx3M/Heb2M0st7WH3NPiI7VFOamJtMVpq fpDPXotv4bzc6iL3pfyX6jYkFWpO68/mrLOTWAJm10FqrIgfuUdHb64N7q+V2Fs= 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241029_234530_190739_4D360550 X-CRM114-Status: GOOD ( 11.18 ) 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 --- 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