From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966343AbcKAOSR (ORCPT ); Tue, 1 Nov 2016 10:18:17 -0400 Received: from foss.arm.com ([217.140.101.70]:52268 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966280AbcKAOSQ (ORCPT ); Tue, 1 Nov 2016 10:18:16 -0400 Subject: Re: [PATCH v2 1/3] arm64: crypto/aes-ce-ccm: Cleanup hwcap check To: Ard Biesheuvel References: <1477929825-5907-1-git-send-email-suzuki.poulose@arm.com> <1477929825-5907-2-git-send-email-suzuki.poulose@arm.com> Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" , Christoffer Dall , Catalin Marinas , Will Deacon , Mark Rutland , Marc Zyngier From: Suzuki K Poulose Message-ID: <42a11fce-d231-2317-3c8e-a9044bbe5f62@arm.com> Date: Tue, 1 Nov 2016 14:18:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/11/16 14:03, Ard Biesheuvel wrote: > Hi Suzuki, > > On 31 October 2016 at 16:03, Suzuki K Poulose wrote: >> Use the module_cpu_feature_match to make sure the system has >> HWCAP_AES to use the module. >> >> Cc: Ard Biesheuvel >> Signed-off-by: Suzuki K Poulose >> --- >> arch/arm64/crypto/aes-ce-ccm-glue.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/arch/arm64/crypto/aes-ce-ccm-glue.c b/arch/arm64/crypto/aes-ce-ccm-glue.c >> index f4bf2f2..fa82eaa 100644 >> --- a/arch/arm64/crypto/aes-ce-ccm-glue.c >> +++ b/arch/arm64/crypto/aes-ce-ccm-glue.c ... >> -module_init(aes_mod_init); >> +module_cpu_feature_match(AES, aes_mod_init); > > I don't think this change is correct. This will result in the AES > instruction dependency to be exposed via the module alias, causing the > module to be loaded automatically as soon as udev detects that the CPU > implements those instructions. For plain AES, that makes sense, but > AES in CCM mode is specific to CCMP (WPA2) on mac80211 controllers > that have no hardware AES support, and to IPsec VPN. For this reason, > the algo type is exposed via the module alias instead (i.e, > 'ccm(aes)'), which will result in the module being loaded as soon as > the crypto algo manager instantiates the transform. On CPUs that don't > implement the AES instructions, this will fail, and it will fall back > to the generic CCM driver instead. Ah, thanks for the explanation. I will drop it. Cheers Suzuki