summaryrefslogtreecommitdiffstats
path: root/arch/arm/crypto
diff options
context:
space:
mode:
authorArd Biesheuvel2017-05-21 12:23:40 +0200
committerHerbert Xu2017-06-01 06:55:42 +0200
commit2a9faf8b7e4350967ed7b59e39522972b9ead0c9 (patch)
tree91f3db02468438a126b98d00b8247d42010fe4e4 /arch/arm/crypto
parentcrypto: arm/sha2-ce - enable module autoloading based on CPU feature bits (diff)
downloadkernel-qcow2-linux-2a9faf8b7e4350967ed7b59e39522972b9ead0c9.tar.gz
kernel-qcow2-linux-2a9faf8b7e4350967ed7b59e39522972b9ead0c9.tar.xz
kernel-qcow2-linux-2a9faf8b7e4350967ed7b59e39522972b9ead0c9.zip
crypto: arm/crc32 - enable module autoloading based on CPU feature bits
Make the module autoloadable by tying it to the CPU feature bits that describe whether the optional instructions it relies on are implemented by the current CPU. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/arm/crypto')
-rw-r--r--arch/arm/crypto/crc32-ce-glue.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/crypto/crc32-ce-glue.c b/arch/arm/crypto/crc32-ce-glue.c
index e1566bec1016..1b0e0e86ee9c 100644
--- a/arch/arm/crypto/crc32-ce-glue.c
+++ b/arch/arm/crypto/crc32-ce-glue.c
@@ -8,6 +8,7 @@
* published by the Free Software Foundation.
*/
+#include <linux/cpufeature.h>
#include <linux/crc32.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -233,6 +234,11 @@ static void __exit crc32_pmull_mod_exit(void)
ARRAY_SIZE(crc32_pmull_algs));
}
+static const struct cpu_feature crc32_cpu_feature[] = {
+ { cpu_feature(CRC32) }, { cpu_feature(PMULL) }, { }
+};
+MODULE_DEVICE_TABLE(cpu, crc32_cpu_feature);
+
module_init(crc32_pmull_mod_init);
module_exit(crc32_pmull_mod_exit);