From patchwork Mon Oct 9 12:08:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13413518 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 A0483E95A8E for ; Mon, 9 Oct 2023 12:12:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 450736B011A; Mon, 9 Oct 2023 08:12:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4013E6B011B; Mon, 9 Oct 2023 08:12:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C8C96B011C; Mon, 9 Oct 2023 08:12:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 18DFF6B011A for ; Mon, 9 Oct 2023 08:12:44 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E1709B48C2 for ; Mon, 9 Oct 2023 12:12:43 +0000 (UTC) X-FDA: 81325811406.19.952CEA1 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id 01C14140002 for ; Mon, 9 Oct 2023 12:12:41 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qbHBXwJK; spf=pass (imf09.hostedemail.com: domain of broonie@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696853562; 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=LQIhCraVzpMXBYTq6hVA7xdodarb3uwbd7PqwwDVRIw=; b=krkagjIbUoV24VTmazfZsBJuXRd293CmZfzs/cCs8W9uANVCz6c89/vJpEOYb06qSe+WzY hdRLCV7tU+Dq+Fv+ttPQ7PUJx5QVS/M9Gg4cwTpX+a+roSGAs3Rp1SHm5dLOzt8Ai03BSo zyF20kEVdSopiiJLub9jhjcq5uZlrKg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696853562; a=rsa-sha256; cv=none; b=2ejKetMQyvZz2TCAXMuqKyDd6uxk8A6kFXQRxSlJEo4eufiaqSNevOOhJPWo60Ha6x4Fn6 IX8x+/rYOFYcKrOqzF2Tc0qGRCtMEXnEy/7dvVcILZ02I810FRV0yC2HfwuKF4d/jkqzIq ANkPvqOJiXyUxi2feW4RRlMG+5eZ9TE= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qbHBXwJK; spf=pass (imf09.hostedemail.com: domain of broonie@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id C20DAB81135; Mon, 9 Oct 2023 12:12:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1EABC433AB; Mon, 9 Oct 2023 12:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696853560; bh=lvoE1O3P70dbe+mZ76dqPIgfPzAOQeTbed5LhVnXTzQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qbHBXwJKK6WbkIpHZVNNuR75YMWz6B1rlWgXQGomiLIBnVf2ZbBp1dMC0ZMOgBEor 2EF/M4CxuUDKzhTkgYFMt2wKxY40qj1uuIf5HvM4Yd2qcAqbdokdvFm0wK5Tv+3Vfi vDukFgrzMMfwyPCYvnAe/jatMV2NZIUenzxynOCuwBNxnT8XV7mQIAhodVazrt8BGb KP7yKsLjSQOfd10jZ71s4gTznggZm9Je/wNUcYqFWSUIYPvsSIQ4wV3eddwp4bOZGR 3y2hn54HnEP0BPy6BzKeM5VHL8ZDI9dspK+4Jzy5MK3NrkvTCCVt6sz071rB9ad1Ql yhgZjrJKSvQ2Q== From: Mark Brown Date: Mon, 09 Oct 2023 13:08:51 +0100 Subject: [PATCH v6 17/38] arm64/hwcap: Add hwcap for GCS MIME-Version: 1.0 Message-Id: <20231009-arm64-gcs-v6-17-78e55deaa4dd@kernel.org> References: <20231009-arm64-gcs-v6-0-78e55deaa4dd@kernel.org> In-Reply-To: <20231009-arm64-gcs-v6-0-78e55deaa4dd@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 , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , 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.13-dev-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=2961; i=broonie@kernel.org; h=from:subject:message-id; bh=lvoE1O3P70dbe+mZ76dqPIgfPzAOQeTbed5LhVnXTzQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlI+2e97itUFbmdKM/AAm/oWnm9YAweKpQRndIz6MZ nS5x0VmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZSPtngAKCRAk1otyXVSH0EeYB/ 9Q/PNyvnWiW4p9UMFv1tk22XH72fXtr+z/uCzMFO15lWzaMu2s5nb304MeTiU7E3qiL9sx6GCQBB7K BkhkD1KNIyCu140HAsk+JKUr2XlTIbR/t7Ec9SDoPKKtasEYd1FagLldM6jZn+BfLwR9Rq/LfE03jW GBJXSo6RHjSPSkiqNtc333VrTbWBknLn5MiUc2szJzvRaGccbjSwn3U0ZtidN5MC2+Ddx4yK5Oc8lZ gBKjROMbML5xWREWb2yXxSYfDBe2tKfZSn1ctZNFHgN0YtorefoswvPl5MM1wIcnGN3+PQyzUPI78G MzzKoi+Db2v4RN7Nur25rmi3/QsEPU X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: 01C14140002 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: zk3j5e1irz693o55or5r4bxp6jkgc98u X-HE-Tag: 1696853561-782206 X-HE-Meta: U2FsdGVkX1+ZocvSh0Soem45BjxqAgojijM6C2P5SNYgVGLH91+begUmRMK8bSfr6vvOEuzxnjdx/0xnbHBWnuXzzsYWxotN4FJKoW5NblK5ovIFCFs7v1G8izeCnV2YRF7DR8d8BCJZR/+QiT5er4KvCwgg/oeWPTxxCm2nVZqY/uCxNHMOmQIAMGsNaT2blXiaeBZ/I1+lRgLuoqCTF9NbMpRBX8wgr/bJgDSlUdNVlq2Rn6ax7uZi2254da4+SNNqjcnTo3S8HLf3HuYQVFntAxvqLKDeGox+ZMiC3a/roerqxDcTmGBoJh50dYhbyGMz7elxEHr3bpr5ps7qe3G12T6t1hgBhfrYKt+OYrM33hnNSsFeBxlc5uLNtapZNcOQAhLlE/j4kRYlQd8EmJAxFsR4t+paFVK+TwjGOExZoIAdAztXczjWwh1UzBdlGg+NMat/BNfUR8DDMJksA/0nrGgYCdPZyqYCtCoN/Y3aFxP/TZXM7vql6/1HB+MVDMhgFObNg6HnWBYmB32PIU4Q8gSHiNpom7cwUyK8cG01TKNw8EKVhY4xbZEtFblftEh1Oi1nBzLycTv8qWMw+9gf0pBHms7mxxzyHICkt63RmnrnPYrYh4/vVE+Cb6Q6vI2fAsUCNEeqBD04G2sfDo8pCRjVffaPLjHdYCNda+XTVirbhpRGMfMv33MK4ZNKxalCDUvMEtKBqfM1vMogUGb1+7GdFoBKraGz2zY+DXpFdVFduM9s+Os48Lt4HfJgScAz4nroYwHY2moq6jGv5rApsz+/UyF1RX1vSDU9tJUFDcVgs6AH1YZGU5lCyACSuIpeWGFZ794hbj4QxqWwggGjMCABVGv1f9hIjI4ORwUDPN/7UP/i0VY86Xdw0KDydgHZN0TKTSIIGrDGIMAZWL4JmvETNiGvXn0rel+uRVWfs7NqpSHsNlH17kfWDnFJkiyI6O08urp80rtYJPS 9P5kWqtR vHz/mQ0QIbAY6prITiSknwozjvEUMiAG+9QRGbCBFGm4neltwcGiL3HIxObyVncfhLUs/Wob2L1VNXh68iAJcDEU+aJTgtPkGkef3HPNkMw21+tJL/yqwGMGzlA+ZmXWrDXxqlB6jForLG7Cg+Pv03i/8aaqksEE417tp9GTT0+gsPkBmYQ1t8LmVFOtX4LIDTt/BW0Wnw3aZfGLm7sMrATtULf1KYGbCysjJxGyApWQV4LVvIuu4FzWk+MKDOQ5vXm30Qlwaf2sqZnOJ6/b4lx6geWqHZ50IRcSB0A96qEnoKkXvI1bqXinD9MpYLv3RZQc0QEFA0xxiS4w= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Provide a hwcap to enable userspace to detect support for GCS. Signed-off-by: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 3 +++ 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, 9 insertions(+) diff --git a/Documentation/arch/arm64/elf_hwcaps.rst b/Documentation/arch/arm64/elf_hwcaps.rst index 76ff9d7398fd..5c9e17a3c8d8 100644 --- a/Documentation/arch/arm64/elf_hwcaps.rst +++ b/Documentation/arch/arm64/elf_hwcaps.rst @@ -308,6 +308,9 @@ HWCAP2_MOPS HWCAP2_HBC Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001. +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 521267478d18..d4bcd1cab698 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -139,6 +139,7 @@ #define KERNEL_HWCAP_SME_F16F16 __khwcap2_feature(SME_F16F16) #define KERNEL_HWCAP_MOPS __khwcap2_feature(MOPS) #define KERNEL_HWCAP_HBC __khwcap2_feature(HBC) +#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 53026f45a509..5c0932bb7842 100644 --- a/arch/arm64/include/uapi/asm/hwcap.h +++ b/arch/arm64/include/uapi/asm/hwcap.h @@ -104,5 +104,6 @@ #define HWCAP2_SME_F16F16 (1UL << 42) #define HWCAP2_MOPS (1UL << 43) #define HWCAP2_HBC (1UL << 44) +#define HWCAP2_GCS (1UL << 45) #endif /* _UAPI__ASM_HWCAP_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index e247dce1759c..114876512172 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2844,6 +2844,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 98fda8500535..e99724c9b440 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -127,6 +127,7 @@ static const char *const hwcap_str[] = { [KERNEL_HWCAP_SME_F16F16] = "smef16f16", [KERNEL_HWCAP_MOPS] = "mops", [KERNEL_HWCAP_HBC] = "hbc", + [KERNEL_HWCAP_GCS] = "gcs", }; #ifdef CONFIG_COMPAT