summaryrefslogtreecommitdiff
path: root/arch/powerpc/crypto/chacha-p10-glue.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-05-10 17:49:02 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2024-05-10 20:20:18 +0300
commit4232da23d75d173195c6766729e51947b64f83cd (patch)
tree7eb1420b118d452c0b497bf6267ecdfb0a6d5931 /arch/powerpc/crypto/chacha-p10-glue.c
parentbbe10a5cc0c775e52e91c8b3b6547b59b2054f44 (diff)
parent7b7e584f90bf670d5c6f2b1fff884bf3b972cad4 (diff)
downloadlinux-4232da23d75d173195c6766729e51947b64f83cd.tar.xz
Merge tag 'loongarch-kvm-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson into HEAD
LoongArch KVM changes for v6.10 1. Add ParaVirt IPI support. 2. Add software breakpoint support. 3. Add mmio trace events support.
Diffstat (limited to 'arch/powerpc/crypto/chacha-p10-glue.c')
-rw-r--r--arch/powerpc/crypto/chacha-p10-glue.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/powerpc/crypto/chacha-p10-glue.c b/arch/powerpc/crypto/chacha-p10-glue.c
index 74fb86b0d209..7c728755852e 100644
--- a/arch/powerpc/crypto/chacha-p10-glue.c
+++ b/arch/powerpc/crypto/chacha-p10-glue.c
@@ -197,6 +197,9 @@ static struct skcipher_alg algs[] = {
static int __init chacha_p10_init(void)
{
+ if (!cpu_has_feature(CPU_FTR_ARCH_31))
+ return 0;
+
static_branch_enable(&have_p10);
return crypto_register_skciphers(algs, ARRAY_SIZE(algs));
@@ -204,10 +207,13 @@ static int __init chacha_p10_init(void)
static void __exit chacha_p10_exit(void)
{
+ if (!static_branch_likely(&have_p10))
+ return;
+
crypto_unregister_skciphers(algs, ARRAY_SIZE(algs));
}
-module_cpu_feature_match(PPC_MODULE_FEATURE_P10, chacha_p10_init);
+module_init(chacha_p10_init);
module_exit(chacha_p10_exit);
MODULE_DESCRIPTION("ChaCha and XChaCha stream ciphers (P10 accelerated)");