From patchwork Tue Jun 25 14:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13711440 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 E9F18C3064D for ; Tue, 25 Jun 2024 15:02:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEBC26B0082; Tue, 25 Jun 2024 11:02:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B9A316B00A9; Tue, 25 Jun 2024 11:02:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3A346B00AA; Tue, 25 Jun 2024 11:02:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 85F316B0082 for ; Tue, 25 Jun 2024 11:02:47 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D66471401FB for ; Tue, 25 Jun 2024 15:02:46 +0000 (UTC) X-FDA: 82269727932.14.2F100EC Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf24.hostedemail.com (Postfix) with ESMTP id 14378180031 for ; Tue, 25 Jun 2024 15:02:37 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pNuQG46x; spf=pass (imf24.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 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=1719327743; 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=CvhkkUJZStYguSJ61DESxCdwJuPPz6XM/XVUYoczIro=; b=h929tsb0N9NHgaYerrX+rvnuzy1ZhygnTzQr3f+in8GkRumDhbDMVc/QfXcL0i4zNNIf3e uZ6jCwgPiMZhJur+hQk2TH0wB/jCeewFuA8tjoy8rOqL09S6tEqdeyMOWnSKkzR7wSdI6K bUv6RAAiXEbnGL9a+Ip5x6tp/mb4ShM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719327743; a=rsa-sha256; cv=none; b=eDucB5EFKhLStHP624KThrbZbUYuW8GhsH7tURztzqmf+Ie6bvWlrNqXlzWis1RCvVhapQ Qx4JUGHkwgzS7bI+tNyE1wvr6XepetCWNQSpv+ppQjRXzW2PUCYqirTzd6yv4PSztweSyO dOZekKdPioVDUb7uKH7WUM5bQ561yFg= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pNuQG46x; spf=pass (imf24.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 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 sin.source.kernel.org (Postfix) with ESMTP id 88711CE1A81; Tue, 25 Jun 2024 15:02:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 235C8C4AF0C; Tue, 25 Jun 2024 15:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719327753; bh=Kmxb5RVmmeKbW1/e3B7PrOUII5jIGIYQVXAvph2Sh9w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pNuQG46xkvoalQUluSU0Pyvi0FtChPN7m57Cv94qrrJxDYDN6LCwQkij03Gs0g2rW VHdt5Nov24e022+FazmjFM/W+rTThpo/VUpLP/c90c3TrLzn+3P+juCj7S8opQrRRb ilD5u2RwzkuutsnvK5DAK49HhvWobgc5+Z/Juij/4EIDdkGi/ZGMV5H95Kj+abYLv3 jYGi1wCzuNQsQ5IeYHgRCQEXpo67/UbXPwn4oSwai9IcN5lgHlCn8Wn/KGT28TS2FI GgGoYkYpogFpCLq68jzH6LRWO+m6/ABX5Oj8+RnZhj4pd34sMxyp3Xk/pZlQ+GiMQ5 zL6kNPmu5f49w== From: Mark Brown Date: Tue, 25 Jun 2024 15:57:44 +0100 Subject: [PATCH v9 16/39] arm64/hwcap: Add hwcap for GCS MIME-Version: 1.0 Message-Id: <20240625-arm64-gcs-v9-16-0f634469b8f0@kernel.org> References: <20240625-arm64-gcs-v9-0-0f634469b8f0@kernel.org> In-Reply-To: <20240625-arm64-gcs-v9-0-0f634469b8f0@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 , 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.14-dev-d4707 X-Developer-Signature: v=1; a=openpgp-sha256; l=3096; i=broonie@kernel.org; h=from:subject:message-id; bh=Kmxb5RVmmeKbW1/e3B7PrOUII5jIGIYQVXAvph2Sh9w=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmett+HbgswjYmIS8NkxyQ5h/tmy9cg8tyQVHSeEPW ROv9x7yJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZnrbfgAKCRAk1otyXVSH0P6tB/ 9YJkv1pEI2Ay3oWSOI4Ku6iBxLgePypAa//iO/tXZKi5RRtkYzG+iXbXcvJh4pSw8RIW8Hj1ykC8fX FRSx/1jK5T7ch4HvDyZkbb/sTo0hNnn13zrSz4LoKc7OucF0pa8kWDQT6kLYWKI2JzIOyTAqZI7IlV 8MM3HcP+Z+FkrHXOXz6Hy27RVcWw13oS5gpyi4ZP1hgVb9pHYmyzZ0dBDQ4RaeGNGSyxBXk17ZfpiT 16VK6xI9ZRpitjDrbExn0fm+Z1MTzk9zZYHtnn4MxIG2pfEKSw5fMxokw75jpiirfbD+4FGn30b07c 9Hn5KOdKrWAy3fcNIhkxBAvRU9lwzO X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Stat-Signature: mjp5r6w9dzt4onop31sfubprfynipg4g X-Rspamd-Queue-Id: 14378180031 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719327757-848211 X-HE-Meta: U2FsdGVkX1+QaE4awGWyCTXYnYTSWiDYHv6gfzd+udddxUBDN/e84zjr2iTz2qzcShhxaTnajhudN4SS9qOpLoMdqw43rPxo9BeuhIUc4dMl6Gt58+AdccrX3erQAruDqVioVY1w0zxNmqERoQdxj/fm9A14URRpUFWJPDTFDEvIp5bh+hSQAL9TsX0BaaOhtQ+VzNdOj5Xqcr0XkYFBcGuZCuYNyoxqRk6C6TkTz1L3XmMKI5nvIorXhZQWMLii8m6CnD3CY1ChlkTA2ZThJta239V+9qPZh9+VpW1SmaUeHRH/bqDTZjCh9w2FGUK9dxKTEH246zATrUMHhqbW20fVG87ZkhrVUshLDxEXrMkzAZhaq4ooY6Ge0QSeo+xyYGDpNx3JrqhWSqPt6WKd6asXBQdO27PepK7PAyS48WAPbqBUA/RLgzYX6jX1H83x+nxY/3oUxE+MJsEwpOTMo1qM6qMmQ02xZG6W9v/8YBsxDJeSy0lUGrwJ/esS+4XTny2UWFtnjoGNcALi6wd27Zo0E8WkxF40iQmZLBbH+fmHI0TkFT6U3J/uSqUCKqu8aE2R9OQamidMkE4cpaKQTej+gNYssoDzihqYUCagbi8XgKyZPP2D8p1TDo8Fl8jhp3EVMdvGXZi7/XEu8298IYMaBDxXjmEaSJgGHurDuwKQiroqK7kMHjkilK43dYPoWorOoaUIsMMeeZpB3igLyxod3G6VdIo2Fs0+cjhHc1qNTBs+VmsrHndT5q9dgiNdEKuiqrxjvzOueGj07dGqjHnllNh/V2IGbOVZjo2Eks+i/VvyAbETd9r649Q+yadS3fLHXcrUdJACNZ/ghidYT+BCfSELmWLDvJqLSlf9gGX+Xbj+KHSth7QflQuPOcxopT2OB6kzNBa+wIzgf5rwZc9B5b7Y+tJjyAy1iKqjK++uJ/dxxRokGOUnuyR7RouLcAjGRjK3TfPiLVScjbt VDkauiFo 2JyNiSq80R21zKV1nszTMdCrV/gFmr9hC8SGy0vdju5vWkahpUgxKIsXo5O4An9kJvpwlOXYp4iW+E3qQ1RFSgIHB7NEqszCzFOVvkpsMAX3yfGlFkoKcQYYQ7ZByNLHwYMejbe5Vd8OoyqcUxFlpNKxs2XV00AWY/nmVHlhlCydV4yK2G6vDkhdOcBzkmKkXOWEfSlTZDuy7UfNSErx0DrfZUiDXx4FbN26yM8tsvlHdEA8z6+iS1ZxZwH5OungC5claARNaAY+OkenE/tfS1W9PKhjHdodEipSsgvvLHXefoYTt8aaP3A2YKdlu7wUPVlJB93Q3Po2c+oyrY5+wSqWfT+C3kJVHuiG/Zp91r/AEmgwFriWN7tJdnSIeU1BxXTV+ 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: List-Subscribe: List-Unsubscribe: Provide a hwcap to enable userspace to detect support for GCS. Reviewed-by: Thiago Jung Bauermann Signed-off-by: Mark Brown --- 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 056d394920f9..d2d9b0be9c5b 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -3000,6 +3000,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