Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4469603rwb; Mon, 31 Jul 2023 07:22:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlF7kOIAGakPR0SElMbC38rwkmhgEycCm7yAKUhZjJFYWDQO1CK2iyxHnqYecktVAQXnbvSo X-Received: by 2002:a17:90a:b790:b0:267:f66a:f25f with SMTP id m16-20020a17090ab79000b00267f66af25fmr9363309pjr.11.1690813350131; Mon, 31 Jul 2023 07:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690813350; cv=none; d=google.com; s=arc-20160816; b=bT/ScOm+Alv66XIKeLwpIqm5in+ue0WzOJXqElKRBt1kEu7ijRMFmsIdoZXV5cyuPU UP/0e5UVThlwHIX809thqNlshj8/IOeO0+Ifcz3+axg2emsCR5TS/o7wtiSaIjv1LxVg 2enzRdfN1q/JJEUKdgRJe2znQWLcwb4M3B+lUJPmlE/G8/ezUh7VsWuTv94+9NhwTiSh iiNJobys8filHf6Ih0SCZJA6dt0fhPoaw5tznBM0bF9FjdF1t5w6OgXhYF3ms25zIhCF R1YB4LdtBEkGEMVDtAciENmQ/0F5XCP4dNag1qXHl6+GnqMgnoZ9jvvltKQy9ulElCdl 9ZzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=UdUe/7o7abJT5BqbT0XR+lhA0UzLWbJEWS7DcJ5Gy0c=; fh=EdAFSmIgUzZTC6WCy4Jg1wBZ0/m6m2d/OjiRUJ3BsTI=; b=Qw/2VKbRK0fv4q5lLMGsy1Syzjiz30Ahi0ahhlEhxA42wVmZtPyuJ9Qui+jGOtrcTZ IO9Bmg6yW5KPYui0TXuqj2xrymO1qlYgrdU3p3KTEgnXPjDpAZUSzDmdW14EK/siIJ6C DVQEEiIoUdOFbNgYlhCPc8mh8DzC6WCTtyoLed6lBKlzUYA+j8UPkJ8tEFOqe/GyeW4d lUtpwl/E8UDi/aBD8W/OgJnu+LlEtNuKntW3vi7i1cqNM5rXk9WkcBtgXzLAZ67O+Bkl e8tp4k8kdeFmb0qoBcR0TKMfjUtqcn1E6lCdFbrVycp0yXSwSG4s2aghrnqUpfuIzvq8 WDIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QrkUAv/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik12-20020a170902ab0c00b001b9d1813011si7428404plb.455.2023.07.31.07.22.09; Mon, 31 Jul 2023 07:22:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QrkUAv/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232957AbjGaNyW (ORCPT + 99 others); Mon, 31 Jul 2023 09:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233116AbjGaNxN (ORCPT ); Mon, 31 Jul 2023 09:53:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6C131BEC; Mon, 31 Jul 2023 06:52:23 -0700 (PDT) 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 6524D61164; Mon, 31 Jul 2023 13:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18347C433C9; Mon, 31 Jul 2023 13:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690811542; bh=ggfCgbEg0UE7JP5CH6e+dKjRf0SerXD/ltcRHcZOEeI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QrkUAv/W0nEQPufXRsBRT09S1vN1MsrhsyLx/XO9OmUHtWcHJSX7+yGNATPxVMZXS MRAvlmh71lY5c83nhcOd93cPbNBZNitx2jj/E3dySRlPeWDH9BNgohphQpJzN+Ppo8 ZNXFwiKV/a8C8tjKxGpm4qm23Pok5wDzyojLAMecNxTRr5STl9yzNetcm1HmECXI0C WZzXNVC0L3BxNLpxHi899QcxhUn4VAqPIVlE4LRshZldKQXFh0i5U9Wi2j8vcM/JkB uoZYq35+Ke9i8Md2EAj1uZ/YUddwuAMKQM4dwoZVLBOYrec3huk9QpAUsGxkICQIlp yUPmEARlnmHAA== From: Mark Brown Date: Mon, 31 Jul 2023 14:43:24 +0100 Subject: [PATCH v3 15/36] arm64/hwcap: Add hwcap for GCS MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230731-arm64-gcs-v3-15-cddf9f980d98@kernel.org> References: <20230731-arm64-gcs-v3-0-cddf9f980d98@kernel.org> In-Reply-To: <20230731-arm64-gcs-v3-0-cddf9f980d98@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-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=3001; i=broonie@kernel.org; h=from:subject:message-id; bh=ggfCgbEg0UE7JP5CH6e+dKjRf0SerXD/ltcRHcZOEeI=; b=owGbwMvMwMWocq27KDak/QLjabUkhpTjexTSlzo3H+HfUrXWf8rP6liO2dtUd823deW8IcaRbim7 wM+9k9GYhYGRi0FWTJFl7bOMVenhElvnP5r/CmYQKxPIFAYuTgGYyMYs9n+qHTbKkasqexICpjxWfx 2rejZ71RG5mbPkW6UPHc7w4fLnt0lXsjqyyHWrejXXeXHT4NDgoouP5R4xxa3u8DFOc2GVMNKSmCOw ueew6GOu3ABzPceoPXdXPVB4zlYpwGzPvCl0avPF0/ktfLd6+UzMjMIe1EaLnH2/n+dl3BW+//ztm1 mjPgckO87+1fm3s6D03C77Hwz6RSwBzWpvjymG7rSIz3a17jNqyOyveP1veunVmv2fXj06cPX3twPK 66x/r3Dq+7bW2NGsfnXYhaUTIya/e7HyY/HjPq+sBUqFk5a7eG9evtVXuNLwmahpgqfMnyvi8bcWFn +M3ZB3v2mCnqn6VT+9SI2Oz+aRAA== X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.30.2