From patchwork Wed Nov 22 09:42:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13464411 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 C6119C61D9C for ; Wed, 22 Nov 2023 09:45:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C7AA6B05AC; Wed, 22 Nov 2023 04:45:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 579746B05AD; Wed, 22 Nov 2023 04:45:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 419196B05AE; Wed, 22 Nov 2023 04:45:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2D6A46B05AC for ; Wed, 22 Nov 2023 04:45:04 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0074EB5067 for ; Wed, 22 Nov 2023 09:45:03 +0000 (UTC) X-FDA: 81485106528.03.ACACE13 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf22.hostedemail.com (Postfix) with ESMTP id E54ADC001D for ; Wed, 22 Nov 2023 09:45:01 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hzQJt+Qj; spf=pass (imf22.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=1700646302; 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=urIKzgF+gbFci+9gR98y0hlMG49q807Mv9quL2usDL0=; b=RLLAeuFXk0yMuWNb1x9rftAWbUDaw3nwCaTktrTsVbXhTznxkM2bjeoNGQe10d3KLA8NS5 Kr/vlf9O95FJUK8Md3Z3Z9uFAtaxki2R5C4o7+F8DVlR1r72eX53mRz04SApCjLJ/z1a5V Ga+1zsNRjrh7iQPmUuMvLyeh9upZ2OQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700646302; a=rsa-sha256; cv=none; b=QUWD0g78yIHStPUD5zE3w7Nc87gWt8mDenuYCDb+nm1sV4ZgM+ykgH3NVijZ+sO+zFVRcO EZx9NLToQfoz+/pbET/VMsbTQYWIlWf9QJNyZpVr2lPOR0JhXSNw7Bl4in6Mc1TamrgZuq PM+nH4zuxP7v9YsswO2nL9+U17OBNoI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hzQJt+Qj; spf=pass (imf22.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 806E6B8118C; Wed, 22 Nov 2023 09:45:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11890C433C9; Wed, 22 Nov 2023 09:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700646299; bh=aU3xh1nd0j/0DloWdWCWjw7vV0cVDgM+Blqu3VdYPtQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hzQJt+QjotGyzdW5aJXId+R762os1ez45wKIR4uvXUTtbTXvvCKCEaxjLQyE5+11O K/3A3ODSi956zsBNcLEf8f9eLMdYm4TfOH9+z7tMTrIVtOdP9B4+I+wuRvMERobQ0h JUCP4jebtXbiUqppMsA8G+rhZvXVKolcxtB4XUuTV/t0oWGtgR4VblnkO4cK75mYwx 9qI5OOQOQdgWtzvzwMesWgtsn9CBkG0LqBT1uOptR+3dcOUP2In7IV76hwF2BkIhlS 3YE7/eFIr9cmqTmfXYxf0PZPbAKrclY8V1Irgn/qaq2Sr3mVtzvKuhhfqIj/o2sm81 2gp9m8bABLqRQ== From: Mark Brown Date: Wed, 22 Nov 2023 09:42:27 +0000 Subject: [PATCH v7 17/39] arm64/hwcap: Add hwcap for GCS MIME-Version: 1.0 Message-Id: <20231122-arm64-gcs-v7-17-201c483bd775@kernel.org> References: <20231122-arm64-gcs-v7-0-201c483bd775@kernel.org> In-Reply-To: <20231122-arm64-gcs-v7-0-201c483bd775@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 , Thiago Jung Bauermann , 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=2995; i=broonie@kernel.org; h=from:subject:message-id; bh=aU3xh1nd0j/0DloWdWCWjw7vV0cVDgM+Blqu3VdYPtQ=; b=owGbwMvMwMWocq27KDak/QLjabUkhtTYs8yBxYdLZ52e+l5Oe09GrZNLak6ww3nOF9bCn5eUz FSfv86zk9GYhYGRi0FWTJFl7bOMVenhElvnP5r/CmYQKxPIFAYuTgGYiBcP+z8LRdmId5Olin8b 5BuLuhe2H8zc9ODU6aXpE8zOPVi9ocN05a+2aUysdeZfqnTPtFgnF7PO8Qh455/rUsuYdEXCoWZ e5IkWn8z3tRp6xy/cEp5xxCrjXWG54XKjD0tzVhQL8U0tviwncOXjLeGMSaYXTx7ZMyv5ZSe/z9 KE6susi0KynUof7X5r/u7qHfdQVpVtXS8614fxdCQcYuox5Nz0pPapaL5lp2gH9/Zn+zrrWY6+C l5S0Cl4egfbyxm98Wl8aS1hDzNipDcaelg8K3/9QGndFfevh306TfLYk3wcJffkljH++LlJwvkP m6kTi1VGgv/ioufK5joTf4rHJIo9vjD7mFjODZHj5Qq/AA== X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: E54ADC001D X-Rspam-User: X-Stat-Signature: ffrdwir6mta89k56ifzeenayktayjin3 X-Rspamd-Server: rspam03 X-HE-Tag: 1700646301-252185 X-HE-Meta: U2FsdGVkX1896xkg/Xnh5paOg8HNm5JE+VOU19Gvv5ekk3rsAokDGBJC+mgAFYieC8a2VelKftkLbE0QhLLZ4ads/Etk5SGQWgXRb6rZ6wMq6jv935auT9W8eb04gmtfxaCrBPGh/PTDMGF9XySbbqngUwwXUrSsB+qwVa7P8Zo16pK02AWEkbssIyCRRtV/4ooL4Xo2zHK0jrxfjRJFZPocMT8kVZsjuD0XviZtl22li3Sx+a1iL4nxAF6+FrpUdcgOe0kIyR6g7QTGspacIKju/KQ8Mac4eo2EDwadYfNEW9L7Rzl01ZaPqTSp5dtaPUmBB7lZb+4lEFDk4t14TIrRjTuoRnwC8RCSlqCHrJJxpx5dfUPFnX5wEYDel7X1gmUVYEb86gPoEdUucv4gR9UMZtc1CTOkn1wQFX9Ad/gX0P420K0q4pYReo6bV/iptUoohfiG4FI/BHcLF+9z9ZwBC108+rm73ov3iZ/3lyWOoN0eU69w5ANC5Xt61MdcwQhiDVNSfwMq9yHVv0wQv3cTy2ZTEDrdg8X5NrEhDLdrZ59OFPSIDhplQPxKgCi6hIAFcxshqlrhPu25WwQbflHywSi1xkuLtAl/xClThr57mtm8Qof50/QAskjlm1uFxVRpGFU0S32wRcInLNhe3EtD3Sue5jwcF1GHnZo889lmmZL/9PYTOsMCYVGmkwQ3Nr7nrurnlk2AUBXGfLpnC5jbAawfqGlEOVjAnpT4HecwfbXUpLBZLSwwBJJTOMvv9NA8iS4/Whn72kys5jaUF2d2J6V/pOY8D42uxgsr7YPq4JlS4OBsgUs9YWNm+iwltbp82yKVv5Pl/lv5alLrHNB7K/0tGTCzK+lB8IVjV4vr/dhZPBGnmsVLS1MaLJu+XSh15kmMgyVvQpCEdaCCQTVO00JJ822CN+d0ePtWSzf6EMCJya79foBFKR606ycSt5+2Lkm0og+fmccQ969 g9D0GmaS uPLC4rhenBfWhNbDFFr7Y3HFzyTmJeuC2lK4yy2Wfjmf48CCDevInjUs2iNRcCzoiVPQwjlZX8tiIwBhA4HEme1fCb4S/5Nk0N/qn8GqGpHlrQkhyqfVhgB7hZ0BL302eW02C4t/cevg7Qf/wdA0XYeSXTPj7Nl7ia0Gn3R5al318Z7dywD6aAFQ9OodZ1RGesSOtBI17Vl4uUmukUvCFS5jre0V4/JBA1bOuMafxS4xH7eP0fOYR/uEauwDv6sSNZyZmMH2KFos3hnVc1VY3eaKbJxaRk9ztekFL39f409SFapJmtNTJbDUy1lBYANWxplxa 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. 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 ced7b335e2e0..86d4ace9c75c 100644 --- a/Documentation/arch/arm64/elf_hwcaps.rst +++ b/Documentation/arch/arm64/elf_hwcaps.rst @@ -317,6 +317,9 @@ HWCAP2_LRCPC3 HWCAP2_LSE128 Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0011. +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 cd71e09ea14d..e01e6b72a839 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -142,6 +142,7 @@ #define KERNEL_HWCAP_SVE_B16B16 __khwcap2_feature(SVE_B16B16) #define KERNEL_HWCAP_LRCPC3 __khwcap2_feature(LRCPC3) #define KERNEL_HWCAP_LSE128 __khwcap2_feature(LSE128) +#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 5023599fa278..996b5b5d4c4e 100644 --- a/arch/arm64/include/uapi/asm/hwcap.h +++ b/arch/arm64/include/uapi/asm/hwcap.h @@ -107,5 +107,6 @@ #define HWCAP2_SVE_B16B16 (1UL << 45) #define HWCAP2_LRCPC3 (1UL << 46) #define HWCAP2_LSE128 (1UL << 47) +#define HWCAP2_GCS (1UL << 48) #endif /* _UAPI__ASM_HWCAP_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 5477451cefa1..dab80391543f 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2859,6 +2859,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 a257da7b56fe..d557ee301464 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -130,6 +130,7 @@ static const char *const hwcap_str[] = { [KERNEL_HWCAP_SVE_B16B16] = "sveb16b16", [KERNEL_HWCAP_LRCPC3] = "lrcpc3", [KERNEL_HWCAP_LSE128] = "lse128", + [KERNEL_HWCAP_GCS] = "gcs", }; #ifdef CONFIG_COMPAT