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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6F85C433F5 for ; Fri, 15 Oct 2021 16:10:07 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3817961090 for ; Fri, 15 Oct 2021 16:10:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3817961090 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2071E836A7; Fri, 15 Oct 2021 18:10:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (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="b+0tHfX4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DEC3D836A7; Fri, 15 Oct 2021 18:10:00 +0200 (CEST) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (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 1018683695 for ; Fri, 15 Oct 2021 18:09:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x830.google.com with SMTP id g17so973182qtk.8 for ; Fri, 15 Oct 2021 09:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Fs/umrBfwMzg9CITwoc8MqIth8gsumJlz9sk24hHsV4=; b=b+0tHfX4GnhOPRL/8Ncec/un4nNpvXSZOSfKc08v05TwPDiyVufFYjNRAVzIyhvza8 kFVLAJkBB3U+VD0d03QkgOE1OwM9gjL3sCtuzSCW6R3QVKoAytIgQ6onJ02FhKNRXX9u D2v8t7BrSCElLaLYCqEvyhHxFo5wywDw/hR6w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Fs/umrBfwMzg9CITwoc8MqIth8gsumJlz9sk24hHsV4=; b=xLO6CSWME+xC2EVnUq/O8KGK7ypPvlrRJRZ3aio1xmMYRfjfDYtzpLbWLZuYrarhF0 kks2ONya+zpt7C9LNT+wJ6fkods8GUZ1CEyHmrQ1LyyQJb/SLbC0WRBSaLtOQzfoEWRr uG3SglhuWRD9RU13Og+aGKxoycO42NEZvE2/tAeyn3LBJGYMmn/pD5vRHH6kcJFeaRyc 6sp7RhSfoPtksKqoKl1N4hK4XstCBzi8xkXiiNFDmcR+LiWqtVtE2gGHD7UNemzPhgZr T7McueMxpt0sTWjkAcyfgute5X3NQQauVr5LXenGOwPbfa3i2NVf0wmQPCfcF0yUV1sy kbVQ== X-Gm-Message-State: AOAM533QDwY3NnCp6QWQ9UF/qaINNTtp1et1nCLcdgTaSUSKuJWRcSAv TEbeBsaEsi5Ze6tvxUyjZNqoCQ== X-Google-Smtp-Source: ABdhPJyss/D+pocHg3Zw1sTrne0qaIBAT+hNbESp9DLu7PxY9mofSNlpwqun5RHxKV5JZfaC5WovmQ== X-Received: by 2002:ac8:5dd2:: with SMTP id e18mr4916346qtx.206.1634314194620; Fri, 15 Oct 2021 09:09:54 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-f8b0-5c25-4d47-ecdb.res6.spectrum.com. [2603:6081:7b01:cbda:f8b0:5c25:4d47:ecdb]) by smtp.gmail.com with ESMTPSA id k9sm1706785qkj.75.2021.10.15.09.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 09:09:53 -0700 (PDT) Date: Fri, 15 Oct 2021 12:09:51 -0400 From: Tom Rini To: Marek Vasut Cc: Simon Glass , U-Boot Mailing List , Marek Vasut Subject: Re: [PATCH] loads: Block writes into LMB reserved areas of U-Boot Message-ID: <20211015160951.GX7964@bill-the-cat> References: <20211010215241.872206-1-marek.vasut@gmail.com> <69e586a7-7fb3-e530-d0f2-196ebb59b098@denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ag9Dn5QRqpz+/vZN" Content-Disposition: inline In-Reply-To: <69e586a7-7fb3-e530-d0f2-196ebb59b098@denx.de> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean --ag9Dn5QRqpz+/vZN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 15, 2021 at 04:23:27PM +0200, Marek Vasut wrote: > On 10/14/21 5:10 PM, Simon Glass wrote: > [...] > > > @@ -137,6 +138,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, = int flag, int argc, > > >=20 > > > static ulong load_serial(long offset) > > > { > > > + struct lmb lmb; > > > char record[SREC_MAXRECLEN + 1]; /* buffer for one S-= Record */ > > > char binbuf[SREC_MAXBINLEN]; /* buffer for binary= data */ > > > int binlen; /* no. of data bytes= in S-Rec. */ > > > @@ -147,6 +149,9 @@ static ulong load_serial(long offset) > > > ulong start_addr =3D ~0; > > > ulong end_addr =3D 0; > > > int line_count =3D 0; > > > + long ret; > > > + > > > + lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); > > >=20 > > > while (read_record(record, SREC_MAXRECLEN + 1) >=3D 0) { > > > type =3D srec_decode(record, &binlen, &addr, binbuf); > > > @@ -172,7 +177,14 @@ static ulong load_serial(long offset) > > > } else > > > #endif > > > { > > > + ret =3D lmb_reserve(&lmb, store_addr, binlen); > > > + if (ret) { > > > + printf("\nCannot overwrite reserved a= rea (%08lx..%08lx)\n", > > > + store_addr, store_addr + binl= en); > > > + return ret; > > > + } > > > memcpy((char *)(store_addr), binbuf, binlen); > > > + lmb_free(&lmb, store_addr, binlen); > > > } > > > if ((store_addr) < start_addr) > > > start_addr =3D store_addr; > > > -- > > > 2.33.0 > > >=20 > >=20 > > Reviewed-by: Simon Glass > >=20 > > This code looks OK but I don't know what lmb_reserve() and lmb_free() > > do. Can you add comments to the header file? >=20 > Not here, the entire LMB stuff needs (better) documentation, that's where > (all) such clarification should go. Is that you saying you'll do such a follow-up patch, given you've touched this code the most of late? --=20 Tom --ag9Dn5QRqpz+/vZN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFpp8wACgkQFHw5/5Y0 tyxgswwApnZJtLPk2RQz5nsUkKTCKgD48RgZS/sppY/KMGwhtu+TpnSlEUC790i+ iiIODHlAp9fYBY6S0V2UocUKhIX1KeWZKGLjf0if5wKQDZOxK1UYaE3+eBjW1RJo Qo1GJy1+Gvw9iQ7xK3RDr9SYHLVFCNtUexgZvTe1vKv+Pzy//eceBVQqdiKCweZx 4QWZ/f126+b/nZRHP734DGHlBNkCNiGVp0eqMKvm1mvLr3sSvTDTgAF+RLSKrhh+ w3iuHBSKvErBfCWT1X/5iqH4r6DPaxmzuDXUVf7oeaJ/vLTK2yUfojsnVtYhnRk5 aOpx1dsBiAAOthGMr9wau7x6MWKPw/nQkCS38LDIBOkGv+PYqd3ay5UkEj7a+3UV io5Lik0sH4YjP02F1WcP1rCvGrX4nUuV13f76bZDmmrhg5os7d9CsRfNr74hyh08 j7a7kjJWOFizUFwVLJYg+KgfOGA5C6I+ZHWjrJ705R1Ls92YljPokVjpR5AASLnm Sv8s16pZ =ZRYF -----END PGP SIGNATURE----- --ag9Dn5QRqpz+/vZN--