Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218487

[PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros

From Alexander Kuleshov <kuleshovmail@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros
Date 2015-09-03 20:20 +0200
Message-ID <q4Hh9-2W4-39@gated-at.bofh.it> (permalink)
References <q4Hh8-2W4-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The 26d75e67c commit (arm64/cpufeature.h: Add macros for a cpu features
testing) provides set of macros for the testing processor's crypto features.
Let's use these macros instead of direct calculation.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 arch/arm64/kernel/setup.c | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 926ae8d..a3faf4f 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -250,33 +250,22 @@ static void __init setup_processor(void)
 
 	/*
 	 * ID_AA64ISAR0_EL1 contains 4-bit wide signed feature blocks.
-	 * The blocks we test below represent incremental functionality
-	 * for non-negative values. Negative values are reserved.
 	 */
 	features = read_cpuid(ID_AA64ISAR0_EL1);
-	block = (features >> 4) & 0xf;
-	if (!(block & 0x8)) {
-		switch (block) {
-		default:
-		case 2:
-			elf_hwcap |= HWCAP_PMULL;
-		case 1:
-			elf_hwcap |= HWCAP_AES;
-		case 0:
-			break;
-		}
-	}
 
-	block = (features >> 8) & 0xf;
-	if (block && !(block & 0x8))
+	if (ID_AA64ISAR0_EL1_AES(features))
+		elf_hwcap |= HWCAP_AES;
+
+	if (ID_AA64ISAR0_EL1_PMULL(features))
+		elf_hwcap |= HWCAP_PMULL;
+
+	if (ID_AA64ISAR0_EL1_SHA1(features))
 		elf_hwcap |= HWCAP_SHA1;
 
-	block = (features >> 12) & 0xf;
-	if (block && !(block & 0x8))
+	if (ID_AA64ISAR0_EL1_SHA2(features))
 		elf_hwcap |= HWCAP_SHA2;
 
-	block = (features >> 16) & 0xf;
-	if (block && !(block & 0x8))
+	if (ID_AA64ISAR0_EL1_CRC32(features))
 		elf_hwcap |= HWCAP_CRC32;
 
 #ifdef CONFIG_COMPAT
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] arm64/cpufeature.h: Add macros for a cpu features testing Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-09-03 20:20 +0200
  [PATCH 3/3] arm64/fpsimd: Use ID_AA64PFR0_EL1_.* macros Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-09-03 20:20 +0200
  [PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-09-03 20:20 +0200
    Re: [PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros Catalin Marinas <catalin.marinas@arm.com> - 2015-09-04 13:30 +0200
  Re: [PATCH 1/3] arm64/cpufeature.h: Add macros for a cpu features  testing Catalin Marinas <catalin.marinas@arm.com> - 2015-09-04 13:30 +0200
  Re: [PATCH 1/3] arm64/cpufeature.h: Add macros for a cpu features  testing "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2015-09-04 14:10 +0200
    Re: [PATCH 1/3] arm64/cpufeature.h: Add macros for a cpu features testing Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-09-04 14:20 +0200

csiph-web