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 D3E70C433F5 for ; Wed, 13 Oct 2021 18:06:51 +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 1FCF660F3A for ; Wed, 13 Oct 2021 18:06:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1FCF660F3A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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 3E9EE83757; Wed, 13 Oct 2021 20:06:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="caaoe6qG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D78C8378C; Wed, 13 Oct 2021 20:06:23 +0200 (CEST) Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) (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 3379883771 for ; Wed, 13 Oct 2021 20:06:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa34.google.com with SMTP id h132so2239425vke.8 for ; Wed, 13 Oct 2021 11:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VJo5SjFDa0jMzsx3Khugab7vwFIbFig9lf4+kis+xQA=; b=caaoe6qG4YbbOM/uFpcp0z5BACaPB9yuTwNXJm/hPmMEAPjPnpbwuOO+aAX09yG33P keG5VFITnro1SdxkwNAS5xgriGOB1ycvoiycx7XiWpndSFAuGND1ndlQSqvuAoXpuSUh 24nV1DAJjJNzaWhAGTuBLofoFDYjWLtPLHyKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VJo5SjFDa0jMzsx3Khugab7vwFIbFig9lf4+kis+xQA=; b=5uPRepukeduOytL3CV5du1t8isxbw0wtXT3m4NLATxDIqtPGWOVvYWYZ5Q9iLo6thq 0F41mR4S8n/xj3teVuenL3C014L2y0KS4OZW/k1Lh51aNWHTMOiL3c2/Yum4JeY8nErP 6ZLbpyJ307IANTyVTicyVMG+oXzV5V/5stBJhCAtDgw57/k/8DaLWHUzQnscyHjoktiS 3FZQme73V/8NYbsb6a+XfWx73EhTEAU0u8We1KgutvDPC7vmOSX1UQJEXRamvQZ7ADp7 U8sDfr6BG6QsAWFfhQIQcwqas792twQkMMH2jPZPEXShUax15Sk4xiFPk+5Z+ZZ6LC/t i7Ww== X-Gm-Message-State: AOAM533cbbYB1Tovd+tijXvcA5ddOQltuLSzUG19z4bLTID+T1SYiETR 7qbMKUBKg0oKCf149FJB0/L5vtrBEix/5eDZ5BsNMw== X-Google-Smtp-Source: ABdhPJyeenEljdl/4LUHdyJnYSFYWTyR4mq4gAFcy5z1hPoLGeysKdra61mSmqqh5Dj1oNhjewzSXYPH8ryGYshRtPU= X-Received: by 2002:a1f:1841:: with SMTP id 62mr867789vky.26.1634148371686; Wed, 13 Oct 2021 11:06:11 -0700 (PDT) MIME-Version: 1.0 References: <20211013023022.58829-1-samuel@sholland.org> <20211013023022.58829-3-samuel@sholland.org> In-Reply-To: <20211013023022.58829-3-samuel@sholland.org> From: Simon Glass Date: Wed, 13 Oct 2021 12:06:00 -0600 Message-ID: Subject: Re: [PATCH 2/3] binman: Prevent entries in a section from overlapping To: Samuel Holland Cc: U-Boot Mailing List , Jagan Teki , Andre Przywara , Masahiro Yamada Content-Type: text/plain; charset="UTF-8" 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 Hi Samuel, On Tue, 12 Oct 2021 at 20:30, Samuel Holland wrote: > > Currently, if the "offset" property is given for an entry, the section's > running offset is completely ignored. This causes entries to overlap if > the provided offset is less than the size of the entries earlier in the > section. Avoid the overlap by only using the provided offset when it is > greater than the running offset. > > The motivation for this change is the rule used by SPL to find U-Boot on > sunxi boards: U-Boot starts 32 KiB after the start of SPL, unless SPL is > larger than 32 KiB, in which case U-Boot immediately follows SPL. > > Signed-off-by: Samuel Holland > --- > > tools/binman/entry.py | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/binman/entry.py b/tools/binman/entry.py > index 70222718ea..61822eb5e4 100644 > --- a/tools/binman/entry.py > +++ b/tools/binman/entry.py > @@ -404,7 +404,9 @@ class Entry(object): > if self.offset_unset: > self.Raise('No offset set with offset-unset: should another ' > 'entry provide this correct offset?') > - self.offset = tools.Align(offset, self.align) > + elif self.offset > offset: > + offset = self.offset > + self.offset = tools.Align(offset, self.align) > needed = self.pad_before + self.contents_size + self.pad_after > needed = tools.Align(needed, self.align_size) > size = self.size > -- > 2.32.0 > The behaviour needs to be deterministic, here. You have two cases, as I understand it - you want the offset to be set to the running offset, if the previous section is >=32KB - you want the offset to be set to the 'offset' property otherwise I see a few options: - Add a new 'sunxi-spl-pad' etype between SPL and U-Boot for the padding. It can decide its own size - Add a new 'min-size' property to entries, update the packer, use it in the SPL node, set to 32KB There are probably others. No need to worry about it if you are just putting out ideas, but we do need a test for any new behaivour: binman test -T needs to pass with 100% code coverage. Regards, Simon