linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] vmx-crypto: Add missing dependencies
@ 2022-02-17 10:57 Petr Vorel
  2022-02-17 10:57 ` [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX Petr Vorel
  2022-02-17 10:57 ` [PATCH v3 2/2] crypto: vmx - add missing dependencies Petr Vorel
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2022-02-17 10:57 UTC (permalink / raw)
  To: linux-crypto
  Cc: Herbert Xu, Nicolai Stange, linux-kbuild, Nayna Jain, Petr Vorel,
	Paulo Flabiano Smorigo, leitao, linuxppc-dev

Hi all,


changes v2->v3:
* keep CRYPTO_DEV_VMX and merge CRYPTO_DEV_VMX_ENCRYPT into it instead
  of vice versa (suggested by Nicolai). I have no problem to send
  another version if maintainers want the original approach.
* change commit subject to be compatible
* remove MAINTAINERS changes

Petr Vorel (2):
  crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX
  crypto: vmx - add missing dependencies

 arch/powerpc/configs/powernv_defconfig |  2 +-
 arch/powerpc/configs/ppc64_defconfig   |  2 +-
 arch/powerpc/configs/pseries_defconfig |  2 +-
 drivers/crypto/Kconfig                 | 13 +++++++++----
 drivers/crypto/vmx/Kconfig             | 10 ----------
 drivers/crypto/vmx/Makefile            |  4 ++--
 6 files changed, 14 insertions(+), 19 deletions(-)
 delete mode 100644 drivers/crypto/vmx/Kconfig

-- 
2.35.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX
  2022-02-17 10:57 [PATCH v3 0/2] vmx-crypto: Add missing dependencies Petr Vorel
@ 2022-02-17 10:57 ` Petr Vorel
  2022-02-23  2:57   ` Herbert Xu
  2022-02-17 10:57 ` [PATCH v3 2/2] crypto: vmx - add missing dependencies Petr Vorel
  1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2022-02-17 10:57 UTC (permalink / raw)
  To: linux-crypto
  Cc: Herbert Xu, Nicolai Stange, linux-kbuild, Nayna Jain, Petr Vorel,
	Paulo Flabiano Smorigo, leitao, linuxppc-dev

CRYPTO_DEV_VMX_ENCRYPT is redundant with CRYPTO_DEV_VMX.

And it also forces CRYPTO_GHASH to be builtin even
CRYPTO_DEV_VMX_ENCRYPT was configured as module.

This requires to change defconfig values to m for backwards
compatibility.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
changes v2->v3:
* keep CRYPTO_DEV_VMX and merge CRYPTO_DEV_VMX_ENCRYPT into it instead
  of vice versa (suggested by Nicolai). I have no problem to send
  another version if maintainers want the original approach.
* change commit subject to be compatible
* remove MAINTAINERS changes

 arch/powerpc/configs/powernv_defconfig |  2 +-
 arch/powerpc/configs/ppc64_defconfig   |  2 +-
 arch/powerpc/configs/pseries_defconfig |  2 +-
 drivers/crypto/Kconfig                 |  9 +++++----
 drivers/crypto/vmx/Kconfig             | 10 ----------
 drivers/crypto/vmx/Makefile            |  4 ++--
 6 files changed, 10 insertions(+), 19 deletions(-)
 delete mode 100644 drivers/crypto/vmx/Kconfig

diff --git a/arch/powerpc/configs/powernv_defconfig b/arch/powerpc/configs/powernv_defconfig
index 49f49c263935..661b294d1744 100644
--- a/arch/powerpc/configs/powernv_defconfig
+++ b/arch/powerpc/configs/powernv_defconfig
@@ -337,7 +337,7 @@ CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_LZO=m
 CONFIG_CRYPTO_DEV_NX=y
-CONFIG_CRYPTO_DEV_VMX=y
+CONFIG_CRYPTO_DEV_VMX=m
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=m
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index c8b0e80d613b..cc51b506066c 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -355,7 +355,7 @@ CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_LZO=m
 CONFIG_CRYPTO_DEV_NX=y
 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
-CONFIG_CRYPTO_DEV_VMX=y
+CONFIG_CRYPTO_DEV_VMX=m
 CONFIG_PRINTK_TIME=y
 CONFIG_PRINTK_CALLER=y
 CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index b571d084c148..2366d3be0d11 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -315,7 +315,7 @@ CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_LZO=m
 CONFIG_CRYPTO_DEV_NX=y
 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
-CONFIG_CRYPTO_DEV_VMX=y
+CONFIG_CRYPTO_DEV_VMX=m
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=m
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 4f705674f94f..923fa1effb4a 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -762,12 +762,13 @@ config CRYPTO_DEV_QCOM_RNG
 	  module will be called qcom-rng. If unsure, say N.
 
 config CRYPTO_DEV_VMX
-	bool "Support for VMX cryptographic acceleration instructions"
+	tristate "Power VMX cryptographic acceleration instructions driver"
 	depends on PPC64 && VSX
+	select CRYPTO_GHASH
 	help
-	  Support for VMX cryptographic acceleration instructions.
-
-source "drivers/crypto/vmx/Kconfig"
+	  Support for VMX cryptographic acceleration instructions on Power8 CPU.
+	  This module supports acceleration for AES and GHASH in hardware. If you
+	  choose 'M' here, this module will be called vmx-crypto.
 
 config CRYPTO_DEV_IMGTEC_HASH
 	tristate "Imagination Technologies hardware hash accelerator"
diff --git a/drivers/crypto/vmx/Kconfig b/drivers/crypto/vmx/Kconfig
deleted file mode 100644
index c85fab7ef0bd..000000000000
--- a/drivers/crypto/vmx/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-config CRYPTO_DEV_VMX_ENCRYPT
-	tristate "Encryption acceleration support on P8 CPU"
-	depends on CRYPTO_DEV_VMX
-	select CRYPTO_GHASH
-	default m
-	help
-	  Support for VMX cryptographic acceleration instructions on Power8 CPU.
-	  This module supports acceleration for AES and GHASH in hardware. If you
-	  choose 'M' here, this module will be called vmx-crypto.
diff --git a/drivers/crypto/vmx/Makefile b/drivers/crypto/vmx/Makefile
index 709670d2b553..703f67b8459e 100644
--- a/drivers/crypto/vmx/Makefile
+++ b/drivers/crypto/vmx/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
+obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx-crypto.o
 vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o
 
 ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
@@ -15,7 +15,7 @@ targets += aesp8-ppc.S ghashp8-ppc.S
 
 $(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl FORCE
 	$(call if_changed,perl)
-  
+
 $(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl FORCE
 	$(call if_changed,perl)
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/2] crypto: vmx - add missing dependencies
  2022-02-17 10:57 [PATCH v3 0/2] vmx-crypto: Add missing dependencies Petr Vorel
  2022-02-17 10:57 ` [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX Petr Vorel
@ 2022-02-17 10:57 ` Petr Vorel
  2022-02-23  2:58   ` Herbert Xu
  1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2022-02-17 10:57 UTC (permalink / raw)
  To: linux-crypto
  Cc: Herbert Xu, Nicolai Stange, linux-kbuild, Nayna Jain, Petr Vorel,
	Paulo Flabiano Smorigo, leitao, linuxppc-dev

vmx-crypto module depends on CRYPTO_AES, CRYPTO_CBC, CRYPTO_CTR or
CRYPTO_XTS, thus add them.

These dependencies are likely to be enabled, but if
CRYPTO_DEV_VMX=y && !CRYPTO_MANAGER_DISABLE_TESTS
and either of CRYPTO_AES, CRYPTO_CBC, CRYPTO_CTR or CRYPTO_XTS is built
as module or disabled, alg_test() from crypto/testmgr.c complains during
boot about failing to allocate the generic fallback implementations
(2 == ENOENT):

[    0.540953] Failed to allocate xts(aes) fallback: -2
[    0.541014] alg: skcipher: failed to allocate transform for p8_aes_xts: -2
[    0.541120] alg: self-tests for p8_aes_xts (xts(aes)) failed (rc=-2)
[    0.544440] Failed to allocate ctr(aes) fallback: -2
[    0.544497] alg: skcipher: failed to allocate transform for p8_aes_ctr: -2
[    0.544603] alg: self-tests for p8_aes_ctr (ctr(aes)) failed (rc=-2)
[    0.547992] Failed to allocate cbc(aes) fallback: -2
[    0.548052] alg: skcipher: failed to allocate transform for p8_aes_cbc: -2
[    0.548156] alg: self-tests for p8_aes_cbc (cbc(aes)) failed (rc=-2)
[    0.550745] Failed to allocate transformation for 'aes': -2
[    0.550801] alg: cipher: Failed to load transform for p8_aes: -2
[    0.550892] alg: self-tests for p8_aes (aes) failed (rc=-2)

Fixes: c07f5d3da643 ("crypto: vmx - Adding support for XTS")
Fixes: d2e3ae6f3aba ("crypto: vmx - Enabling VMX module for PPC64")

Suggested-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
changes v2->v3:
* more less the same, just in drivers/crypto/Kconfig (previously it was
  in drivers/crypto/vmx/Kconfig)
* change commit subject to be compatible

 drivers/crypto/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 923fa1effb4a..0eafb2a49f04 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -764,7 +764,11 @@ config CRYPTO_DEV_QCOM_RNG
 config CRYPTO_DEV_VMX
 	tristate "Power VMX cryptographic acceleration instructions driver"
 	depends on PPC64 && VSX
+	select CRYPTO_AES
+	select CRYPTO_CBC
+	select CRYPTO_CTR
 	select CRYPTO_GHASH
+	select CRYPTO_XTS
 	help
 	  Support for VMX cryptographic acceleration instructions on Power8 CPU.
 	  This module supports acceleration for AES and GHASH in hardware. If you
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX
  2022-02-17 10:57 ` [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX Petr Vorel
@ 2022-02-23  2:57   ` Herbert Xu
  2022-02-23 15:09     ` Petr Vorel
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2022-02-23  2:57 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Nicolai Stange, linux-kbuild, Nayna Jain, Paulo Flabiano Smorigo,
	linux-crypto, leitao, linuxppc-dev

On Thu, Feb 17, 2022 at 11:57:50AM +0100, Petr Vorel wrote:
> CRYPTO_DEV_VMX_ENCRYPT is redundant with CRYPTO_DEV_VMX.
> 
> And it also forces CRYPTO_GHASH to be builtin even
> CRYPTO_DEV_VMX_ENCRYPT was configured as module.

Just because a tristate sits under a bool, it does not force
the options that it selects to y/n.  The select still operates
on the basis of the tristate.

So I don't see the point to this code churn unless the powerpc
folks want to move in this direction.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/2] crypto: vmx - add missing dependencies
  2022-02-17 10:57 ` [PATCH v3 2/2] crypto: vmx - add missing dependencies Petr Vorel
@ 2022-02-23  2:58   ` Herbert Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2022-02-23  2:58 UTC (permalink / raw)
  To: Petr Vorel
  Cc: Nicolai Stange, linux-kbuild, Nayna Jain, Paulo Flabiano Smorigo,
	linux-crypto, leitao, linuxppc-dev

On Thu, Feb 17, 2022 at 11:57:51AM +0100, Petr Vorel wrote:
> vmx-crypto module depends on CRYPTO_AES, CRYPTO_CBC, CRYPTO_CTR or
> CRYPTO_XTS, thus add them.
> 
> These dependencies are likely to be enabled, but if
> CRYPTO_DEV_VMX=y && !CRYPTO_MANAGER_DISABLE_TESTS
> and either of CRYPTO_AES, CRYPTO_CBC, CRYPTO_CTR or CRYPTO_XTS is built
> as module or disabled, alg_test() from crypto/testmgr.c complains during
> boot about failing to allocate the generic fallback implementations
> (2 == ENOENT):
> 
> [    0.540953] Failed to allocate xts(aes) fallback: -2
> [    0.541014] alg: skcipher: failed to allocate transform for p8_aes_xts: -2
> [    0.541120] alg: self-tests for p8_aes_xts (xts(aes)) failed (rc=-2)
> [    0.544440] Failed to allocate ctr(aes) fallback: -2
> [    0.544497] alg: skcipher: failed to allocate transform for p8_aes_ctr: -2
> [    0.544603] alg: self-tests for p8_aes_ctr (ctr(aes)) failed (rc=-2)
> [    0.547992] Failed to allocate cbc(aes) fallback: -2
> [    0.548052] alg: skcipher: failed to allocate transform for p8_aes_cbc: -2
> [    0.548156] alg: self-tests for p8_aes_cbc (cbc(aes)) failed (rc=-2)
> [    0.550745] Failed to allocate transformation for 'aes': -2
> [    0.550801] alg: cipher: Failed to load transform for p8_aes: -2
> [    0.550892] alg: self-tests for p8_aes (aes) failed (rc=-2)
> 
> Fixes: c07f5d3da643 ("crypto: vmx - Adding support for XTS")
> Fixes: d2e3ae6f3aba ("crypto: vmx - Enabling VMX module for PPC64")
> 
> Suggested-by: Nicolai Stange <nstange@suse.de>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> changes v2->v3:
> * more less the same, just in drivers/crypto/Kconfig (previously it was
>   in drivers/crypto/vmx/Kconfig)
> * change commit subject to be compatible
> 
>  drivers/crypto/Kconfig | 4 ++++
>  1 file changed, 4 insertions(+)

Please respin this patch to add the selects to the existing tristate.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX
  2022-02-23  2:57   ` Herbert Xu
@ 2022-02-23 15:09     ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2022-02-23 15:09 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Nicolai Stange, linux-kbuild, Nayna Jain, Paulo Flabiano Smorigo,
	linux-crypto, leitao, linuxppc-dev

> On Thu, Feb 17, 2022 at 11:57:50AM +0100, Petr Vorel wrote:
> > CRYPTO_DEV_VMX_ENCRYPT is redundant with CRYPTO_DEV_VMX.

> > And it also forces CRYPTO_GHASH to be builtin even
> > CRYPTO_DEV_VMX_ENCRYPT was configured as module.

> Just because a tristate sits under a bool, it does not force
> the options that it selects to y/n.  The select still operates
> on the basis of the tristate.
I'm sorry, not sure what I did wrong before. Now it really behaves as expected.

> So I don't see the point to this code churn unless the powerpc
> folks want to move in this direction.
Sure (sending now just second commit as requested.

Thank for your review.

Kind regards,
Petr

> Thanks,

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-23 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 10:57 [PATCH v3 0/2] vmx-crypto: Add missing dependencies Petr Vorel
2022-02-17 10:57 ` [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX Petr Vorel
2022-02-23  2:57   ` Herbert Xu
2022-02-23 15:09     ` Petr Vorel
2022-02-17 10:57 ` [PATCH v3 2/2] crypto: vmx - add missing dependencies Petr Vorel
2022-02-23  2:58   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).