From: Alexander Kuleshov <kuleshovmail@gmail.com> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Kuleshov <kuleshovmail@gmail.com> Subject: [PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros Date: Fri, 4 Sep 2015 00:12:52 +0600 [thread overview] Message-ID: <1441303972-9480-1-git-send-email-kuleshovmail@gmail.com> (raw) In-Reply-To: <1441303911-9421-1-git-send-email-kuleshovmail@gmail.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: kuleshovmail@gmail.com (Alexander Kuleshov) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros Date: Fri, 4 Sep 2015 00:12:52 +0600 [thread overview] Message-ID: <1441303972-9480-1-git-send-email-kuleshovmail@gmail.com> (raw) In-Reply-To: <1441303911-9421-1-git-send-email-kuleshovmail@gmail.com> 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
next prev parent reply other threads:[~2015-09-03 18:13 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-03 18:11 [PATCH 1/3] arm64/cpufeature.h: Add macros for a cpu features testing Alexander Kuleshov 2015-09-03 18:11 ` Alexander Kuleshov 2015-09-03 18:12 ` Alexander Kuleshov [this message] 2015-09-03 18:12 ` [PATCH 2/3] arm64/setup: Use ID_AA64ISAR0_EL1_.* macros Alexander Kuleshov 2015-09-04 11:26 ` Catalin Marinas 2015-09-04 11:26 ` Catalin Marinas 2016-11-07 16:30 ` Suzuki K Poulose 2016-11-07 16:30 ` Suzuki K Poulose 2015-09-03 18:12 ` [PATCH 3/3] arm64/fpsimd: Use ID_AA64PFR0_EL1_.* macros Alexander Kuleshov 2015-09-03 18:12 ` Alexander Kuleshov 2016-11-07 16:31 ` Suzuki K Poulose 2016-11-07 16:31 ` Suzuki K Poulose 2015-09-04 11:25 ` [PATCH 1/3] arm64/cpufeature.h: Add macros for a cpu features testing Catalin Marinas 2015-09-04 11:25 ` Catalin Marinas 2015-09-04 12:00 ` Suzuki K. Poulose 2015-09-04 12:00 ` Suzuki K. Poulose 2015-09-04 12:19 ` Alexander Kuleshov 2015-09-04 12:19 ` Alexander Kuleshov 2015-09-16 14:48 ` Suzuki K. Poulose 2015-09-16 14:48 ` Suzuki K. Poulose
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1441303972-9480-1-git-send-email-kuleshovmail@gmail.com \ --to=kuleshovmail@gmail.com \ --cc=catalin.marinas@arm.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=will.deacon@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.