Skip to contentSkip to conversation

Enabling VMX module for PPC64

PATCH Superseded Leonidas S. Barbosa 2 participants 3 messages Feb 5, 2015 – Feb 6, 2015 Crypto API

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 Enabling VMX module for PPC64

This patch enables VMX module in PPC64.

---
 drivers/crypto/Kconfig      | 12 ++++++++++++
 drivers/crypto/Makefile     |  1 +
 drivers/crypto/vmx/Kconfig  |  9 +++++++++
 drivers/crypto/vmx/Makefile | 21 +++++++++++++++++++++
 4 files changed, 43 insertions(+)
 create mode 100644 drivers/crypto/vmx/Kconfig
 create mode 100644 drivers/crypto/vmx/Makefile
drivers/crypto/Kconfig +12 -0
index 2fb0fdf..979cbff 100644
@@ -436,4 +436,16 @@ config CRYPTO_DEV_QCE
 	  hardware. To compile this driver as a module, choose M here. The
 	  module will be called qcrypto.
 
+config CRYPTO_DEV_VMX
+	bool "Support for VMX cryptographic acceleration instructions"
+	depends on PPC64
+	default n
+	help
+	  Support for VMX cryptographic acceleration instructions.
+
+if CRYPTO_DEV_VMX
+	source "drivers/crypto/vmx/Kconfig"
+endif
+
 endif # CRYPTO_HW
+
drivers/crypto/Makefile +1 -0
index 3924f93..20a7127 100644
@@ -25,3 +25,4 @@ obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o
 obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/
 obj-$(CONFIG_CRYPTO_DEV_QAT) += qat/
 obj-$(CONFIG_CRYPTO_DEV_QCE) += qce/
+obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
drivers/crypto/vmx/Kconfig new file +9 -0
new file mode 100644
index 0000000..6728864
@@ -0,0 +1,9 @@
+config CRYPTO_DEV_VMX_ENCRYPT
+	tristate "Encryption acceleration support on P8 CPU"
+	depends on PPC64
+	default y
+	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.
+	  
drivers/crypto/vmx/Makefile new file +21 -0
new file mode 100644
index 0000000..8898ce6
@@ -0,0 +1,21 @@
+obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
+vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o ghash.o
+
+ifeq ($(CONFIG_PPC64),y)
+ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
+TARGET := linux-ppc64le
+else
+TARGET := linux-pcc64
+endif
+endif
+
+quiet_cmd_perl = PERL $@
+      cmd_perl = $(PERL) $(<) $(TARGET) > $(@)
+
+$(src)/aesp8-ppc.S: $(src)/aesp8-ppc.pl
+	$(call cmd,perl)
+  
+$(src)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl
+	$(call cmd,perl)
+
+.PRECIOUS: $(obj)/aesp8-ppc.S $(obj)/ghashp8-ppc.S
Signature · 1 line
2.1.0
#1 lore raw
Quoted 23 lines · Leonidas S. Barbosa

This patch enables VMX module in PPC64.

---
 drivers/crypto/Kconfig      | 12 ++++++++++++
 drivers/crypto/Makefile     |  1 +
 drivers/crypto/vmx/Kconfig  |  9 +++++++++
 drivers/crypto/vmx/Makefile | 21 +++++++++++++++++++++
 4 files changed, 43 insertions(+)
 create mode 100644 drivers/crypto/vmx/Kconfig
 create mode 100644 drivers/crypto/vmx/Makefile
drivers/crypto/Kconfig +3 -0
index 2fb0fdf..979cbff 100644
@@ -436,4 +436,16 @@ config CRYPTO_DEV_QCE
 	  hardware. To compile this driver as a module, choose M here. The
 	  module will be called qcrypto.
 
+config CRYPTO_DEV_VMX
+	bool "Support for VMX cryptographic acceleration instructions"
+	depends on PPC64

drivers/crypto/Kconfig config CRYPTO_DEV_QCE · line 451

Quoted 10 lines
drivers/crypto/Kconfig +9 -0
+	default n
+	help
+	  Support for VMX cryptographic acceleration instructions.
+
+if CRYPTO_DEV_VMX
+	source "drivers/crypto/vmx/Kconfig"
+endif
+
 endif # CRYPTO_HW
+

Unneeded extra line.

Quoted 15 lines
drivers/crypto/Makefile +1 -0
index 3924f93..20a7127 100644
@@ -25,3 +25,4 @@ obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o
 obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/
 obj-$(CONFIG_CRYPTO_DEV_QAT) += qat/
 obj-$(CONFIG_CRYPTO_DEV_QCE) += qce/
+obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
drivers/crypto/vmx/Kconfig new file +0 -0
new file mode 100644
index 0000000..6728864

drivers/crypto/vmx/Kconfig line 3

Quoted 3 lines
drivers/crypto/vmx/Kconfig new file +3 -0
@@ -0,0 +1,9 @@
+config CRYPTO_DEV_VMX_ENCRYPT
+	tristate "Encryption acceleration support on P8 CPU"
+	depends on PPC64

The net effect of the "if CRYPTO_DEV_VMX" wrapper round the source-ing of this file is that CRYPTO_DEV_VMX_ENCRYPT depends on CRYPTO_DEV_VMX. That makes depending on PPC64 superfluous here. You might as well make this symbol depend on CRYPTO_DEV_VMX and drop the "if CRYPTO_DEV_VMX" wrapper.

drivers/crypto/vmx/Kconfig line 9

Quoted 6 lines
drivers/crypto/vmx/Kconfig new file +6 -0
+	default y
+	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.
+	  

Trailing line of whitespace only.

drivers/crypto/vmx/Makefile line 4

Quoted 10 lines
drivers/crypto/vmx/Makefile new file +4 -0
new file mode 100644
index 0000000..8898ce6
@@ -0,0 +1,21 @@
+obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
+vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o ghash.o
+
+ifeq ($(CONFIG_PPC64),y)

Can this test ever fail?

Quoted 7 lines
drivers/crypto/vmx/Makefile new file +7 -0
+ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
+TARGET := linux-ppc64le
+else
+TARGET := linux-pcc64
+endif
+endif
+

drivers/crypto/vmx/Makefile line 21

Quoted 10 lines
drivers/crypto/vmx/Makefile new file +10 -0
+quiet_cmd_perl = PERL $@
+      cmd_perl = $(PERL) $(<) $(TARGET) > $(@)
+
+$(src)/aesp8-ppc.S: $(src)/aesp8-ppc.pl
+	$(call cmd,perl)
+  
+$(src)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl
+	$(call cmd,perl)
+
+.PRECIOUS: $(obj)/aesp8-ppc.S $(obj)/ghashp8-ppc.S

Paul Bolle

#2 lore raw

Thanks for the advices Paul.
Resending patch set as V2.

Quoted 5 lines

drivers/crypto/vmx/Makefile line 4

Quoted 3 lines
drivers/crypto/vmx/Makefile new file +3 -0
+vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o ghash.o
+
+ifeq ($(CONFIG_PPC64),y)

Can this test ever fail?

In fact we don't need this first IF, since it already depends on PPC64.

---
Leonidas.