linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] crypto: arm/crc32 - enable module autoloading based on CPU feature bits
Date: Sun, 21 May 2017 10:23:40 +0000	[thread overview]
Message-ID: <1495362220-30044-6-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1495362220-30044-1-git-send-email-ard.biesheuvel@linaro.org>

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>
---
 arch/arm/crypto/crc32-ce-glue.c | 6 ++++++
 1 file changed, 6 insertions(+)

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);
 
-- 
2.7.4

  parent reply	other threads:[~2017-05-21 10:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21 10:23 [PATCH 0/5] crypto: arm - enable module autoloading Ard Biesheuvel
2017-05-21 10:23 ` [PATCH 1/5] crypto: arm/aes-ce - enable module autoloading based on CPU feature bits Ard Biesheuvel
2018-09-10  6:21   ` Stefan Agner
2018-09-10  7:01     ` Ard Biesheuvel
2018-09-13  6:24       ` Stefan Agner
2018-09-13  7:52         ` Ard Biesheuvel
2017-05-21 10:23 ` [PATCH 2/5] crypto: arm/ghash-ce " Ard Biesheuvel
2017-05-21 10:23 ` [PATCH 3/5] crypto: arm/sha1-ce " Ard Biesheuvel
2017-05-21 10:23 ` [PATCH 4/5] crypto: arm/sha2-ce " Ard Biesheuvel
2017-05-21 10:23 ` Ard Biesheuvel [this message]
2017-06-01  5:06 ` [PATCH 0/5] crypto: arm - enable module autoloading Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495362220-30044-6-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).