From patchwork Tue Oct 18 10:52:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77976 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp819176qge; Tue, 18 Oct 2016 03:52:36 -0700 (PDT) X-Received: by 10.36.89.206 with SMTP id p197mr254406itb.103.1476787956511; Tue, 18 Oct 2016 03:52:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hr5si29379611pac.174.2016.10.18.03.52.36; Tue, 18 Oct 2016 03:52:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586AbcJRKwf (ORCPT + 1 other); Tue, 18 Oct 2016 06:52:35 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:34553 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752193AbcJRKwe (ORCPT ); Tue, 18 Oct 2016 06:52:34 -0400 Received: by mail-qk0-f180.google.com with SMTP id f128so272315515qkb.1 for ; Tue, 18 Oct 2016 03:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LPq3qxkQIy0R4yob03JqCR71IYo2qtUv5bCMUBci/Pw=; b=H2h/FGSdTyec4yKF3Zqa2LQZh06qN3ubj2se9gPmiU+Y5+ToKnJXeSk9A1D9UwEubN q9LreBCzur9+BXsAfD8y6ExmUbAKc+uNsd62sK8GyTKv7jhCjhKMD2rVGRAx/YQaN5eV 5WQ2G+4Gl51Z4oIFccvQkbUHKP0qZc7uNsrWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LPq3qxkQIy0R4yob03JqCR71IYo2qtUv5bCMUBci/Pw=; b=O0sYRjxSqVPwpTlaxZkAQNBp9K9EENYF4AgGBQDSN2w4WM9ETwaNQh9e4UEX620oS/ LdPg5wFRdoUXJn6xltOd6w8iVgeFQezgfGWy9oR5APi7f4tRdq6QNr6JjQ7oqiLauO55 7kdpM9/vlQUfE2TqN3LYNbtNWZ0x0y9UI9GXZy8jsLpTT04C+Afoe/drVtIEQTHl34fo rQt9tVBbM+yjw1mOLgTYZeNh6lfu9yK0fH9ScM06EEKwB2bFcI95Vwq1seAe1UlSo/86 k+Qf8qWywdcIaSA88o9hLP+I5u18HFNltHcTtDi3Jftpbv2WbEztL5StycDDBYvqoXdB /SSQ== X-Gm-Message-State: AA6/9RnkLvyxoNGRTBOcyFWZ6rJ9nz4xQXrAn0Y5cf4yKHKRA4xcjZeNyIwBEuoIBeIX7MiB X-Received: by 10.194.106.135 with SMTP id gu7mr13470182wjb.153.1476787953726; Tue, 18 Oct 2016 03:52:33 -0700 (PDT) Received: from localhost.localdomain ([105.137.38.75]) by smtp.gmail.com with ESMTPSA id za1sm57784083wjb.8.2016.10.18.03.52.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 03:52:33 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux@arm.linux.org.uk, herbert@gondor.apana.org.au Cc: steve.capper@linaro.org, Ard Biesheuvel Subject: [PATCH 2/5] crypto: arm/aes-ce - enable module autoloading based on CPU feature bits Date: Tue, 18 Oct 2016 11:52:16 +0100 Message-Id: <1476787939-21889-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476787939-21889-1-git-send-email-ard.biesheuvel@linaro.org> References: <1476787939-21889-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Make the module autoloadable by tying it to the CPU feature bit that describes whether the optional instructions it relies on are implemented by the current CPU. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/aes-ce-glue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index aef022a87c53..5b1af6f8b2b5 100644 --- a/arch/arm/crypto/aes-ce-glue.c +++ b/arch/arm/crypto/aes-ce-glue.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -515,8 +516,6 @@ static struct crypto_alg aes_algs[] = { { static int __init aes_init(void) { - if (!(elf_hwcap2 & HWCAP2_AES)) - return -ENODEV; return crypto_register_algs(aes_algs, ARRAY_SIZE(aes_algs)); } @@ -525,5 +524,5 @@ static void __exit aes_exit(void) crypto_unregister_algs(aes_algs, ARRAY_SIZE(aes_algs)); } -module_init(aes_init); +module_cpu_feature_match(AES, aes_init); module_exit(aes_exit);