From: Sascha Hauer <s.hauer@pengutronix.de>
To: chalianis1@gmail.com
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] arm: crypto: add a check for crypto extensions support.
Date: Wed, 27 Aug 2025 11:22:48 +0200 [thread overview]
Message-ID: <aK7OaAdTGHt7HLwQ@pengutronix.de> (raw)
In-Reply-To: <20250827060606.610447-1-chalianis1@gmail.com>
Hi,
On Wed, Aug 27, 2025 at 02:06:06AM -0400, chalianis1@gmail.com wrote:
> From: Chali Anis <chalianis1@gmail.com>
>
> In some configuration the CPU may raise an exception bacause of an
> unknown instruction if it does not support Crypto Extensions for
> example in some BCM281X (RPi3B in my case) when running barebox
> as an EFI Payload, where the EFI stops with a synchronous execption
> See bellow:
> Synchronous Exception at 0x0000000037BFF548
> SP 0x0000000037F798C0 ELR 0x0000000037BFF548
> SPSR 0x20000209 FPSR 0x00000000
> ESR 0x02000000 FAR 0x14F64325185430BF
> ESR : EC 0x00 IL 0x1 ISS 0x00000000
>
> Signed-off-by: Chali Anis <chalianis1@gmail.com>
> ---
> arch/arm/crypto/sha1-ce-glue.c | 6 ++++++
> arch/arm/crypto/sha2-ce-glue.c | 6 ++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c
> index 5b49237573fa..3c5213774429 100644
> --- a/arch/arm/crypto/sha1-ce-glue.c
> +++ b/arch/arm/crypto/sha1-ce-glue.c
> @@ -88,6 +88,12 @@ static struct digest_algo m = {
>
> static int sha1_ce_mod_init(void)
> {
> + uint64_t isar0;
> +
> + asm volatile("mrs %0, ID_AA64ISAR0_EL1" : "=r"(isar0));
You could use read_sysreg():
#include <asm/sysreg.h>
isar0 = read_sysreg(ID_AA64ISAR0_EL1);
> + if (!(isar0 & 0xF00))
> + return -EOPNOTSUPP;
defines for this bitmask would be cool. I just looked at the kernel and
it seems a bit overkill for barebox, but maybe something like
#define ID_AA64ISAR0_EL1_SHA1_MASK GENMASK(11, 8)
#define ID_AA64ISAR0_EL1_SHA2_MASK GENMASK(15, 12)
in asm/sysreg.h would do it as a start.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-08-27 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 6:06 chalianis1
2025-08-27 9:22 ` Sascha Hauer [this message]
2025-08-27 15:53 chalianis1
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=aK7OaAdTGHt7HLwQ@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=chalianis1@gmail.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: 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