From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: advertise availability of v8 Crypto instructions
Date: Mon, 9 Mar 2015 18:06:45 +0000 [thread overview]
Message-ID: <20150309180645.GD8656@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1425556302-3370-1-git-send-email-ard.biesheuvel@linaro.org>
On Thu, Mar 05, 2015 at 12:51:42PM +0100, Ard Biesheuvel wrote:
> @@ -393,6 +393,20 @@ static void __init cpuid_init_hwcaps(void)
> vmsa = (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xf) >> 0;
> if (vmsa >= 5)
> elf_hwcap |= HWCAP_LPAE;
> +
> + /* check for supported v8 Crypto instructions */
> + isar5 = read_cpuid_ext(CPUID_EXT_ISAR5);
> +
> + switch ((isar5 >> 4) & 0xf) {
> + case 2: elf_hwcap2 |= HWCAP2_PMULL; /* pmull implies aes */
> + case 1: elf_hwcap2 |= HWCAP2_AES;
> + }
> + if (((isar5 >> 8) & 0xf) == 1)
> + elf_hwcap2 |= HWCAP2_SHA1;
> + if (((isar5 >> 12) & 0xf) == 1)
> + elf_hwcap2 |= HWCAP2_SHA2;
> + if (((isar5 >> 16) & 0xf) == 1)
> + elf_hwcap2 |= HWCAP2_CRC32;
Reading through the ARMv7 ARM, the ISAR registers seem to work in a way
that "feature >= N" is sufficient to test for something (in other words,
the feature revision bits build on previous instructions added by older
revisions of that feature.)
Hence why PMULL implies AES - that follows the same pattern. So, I wonder
if those == should all be >=, and there should be a "default:" before
"case 2:" with the zero case handled separately.
--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2015-03-09 18:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 11:51 [PATCH v2] ARM: advertise availability of v8 Crypto instructions Ard Biesheuvel
2015-03-09 18:06 ` Russell King - ARM Linux [this message]
2015-03-09 18:12 ` Ard Biesheuvel
2015-03-09 18:38 ` Ard Biesheuvel
2015-03-10 10:15 ` Russell King - ARM Linux
2015-03-10 10:18 ` Ard Biesheuvel
2015-03-10 10:11 ` Russell King - ARM Linux
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=20150309180645.GD8656@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).