From patchwork Sun May 21 10:23:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100239 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1009595qge; Sun, 21 May 2017 03:23:52 -0700 (PDT) X-Received: by 10.98.196.18 with SMTP id y18mr19218015pff.49.1495362232562; Sun, 21 May 2017 03:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495362232; cv=none; d=google.com; s=arc-20160816; b=0RjoWTTkYfgq70eyw7LrMUaWpYeLu7GvZ5ABMwQvEeNwkTDWOFP+E3Cv5OAOuWypIH APE9J2+cuxBOWYoKukjzSuVdKVSoLW2d+TiRi+mpPKCjstfkbZUd1g3/VdigzxKXjNHO KAXEfKZooBrbAT7fnZ8lhx4U0VGNwLgVve2FX0lKlNEdT7+PVIViqRTl+MHkviBsx6VZ 0DOlJdiz7kBE/gBQQuc3K1tUlxC8C8cdM99pzAJV8KlLLAh4mK4fzw4qEHrJUiC9BzKt 14wnWp3NyEGVeDP3snVSI7eNuD5b5He7i7QB4948n+DHVz40Wna4e75lI3ZqCBot6lmC gMwA== 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=0ssTKdP8YxnfqR4bhdpaV/LuJ+3btVkF8sgYMYGColo=; b=knRj1qDCLbkOPUjrVuROGGfGSYpKwzmDYHty/fjfKNgO1WaHW4iK5g9pjOhs5awilK 5aB6i00zYl1N6IaulQ2tynS5MltYeu50QtyMJL/Y/WKGi7ne2UgIPl/O6oCzaoS5lz2r +7cZxEjLE360d5kcfaR1VGup3UMrZ7f2ymxh9QOwb/8okaonvxWKugdyMneEtWPb2BdU extbmn0RHKzB1ZsZ+FmZ/aFnbviQE9KJoz5hunTfPCl83U2/epCOFcBUn+v6z7maEQy4 n/3OtwcsS4Oh4GBAF0xl90jziwNLwm+1vCjuCl+bQPNZJgOraxdnCqGmkueVNeG3K9jt YdKA== 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.52; Sun, 21 May 2017 03:23:52 -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 S1752645AbdEUKXv (ORCPT + 1 other); Sun, 21 May 2017 06:23:51 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36983 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646AbdEUKXu (ORCPT ); Sun, 21 May 2017 06:23:50 -0400 Received: by mail-wm0-f42.google.com with SMTP id d127so117724598wmf.0 for ; Sun, 21 May 2017 03:23:49 -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=0ssTKdP8YxnfqR4bhdpaV/LuJ+3btVkF8sgYMYGColo=; b=gs+aUatheKYYOoHd4eoUI/sIOkk/0TDY3JlzPo14gEjnVCwSiG1stqrr7dCvfP/Bjq OWBCpg45BIYyyhgaXhmWoZ2E+7OBmqkDLF77bQLYrUjGSyiA/gHIWCHnUfFLhxcuZgSl CZSt9XiX3dMgUI2uMCzLnugdCCDERrHOV+zX0= 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=0ssTKdP8YxnfqR4bhdpaV/LuJ+3btVkF8sgYMYGColo=; b=H9jGb70CpdzAa7ilZ7zIAGWRp9s5TyNG66ztllmxDdDc2X81BwzECQQrh5X/oPAMFi Pquhbbe9oMiGgxCWkgJmesRf5FgltoUIdvNHNFygEzHLglhjrlN4hlZuNzWGpkGEJrud OvlhnH6qq5m6z/i1Z3kWTFRnKrhec+jBYvF946TDjOKSlCluCJ2DyjzC0Vt5Z3fopVzk 0ojieGK27DbMpINM1L0AzL9iogdZfHdaCEtn+DkZRKbUybjdlnJB8My2pBtAB4OKqbcr n51r3EUSIfZmS4lkGOR57u4ukV7JpxUGmRW1jRitMVGZkxPC9iY1xvcBD6bf1DxnUIzi /Lsw== X-Gm-Message-State: AODbwcBgUvWQlz9+AvE2QfOL6jbMhq/dedB401i7T9Z0SEOj+eHW5cGB sJ82rIb6EcOlguWW X-Received: by 10.28.170.11 with SMTP id t11mr10646452wme.44.1495362228796; Sun, 21 May 2017 03:23:48 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id y60sm13381366wrb.39.2017.05.21.03.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 May 2017 03:23:47 -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 1/5] crypto: arm/aes-ce - enable module autoloading based on CPU feature bits Date: Sun, 21 May 2017 10:23:36 +0000 Message-Id: <1495362220-30044-2-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/aes-ce-glue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index 883b84d828c5..0f966a8ca1ce 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 @@ -425,9 +426,6 @@ static int __init aes_init(void) int err; int i; - if (!(elf_hwcap2 & HWCAP2_AES)) - return -ENODEV; - err = crypto_register_skciphers(aes_algs, ARRAY_SIZE(aes_algs)); if (err) return err; @@ -451,5 +449,5 @@ static int __init aes_init(void) return err; } -module_init(aes_init); +module_cpu_feature_match(AES, aes_init); module_exit(aes_exit); 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); From patchwork Sun May 21 10:23:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100241 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1009619qge; Sun, 21 May 2017 03:23:57 -0700 (PDT) X-Received: by 10.98.157.83 with SMTP id i80mr19467663pfd.166.1495362237456; Sun, 21 May 2017 03:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495362237; cv=none; d=google.com; s=arc-20160816; b=04N5FYY7XUUChtZ5ZTfpCcVeAfpm3TLhrr3ZabUOV+EcnDCby4ada4/UucRK4KeCXH v/U6hf04Wb9ti5WIC7RyTtdqC+4MeRsE/dU1TpBrpxofRZ4FlxMCPdBSXkyslZyLvbRq fIT7jms8MIzRyB7CrGSdli/VKtYdsajeBSJI3RcZ5H7tYDUCmNivxLroBktxDeMfyg/J j6GHubGtdcjCQ3kLjYnELD2A0JqXS0xB7qCaOCc8ogJjP5B0efA48G/MHj0htQt46pyK jow5BhZCBumlalaETtWgkjUHUqRqelKDRWiCNPZz4vbbkObqPdvSCcbeYRhVorj3BdGU wcKA== 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=tIhXXZitwFbq0MPGAZ6/t9pj8i+vDL+dWwBhTKwu+p8=; b=rKQFZptvz5mo4ux1ejGv8ynCQjNTwLbTLKIP2A+PSa+32LkoYqQWSwoJozRXuemvTf thTrQ2sbQvMVi7MbeBojX+GIFo5IkyePpdXSE+p3lteudRiYQEBk8Gnztbsc0S30v2pg UXgbwYSaOqTGMR2Wg4QcUiIDJv0XtbEPRMzOLl3rfmxc544OyuuTeB3TUikAvrvSwc8a up9WBFl9s1n8Tvcu2mi/VbyqYC1FtMUcChGDZ2nSgkc5Ank6rQwgaJDoBvCMWWuwXOVr PCI2IaXJWZuo0c59HbIdBUtWW5FCq8+twGzym7jSAsJASNGXIKevFCx0cvhcqOArfGFh h+Ww== 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.57; Sun, 21 May 2017 03:23:57 -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 S1752646AbdEUKXz (ORCPT + 1 other); Sun, 21 May 2017 06:23:55 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38890 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752678AbdEUKXy (ORCPT ); Sun, 21 May 2017 06:23:54 -0400 Received: by mail-wm0-f47.google.com with SMTP id e127so2373716wmg.1 for ; Sun, 21 May 2017 03:23:53 -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=tIhXXZitwFbq0MPGAZ6/t9pj8i+vDL+dWwBhTKwu+p8=; b=SxRj0o76L7GGUSHBu/irUbJkK3OVlRNPIq0XQEcKoPG1QWQtB+3XZ0h3k8LBwluC4g O4obIkW3VhoXSML2yNMDELv3aN5z1fmkTlvNYRo2z8udnkefMHYFUm/WpTbREKsmh/ip UBtd5RGsSugTKWmFI3+j7XAd3ySdpfuLu2QF8= 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=tIhXXZitwFbq0MPGAZ6/t9pj8i+vDL+dWwBhTKwu+p8=; b=RzsoIPQpROSLnR7BxoMg3dh1vP/8xQIBaYYfR0vWj51t4umDLaPmqca25CnsVRto3U 3jIzodho/bCQ8jarFT07C0i/SW5AR+OCYp0zVQXvABhe/EvXUzF2gRnMISQiscMv4Br/ blbpCGQC3YB+0lvM67NYfiVBFxIjqOOu00gPQH9zrwC9hgRHuqZq3QyW6XxLzOzS5UyM C5FU7kZJ0bS0p8omHcRUDQXbNjDlvvHnDKLnBeIl2yU04fipbhAlxPzdv4onNRVnUAcU cINAx4pxqi/i4JxOS1N1EQkTmiwMYvddPbW84PiX6yiTOvinp2vxfr0jXe1lZue+ZIaB LNwg== X-Gm-Message-State: AODbwcBs83wx5JXLKcQSN/IddhRV52om3BiF1R6+nJ7KCjhxPRHrzpm1 Rg91tpHU9BNqinTO X-Received: by 10.223.135.216 with SMTP id c24mr8071946wrc.109.1495362232646; Sun, 21 May 2017 03:23:52 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id y60sm13381366wrb.39.2017.05.21.03.23.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 May 2017 03:23:51 -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 3/5] crypto: arm/sha1-ce - enable module autoloading based on CPU feature bits Date: Sun, 21 May 2017 10:23:38 +0000 Message-Id: <1495362220-30044-4-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/sha1-ce-glue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c index 80bc2fcd241a..555f72b5e659 100644 --- a/arch/arm/crypto/sha1-ce-glue.c +++ b/arch/arm/crypto/sha1-ce-glue.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -82,8 +83,6 @@ static struct shash_alg alg = { static int __init sha1_ce_mod_init(void) { - if (!(elf_hwcap2 & HWCAP2_SHA1)) - return -ENODEV; return crypto_register_shash(&alg); } @@ -92,5 +91,5 @@ static void __exit sha1_ce_mod_fini(void) crypto_unregister_shash(&alg); } -module_init(sha1_ce_mod_init); +module_cpu_feature_match(SHA1, sha1_ce_mod_init); module_exit(sha1_ce_mod_fini); From patchwork Sun May 21 10:23:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100242 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1009624qge; Sun, 21 May 2017 03:23:59 -0700 (PDT) X-Received: by 10.98.30.129 with SMTP id e123mr19864700pfe.240.1495362239629; Sun, 21 May 2017 03:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495362239; cv=none; d=google.com; s=arc-20160816; b=im4AKOan/NxoK2nD6la2QpAA2wT7pWQESCkqfu8hLV7JyqQkOcZJxPBBjnm1Q0DoFA uc7mn31b1W+04WRE/WYJkpORyFIA6mgsGDz0NR5Sny5OkvxLDnFX6uoFy81/Floo9AsR 71rQDPBXtS3pncsaEypi9WQwplYjlo46ct2HByTVk93t1OMMXRM0cry6Ca/U+3So+5Xe 8NLbKxpP1fbtD3LgtyVJYJO/hY9ladC7bWXAj8VhHVF5hcZ2nKhGyuMHQYrI8I/bI4+r v7Dz7nGTYSvHxTHyCEcW6yPReILwL135j36FuDRHQqyVURWgVbMix2+4OSI9ZnMpAJkJ jZNQ== 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=lJQzJQRkC1WqnKvLlCFhgaGpa51TTvChym+4fqf4y84=; b=N+6ucioKphcvZswnIDNICljIVnDCKN+rcpmWJaTFundWMEqows49FV1h1fYkysyy4R D/TDE69FHD39QuXqo9OiWTpHjW8FQdCKdkq375PFsive+nC13KLlhSqAlmAwYcns+6rr QgPkE1uCKL5A+vSNVlLWPnjH+fiaHmOUuS0AZREqJiA39E/o2A38Cke3BuHLtesV+XC5 ElIsgY21dHl6hPGbT2AstHJcQbFtMovO7Ef9+M6/G9IVwC1vYV74wSsLQN9pdNlL+dQy BKA1sBMqyEisyXjGmdmuSXZxo3iuB7+X472Za4Eg3HE2r4B3tWOvckOI5YagrUcQBgrH 0ABQ== 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.59; Sun, 21 May 2017 03:23:59 -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 S1752705AbdEUKX6 (ORCPT + 1 other); Sun, 21 May 2017 06:23:58 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37049 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752678AbdEUKX4 (ORCPT ); Sun, 21 May 2017 06:23:56 -0400 Received: by mail-wm0-f42.google.com with SMTP id d127so117726436wmf.0 for ; Sun, 21 May 2017 03:23:56 -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=lJQzJQRkC1WqnKvLlCFhgaGpa51TTvChym+4fqf4y84=; b=ARJ0bCiVCm4qhjpDOPd0KJgbQpLeY1uf+BO++W2Q4DlJ8mqZSc4CyeeqQTWX6GciN7 kfTjI93ICxsT/wBc/kqQ1/4bHzfLw1zH1Mvasbsvla9BdQDUjLtZeJidyXO/qyRzOXNi kEtvBcqfuwrMN+2sjw416sDoBd18BV5BTqSA4= 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=XAt08OyIxjSO0FiRqrRF5OTQkyhB0cY6h2sSmUnUZvtYWr46RfwZZGcwVRgqFsbIIF 46ZVFalZBZBQBjPxFM7azcjUcsQv86C9oJ0YGW+OniDEB0lJwK5rcRqzB9zZPDiznuPO TZi4YOSve0LB5PS0XFt65whphyn+Yt2dyKJwfU2AlOPvziuv+zikpZVIooyZVtXu3iLt jFHrh94eqbD96J/kX0YBA+pTNkgw7WbTcSaLOdzhhsKX+JlO9VlYhjQUE0kC46G7VbCd U9BFi75tNCp94YNAFU1komKYaMtWl+55a0P/WGy14RweB3DNFYvyEesBFV5171ZpJ2cx nyGQ== X-Gm-Message-State: AODbwcC6gnWi+cbuMMnPJsEl2NyzbEjfb+SWIab/YOX1nOMUSCYk6jQ8 rH6gOVbUpKS7Sl8/ X-Received: by 10.223.163.21 with SMTP id c21mr7687115wrb.38.1495362234758; Sun, 21 May 2017 03:23:54 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id y60sm13381366wrb.39.2017.05.21.03.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 May 2017 03:23:53 -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 4/5] crypto: arm/sha2-ce - enable module autoloading based on CPU feature bits Date: Sun, 21 May 2017 10:23:39 +0000 Message-Id: <1495362220-30044-5-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/sha2-ce-glue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.4 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); From patchwork Sun May 21 10:23:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100243 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1009630qge; Sun, 21 May 2017 03:24:01 -0700 (PDT) X-Received: by 10.99.111.140 with SMTP id k134mr19049182pgc.20.1495362241081; Sun, 21 May 2017 03:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495362241; cv=none; d=google.com; s=arc-20160816; b=LIAJQVamQ5HsDDueG/8pnD3Sw0x6Yq4H7DaHbnivheW5ulOZDRCd0HI1lx1ZwU8MSv j00JnPsQv4nLx103veeR/XiLBNRnBT9I/Q+PG0slZm97R+MC64B4uebeY81NRv3ggm8t 2sxKiFWXj2JJjOCQ8yV/qGcNfP4CDwCA4czMOzRpb5bOjLxCZ5WSvfBiKpgR/nNicxv0 7u3LfDuaPJGzeILJ1PdbHnQkLg5kMGuUIhhcZiZpATlbOliDSysEqQV7tdtEnmWgy6fF Ccu5X/3pqfLnafqEiOKoRrVpJ58HOITOg6qYoTWuV4lsTunfuubgC9+nZoE0SIlIc8Wk B0dg== 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=Q848h39yojkU33soc6zuuEdaazznnNSrSJnl+94k8Yo=; b=DED/ZpBpSA3BNk9uaYLzGrC1KtDDnLS1HD4fhUboF0I7IxvkV61nwyjtiggnyKlOtd w3J29LGiE4UYKHDkR0HEeOd3VmppGLLwdOEv9JYIJmCPFKlAIj5uzeKK5WKrmDZyJPFN PCDe1+0mgPo00vuWBkFGHAvlbjEU8sBEN/n6HxkqOGZLo+/M48kIncimZ1lw08MQCjmf w896A0mvAywz3XROn07dLkXi+KP/yYrsQrk3A8LIGv0BxDXxPzr23i+qYEygLV9oEROy Cdyjov2LopERaEKIsm20V6LfqpWxmHGjOlo18DQidwJJ+hc5m8kM4aEI6cUehXs5lPuj CbhQ== 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.24.00; Sun, 21 May 2017 03:24:01 -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 S1752678AbdEUKX7 (ORCPT + 1 other); Sun, 21 May 2017 06:23:59 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35346 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752701AbdEUKX6 (ORCPT ); Sun, 21 May 2017 06:23:58 -0400 Received: by mail-wm0-f52.google.com with SMTP id b84so267511457wmh.0 for ; Sun, 21 May 2017 03:23:57 -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=Q848h39yojkU33soc6zuuEdaazznnNSrSJnl+94k8Yo=; b=bBa7xx2EoiSOspIApSNspd/GyttG/AWdkFCCsdUBific2JG4ajGumZOw/Scj0+8m8b r9lpxMBk+fsFE79sINIDIzBX1Ox7U6Bx6PaywfmdVZIaVR0GGVHYnhHdDFprQVt+Pnwd lXc5Z0Qc2yWidgQ8cy5hM1esCKF+eF0As0YIc= 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=Q848h39yojkU33soc6zuuEdaazznnNSrSJnl+94k8Yo=; b=GqJaPadI+KSJCSfXpIKw/tUJSAPDFy0gPhKm6Y9R3G1+s7ne7yapfJ2HXp0ZEmS35z h8hb4piCtL5Qs24Rq0cn0CaXsTgi8FkypDuz0l8W8Ahii8h6P1Knnh0qog2X/fpI/6UM aCdA+qIaHtR+i8ZPWIeWe3g5I6ASvMmk9x9yJ6dTDR6+bLTlk2TJTbNDYr1c2koe3uXF z8g94uCAJl/nKwbki6ULZHD4zz83tdiyuwHoahT6WHd1r3kKrWOJVAmw4SNBlEMbp9iQ 2e2tNULbXf/zw6SrFHbTxmRzCdUfHwPYh2JBNK+qCNOsbyXrSsqokQVoabH0pmPBMQ20 e+8w== X-Gm-Message-State: AODbwcCOa+sA1Ufy3Auhn7RZ4h+hd/o/rn/7ZVfah+c7jyra0ReXtlA4 Ng8++VVUryrC6ULW X-Received: by 10.223.160.70 with SMTP id l6mr9606698wrl.0.1495362236705; Sun, 21 May 2017 03:23:56 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id y60sm13381366wrb.39.2017.05.21.03.23.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 May 2017 03:23:55 -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 5/5] crypto: arm/crc32 - enable module autoloading based on CPU feature bits Date: Sun, 21 May 2017 10:23:40 +0000 Message-Id: <1495362220-30044-6-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 bits that describe whether the optional instructions it relies on are implemented by the current CPU. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/crc32-ce-glue.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/arch/arm/crypto/crc32-ce-glue.c b/arch/arm/crypto/crc32-ce-glue.c index e1566bec1016..1b0e0e86ee9c 100644 --- a/arch/arm/crypto/crc32-ce-glue.c +++ b/arch/arm/crypto/crc32-ce-glue.c @@ -8,6 +8,7 @@ * published by the Free Software Foundation. */ +#include #include #include #include @@ -233,6 +234,11 @@ static void __exit crc32_pmull_mod_exit(void) ARRAY_SIZE(crc32_pmull_algs)); } +static const struct cpu_feature crc32_cpu_feature[] = { + { cpu_feature(CRC32) }, { cpu_feature(PMULL) }, { } +}; +MODULE_DEVICE_TABLE(cpu, crc32_cpu_feature); + module_init(crc32_pmull_mod_init); module_exit(crc32_pmull_mod_exit);