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 4ECB0C38A2D for ; Wed, 26 Oct 2022 05:53:15 +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=1rXlPDDpd4OTyxD5/lhgYGTARqFWMCWeBTnB30HqLys=; b=LgamIQmCeYklvj h28gEqohOY1ARoPsPo5PFUEGmPSLyj8vMcDJugRB1F5T0SZ95Oova6icV7G1QoloSQQP4N9zFkx9b v8H2n1jhadCkRlBdA/US1RwCdXmh5RaH4jvLT+sRyBRfhTFeUHFLrZnOgWJRJjdT+h2jCmjVRlrCk RJdG/HTcCgxlhAOdZtHMMmm3RclYhthR+rAPnDuCR9vFNNq5yEY4LdrXRfy66vCMyjwY+NdxwTSQD EQok64dCc3LKMkUEfGiDJYgIhX7M8Q//3UWxLFpZvTUWGM0GUw2QtP+vZ5sTenEtEOgAZA4NpqFBc 9IEwUtzuadGWP9kTc2Rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onZKt-0083Xb-64; Wed, 26 Oct 2022 05:52:19 +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 1onZJb-0082vp-P8 for linux-arm-kernel@lists.infradead.org; Wed, 26 Oct 2022 05:51:06 +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 914EA23A; Tue, 25 Oct 2022 22:51:02 -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 9D4763F7B4; Tue, 25 Oct 2022 22:50:54 -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 7/8] ARM: Add hwcap for Speculation Barrier(SB) Date: Wed, 26 Oct 2022 11:20:00 +0530 Message-Id: <20221026055001.12986-8-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_225059_883439_BB133849 X-CRM114-Status: GOOD ( 11.81 ) 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 Speculation Barrier(FEAT_SB) is a feature present in AArch32 state for Armv8 and is represented by ISAR6.SB identification register. This feature denotes the presence of SB instruction and hence adding a hwcap will enable the userspace to check it before trying to use this instruction. This commit adds the ID feature bit detection, and uses elf_hwcap2 accordingly. Signed-off-by: Amit Daniel Kachhap --- arch/arm/include/uapi/asm/hwcap.h | 1 + arch/arm/kernel/setup.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h index 46833c668ec2..bc9e7d318e25 100644 --- a/arch/arm/include/uapi/asm/hwcap.h +++ b/arch/arm/include/uapi/asm/hwcap.h @@ -43,5 +43,6 @@ #define HWCAP2_SHA1 (1 << 2) #define HWCAP2_SHA2 (1 << 3) #define HWCAP2_CRC32 (1 << 4) +#define HWCAP2_SB (1 << 5) #endif /* _UAPI__ASMARM_HWCAP_H */ diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index de2d85ddec8d..f676c54e5d14 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -450,6 +450,7 @@ static void __init cpuid_init_hwcaps(void) { int block; u32 isar5; + u32 isar6; if (cpu_architecture() < CPU_ARCH_ARMv7) return; @@ -485,6 +486,12 @@ static void __init cpuid_init_hwcaps(void) block = cpuid_feature_extract_field(isar5, 16); if (block >= 1) elf_hwcap2 |= HWCAP2_CRC32; + + /* Check for Speculation barrier instruction */ + isar6 = read_cpuid_ext(CPUID_EXT_ISAR6); + block = cpuid_feature_extract_field(isar6, 12); + if (block >= 1) + elf_hwcap2 |= HWCAP2_SB; } static void __init elf_hwcap_fixup(void) @@ -1264,6 +1271,7 @@ static const char *hwcap2_str[] = { "sha1", "sha2", "crc32", + "sb", NULL }; -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel