diff options
| author | Alastair D'Silva <alastair@d-silva.org> | 2016-07-19 00:03:53 -0400 |
|---|---|---|
| committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-07-21 06:33:57 -0400 |
| commit | ccf5c442a1b82bf74105d72416e069607353cb82 (patch) | |
| tree | bf314f50e9d14b4a381cd99a06862b030386c4ba /drivers/crypto/vmx | |
| parent | 4a1202765ddf4e5bb3143c0a859ee37f8fcf9b85 (diff) | |
crypto: vmx - Convert to CPU feature based module autoloading
This patch utilises the GENERIC_CPU_AUTOPROBE infrastructure
to automatically load the vmx_crypto module if the CPU supports
it.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/crypto/vmx')
| -rw-r--r-- | drivers/crypto/vmx/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/crypto/vmx/vmx.c | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/crypto/vmx/Kconfig b/drivers/crypto/vmx/Kconfig index 89d8208d9851..a83ead109d5f 100644 --- a/drivers/crypto/vmx/Kconfig +++ b/drivers/crypto/vmx/Kconfig | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | config CRYPTO_DEV_VMX_ENCRYPT | 1 | config CRYPTO_DEV_VMX_ENCRYPT |
| 2 | tristate "Encryption acceleration support on P8 CPU" | 2 | tristate "Encryption acceleration support on P8 CPU" |
| 3 | depends on CRYPTO_DEV_VMX | 3 | depends on CRYPTO_DEV_VMX |
| 4 | default y | 4 | default m |
| 5 | help | 5 | help |
| 6 | Support for VMX cryptographic acceleration instructions on Power8 CPU. | 6 | Support for VMX cryptographic acceleration instructions on Power8 CPU. |
| 7 | This module supports acceleration for AES and GHASH in hardware. If you | 7 | This module supports acceleration for AES and GHASH in hardware. If you |
diff --git a/drivers/crypto/vmx/vmx.c b/drivers/crypto/vmx/vmx.c index e163d5770438..5a40f2f287b1 100644 --- a/drivers/crypto/vmx/vmx.c +++ b/drivers/crypto/vmx/vmx.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
| 24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
| 25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
| 26 | #include <linux/cpufeature.h> | ||
| 26 | #include <linux/crypto.h> | 27 | #include <linux/crypto.h> |
| 27 | #include <asm/cputable.h> | 28 | #include <asm/cputable.h> |
| 28 | #include <crypto/internal/hash.h> | 29 | #include <crypto/internal/hash.h> |
| @@ -43,9 +44,6 @@ int __init p8_init(void) | |||
| 43 | int ret = 0; | 44 | int ret = 0; |
| 44 | struct crypto_alg **alg_it; | 45 | struct crypto_alg **alg_it; |
| 45 | 46 | ||
| 46 | if (!(cur_cpu_spec->cpu_user_features2 & PPC_FEATURE2_VEC_CRYPTO)) | ||
| 47 | return -ENODEV; | ||
| 48 | |||
| 49 | for (alg_it = algs; *alg_it; alg_it++) { | 47 | for (alg_it = algs; *alg_it; alg_it++) { |
| 50 | ret = crypto_register_alg(*alg_it); | 48 | ret = crypto_register_alg(*alg_it); |
| 51 | printk(KERN_INFO "crypto_register_alg '%s' = %d\n", | 49 | printk(KERN_INFO "crypto_register_alg '%s' = %d\n", |
| @@ -78,7 +76,7 @@ void __exit p8_exit(void) | |||
| 78 | crypto_unregister_shash(&p8_ghash_alg); | 76 | crypto_unregister_shash(&p8_ghash_alg); |
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | module_init(p8_init); | 79 | module_cpu_feature_match(PPC_MODULE_FEATURE_VEC_CRYPTO, p8_init); |
| 82 | module_exit(p8_exit); | 80 | module_exit(p8_exit); |
| 83 | 81 | ||
| 84 | MODULE_AUTHOR("Marcelo Cerri<mhcerri@br.ibm.com>"); | 82 | MODULE_AUTHOR("Marcelo Cerri<mhcerri@br.ibm.com>"); |
