From patchwork Mon Aug 7 22:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13345137 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 B564CC04A94 for ; Mon, 7 Aug 2023 22:03:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D5E96B007E; Mon, 7 Aug 2023 18:03:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45E94900002; Mon, 7 Aug 2023 18:03:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D8FC8D0001; Mon, 7 Aug 2023 18:03:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 179376B007E for ; Mon, 7 Aug 2023 18:03:08 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D49CD1C9036 for ; Mon, 7 Aug 2023 22:03:07 +0000 (UTC) X-FDA: 81098684814.17.621DDC9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id EB36E140019 for ; Mon, 7 Aug 2023 22:03:05 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CIBFyqNG; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691445786; 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=UdUe/7o7abJT5BqbT0XR+lhA0UzLWbJEWS7DcJ5Gy0c=; b=vmZWYqXBsqFtFxjbQRzTMdtdBfNqX+4+JnXqJXUvH47o5lJu9Ns3ALCMjdFRr5U28IOlI6 B7PVqG9H5UtwAgXokfECYeYQgwqrc/LZ+srxQXW6CxOpfq0tqZua1He86MmJCLyxubsFWQ 2BAqUjnML6g/bcFgn9Vs2+1sj0jaz8Q= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CIBFyqNG; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691445786; a=rsa-sha256; cv=none; b=VP0sE68x11uQXJ0tXINYEeMMGZQJqV4OLHyzkF86S6+0shKe3DXz0IeXF4p+WVFDRZ/Zhu MHhUFlk+ChqpsAAG/guqNIfT9H61vBmfMWCfvBCMQLR8K3m//tgnJ7vzxep691O943a7Mv ZYIHoLMOKAgCUmN6W2ndR3VOe7Zp03E= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1659C6229C; Mon, 7 Aug 2023 22:03:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 859CDC433CD; Mon, 7 Aug 2023 22:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691445784; bh=ggfCgbEg0UE7JP5CH6e+dKjRf0SerXD/ltcRHcZOEeI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CIBFyqNGcrfqpOq6R8BTm1yxvk6wWt/C4A3uO5XiBzrwhmxJVumHKVGReUNd4D/j1 br5UtebEH0RmY7oMeqaRFrQgcm2OJioJahyEoA/HQGMwHTBvYvzapNcTa3g3zcv/53 j1piAnkGo1sHdlHU6i0zophCuB/VmBrrysT8ZmpPJfFWufosqtQXJFsTkklJoVeYo8 iKYTWz9cUr4Q/ZXoo3EyiKAAZO6psSnoyeJDymIlT7MkYyCygpXyjOy7rC52lWzWPM kFwFrsosfzLCWDsJpYps9+bkakZUhN/olsUxEMO1f/As+hUIYO0mvUAwcLEqnIe6+A pO2wC6pNYErRw== From: Mark Brown Date: Mon, 07 Aug 2023 23:00:20 +0100 Subject: [PATCH v4 15/36] arm64/hwcap: Add hwcap for GCS MIME-Version: 1.0 Message-Id: <20230807-arm64-gcs-v4-15-68cfa37f9069@kernel.org> References: <20230807-arm64-gcs-v4-0-68cfa37f9069@kernel.org> In-Reply-To: <20230807-arm64-gcs-v4-0-68cfa37f9069@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 , 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-034f2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3001; i=broonie@kernel.org; h=from:subject:message-id; bh=ggfCgbEg0UE7JP5CH6e+dKjRf0SerXD/ltcRHcZOEeI=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBk0WmjwcCbGPzks/JnfaQIfFdlcySo+Xhb7ZoorOkh BPhYuqeJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZNFpowAKCRAk1otyXVSH0Ng7B/ sELxqzv9TndJiJaKFN2xDsYzZsTwaTdfWQVXCxwaKMcN+WDJWuyRn2WMnU4LEwvc86N1e1Y0T/t7Aj F6QEt2yM0QSrVKMhibQYlvjUJAKxoIpCxfPb6lCrPbmbQ0IiQFuDHGmt9L/Pu2fGN+/cweG86OGVHk Kujdu7KzE9kEhlTK18kzhMfhmVZBbjrMC769Ev08HnQa11nwE8YvvSQdGcpCr331WLFc2NeJGXOzMU X2YwDufERf32R8WH8k2BtqSqBWvKVLpEFdtL+E/kdDnumKj2lNczmmEI1EGzk5VTB5oC6MUoDLNni7 KjEWDNii2I/FOpnm31f7ggZWPlySmH X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Stat-Signature: ao3pfk4x5pz3z558quz9owdxdr7dksj6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EB36E140019 X-HE-Tag: 1691445785-842783 X-HE-Meta: U2FsdGVkX19q2APcBWYaVkswZvQTr4RfA19Gae5SIpm2776G8yD0Y2hMJugGf4UybU5aI+t5Ivt16tSWbCuzBrv1tc7wgesg4+gt7hVWCh+b/Ws+XTEX7La+jbrIhmK/g95Pyc70M5LVdedUH6HoSaFMoaD+nxSzbEC9/lSdzeqA8zNPmTXZLXcxB3H20xkr/n2OMVk7x+GXGQ2VcObQv3a5glbBOA5D4z77NGxihhWf7amQ70DVnAmGUia4nBWhi06+PJ8yaOkADvtQCWO/uDq3LKdyAdcEgcud39enhsNyaZ5Xfd5fyy5ONQ8SHsjON7JQbIaZMsVbDpxBWm5vJhgtNyReOuPY1Sbk05LIhw4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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 8c8addb4194c..75f3960cad39 100644 --- a/Documentation/arch/arm64/elf_hwcaps.rst +++ b/Documentation/arch/arm64/elf_hwcaps.rst @@ -305,6 +305,9 @@ HWCAP2_SMEF16F16 HWCAP2_MOPS Functionality implied by ID_AA64ISAR2_EL1.MOPS == 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 692b1ec663b2..39f397a2b5b2 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -138,6 +138,7 @@ #define KERNEL_HWCAP_SME_B16B16 __khwcap2_feature(SME_B16B16) #define KERNEL_HWCAP_SME_F16F16 __khwcap2_feature(SME_F16F16) #define KERNEL_HWCAP_MOPS __khwcap2_feature(MOPS) +#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 a2cac4305b1e..7510c35e6864 100644 --- a/arch/arm64/include/uapi/asm/hwcap.h +++ b/arch/arm64/include/uapi/asm/hwcap.h @@ -103,5 +103,6 @@ #define HWCAP2_SME_B16B16 (1UL << 41) #define HWCAP2_SME_F16F16 (1UL << 42) #define HWCAP2_MOPS (1UL << 43) +#define HWCAP2_GCS (1UL << 44) #endif /* _UAPI__ASM_HWCAP_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 91a14a6ccb04..7b46e01140c4 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2840,6 +2840,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 58622dc85917..451fbbeffa39 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -126,6 +126,7 @@ static const char *const hwcap_str[] = { [KERNEL_HWCAP_SME_B16B16] = "smeb16b16", [KERNEL_HWCAP_SME_F16F16] = "smef16f16", [KERNEL_HWCAP_MOPS] = "mops", + [KERNEL_HWCAP_GCS] = "gcs", }; #ifdef CONFIG_COMPAT