From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 143A9C05027 for ; Wed, 8 Feb 2023 18:39:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DF47E85EE5; Wed, 8 Feb 2023 19:39:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="UvmR46d8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09FC585EE5; Wed, 8 Feb 2023 19:39:14 +0100 (CET) Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5BCF185631 for ; Wed, 8 Feb 2023 19:39:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf30.google.com with SMTP id lx14so2080650qvb.11 for ; Wed, 08 Feb 2023 10:39:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=n8SVQ0Y7DKETx8TXuXAOwTNA+8Hj4A9ynK+9PQdt7hM=; b=UvmR46d8QmZ3SiByPLIC3hcYw/qAUaVq98e+2kEy7ZyFc2JPAGJ2ZTRRcvbBsvTA5Y 3ReyvTmHQU1vOsi3venNfXHkIBwJpG+jbEGDHbFsdW3ROOeNC+txuWhKEJs0a4SsaYhS 00Gf9J2vUYklkVK7MetDfnrbjW+1KucZDykUQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=n8SVQ0Y7DKETx8TXuXAOwTNA+8Hj4A9ynK+9PQdt7hM=; b=iaNY0MuKBc9LHtRAZPdSLUBpu9l3kV80UyzL5nlgSog4PKFq/xZzlhHmpnZLQ3siNY YJUjMuy+PzLmqF9poTZFUgdywvLy2iDFz2TRH83P8wUtJXt5SOawJhXNyQh/64vUln/V BAtiVke9HLdgFAgZGn1GbGXwxe78o0PKLl6jJH/Zcm6hhDwgxXZXmBTPO6AZv720M4G8 qATwU9uxDbVXN2ZC8j5SEKP/07kTGv4TQd9QtXCzBKy4okkzPYCBxZ/f2INlI/+ZSQ0K QbmIDi18t6h7WoNp/HLHe/p/YztseMSkKxAr1FirWsPM6KS5emLxJsVlH7udMgFkopN+ Go/w== X-Gm-Message-State: AO0yUKWiYS83xk/Bv43Ze42kJeAoGIUpxHtESVRKwjfjMc6kfG8px6/B lzl00mMUZds2pIxk+tFrIrZ/Zg== X-Google-Smtp-Source: AK7set9OuICL2RQOFvGPOJeMDbC+8mh+BiCc3Pf1ypoUHGKbf5grZN9BTsfrnn2h1vozbRPUWXpwlA== X-Received: by 2002:a0c:eb82:0:b0:56c:2295:f836 with SMTP id x2-20020a0ceb82000000b0056c2295f836mr1813287qvo.2.1675881542074; Wed, 08 Feb 2023 10:39:02 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-90cc-7e59-435b-3104.res6.spectrum.com. [2603:6081:7b00:6400:90cc:7e59:435b:3104]) by smtp.gmail.com with ESMTPSA id b6-20020a379906000000b007186c9e167esm12232968qke.52.2023.02.08.10.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 10:39:01 -0800 (PST) Date: Wed, 8 Feb 2023 13:38:59 -0500 From: Tom Rini To: Simon Glass Cc: Loic Poulain , kettenis@openbsd.org, michal.simek@xilinx.com, u-boot@lists.denx.de Subject: Re: [PATCH v2 4/5] lib: sha256: Add support for hardware specific sha256_process Message-ID: References: <1654107991-598-1-git-send-email-loic.poulain@linaro.org> <1654107991-598-5-git-send-email-loic.poulain@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="44wzEI+H5zQsDbQF" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean --44wzEI+H5zQsDbQF Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 08, 2023 at 11:28:21AM -0700, Simon Glass wrote: > Hi Tom, >=20 > On Tue, 7 Feb 2023 at 17:10, Tom Rini wrote: > > > > On Tue, Feb 07, 2023 at 03:25:16PM -0700, Simon Glass wrote: > > > Hi Loic, > > > > > > On Tue, 7 Feb 2023 at 14:47, Loic Poulain w= rote: > > > > > > > > Hi Simon, > > > > > > > > On Tue, 7 Feb 2023 at 05:05, Simon Glass wrote: > > > > > > > > > > Hi Loic, > > > > > > > > > > On Mon, 6 Feb 2023 at 15:12, Loic Poulain wrote: > > > > > > > > > > > > Hi Simon, > > > > > > > > > > > > Le lun. 6 f=E9vr. 2023 =E0 18:12, Simon Glass a =E9crit : > > > > > >> > > > > > >> Hi Loic, > > > > > >> > > > > > >> On Wed, 1 Jun 2022 at 12:27, Loic Poulain wrote: > > > > > >> > > > > > > >> > Mark sha256_process as weak to allow hardware specific imple= mentation. > > > > > >> > Add parameter for supporting multiple blocks processing. > > > > > >> > > > > > > >> > Signed-off-by: Loic Poulain > > > > > >> > --- > > > > > >> > lib/sha256.c | 26 +++++++++++++++++++------- > > > > > >> > 1 file changed, 19 insertions(+), 7 deletions(-) > > > > > >> > > > > > [...] > > > > > >> > +__weak void sha256_process(sha256_context *ctx, const unsig= ned char *data, > > > > > >> > + unsigned int blocks) > > > > > >> > +{ > > > > > >> > + if (!blocks) > > > > > >> > + return; > > > > > >> > + > > > > > >> > + while (blocks--) { > > > > > >> > + sha256_process_one(ctx, data); > > > > > >> > + data +=3D 64; > > > > > >> > + } > > > > > >> > +} > > > > > >> > + > > > > > >> > void sha256_update(sha256_context *ctx, const uint8_t *inpu= t, uint32_t length) > > > > > >> > { > > > > > >> > uint32_t left, fill; > > > > > >> > @@ -204,17 +218,15 @@ void sha256_update(sha256_context *ctx= , const uint8_t *input, uint32_t length) > > > > > >> > > > > > > >> > if (left && length >=3D fill) { > > > > > >> > memcpy((void *) (ctx->buffer + left), (void = *) input, fill); > > > > > >> > - sha256_process(ctx, ctx->buffer); > > > > > >> > + sha256_process(ctx, ctx->buffer, 1); > > > > > >> > length -=3D fill; > > > > > >> > input +=3D fill; > > > > > >> > left =3D 0; > > > > > >> > } > > > > > >> > > > > > > >> > - while (length >=3D 64) { > > > > > >> > - sha256_process(ctx, input); > > > > > >> > - length -=3D 64; > > > > > >> > - input +=3D 64; > > > > > >> > - } > > > > > >> > + sha256_process(ctx, input, length / 64); > > > > > >> > + input +=3D length / 64 * 64; > > > > > >> > + length =3D length % 64; > > > > > >> > > > > > > >> > if (length) > > > > > >> > memcpy((void *) (ctx->buffer + left), (void = *) input, length); > > > > > >> > -- > > > > > >> > 2.7.4 > > > > > >> > > > > > > >> > > > > > >> I just came across this patch as it broke minnowmax. > > > > > > > > > > > > > > > > > > Ok, is it a build time or runtime break? > > > > > > > > > > Build, but you need the binary blobs to see it :-( > > > > > >> > > > > > >> This should be using driver model, not weak functions. Please = can you > > > > > >> take a look? > > > > > > > > Just tested the minnowmax build (b69026c91f2e; minnowmax_defconfig; > > > > gcc-11.3.0), and I've not observed any issue (but I had to fake some > > > > of the binary blobs...). Could you share the build problem/error you > > > > > > Unfortunately you need the blobs! > > > > > > > encountered? As you mentioned it, Is the error specifically related= to > > > > _weak function linking? Would like to have a simple and quick fix > > > > before trying to move on to a more proper DM based solution. > > > > > > It is just because of the code size increase, I believe. I am planning > > > to dig into it a bit as Bin Meng asked for more info as to why I sent > > > a revert for his patch moving U-Boot. > > > > That honestly makes more sense, having stared at the commit in > > question. Perhaps Minnow needs LTO enabled. >=20 > Yes, that would likely help. But Bin's point is that it should be > possible to move the text base. I suspect that might just be more fall-out of the size problem and possibly some hard coded assumptions in the blobs? > Anyway, the point of this thread is that this needs to be done as > drivers rather than weak functions. Unfortunately hash.c has grown a > few appendages...this is yet another. I don't know, it seems fine, especially since we aren't really talking about a "hash driver" but rather introducing some performance sensitive code. --=20 Tom --44wzEI+H5zQsDbQF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmPj7EMACgkQFHw5/5Y0 tyyXpAv/bux9XQAK/h5v0Q/Wj2MClMGL4aBtt3NmITZrDg2qvYCAKvKOoz5hAcnG xfSjJqa3neGR8e9hHmt0akpU+oFqbkI9gc/kCCMlgvQ5Ni3NDY9tE9XCGouM3cFr aNTtNbftdIH3qGvUAFT3btWrPeGDVZIV0EOxfZ1mXbtEqku7Ifd2NHdR2LcqOBAB l+y3LquSR6vCD5i0PQGoXKSk2hZ02vwroMsH8Uh83pouzYM0599CSKJhKqoTwMci AJ5/ZQPMTdHTAczCce+Sr6Gay5Yf//b/nr9plURdMzmbiFda9Z591bDK+C6Tm/AE ZiPydMKuGlkUVx6Qn2J8DUNZDodlYGY9m6/MKSRlr8Ji9UOHRq8deb/BleMbOtis r1eX2nCWG3ualMHGDgrNF/BoKLVshnM936iEKqJ7gU0jdb3srUdjAM+y4oid4F6m Nvefoeq5W+/KYXx5tyel8qgovqPVUa2I9j0YB6/erlWxDTik/AfnMN5v3oWybNtj P72i0+Iw =LTN2 -----END PGP SIGNATURE----- --44wzEI+H5zQsDbQF--