Re: [PATCH] crypto: powerpc/poly1305 - Restore crypto_simd_usable test

Herbert Xu
2025-05-09T14:16:25Z

On Thu, May 08, 2025 at 08:23:17PM +0800, Herbert Xu wrote:
>
> @@ -51,7 +52,7 @@ void poly1305_blocks_arch(struct poly1305_block_state *state, const u8 *src,
> if (!static_key_enabled(&have_p10))
> return poly1305_blocks_generic(state, src, len, padbit);
> vsx_begin();
> - if (len >= POLY1305_BLOCK_SIZE * 4) {
> + if (crypto_simd_usable() && len >= POLY1305_BLOCK_SIZE * 4) {

This patch is obviously broken. However, I think this code was
always broken in the SIMD-fallback case. AFAICS the fallback
uses vector instructions so it can't be used in softirqs either.

A proper fallback would have to convert the state to the format
used by the generic poly1305 implementation, call that, and then
convert it back.

Of course it would be a lot easier if ppc could make VSX usable
in softirq context.

Cheers,