From patchwork Tue Oct 22 01:57:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13845042 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 B5468D1715E for ; Tue, 22 Oct 2024 03:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=bo8mvyzhNAGog51IrcbhLjSHRzC25xwCT3do7aV0R5s=; b=lySWZVEBXQGUHrobMZCrEcX0j4 qCt9BqLO9UWY6wLH4NYDaR5zHsb6WbQHD0+j27a3u2T4wplWqpMYPwLGmoPbGC36WvQVb5bZeDIYA oo7VXcwek0ZvzsbZPsYNqPQjKb3+X9JIgi8mzg+skLAoShw9dIYcOoDfcB97YChzWORGq+MBKKwZ6 ZWCQ97iYS8p61v78P4RNlWBr7YoIyNGk0kas0ffqR+Za8kc06/j/UC8+QsvKibP6rVdLwquH13MrV nTEqHxiBR3dJAR2crOql/P2yFVLIjIGKYS6A81l/y7AzjeIxqQW6hlfW+wi62vtCljnwVf1SGh/Ut UtMTvlVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t35Mu-00000009Ozi-1TSi; Tue, 22 Oct 2024 03:15:36 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t34BH-00000009Ftm-3A0x for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2024 01:59:34 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2e2e88cb0bbso3728668a91.3 for ; Mon, 21 Oct 2024 18:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729562370; x=1730167170; 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=bo8mvyzhNAGog51IrcbhLjSHRzC25xwCT3do7aV0R5s=; b=b8lCl3PaGZ7t44U8j81jNmUsLQtPG0XmyVyKCrZrNezBcNyTFayM83Mvz3paw45XVo 9ctQQxryoI43Vn9jv+w3CdCfKeNt/FcV+KHqWAKofKRjnCrvHGT9RhY/d/CSFYzDXIjV PNesvVUDEcWQn23URGWue6cARWtMNFZ+J6S8kC+SrRtMwzWyhEVQQw/xEFIUoDACsRji XRwLVVEjdboCPyckWQTdOa/WmNfysl2gyLPkN3b6U2ePIWutDVqRcII1HaUhwvCK+faF pbhHHUVzC8aCnghIwIiN/IwSRmUhRpOdfSCTkh//ESFtGaDLViq9yWTtocWDDBtwde06 /wNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729562370; x=1730167170; 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=bo8mvyzhNAGog51IrcbhLjSHRzC25xwCT3do7aV0R5s=; b=g+95ggsqVt1f3wuLKL787ktslAzHn6BtPp4XTn0gLsmT2YHQblJVjS/icA3vMZTeL/ iugVmwPbEjodI41w6SGm10WJI57u/vYaAqjKFuITtPm6XegUAP/Xjulos/wVzBORWOaP vVitESZHVdShkXhXiGPvb2/4OBCPWMJL+/ibql9HJBQdfyc9/MTaJmm5lcMmUPZr4LoL nfL6cqwrjYm8Ct0GhINSnKHLIu0KdfSllUkWwWRVIwTG9hsvJCFqOGVfmrwUvPBRZUkq igXOKPk9R7BqDP4R6BCycBCknhxKSgtxyARYs0nKsTfJRCq+hSGjo9t097p/7kCdq4sS esrA== X-Forwarded-Encrypted: i=1; AJvYcCWWgmYNqS4p50DNNUYwxVX3d20BBNDHfkEO/nMUzSR0zSJBlMDhbQiN3Y+XnXBv+iFjYYPbC++xDwHA3V0qGkMZ@lists.infradead.org X-Gm-Message-State: AOJu0Yx2+6V+jQ77mGMC1+Wq8miaBvH4pVj9htzAfTh81GekW06lxZ7D e6yTxfkEU9kqilyxfj7ArNPMBSz/CGL6+5vFHFUWRl3xCrB+XzkrzVxKLUEVGjs= X-Google-Smtp-Source: AGHT+IGIGEeeGnC+KScU7RsGDXnOT3F+tOuXMVMoo+fGP2CQIBFtA2wtlRRoG48p3wyuBbKw6oUq4g== X-Received: by 2002:a05:6a20:b40b:b0:1d9:b78:2dd3 with SMTP id adf61e73a8af0-1d92c5100b6mr19225561637.26.1729562370603; Mon, 21 Oct 2024 18:59:30 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec132ffdcsm3600710b3a.46.2024.10.21.18.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 18:59:29 -0700 (PDT) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org, Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com Cc: llvm@lists.linux.dev, Catalin Marinas , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti , Will Deacon , Evgenii Stepanov , Andrew Morton , linux-arm-kernel@lists.infradead.org, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Samuel Holland Subject: [PATCH v2 8/9] riscv: Add SBI Firmware Features extension definitions Date: Mon, 21 Oct 2024 18:57:16 -0700 Message-ID: <20241022015913.3524425-9-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241022015913.3524425-1-samuel.holland@sifive.com> References: <20241022015913.3524425-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_185931_886258_9BD08A25 X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Clément Léger Add necessary SBI definitions to use the FWFT extension. [Samuel: Add SBI_FWFT_POINTER_MASKING_PMLEN] Signed-off-by: Clément Léger Signed-off-by: Samuel Holland --- Changes in v2: - New patch for v2 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 98f631b051db..4a35c6ffe49f 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,33 @@ 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_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_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