From patchwork Wed Jan 11 17:01:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 90957 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1218948qgi; Wed, 11 Jan 2017 09:03:50 -0800 (PST) X-Received: by 10.98.74.142 with SMTP id c14mr11468475pfj.139.1484154230589; Wed, 11 Jan 2017 09:03:50 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id j130si6315196pgc.309.2017.01.11.09.03.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 09:03:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRMJQ-0000g4-Jb; Wed, 11 Jan 2017 17:03:48 +0000 Received: from mail-wj0-x230.google.com ([2a00:1450:400c:c01::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRMIZ-0007WZ-4u for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 17:02:57 +0000 Received: by mail-wj0-x230.google.com with SMTP id kq3so61427119wjc.0 for ; Wed, 11 Jan 2017 09:02:34 -0800 (PST) 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=lJQzJQRkC1WqnKvLlCFhgaGpa51TTvChym+4fqf4y84=; b=hitFV8sTnHZP39CLr6FKz0v+baTLIBZeDnIk6zP2JN5bj+MvDzb+vzTmuWe2Xz7NEC FsLDC7VlwWD6h3jFBcPIOB13w+dczuDvJZXtsR7pA4/v5jqkLVdRTNWjBh8VpYxV0ie0 lFbYn+qyGm9oup5+gvps4kQ4FNxH0mYAaE3eM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lJQzJQRkC1WqnKvLlCFhgaGpa51TTvChym+4fqf4y84=; b=DBpbdFQbUynxaM9DPFY0vbBf124pqnQbzv7vSxdfhiK2jTIJHCDJ6ryOd/cKotP32w qp+zTZVCHChcr82/KrDFglS5rEJEfW8QTf+blJkpj4KW8APYuwfZDujbZbEna3TCCwR2 mi4NDAXC3bg3JdUiW1NpqkgJNaQAESDeCGUDTDOXWDDXHc+dY50kLys0Ho22vBgjYD4H yvnZosU8xX1J92Adj6uGX4YhsQRbiSB8AsTZ2jXyAtwwW3Q2yE90qraLY16hyAL6gTkd RXvI8mhooxWeHkgQjAujKZTQzDmP9+JRktg795vJ6zP1VrIyr/hUvNEgEPJF0NUkxpO0 x86g== X-Gm-Message-State: AIkVDXJAptYnmLPLMAX47QFCxCGA+t/okuhBQ4BVopEf06B/87Jovm79Ry1MRBHAAHEz4IFy X-Received: by 10.194.139.7 with SMTP id qu7mr3395424wjb.220.1484154153257; Wed, 11 Jan 2017 09:02:33 -0800 (PST) Received: from localhost.localdomain ([160.167.203.25]) by smtp.gmail.com with ESMTPSA id o132sm9873491wmo.17.2017.01.11.09.02.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jan 2017 09:02:32 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 5/5] crypto: arm/sha2-ce - enable module autoloading based on CPU feature bits Date: Wed, 11 Jan 2017 17:01:58 +0000 Message-Id: <1484154118-22139-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484154118-22139-1-git-send-email-ard.biesheuvel@linaro.org> References: <1484154118-22139-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_090255_471658_7CDFE5CD X-CRM114-Status: GOOD ( 13.38 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c01:0:0:0:230 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux@armlinux.org.uk, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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/sha2-ce-glue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c index 0755b2d657f3..df4dcef054ae 100644 --- a/arch/arm/crypto/sha2-ce-glue.c +++ b/arch/arm/crypto/sha2-ce-glue.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -100,8 +101,6 @@ static struct shash_alg algs[] = { { static int __init sha2_ce_mod_init(void) { - if (!(elf_hwcap2 & HWCAP2_SHA2)) - return -ENODEV; return crypto_register_shashes(algs, ARRAY_SIZE(algs)); } @@ -110,5 +109,5 @@ static void __exit sha2_ce_mod_fini(void) crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); } -module_init(sha2_ce_mod_init); +module_cpu_feature_match(SHA2, sha2_ce_mod_init); module_exit(sha2_ce_mod_fini);