Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4030749rdh; Tue, 28 Nov 2023 09:55:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXNdI5dJevrTWMIVu3DJ+6u8ooUmMN/x3jePDAJD22b8KdRAGXqCdXqFyoIivSHOrh18sc X-Received: by 2002:a17:903:11c4:b0:1cc:4072:22c6 with SMTP id q4-20020a17090311c400b001cc407222c6mr18694889plh.24.1701194126033; Tue, 28 Nov 2023 09:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701194126; cv=none; d=google.com; s=arc-20160816; b=nVOjneEsPcBfgS1R2AQPrrJvlb19K22phsrsT9ZIGUQbWBk1o4ZqgGTMfaVwuRs+wk fVh9iyDjHZv0zW13EicL/Oh/Q2NnfSVKClgl4Yt9+Ulu2iaae+fidqyRj/pblOAtQB7C +nFmAwoh4lrOxwU+gKslE97M3sQmFw8UG6kDyC71+FtFqnry3hfz7DDS9LzWyETwr0RM oVAnmqJUutZESFg3+4kUeCf/h0sk+BIC3tA7eEHhGqdGoaTo7YhxdhA15LZnmgULS6OR Bs/K64Bb9dQ+vaJJfbKtwZz5zdKIuj4Lo/tjGzjVvVJxbNQLGOuaTWfxV9HnE7k0+LKP 0dWw== 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=9S4uI+Z4ZlmPyjtEol1mzy8b6oVNoWnO64s9PvJagyQ=; fh=sZENwmnjOejbjfhribrhBQTeV9beuXO5un8RLIyXV6Q=; b=vN0n9iiWxtOp/Rz3QiBR128DKcLbZ9N/nQUWSEb1X3V/itwWFrNWWmaBm67bzB17BQ bbUekpjiqdw/qjB7sb33n5aGzldfq6UMt47BK8l9G/VEQpNoxTBYXdIQ8l+rPIri3i9i Z+azl55lCMs7JSt2M8sh8VsO/Is5su7NFqKMCbrHpTfK9riigaUNpvxKuU6cFg7/w89B tm/7LfFKgAhzC///DmkmxLwDPf0IEc4mXKn1LnTs4UR5g420d4ECDTn+LO+cQY1lTP4J HwQtVygf+XDhtdTboHAU40wFo2gACPDGCy61rPeG5KmiLCJxbUMSNQgKcQfzYZDotpLo mx3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Hsiw/925"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m11-20020a1709026bcb00b001c9ad94f614si11948623plt.244.2023.11.28.09.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 09:55:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Hsiw/925"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 58E2B80B81F7; Tue, 28 Nov 2023 09:55:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346520AbjK1RzK (ORCPT + 99 others); Tue, 28 Nov 2023 12:55:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346688AbjK1Ryu (ORCPT ); Tue, 28 Nov 2023 12:54:50 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5EC19A7 for ; Tue, 28 Nov 2023 09:54:55 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D643EC433C9; Tue, 28 Nov 2023 17:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701194094; bh=N3vZMmlwPmMLxmgsU8NU5aW8UlcCxY+iRKRi4fSgJas=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hsiw/925cVatmSVS2Mjf+lwGsahVcUe9gEJwVlcmNPn+zWbmwNZ2MPg9C24I1RYFq skwNvzE0segMkYvoLC58hDXsNzhnsX3tfykvPEfkeBlgAQXPLVjPalu2EOmmIgvATQ aoxfGaC2vUW1mpXBAFr/E2qRXkpGsa6WRLj3i45jI8GsHf/aJokHiMdpDsswRmp4Ah DfMLen3NJkBkTvG87EMmW3JR0n8L0v4+iXgXwtJcN0VoeGH7M1OgsO9pWPe5lQyExH iZTLYaSNqnPLlBpXSFPrzBksF+fRvVV8C9J7TpdYC6shFoTQk/+7WWgpHw8LPVNmEh zdq2ORS22eNSg== Date: Tue, 28 Nov 2023 17:54:49 +0000 From: Conor Dooley To: Jerry Shih Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, herbert@gondor.apana.org.au, davem@davemloft.net, conor.dooley@microchip.com, ebiggers@kernel.org, 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: <20231128-await-tipper-2094715466f2@spud> References: <20231127070703.1697-1-jerry.shih@sifive.com> <20231127070703.1697-5-jerry.shih@sifive.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c+Bx+5YDpVONEprp" Content-Disposition: inline In-Reply-To: <20231127070703.1697-5-jerry.shih@sifive.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 09:55:23 -0800 (PST) --c+Bx+5YDpVONEprp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > +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? 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. Cheers, Conor. --c+Bx+5YDpVONEprp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZWYpaQAKCRB4tDGHoIJi 0gizAQClyXLat6AoDqeEMU7fszIl0aqY562jWFVvkg9MjgR24gEAzNdLynP6jTGp PoJqYxyEhhUhpsxklOCYQbwZPyDf8ws= =ixTm -----END PGP SIGNATURE----- --c+Bx+5YDpVONEprp--