BACKPORT: crypto: arm64/aes-ce-cipher - move assembler code to .S file
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 21 Nov 2017 13:40:17 +0000 (13:40 +0000)
committerBruno Martins <bgcngm@gmail.com>
Sun, 22 Oct 2023 14:12:33 +0000 (15:12 +0100)
commit5401cd9b4bedf630527b363a79ca13bc7e1c8e7e
tree8f768260b773ef2d850fa7ea8bfcfeb5442c2733
parentf11de1799fa89978ed8211a5da2c80edf515ca94
BACKPORT: crypto: arm64/aes-ce-cipher - move assembler code to .S file

commit 019cd46984d04703a39924178f503a98436ac0d7 upstream.

Most crypto drivers involving kernel mode NEON take care to put the code
that actually touches the NEON register file in a separate compilation
unit, to prevent the compiler from reordering code that preserves or
restores the NEON context with code that may corrupt it. This is
necessary because we currently have no way to express the restrictions
imposed upon use of the NEON in kernel mode in a way that the compiler
understands.

However, in the case of aes-ce-cipher, it did not seem unreasonable to
deviate from this rule, given how it does not seem possible for the
compiler to reorder cross object function calls with asm blocks whose
in- and output constraints reflect that it reads from and writes to
memory.

Now that LTO is being proposed for the arm64 kernel, it is time to
revisit this. The link time optimization may replace the function
calls to kernel_neon_begin() and kernel_neon_end() with instantiations
of the IR that make up its implementation, allowing further reordering
with the asm block.

So let's clean this up, and move the asm() blocks into a separate .S
file.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-By: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Matthias Kaehlcke <mka@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ bgcngm: Backported to 4.9 ]
Signed-off-by: Bruno Martins <bgcngm@gmail.com>
Change-Id: I7b271d83a3d5baf81aa5fca69cd4f2817945a477
arch/arm64/crypto/Makefile
arch/arm64/crypto/aes-ce-cipher-core.c [deleted file]
arch/arm64/crypto/aes-ce-cipher-glue.c [deleted file]
arch/arm64/crypto/aes-ce-core.S [new file with mode: 0644]
arch/arm64/crypto/aes-ce-glue.c [new file with mode: 0644]