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);