From patchwork Wed Jan 11 17:01:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 90953 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1218450qgi; Wed, 11 Jan 2017 09:03:00 -0800 (PST) X-Received: by 10.99.53.195 with SMTP id c186mr12061233pga.24.1484154180315; Wed, 11 Jan 2017 09:03:00 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id h8si5053340plk.307.2017.01.11.09.03.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 09:03:00 -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 1cRMIc-0007o7-RJ; Wed, 11 Jan 2017 17:02:58 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRMIT-0007VP-F9 for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 17:02:51 +0000 Received: by mail-wm0-x229.google.com with SMTP id c85so163151246wmi.1 for ; Wed, 11 Jan 2017 09:02:28 -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=2fibi3Jl6azJdDDFTs37PrrO+3vFK0x7I0Dv4topbv4=; b=Aa22otXLnjwhMXfPJwkbwV5vPO7f6OW9lumzPlshpJ8vkNRThThKvyRrsrprJWdEFn JJNKl8BDJ+4JadB8Kz3eSdxkjjMEeWSh1P/1g+zXb71u77XcJ9ajHkS2FgdDxxSxLVF5 R95bkajQmCcogzGkJCuTpcidKfk7+ftWb8BX0= 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=2fibi3Jl6azJdDDFTs37PrrO+3vFK0x7I0Dv4topbv4=; b=pM7m+N6doCG1Jynpjok4zJjsQW5WnVmodzq2/6tarJd9Oqlq5OB6zZ5n1j3hBtBMjA kUtBKJx7kleH2oy00A//HwJJMiC9xv7vhrdfQ8KObGjaq1HW13X6kM4IVxMU6Sw+Dcku IjJM0EFCh3hg5/rjJHsO7SYXTd9vfxUqO+tgZ3CHTtcad5jk2tPNG0k/QsnRK8iGlRlD qO/316I+lLOMiTnwJpjJZ7fNn3OQW1Z4MBGNdUEztYDicZ38Mn06FyTTKjzDfoS+zF4j ca1m+IHIhQ5N+oY3rqIzlQpi+vKSaVT0DYJn/7afP990F1s2S4aju2I981XRMPAGUY9+ MqKA== X-Gm-Message-State: AIkVDXJyRe/SR2m2+wHGI/zU9fI8jMzEJNsa6XCkrkEdYk8rcV8v/ihdoX6p9xayoasIHacx X-Received: by 10.28.31.84 with SMTP id f81mr4173061wmf.94.1484154147401; Wed, 11 Jan 2017 09:02:27 -0800 (PST) Received: from localhost.localdomain ([160.167.203.25]) by smtp.gmail.com with ESMTPSA id o132sm9873491wmo.17.2017.01.11.09.02.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jan 2017 09:02:26 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/5] crypto: arm/aes-ce - enable module autoloading based on CPU feature bits Date: Wed, 11 Jan 2017 17:01:55 +0000 Message-Id: <1484154118-22139-3-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_090249_686711_654B1850 X-CRM114-Status: GOOD ( 11.94 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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/aes-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/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index 8857531915bf..98c68ad101e5 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 @@ -428,9 +429,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; @@ -454,5 +452,5 @@ static int __init aes_init(void) return err; } -module_init(aes_init); +module_cpu_feature_match(AES, aes_init); module_exit(aes_exit);