From patchwork Wed Jan 11 17:01:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 90956 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1218848qgi; Wed, 11 Jan 2017 09:03:37 -0800 (PST) X-Received: by 10.84.241.1 with SMTP id a1mr14417584pll.65.1484154216977; Wed, 11 Jan 2017 09:03:36 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w10si6318907pgo.263.2017.01.11.09.03.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 09:03:36 -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 1cRMJC-0000Jn-J7; Wed, 11 Jan 2017 17:03:34 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRMIV-0007VT-0W for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 17:02:54 +0000 Received: by mail-wm0-x231.google.com with SMTP id r144so34829039wme.1 for ; Wed, 11 Jan 2017 09:02:30 -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=Af1iipqihkTtWaUGYlILvcXZHoWoeNpa3qzq/GW/2Zw=; b=f9IqXtJT+JZ8usBf0zshMV9zwecrE0a6BmOPCtCg8n+sb7C0ngZ2MC+WheSqLYF9Nl xzk3RAWrUoGPk8tBBi4JeFCfub+HSzy/fhG7tgWHyLUpgVAiTNIjyFBssBXxAdzua/+5 51MP/UqH8qaqAalFtnbL2FbvUfhiaXVnBWeJU= 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=Af1iipqihkTtWaUGYlILvcXZHoWoeNpa3qzq/GW/2Zw=; b=KrDc6vrt7TZv6WkN0QW4hFE64UjbedUl6YXcqkMjZyVBpxfjCHvfXskOH86vErdTne negyBEjTJ1cfS2SunJtAnNsi+eQpBIeVH24aCvEhSo8ZA1lNc6CdMchsrWZbvfWntDqA 0Szj56ZeDXVIjmk4yt/PKWmaN3jpR/wfbDkWkagQckg2L/TDXlGHHlSBAl9P1W6uKwKn vPDi4t4iTwQGyaOthtE4v3MktsDG3b+BHVhIDxwutZdJz7FWxo+Odu1xGKfe+bv9EZM3 NGk9KPhEkEl7PXfj/tlgRoc2lDd8IaIEf7svshyPnVTrb4AI+ndr43m2aBCy8kVMoE3x XVhQ== X-Gm-Message-State: AIkVDXI+u9312vIw6uy8IdXFvy5iPDC2EaGgEbYx8QZGg678dd7tw4asNXniEq0BIzwC1gSW X-Received: by 10.28.132.193 with SMTP id g184mr3794218wmd.130.1484154149093; Wed, 11 Jan 2017 09:02:29 -0800 (PST) Received: from localhost.localdomain ([160.167.203.25]) by smtp.gmail.com with ESMTPSA id o132sm9873491wmo.17.2017.01.11.09.02.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jan 2017 09:02:28 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/5] crypto: arm/ghash-ce - enable module autoloading based on CPU feature bits Date: Wed, 11 Jan 2017 17:01:56 +0000 Message-Id: <1484154118-22139-4-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_090251_321395_4EDFE6AD X-CRM114-Status: GOOD ( 12.09 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:231 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/ghash-ce-glue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 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/ghash-ce-glue.c b/arch/arm/crypto/ghash-ce-glue.c index 7546b3c02466..6bac8bea9f1e 100644 --- a/arch/arm/crypto/ghash-ce-glue.c +++ b/arch/arm/crypto/ghash-ce-glue.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -311,9 +312,6 @@ static int __init ghash_ce_mod_init(void) { int err; - if (!(elf_hwcap2 & HWCAP2_PMULL)) - return -ENODEV; - err = crypto_register_shash(&ghash_alg); if (err) return err; @@ -334,5 +332,5 @@ static void __exit ghash_ce_mod_exit(void) crypto_unregister_shash(&ghash_alg); } -module_init(ghash_ce_mod_init); +module_cpu_feature_match(PMULL, ghash_ce_mod_init); module_exit(ghash_ce_mod_exit);