diff mbox series

crypto: caam - enable hash api only on ARM platforms per default

Message ID 20240626155724.4045056-1-m.felsch@pengutronix.de (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show
Series crypto: caam - enable hash api only on ARM platforms per default | expand

Commit Message

Marco Felsch June 26, 2024, 3:57 p.m. UTC
Tests showed that ARMv8-A crypto extensions as implemented on the ARM
Cortex-A53 on the i.MX8M family of processors are substantially faster
than the same primitives offered by the CAAM.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/crypto/caam/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Horia Geanta July 5, 2024, 9:39 a.m. UTC | #1
On 6/26/2024 6:57 PM, Marco Felsch wrote:
> Tests showed that ARMv8-A crypto extensions as implemented on the ARM
> Cortex-A53 on the i.MX8M family of processors are substantially faster
> than the same primitives offered by the CAAM.
> 
I disagree with compiling out the hash support.

If needed, algorithm priority could be changed - even at runtime,
using NETLINK_CRYPTO messages (needs CONFIG_CRYPTO_USER=y/m).

Thanks,
Horia
Herbert Xu July 5, 2024, 11:01 a.m. UTC | #2
On Fri, Jul 05, 2024 at 09:39:19AM +0000, Horia Geanta wrote:
>
> I disagree with compiling out the hash support.
> 
> If needed, algorithm priority could be changed - even at runtime,
> using NETLINK_CRYPTO messages (needs CONFIG_CRYPTO_USER=y/m).

We should change the default priority.

Thanks,
Marco Felsch July 9, 2024, 8:54 a.m. UTC | #3
On 24-07-05, Herbert Xu wrote:
> On Fri, Jul 05, 2024 at 09:39:19AM +0000, Horia Geanta wrote:
> >
> > I disagree with compiling out the hash support.

We don't compile it out, we just don't set the default=y since on ARMv8
it's not required.

> > If needed, algorithm priority could be changed - even at runtime,
> > using NETLINK_CRYPTO messages (needs CONFIG_CRYPTO_USER=y/m).
> 
> We should change the default priority.

We had an patch exactly doing this but depending on the SoC the default
prio may valid since the CAAM is used on ARMv7 and ARMv8 NXP SoCs. To
not cause any regression we went this way.

Regards,
  Marco

> 
> Thanks,
> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
Herbert Xu July 9, 2024, 8:11 p.m. UTC | #4
On Tue, Jul 09, 2024 at 10:54:54AM +0200, Marco Felsch wrote:
>
> We had an patch exactly doing this but depending on the SoC the default
> prio may valid since the CAAM is used on ARMv7 and ARMv8 NXP SoCs. To
> not cause any regression we went this way.

I don't understand.  Why not just set the priority depending on
IS_ENABLED(CONFIG_ARM)? That way it's strictly better than the
Kconfig patch:

1) If the driver is indeed slower then you'd have achieved the same
result of preferring the non-driver algorithm.

2) If the driver ends up being faster then at least the admin can
adjust the priorities.

Or perhaps your Kconfig option should set the priority.

Cheers,
Marco Felsch July 10, 2024, 6:51 a.m. UTC | #5
On 24-07-10, Herbert Xu wrote:
> On Tue, Jul 09, 2024 at 10:54:54AM +0200, Marco Felsch wrote:
> >
> > We had an patch exactly doing this but depending on the SoC the default
> > prio may valid since the CAAM is used on ARMv7 and ARMv8 NXP SoCs. To
> > not cause any regression we went this way.
> 
> I don't understand.  Why not just set the priority depending on
> IS_ENABLED(CONFIG_ARM)? 

Argh.. you're right. I had something other in my mind, sry.

> That way it's strictly better than the Kconfig patch:
> 
> 1) If the driver is indeed slower then you'd have achieved the same
> result of preferring the non-driver algorithm.
> 
> 2) If the driver ends up being faster then at least the admin can
> adjust the priorities.
> 
> Or perhaps your Kconfig option should set the priority.

NACK since no admin knows the prios. I will go with the "IS_ENABLED"
solution, thank you!

Regards,
  Marco

> Cheers,
> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
diff mbox series

Patch

diff --git a/drivers/crypto/caam/Kconfig b/drivers/crypto/caam/Kconfig
index c631f99e415f..5828ac64c988 100644
--- a/drivers/crypto/caam/Kconfig
+++ b/drivers/crypto/caam/Kconfig
@@ -126,7 +126,7 @@  config CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI
 
 config CRYPTO_DEV_FSL_CAAM_AHASH_API
 	bool "Register hash algorithm implementations with Crypto API"
-	default y
+	default y if ARM
 	select CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC
 	select CRYPTO_HASH
 	help