arm: add basic mitigation for Cortex-A AES errata
commitbc13384e1956a9bc38b084f82e250743451aae61
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 21 Oct 2021 16:29:41 +0000 (21 17:29 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Thu, 20 Jan 2022 11:14:44 +0000 (20 11:14 +0000)
treef8dc404560655c5100c23b7d91a24464aadb15a1
parentfacbc2368c8f373a596e7665beb29b96c894bae2
arm: add basic mitigation for Cortex-A AES errata

This patch adds the basic patterns for mitigation of the erratum, but no
attempt is made at this point to optimize the results for the cases where
the erratum mitigation is not needed.

The mitigation is done by guaranteeing that the input operands are fed
from a full-width operation by using an identity operation on the input
values.

gcc/ChangeLog:

* config/arm/crypto.md (crypto_<CRYPTO_AES:crypto_pattern>): Convert
to define_expand.  Add mitigation for the Cortex-A AES erratum
when enabled.
(*crypto_<CRYPTO_AES:crypto_pattern>_insn): New pattern, based
on original crypto_<CRYPTO_AES:crypto_pattern> insn.
(aes_op_protect): New pattern.
* config/arm/unspecs.md (unspec): Add UNSPEC_AES_PROTECT.
gcc/config/arm/crypto.md
gcc/config/arm/unspecs.md