Commit 9861ea85 authored by Alastair D'Silva's avatar Alastair D'Silva Committed by Luis Henriques

crypto: vmx - Convert to CPU feature based module autoloading

BugLink: http://bugs.launchpad.net/bugs/1651322

This patch utilises the GENERIC_CPU_AUTOPROBE infrastructure
to automatically load the vmx_crypto module if the CPU supports
it.
Signed-off-by: default avatarAlastair D'Silva <alastair@d-silva.org>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
(back ported from commit ccf5c442)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>

Conflicts:
	drivers/crypto/vmx/Kconfig
Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Acked-by: default avatarJohn Donnelly <john.donnelly@canonical.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 10bc605d
...@@ -2,7 +2,7 @@ config CRYPTO_DEV_VMX_ENCRYPT ...@@ -2,7 +2,7 @@ config CRYPTO_DEV_VMX_ENCRYPT
tristate "Encryption acceleration support on P8 CPU" tristate "Encryption acceleration support on P8 CPU"
depends on CRYPTO_DEV_VMX depends on CRYPTO_DEV_VMX
select CRYPTO_GHASH select CRYPTO_GHASH
default y default m
help help
Support for VMX cryptographic acceleration instructions on Power8 CPU. Support for VMX cryptographic acceleration instructions on Power8 CPU.
This module supports acceleration for AES and GHASH in hardware. If you This module supports acceleration for AES and GHASH in hardware. If you
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/cpufeature.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <crypto/internal/hash.h> #include <crypto/internal/hash.h>
...@@ -45,9 +46,6 @@ int __init p8_init(void) ...@@ -45,9 +46,6 @@ int __init p8_init(void)
int ret = 0; int ret = 0;
struct crypto_alg **alg_it; struct crypto_alg **alg_it;
if (!(cur_cpu_spec->cpu_user_features2 & PPC_FEATURE2_VEC_CRYPTO))
return -ENODEV;
for (alg_it = algs; *alg_it; alg_it++) { for (alg_it = algs; *alg_it; alg_it++) {
ret = crypto_register_alg(*alg_it); ret = crypto_register_alg(*alg_it);
printk(KERN_INFO "crypto_register_alg '%s' = %d\n", printk(KERN_INFO "crypto_register_alg '%s' = %d\n",
...@@ -80,7 +78,7 @@ void __exit p8_exit(void) ...@@ -80,7 +78,7 @@ void __exit p8_exit(void)
crypto_unregister_shash(&p8_ghash_alg); crypto_unregister_shash(&p8_ghash_alg);
} }
module_init(p8_init); module_cpu_feature_match(PPC_MODULE_FEATURE_VEC_CRYPTO, p8_init);
module_exit(p8_exit); module_exit(p8_exit);
MODULE_AUTHOR("Marcelo Cerri<mhcerri@br.ibm.com>"); MODULE_AUTHOR("Marcelo Cerri<mhcerri@br.ibm.com>");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment