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