From patchwork Tue Oct 18 10:52:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77977 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp819197qge; Tue, 18 Oct 2016 03:52:39 -0700 (PDT) X-Received: by 10.98.65.85 with SMTP id o82mr3857488pfa.168.1476787959103; Tue, 18 Oct 2016 03:52:39 -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.38; Tue, 18 Oct 2016 03:52:39 -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 S1753889AbcJRKwi (ORCPT + 1 other); Tue, 18 Oct 2016 06:52:38 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:33094 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803AbcJRKwg (ORCPT ); Tue, 18 Oct 2016 06:52:36 -0400 Received: by mail-qk0-f169.google.com with SMTP id n189so284262645qke.0 for ; Tue, 18 Oct 2016 03:52:36 -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=Af1iipqihkTtWaUGYlILvcXZHoWoeNpa3qzq/GW/2Zw=; b=gOqQYQtZT/Mug9mi7LJB+IYRdWaGVMUFZ099dEbZ3v0bOqpwlVxomOgF2F69a6nLNq JSoLcAzdLWi8sXhsv/k7dO6ulW9P7Z2oWqowhvy4zzeStgxjxX2iFnOSuYYXIShYRaGx OePOkK/FyVhXxlFyH2D/pQ9xrFtglkbhEYc9E= 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=Af1iipqihkTtWaUGYlILvcXZHoWoeNpa3qzq/GW/2Zw=; b=D1dzd4cphubLl35jPRTUsLZ5TVaYuA3r1TdMyhB4rSLmvROt5q9jNCdT0VMd1wo83b mkkLpwarxwPq5ZdlHrCJ4XKiReL8Khe4ZgIjJfEUFMg290BKDTsN3oGh1DbmjN/BWdKT bc8My0IYREGb2IA2aSlz7iXGFya/Ufe9HIxB4hty3zJo3vZO/AzRXPGWrdLSsDe61DM8 2W54/oZGCHOZTcvBsb3U6RFhMGAQDqw70rx++woEx4h/gfcIs/LAvVjaGsb26X7HOB/d Ke9Df1AVnfCx7Y0r6D5ax/j8/aLNQJuiUQ7PlFmhNe2UpYqIwpeNLlRzj1gmUAwn6OtW e9Xg== X-Gm-Message-State: AA6/9RkwB3tv5XPe/RsZIkUbPNZ6Zw+KFyjsHzkY6e3u+rODs5y2aA3yh1MaXBczU/ZKq2BU X-Received: by 10.194.7.234 with SMTP id m10mr15823530wja.6.1476787955496; Tue, 18 Oct 2016 03:52:35 -0700 (PDT) Received: from localhost.localdomain ([105.137.38.75]) by smtp.gmail.com with ESMTPSA id za1sm57784083wjb.8.2016.10.18.03.52.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 03:52:34 -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 3/5] crypto: arm/ghash-ce - enable module autoloading based on CPU feature bits Date: Tue, 18 Oct 2016 11:52:17 +0100 Message-Id: <1476787939-21889-4-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/ghash-ce-glue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 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/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);