From: James Morse <james.morse@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Russell King <linux@armlinux.org.uk>,
Ard Biesheuvel <ardb@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Subject: [PATCH v2 2/2] ARM: Remove AES hwcap for parts affected by errata
Date: Wed, 13 Apr 2022 18:05:45 +0100 [thread overview]
Message-ID: <20220413170545.3042558-3-james.morse@arm.com> (raw)
In-Reply-To: <20220413170545.3042558-1-james.morse@arm.com>
Cortex-A57 and Cortex-A72 have an erratum where an interrupt that
occurs between a pair of AES instructions in aarch32 mode may corrupt
the ELR. The task will subsequently produce the wrong AES result.
The AES instructions are part of the cryptographic extensions, which are
optional. User-space software will detect the support for these
instructions from the hwcaps. If the platform doesn't support these
instructions a software implementation should be used.
Remove the hwcap bits on affected parts to indicate user-space should
not use the AES instructions.
Signed-off-by: James Morse <james.morse@arm.com>
---
arch/arm/kernel/setup.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1e8a50a97edf..8a409bfd33f2 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -501,6 +501,15 @@ static void __init elf_hwcap_fixup(void)
return;
}
+ /*
+ * HWCAP2_AES can get the wrong result due to A57's erratum #1742098 or
+ * A72's #1655431.
+ */
+ if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A57 ||
+ read_cpuid_part() == ARM_CPU_PART_CORTEX_A72) {
+ elf_hwcap2 &= ~HWCAP2_AES;
+ }
+
/* Verify if CPUID scheme is implemented */
if ((id & 0x000f0000) != 0x000f0000)
return;
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-04-13 17:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 17:05 [PATCH v2 0/2] ARM/arm64: errata: Remove AES hwcap for 32bit tasks on A57/A72 James Morse
2022-04-13 17:05 ` [PATCH v2 1/2] arm64: errata: Remove AES hwcap for COMPAT tasks James Morse
2022-04-13 17:33 ` Ard Biesheuvel
2022-04-14 17:45 ` James Morse
2022-04-14 10:03 ` Will Deacon
2022-04-14 17:43 ` James Morse
2022-04-20 10:17 ` Will Deacon
2022-07-14 16:05 ` James Morse
2022-04-13 17:05 ` James Morse [this message]
2022-04-13 17:34 ` [PATCH v2 2/2] ARM: Remove AES hwcap for parts affected by errata Ard Biesheuvel
2022-04-13 18:15 ` Russell King (Oracle)
2022-04-20 10:15 ` [PATCH v2 0/2] ARM/arm64: errata: Remove AES hwcap for 32bit tasks on A57/A72 Will Deacon
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=20220413170545.3042558-3-james.morse@arm.com \
--to=james.morse@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=will@kernel.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 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.