2022-02-17 23:27:40

by Petr Vorel

[permalink] [raw]
Subject: [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX

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 <[email protected]>
---
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


2022-02-23 10:38:41

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX

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 <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2022-02-23 20:21:29

by Petr Vorel

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] crypto: vmx - merge CRYPTO_DEV_VMX_ENCRYPT into CRYPTO_DEV_VMX

> 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,