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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CC3CC38A2D for ; Wed, 26 Oct 2022 05:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lTzyfMZjXIXQNXgs/0rlN0Pt0oYmmZD3J5JC8Cjgp3M=; b=G2gxAUV+EKnkpp dsxmJbJ61bpa5i7RDRI96aPWfe1poVslvK0k+d09hkADugrzrt+9Do48/t/4LwtdotOgeiijDaZtv n/Bf0/ZRFETxnsqmiIgf2QTHSqhdh3lsDfRX4As0Nsnfd9B16lYc+VsmKwALjcTeipvNis013O82/ yN+axEFA4lMPEF9UnGfP30W/XID1Cshd3QL9R7rJLiZX8748GkqWrBRPyKNJ0i1KnlWtrPEziUnc+ /in0opBDp05TASzrNBVDkjqF19UPtKwoBMcTjNFP8FwLk6tIkapgPR1Rl8G52aLgLY7ThxB34jszp 3JGi3YCB4D+O3FtbOGjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onZKC-00836Z-70; Wed, 26 Oct 2022 05:51:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onZJV-0082tz-R8 for linux-arm-kernel@lists.infradead.org; Wed, 26 Oct 2022 05:50:55 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A51BDD6E; Tue, 25 Oct 2022 22:50:57 -0700 (PDT) Received: from a077416.blr.arm.com (unknown [10.162.42.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8B3B33F7B4; Tue, 25 Oct 2022 22:50:49 -0700 (PDT) From: Amit Daniel Kachhap To: Russell King Cc: patches@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Amit Daniel Kachhap Subject: [PATCH 5/8] ARM: vfp: Add hwcap for FEAT_AA32BF16 Date: Wed, 26 Oct 2022 11:19:58 +0530 Message-Id: <20221026055001.12986-6-amit.kachhap@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026055001.12986-1-amit.kachhap@arm.com> References: <20221026055001.12986-1-amit.kachhap@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_225053_942187_388C0C66 X-CRM114-Status: GOOD ( 10.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Advanced SIMD BFloat16 (FEAT_AA32BF16) is a feature present in AArch32 state for Armv8 and is represented by ISAR6.BF16 identification register. This feature denotes the presence of VCVT, VCVTB, VCVTT, VDOT, VFMAB, VFMAT and VMMLA instructions and hence adding a hwcap will enable the userspace to check it before trying to use those instructions. Signed-off-by: Amit Daniel Kachhap --- arch/arm/include/uapi/asm/hwcap.h | 1 + arch/arm/kernel/setup.c | 1 + arch/arm/vfp/vfpmodule.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h index 3d168d4f2a51..14e260e2d6d0 100644 --- a/arch/arm/include/uapi/asm/hwcap.h +++ b/arch/arm/include/uapi/asm/hwcap.h @@ -32,6 +32,7 @@ #define HWCAP_ASIMDHP (1 << 23) #define HWCAP_ASIMDDP (1 << 24) #define HWCAP_ASIMDFHM (1 << 25) +#define HWCAP_ASIMDBF16 (1 << 26) /* * HWCAP2 flags - for elf_hwcap2 (in kernel) and AT_HWCAP2 diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 5e8bf2d5e516..231d885ad4b5 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1253,6 +1253,7 @@ static const char *hwcap_str[] = { "asimdhp", "asimddp", "asimdfhm", + "asimdbf16", NULL }; diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 404c4f901132..ff574cb8a0b9 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -851,6 +851,12 @@ static int __init vfp_init(void) */ if (cpuid_feature_extract_field(isar6, 8) == 0x1) elf_hwcap |= HWCAP_ASIMDFHM; + /* + * Check for the presence of Advanced SIMD Bfloat16 + * floating point instructions. + */ + if (cpuid_feature_extract_field(isar6, 20) == 0x1) + elf_hwcap |= HWCAP_ASIMDBF16; /* Extract the architecture version on pre-cpuid scheme */ } else { -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel