From patchwork Wed Oct 26 05:49:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Daniel Kachhap X-Patchwork-Id: 13020168 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 EF716C38A2D for ; Wed, 26 Oct 2022 05:52:43 +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=lkSQaJ5nbA4NWmxJ97fCyjs7VpjLMFlQVY4rMtvE7nw=; b=g6s6+ixtF0hgQ/ xTjiCM8WNKBe7vpZwCxynnrJlCSY2643QT1FWV9dUQ5RcNEI4r9SKXuUSExYZ4QGdu+6/fOoSneuC 8tMTAgAyfJMHYVNnYaEHKkWuN/UEO2K1PmGPxcj+DkUUTelyaJNRO4ycp2a3skGrRb4g+ymFCxxRp mstfr5UffIBvkeaYfy8DzudZJTEVapMVKIRB7L1mvOAfDef5rVcf3zavAijCr9oCpPAXTiJgTaTJh jaF2C0UDdIAnm1EcHObm+vICBusFwjmWXS1lkkbHhuuSaZR/yxCLp1m/7ARJWsQ5+sDfJxjvcMJo0 0ZavNBU7FHTG7GbHwAKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onZKQ-0083FK-R6; Wed, 26 Oct 2022 05:51:50 +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 1onZJX-0082ts-61 for linux-arm-kernel@lists.infradead.org; Wed, 26 Oct 2022 05:50:58 +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 00F20ED1; Tue, 25 Oct 2022 22:51:00 -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 E1CB53F7B4; Tue, 25 Oct 2022 22:50:51 -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 6/8] ARM: vfp: Add hwcap for FEAT_AA32I8MM Date: Wed, 26 Oct 2022 11:19:59 +0530 Message-Id: <20221026055001.12986-7-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_225055_287480_475649A6 X-CRM114-Status: GOOD ( 10.47 ) 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Int8 matrix multiplication (FEAT_AA32I8MM) is a feature present in AArch32 state for Armv8 and is represented by ISAR6.I8MM identification register. This feature denotes the presence of VSMMLA, VSUDOT, VUMMLA, VUSMMLA and VUSDOT 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 14e260e2d6d0..46833c668ec2 100644 --- a/arch/arm/include/uapi/asm/hwcap.h +++ b/arch/arm/include/uapi/asm/hwcap.h @@ -33,6 +33,7 @@ #define HWCAP_ASIMDDP (1 << 24) #define HWCAP_ASIMDFHM (1 << 25) #define HWCAP_ASIMDBF16 (1 << 26) +#define HWCAP_I8MM (1 << 27) /* * 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 231d885ad4b5..de2d85ddec8d 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1254,6 +1254,7 @@ static const char *hwcap_str[] = { "asimddp", "asimdfhm", "asimdbf16", + "i8mm", NULL }; diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index ff574cb8a0b9..281110423871 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -857,6 +857,12 @@ static int __init vfp_init(void) */ if (cpuid_feature_extract_field(isar6, 20) == 0x1) elf_hwcap |= HWCAP_ASIMDBF16; + /* + * Check for the presence of Advanced SIMD and floating point + * Int8 matrix multiplication instructions instructions. + */ + if (cpuid_feature_extract_field(isar6, 24) == 0x1) + elf_hwcap |= HWCAP_I8MM; /* Extract the architecture version on pre-cpuid scheme */ } else {