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 EAE93C6FD1C for ; Fri, 24 Mar 2023 08:22:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0CB7F85D76; Fri, 24 Mar 2023 09:22:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1679646163; bh=u+gfQMW8CKDjOIPIz2jvfAT32ZCrLQ2U7WqcpunjRTA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CIYZ/8QLLMa+NV8eK5eTvptuOLCOkZZyAQHMOkpnvnRK0Sm0WQcyQWtc0kPRZisV2 mgOqqgJUW3ZVTsEB2GVFWrq0L6SyWuWsRb3BDNw8Ac2yF75YKv/bZVo2HA9bTclcAh /dDzKKBKjTigEa/Jh5b7vqzcwejJGJBoOnh8SpSxkx1JvYJtEeA+5UxELZMK4Seytr KbTSzNZg7bFwRF3jOHNTvbEG52YDlFcx/J+gp2Q23lC2n8P+pktbZywCGAIhm91AfH C7Zm+6YVqgdX1mMnm8uscKG4H5ECEfF+KI5eo/ftNSJUqQbIJA63fL9aKvlptEqWrm K6j6W5mcnKpEQ== Received: by phobos.denx.de (Postfix, from userid 109) id E8C0E85CB7; Fri, 24 Mar 2023 09:22:41 +0100 (CET) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [IPv6:2001:67c:2050:101:465::107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C828785C3A for ; Fri, 24 Mar 2023 09:22:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4PjZvd4MYnz9sWM; Fri, 24 Mar 2023 09:22:37 +0100 (CET) Message-ID: Date: Fri, 24 Mar 2023 09:22:37 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-mvebu 1/5] tools: kwbimage: Fix invalid UART kwbimage v1 headersz Content-Language: en-US To: =?UTF-8?Q?Pali_Roh=c3=a1r?= , Martin Rowe Cc: u-boot@lists.denx.de References: <20230323195755.5131-1-pali@kernel.org> <20230323195755.5131-2-pali@kernel.org> From: Stefan Roese In-Reply-To: <20230323195755.5131-2-pali@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4PjZvd4MYnz9sWM 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.8 at phobos.denx.de X-Virus-Status: Clean On 3/23/23 20:57, Pali Rohár wrote: > Armada 385 BootROM ignores low 7 bits of headersz when parsing kwbimage > header of UART type, which effectively means that headersz is rounded down > to multiply of 128 bytes. For all other image types BootROM reads and use > all bits of headersz. Therefore fill into UART type of kwbimage v1 headersz > aligned to 128 bytes. > > Fixes: 2b0980c24027 ("tools: kwbimage: Fill the real header size into the main header") > Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese Thanks, Stefan > --- > tools/kwbimage.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/tools/kwbimage.c b/tools/kwbimage.c > index 309657a5637b..177084adf825 100644 > --- a/tools/kwbimage.c > +++ b/tools/kwbimage.c > @@ -1231,6 +1231,16 @@ static size_t image_headersz_v1(int *hasext) > if (count > 0) > headersz += sizeof(struct register_set_hdr_v1) + 8 * count + 4; > > + /* > + * For all images except UART, headersz stored in header itself should > + * contains header size without padding. For UART image BootROM rounds > + * down headersz to multiply of 128 bytes. Therefore align UART headersz > + * to multiply of 128 bytes to ensure that remaining UART header bytes > + * are not ignored by BootROM. > + */ > + if (image_get_bootfrom() == IBR_HDR_UART_ID) > + headersz = ALIGN(headersz, 128); > + > return headersz; > } > Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de