Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4114954rdh; Tue, 28 Nov 2023 12:13:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUb9A3xyBUkarkq0717kP6Btw5qdiWhlvF9RDo0wsw8JUlokxz283gKWpaVc/u8nLSHYWr X-Received: by 2002:a17:902:b90a:b0:1cf:d07c:27f8 with SMTP id bf10-20020a170902b90a00b001cfd07c27f8mr7453926plb.28.1701202383881; Tue, 28 Nov 2023 12:13:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701202383; cv=none; d=google.com; s=arc-20160816; b=BlVJaL8cnwoILTDF6ttbOCdcQiA7TlqYseBMS7kCcVVdxg9+j2W3n2xTTeSf3uZabn Yxoch6M1qW5/CtKb/+I0i2H0xDwau1OSZTjdRROvAa23u8bu8dHFCXGPgWIxNsHVhKPb 3ZLyyHWOzy+fIbV4lidcHuKT/M2c4hmiuBFVT/5l2uVe+7l3xA/BVtdQLEq1LdO4vn3m 5CotSabeeJxD0ffI7OalGLIVdRLifBynp5tHJWrTLH5yVfWIyXbNH3NYssIgeY9j5IH8 nmGEzFrjHG27UpgfknQuYWNp5JVJUeBjaU7RxwZ0IeDK78F8oKVQEcw70gNqQDlW9caf OR+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BeP0rizwDGfWeoojcvda8Kl6tbDYMBcylT2lgewMwtY=; fh=GgWhi44DuXgAT0u8K5SVsqlLqKv3A76UOo+fLkJk5XU=; b=UnFraVzdaCjqMX3k9HqZktjCZqMVNi+2jpMiKjoJR2cywOOe1KnBJKSq1eYKIOLVPw zNFiTxaCgtlK5QSCWD7yukvCTHL8iYyBnQ/qt5oC6w2dGp/XT+ba6wqgFpNGnQnngne+ BMuet8Oenedc0ys4tPi68QTo57w131N/OHPJVTWLs8+MDwXUpunVLVfwVWcsFN4SsR11 Pi6fDMdlwR+zJFtRn5BXG5gXLt86nPC1/J3iBTnzM1bYAIbkVOuzrTtHhzET7SdnlAtY TWem9GIw45mTlM5Ei/Es37d6pe6VJ2sHCib/+LwvHGbIzMFL+QhCOP42Sgom9IKVUMx1 3suQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I2oSykRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b22-20020a170902d89600b001c9af7debb2si12476994plz.525.2023.11.28.12.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 12:13:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I2oSykRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D926A80A9AA9; Tue, 28 Nov 2023 12:13:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346097AbjK1UMe (ORCPT + 99 others); Tue, 28 Nov 2023 15:12:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346011AbjK1UM2 (ORCPT ); Tue, 28 Nov 2023 15:12:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531A01BE1 for ; Tue, 28 Nov 2023 12:12:31 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 884BBC433C7; Tue, 28 Nov 2023 20:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701202351; bh=MhX9PEGZOUPQ3Y/dHE9lpPPcT4wCLCEPYr8D6D5VCtI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I2oSykRN0FvNVERNHm6/mDH1mmOkc0Q49tLDgd40gyaDip6gEW7TAl9Jl/MxHObYA mdl/hcepl0h4CXURQz3Tn8VcDCpPQ0NXOnPu68SuNYjvg/HQgzZ8g4KrNzM5TZPDbJ vDC1pzxUpGiHmYxfU45duhcvVDLjsmwei0St+4UE1NUI6IMhUgdA8mzeRXuH+mLU4q a9yc1zaSWu/cJYpBKDvcaynYd9nSzkV4ILJkE9pokYSgNviVD9rofuNx9vfvhXXoO0 vs/iR/aqK59xYP/4AVrqBmBlKYcCuz41pVbRh1aFxjKBpXasnU4aR8ZDjcQrf4mS9b /NZ1g23uTLU3w== Date: Tue, 28 Nov 2023 12:12:28 -0800 From: Eric Biggers To: Conor Dooley Cc: Jerry Shih , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, herbert@gondor.apana.org.au, davem@davemloft.net, conor.dooley@microchip.com, ardb@kernel.org, heiko@sntech.de, phoebe.chen@sifive.com, hongrong.hsu@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH v2 04/13] RISC-V: crypto: add Zvkned accelerated AES implementation Message-ID: <20231128201228.GE1148@sol.localdomain> References: <20231127070703.1697-1-jerry.shih@sifive.com> <20231127070703.1697-5-jerry.shih@sifive.com> <20231128-await-tipper-2094715466f2@spud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231128-await-tipper-2094715466f2@spud> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 12:13:01 -0800 (PST) On Tue, Nov 28, 2023 at 05:54:49PM +0000, Conor Dooley wrote: > > +static inline bool check_aes_ext(void) > > +{ > > + return riscv_isa_extension_available(NULL, ZVKNED) && > > + riscv_vector_vlen() >= 128; > > +} > > I'm not keen on this construct, where you are checking vlen greater than > 128 and the presence of Zvkned without checking for the presence of V > itself. Can you use "has_vector()" in any places where you depend on the > presence of vector please? Shouldn't both of those things imply vector support already? > Also, there are potentially a lot of places in this drivers where you > can replace "riscv_isa_extension_available()" with > "riscv_has_extension_likely()". The latter is optimised with > alternatives, so in places that are going to be evaluated frequently it > may be beneficial for you. These extension checks are only executed in module_init functions, so they're not performance critical. - Eric