]> git.ipfire.org Git - thirdparty/grub.git/commit
arm: Fix 32-bit ARM handling of the CTR register
authorMarc Zyngier <maz@kernel.org>
Sun, 24 May 2020 11:32:48 +0000 (12:32 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 25 May 2020 13:02:51 +0000 (15:02 +0200)
commit6a34fdb76a07305b95e31659bc27b1d190101cbf
tree85ad446b5f1f2bfadb9198ba55bed51d5d4bed31
parenta81401ff493958e626e84f802f44434978fa4d4d
arm: Fix 32-bit ARM handling of the CTR register

When booting on an ARMv8 core that implements either CTR.IDC or CTR.DIC
(indicating that some of the cache maintenance operations can be
removed when dealing with I/D-cache coherency, GRUB dies with a
"Unsupported cache type 0x........" message.

This is pretty likely to happen when running in a virtual machine
hosted on an arm64 machine (I've triggered it on a system built around
a bunch of Cortex-A55 cores, which implements CTR.IDC).

It turns out that the way GRUB deals with the CTR register is a bit
harsh for anything from ARMv7 onwards. The layout of the register is
backward compatible, meaning that nothing that gets added is allowed to
break earlier behaviour. In this case, ignoring IDC is completely fine,
and only results in unnecessary cache maintenance.

We can thus avoid being paranoid, and align the 32bit behaviour with
its 64bit equivalent.

This patch has the added benefit that it gets rid of a (gnu-specific)
case range too.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/kern/arm/cache.c