From patchwork Mon Jan 6 15:48:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13927606 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 825B1E77188 for ; Mon, 6 Jan 2025 15:51:05 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MjrxT0auFzLTl3kogpHJbWaGYpkay3TvNKsiZK71Ux8=; b=ZSkuvDmMCO5G/y CxEVchdaXqWIOf2AKoBsEE0QX8xwFJrmsFa28qZkprA3ZZm+1cenFw/XWg9y2A4y+gAC0v/wEIZ/w 99W/vbZrPBYY337T7AtYcbCA5dIx/dQBgRuN9SW9lInAHcCQMhCaQY8BkUsJZ9TBpTarUQxjVD2fe FiQO5zVm+KGgOwGR3S5h8e1q+kUrRrUl+WAH+7zpwb9JTBBRZrGn6yPtlULtcz0w5nDsnro2Hy2VV s26XIxCr2jsMYcHU+Fm0dZvEHqmLo/6nUeOvY9weNQkNEL0cHUp2JB72xA3liAovqjQ19TdriZ3IE 7HvJNe15GaBGeLml8tGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUpNc-00000001qUq-1SSZ; Mon, 06 Jan 2025 15:51:00 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUpLt-00000001q3P-0rHm for linux-riscv@lists.infradead.org; Mon, 06 Jan 2025 15:49:14 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-216426b0865so205057795ad.0 for ; Mon, 06 Jan 2025 07:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1736178552; x=1736783352; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YWWbvbVWcBkTLDmBWRGuP/373zfHHQD7CsE6sYbpx+8=; b=diT2LbjAvHbiJHI9xCsx8SmO1nchaDK44rsGe8POikAH21PRAJcpeXpV5cSyKo4ccW C2/6iKIGHXefbOMLbY233WfURKVRpEcvWH/bhz10LZ/DKp0nqnKrVxHCnL4RiXKSZhhU um9xrEmt15bjzmYpKoKG/SgXblkstr0/YYmvfZlq+BaHdc77KQHytAqAsPKR193WlfDP zFq7uK/xRYmkQfcv2yqf82/DYfn1Ajvnbg+3SxRce/CkjcoebMIonzGFfLqKpUKiSiLV eoVpSU7Fw59uV4SCFQiI8lJk4J7c/ZWLOG++Iv6dG51ZU/bVYJCmLJEIpElhkWwGyW2u khkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736178552; x=1736783352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YWWbvbVWcBkTLDmBWRGuP/373zfHHQD7CsE6sYbpx+8=; b=t1QPPemyouMPTpsBU/1eC833kc6/NDNboilPPFP1+E2Qc4SJbwrS7TFFNapWrRRWhg KbSse0fl33ejgHIAKrgj2AQr+iB43IK4Rq0OkwWQ1Tx/DCj+MiKhjO3yekFtyrozOFhf wPi+5vdm4f5ZdQZiF5a+frYB4aUW96c/8wlTyo+9L+Jl5446SPgkhyC/KDNntucv3oGK 69Y9VtlxnxN530mbGRNbxoPdhKvrUwEIxNCKBIY0xqJC7gziAzYsIAnow5ckZtCmuS3D GH+ROxZ77ypRI2UsKjzIcNSJE0Gfty50VApBWUGQTPG9hMCoI/uJSA4KFTjdvvNN0V9u 1ENQ== X-Forwarded-Encrypted: i=1; AJvYcCWsyjIHpkcsSY55c2XP2YcKJt3q0C0xQ7X80qojjBfc/K0Q3fVJWDgtMPmBpnolxNR56cXAT1h8vpqW0Q==@lists.infradead.org X-Gm-Message-State: AOJu0YygnwQOgNH7lv+kX97QLxaIOPNZuF0/Iz3Luu9uBjBPpY11HPfV DYijKIOLFpGxipt0lHZYXzJjAFBPCLtX3/+591gsMkAkjeTpkiXrBIYycqVd+i0= X-Gm-Gg: ASbGncvnlPKtBjByelvkk4ROGAHjm8YWC/OBJZGHrNG7DTVzosuE4a1YR4wSDAsTFNW ojhTvQv37YaNc8+/I49Ii/bfVQxZkOewrgaX0dFKQIMDZ9egbAyAVjsWpJ+g7wwnA+wAd8jfwk6 0wBGYF60cNgUw7VDK2NBWSF91eu/CAeIqX2Ni2AqprOrfeBMztbYvV2g3Ca1JYUlbxsoYOU1XCT EuYAhhZADhv6zO6hTG+dYmYm3mtlvqa3LT7Sag7CHkJatlIulf9H7v1tA== X-Google-Smtp-Source: AGHT+IFsrR++da94vh57i8gZG2YCIfCJlCqOllnoSuVQjwf/TtLCIaXs8yZigKmfjKjyX3pC2+VXhQ== X-Received: by 2002:a17:902:d2c7:b0:216:5448:22a4 with SMTP id d9443c01a7336-219e6e89a6dmr805222645ad.10.1736178552138; Mon, 06 Jan 2025 07:49:12 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:e17:9700:16d2:7456:6634:9626]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f6967sm292479535ad.214.2025.01.06.07.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 07:49:11 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Paul Walmsley , Palmer Dabbelt , Anup Patel , Atish Patra , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Subject: [PATCH 1/6] riscv: add Firmware Feature (FWFT) SBI extensions definitions Date: Mon, 6 Jan 2025 16:48:38 +0100 Message-ID: <20250106154847.1100344-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250106154847.1100344-1-cleger@rivosinc.com> References: <20250106154847.1100344-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250106_074913_234791_A542B969 X-CRM114-Status: UNSURE ( 9.14 ) 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 The Firmware Features extension (FWFT) was added as part of the SBI 3.0 specification. Add SBI definitions to use this extension. Signed-off-by: Clément Léger --- arch/riscv/include/asm/sbi.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 6c82318065cf..ec78de071e0e 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,33 @@ 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_POINTER_MASKING_PMLEN = 0x5, + SBI_FWFT_LOCAL_RESERVED_START = 0x6, + 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_PLATFORM_FEATURE_BIT (1 << 30) +#define SBI_FWFT_GLOBAL_FEATURE_BIT (1 << 31) + +#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