From patchwork Wed Aug 28 23:27:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13782179 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 5CB33C7114C for ; Wed, 28 Aug 2024 23:30:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E42876B00B0; Wed, 28 Aug 2024 19:30:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF1936B00B2; Wed, 28 Aug 2024 19:30:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6BD76B00B3; Wed, 28 Aug 2024 19:30:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A45FA6B00B0 for ; Wed, 28 Aug 2024 19:30:43 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 66E88A01FE for ; Wed, 28 Aug 2024 23:30:43 +0000 (UTC) X-FDA: 82503251166.05.AC479F7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf15.hostedemail.com (Postfix) with ESMTP id 13322A0019 for ; Wed, 28 Aug 2024 23:30:40 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=McPJdFXz; spf=pass (imf15.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724887724; 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=fPGbq8mL8Md2E4S2FovS7cuTeGmusU6z1u3MSnZ8kms=; b=6cGpWkgU5mELzsoA8rZ5TZThmH6oq10QyRBpTfm8wb119IYGNMqPWwkZnCN9iwHl97izM+ BS3WsOWCRWWkZo3oNQPoxYBmnLnD9Y6Q18jLbAHxrkyUeoTFA3XSqDkivKx5qqPoHLv0rq hVYHtu7V1V6NpcCUdLkJXIZfcOjwask= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=McPJdFXz; spf=pass (imf15.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724887724; a=rsa-sha256; cv=none; b=0+qJSMgmngYvHS7tLcyC4VXwW3b3ujF8MHMOXsdJiGXTJkWprPD7IS238AlyFaxuqlKD4A hvi0+1eIxLVd0+UfO2jUl9PKp1iHfC3RT1IGvtiQEMrldRj9oyIVfMhhultp06Lr5BBtXf haSeUTXt6/8rglGM/XEuRcejffNFfiw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 37E29CE19B1; Wed, 28 Aug 2024 23:30:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B304DC4CEC5; Wed, 28 Aug 2024 23:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724887837; bh=zQNH+o8kM+xdeVC0pT4NYleLSSNgw4W1dqWM5aTo6L0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=McPJdFXzB7Xi2TgOFuGbob5FaZF8TacF/kohZkUNSHMICkKs8oRH000SUaFgR2+xG ldppZrfA5lQ+BAzPt68wEREuiHDyB7OWYNv7q3UtCeQMqKxNEONZHyblc4exoaBhQR WPM0DmOtpEzqX29n+FpeYRYvnu20aJTTFmmC50zZx6AmLcP0u41AG6MHH7tRx+75tE DvX6Nljuh58mbxhhLzR2+d+RwP6S0Hilmo+rCPrQgpEF0rt1l0r0/6ZIJaF57WL3w8 fQEMJ6c/T7/BQJ3DG6z2ouc5uGlAvDLRVUV/ASQlRzu/ZvWnQP7pUM8p4UpAninew/ 73e4D2AxwPH2Q== From: Mark Brown Date: Thu, 29 Aug 2024 00:27:33 +0100 Subject: [PATCH v12 17/39] arm64/hwcap: Add hwcap for GCS MIME-Version: 1.0 Message-Id: <20240829-arm64-gcs-v12-17-42fec947436a@kernel.org> References: <20240829-arm64-gcs-v12-0-42fec947436a@kernel.org> In-Reply-To: <20240829-arm64-gcs-v12-0-42fec947436a@kernel.org> To: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , Kees Cook Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , Ross Burton , Yury Khrustalev , Wilco Dijkstra , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Brown X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=3152; i=broonie@kernel.org; h=from:subject:message-id; bh=zQNH+o8kM+xdeVC0pT4NYleLSSNgw4W1dqWM5aTo6L0=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmz7KFye+Iq31zZE7cvUlDXOHm9yUIKSyEcn/sVTXF VxtA+yKJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZs+yhQAKCRAk1otyXVSH0NxnB/ 41/2S9q7Qq+yczFuuYwahqXHNSzMUqPuBcVDukfyFBViWDncG55aJThy4LSw3SZZmcVh13iFa2M7Zt mzYDZoY6CbuxqDBATiuyXvh5EHNhm1lLzOFpzB30bEIhanE2qGcYIyXwyDz6V2kjoVise5X/aOpYC6 +Ywrao7lzPfKuj6VkWeKtDU+b99eWD4y2puxJ1xgb9rfrOwEYiXm77oNgOCpD/jF0OOO5kdj+RXaLd zsTDXVyneyKa8gYaiNpr5FRPwv0FNJYQAqUJkmD4AYp2Zrxp6puvpQkgOBEPKZei/1E6O+1oGKYqk+ zqvUM1uMo2qM4ABISo+karAD/FUOfw X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 13322A0019 X-Stat-Signature: ia1t9iocmdirkcxyymduyjibzcp4yg93 X-Rspam-User: X-HE-Tag: 1724887840-232982 X-HE-Meta: U2FsdGVkX19H1fHR1f+nW9jaIXxxSSwenI5K4vRiFXLcXFPDuPQTDsAEOT/fgyLtrdCN9tZY8DEnlaeBAcDY2aBKSKEBVbfPd6+EyShaYEONqfpFx9FmCpx/pDFR3fWgBCRiK88hR35IJa6GwTum/NX/vpKTFhQq32jlRt6cFS4TVAGpgiwNvwVtotYGu80cPx7ER7fAMlXNyHFLHGrDeDrX9yfxkuw9jIwDEH4cSWrrPxyGKvAIhtSyV1n5u2SVj52UbU2AthvUxbGAB2uEOrH6HwIhub6x4lXEBzRPjXuqWAHfgX3+BnIKYfcUWF13goE+EQFeA7EKmvg0/91pym5KeV+xdo4/HsTx+ZS0QRb6lHw8i6cXM8ypfNDykIQ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ity=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: Provide a hwcap to enable userspace to detect support for GCS. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown Acked-by: Yury Khrustalev --- Documentation/arch/arm64/elf_hwcaps.rst | 2 ++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 3 +++ arch/arm64/kernel/cpuinfo.c | 1 + 5 files changed, 8 insertions(+) diff --git a/Documentation/arch/arm64/elf_hwcaps.rst b/Documentation/arch/arm64/elf_hwcaps.rst index 448c1664879b..cf87be078f33 100644 --- a/Documentation/arch/arm64/elf_hwcaps.rst +++ b/Documentation/arch/arm64/elf_hwcaps.rst @@ -365,6 +365,8 @@ HWCAP2_SME_SF8DP2 HWCAP2_SME_SF8DP4 Functionality implied by ID_AA64SMFR0_EL1.SF8DP4 == 0b1. +HWCAP2_GCS + Functionality implied by ID_AA64PFR1_EL1.GCS == 0b1 4. Unused AT_HWCAP bits ----------------------- diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index 4edd3b61df11..fd7e162e7e39 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -157,6 +157,7 @@ #define KERNEL_HWCAP_SME_SF8FMA __khwcap2_feature(SME_SF8FMA) #define KERNEL_HWCAP_SME_SF8DP4 __khwcap2_feature(SME_SF8DP4) #define KERNEL_HWCAP_SME_SF8DP2 __khwcap2_feature(SME_SF8DP2) +#define KERNEL_HWCAP_GCS __khwcap2_feature(GCS) /* * This yields a mask that user programs can use to figure out what diff --git a/arch/arm64/include/uapi/asm/hwcap.h b/arch/arm64/include/uapi/asm/hwcap.h index 285610e626f5..328fb7843e2f 100644 --- a/arch/arm64/include/uapi/asm/hwcap.h +++ b/arch/arm64/include/uapi/asm/hwcap.h @@ -122,5 +122,6 @@ #define HWCAP2_SME_SF8FMA (1UL << 60) #define HWCAP2_SME_SF8DP4 (1UL << 61) #define HWCAP2_SME_SF8DP2 (1UL << 62) +#define HWCAP2_GCS (1UL << 63) #endif /* _UAPI__ASM_HWCAP_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 315bd7be1106..e3e8290a4447 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2994,6 +2994,9 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = { HWCAP_CAP(ID_AA64ZFR0_EL1, I8MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEI8MM), HWCAP_CAP(ID_AA64ZFR0_EL1, F32MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEF32MM), HWCAP_CAP(ID_AA64ZFR0_EL1, F64MM, IMP, CAP_HWCAP, KERNEL_HWCAP_SVEF64MM), +#endif +#ifdef CONFIG_ARM64_GCS + HWCAP_CAP(ID_AA64PFR1_EL1, GCS, IMP, CAP_HWCAP, KERNEL_HWCAP_GCS), #endif HWCAP_CAP(ID_AA64PFR1_EL1, SSBS, SSBS2, CAP_HWCAP, KERNEL_HWCAP_SSBS), #ifdef CONFIG_ARM64_BTI diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 09eeaa24d456..2f539e3101ee 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -143,6 +143,7 @@ static const char *const hwcap_str[] = { [KERNEL_HWCAP_SME_SF8FMA] = "smesf8fma", [KERNEL_HWCAP_SME_SF8DP4] = "smesf8dp4", [KERNEL_HWCAP_SME_SF8DP2] = "smesf8dp2", + [KERNEL_HWCAP_GCS] = "gcs", }; #ifdef CONFIG_COMPAT