From patchwork Sun May 21 10:23:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100240 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1009609qge; Sun, 21 May 2017 03:23:54 -0700 (PDT) X-Received: by 10.84.142.129 with SMTP id 1mr21596818plx.84.1495362234824; Sun, 21 May 2017 03:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495362234; cv=none; d=google.com; s=arc-20160816; b=a/Sh/1kEQM/qMNVTRFFfoEG/a1hPtGcsFzmdRswoVpeWEcJtvObfhkUjWVKNOpwVH0 8VoJrGLTBTv7nbqSSzLzfRoy48KN8TR1LZAzgUCqRYfOOrHAY8RnYyLQ6DVdCMmKzTG+ gQBYpsEi5t0WpcOep7j3symsSmAMy0zwEZ7Rn6shaFBjvi1CSgkQ3khnnLRtdL8THacO qRnRuBlgVAlxWtwB+MPHB20pTO5W+ggwP0W34z9EHRvHlkb83cDHozqnY19We88VsZQy n7wKIa3emGpTtIQBHQcBHBrtsGiRUjmej86Jo6GFiD4ioXVxvzFbhkY4GjBFm0PZlWwW t/Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Af1iipqihkTtWaUGYlILvcXZHoWoeNpa3qzq/GW/2Zw=; b=o2uIzZ1z8dRaw/eUlMyemFSx+LSkTcufcvpMVUV7veAbFls6dRHsw9eKMKYoReBB0B MgyUc36mhUau++/ab6W87KCKqvWPSewSbUtTAkZYv71nH1RvH6ogNGiNZpAzXpXI05il UbLkhAoA8xJYLytmxjGema+4N5KHI4CZS1y1Hsbcx26I3v70xRJq8nJcE3tldKlt0d2/ GjbKrXi48Idpo5i5ZMNVURFF3E8yDBL03wNg+CNsNBxB0vqCP33xquReU2poLCQIzi+r KVAphFG8itTNaXsj5XAEIPg4qtbZZgRhdeXdGyP/oO57T8Q2X9gzlRAkZPkEGAnvZFrI 6LqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si13414632plr.23.2017.05.21.03.23.54; Sun, 21 May 2017 03:23:54 -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=pass 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752694AbdEUKXx (ORCPT + 1 other); Sun, 21 May 2017 06:23:53 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37005 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbdEUKXw (ORCPT ); Sun, 21 May 2017 06:23:52 -0400 Received: by mail-wm0-f53.google.com with SMTP id d127so117725278wmf.0 for ; Sun, 21 May 2017 03:23:51 -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=IUTAa7QOEA81y+yW/LG/F4BqueGe2S+yqX4xkHqxCkxzj4coX33tHUEa1miZ2UTPrv FK09h7GlsqGOYu+lvxVLhfln/usiVb/ladbHraialEjNoRLgO3NDrVkqRUfsCz4vA1uB 1GKwrX7XhjirlJt5TRnAI65/UN/JLOMxqA94U= 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=I63i8STNbihTfhZUViaaMTXfDkuVFGKvJrHtzCdJV1bMLxZxq3DCpBEmkKWnl8t/UK ib3jErB+S3uIf+08kYmaJyUwcbjUSK9iPXJ9HDaws4IL/gxOfLdkvWc36Ru3dtx6HE5B sFcrM/zyrGsLHtE27PRP6halBvkJwJj+oemH+oBCRwJLyWdWyT/D42PbbBG4W56MyafF C9YjkeBIfE06TU6ekN4GNQ9B3Tik1eIanK2ZF/rkTiekxy8x6vBD+DAdQk24FnXT8F3s E+QKw1MVb6lsf/zTJOWIZwvdjmhqWTj51EDhWa8XrpJ5bc3UKzLACsOQGJG3Vwzanf2F 5hgw== X-Gm-Message-State: AODbwcBVufmdQetBaqnvp3FquW6PVSiNRL8R5NLXf6+rlmf807wM/QBZ KIPoIyrqSRWUQHUz X-Received: by 10.223.174.209 with SMTP id y75mr8202214wrc.82.1495362230873; Sun, 21 May 2017 03:23:50 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id y60sm13381366wrb.39.2017.05.21.03.23.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 May 2017 03:23:50 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 2/5] crypto: arm/ghash-ce - enable module autoloading based on CPU feature bits Date: Sun, 21 May 2017 10:23:37 +0000 Message-Id: <1495362220-30044-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495362220-30044-1-git-send-email-ard.biesheuvel@linaro.org> References: <1495362220-30044-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 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);