From: David Gibson <david@gibson.dropbear.id.au>
To: Wasim Nazir <quic_wasimn@quicinc.com>
Cc: devicetree-compiler@vger.kernel.org, kernel@quicinc.com,
kernel@oss.qualcomm.com,
Srivatsa Vaddagiri <vatsa@codeaurora.org>
Subject: Re: [PATCH v3 1/4] libfdt: overlay_merge: Introduce fdt_overlay_merge()
Date: Sat, 28 Jun 2025 21:02:18 +1000 [thread overview]
Message-ID: <aF_Luosqutkq6CVo@zatzit> (raw)
In-Reply-To: <aF5y5vqcndKUQPuH@hu-wasimn-hyd.qualcomm.com>
[-- Attachment #1: Type: text/plain, Size: 3126 bytes --]
On Fri, Jun 27, 2025 at 04:01:02PM +0530, Wasim Nazir wrote:
> On Tue, Jun 03, 2025 at 09:09:12PM +1000, David Gibson wrote:
> > On Fri, May 30, 2025 at 05:58:58PM +0530, Wasim Nazir wrote:
> > > On Wed, May 21, 2025 at 02:23:29PM +1000, David Gibson wrote:
> > > > On Mon, May 19, 2025 at 02:40:40PM +0530, Wasim Nazir wrote:
> > > > > From: Srivatsa Vaddagiri <vatsa@codeaurora.org>
> > > > >
> > > > > fdt_overlay_merge() merges two overlay blobs. It is largely expected to be
> > > > > used offline on a build machine to combine two or more overlay blobs into one.
> > > > >
> > > > > It is intended to help maintain device-tree overlay code in
> > > > > multiple source repositories, but merge their binary forms (overlay blobs)
> > > > > into one so that bootloader's task of searching for all relevant overlay blobs
> > > > > is simplified.
> > > > >
> > > > > Introduce fdt_overlay_merge() which is identical to fdt_overlay_apply().
> > > > > Subsequent patches will introduce required changes to merge overlay blobs.
> > > > >
> > > > > Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
> > > > > Signed-off-by: Wasim Nazir <quic_wasimn@quicinc.com>
> > > > > ---
> > > > > libfdt/fdt_overlay.c | 59 ++++++++++++++++++++++++++++++++++++++++++++
> > > > > libfdt/libfdt.h | 18 ++++++++++++++
> > > > > 2 files changed, 77 insertions(+)
> > > > >
> > > > > diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
> > > > > index e6b9eb643958..8690ed55c8f6 100644
> > > > > --- a/libfdt/fdt_overlay.c
> > > > > +++ b/libfdt/fdt_overlay.c
> > > > > @@ -1098,3 +1098,62 @@ err:
> > > > >
> > > > > return ret;
> > > > > }
> > > > > +
> > > > > +int fdt_overlay_merge(void *fdt, void *fdto, int *fdto_nospace)
> > > >
> > > > The parameters should be renamed to reflect the new semantics.
> > >
> > > Sure will change to proper name.
> > >
> > > >
> > > > The 'fdto_nospace' parameter seems weird. Why not just return
> > > > -FDT_ERR_NOSPACE from the function?
> > >
> > > fdto_nospace variable is used to know cases when 2nd fdto (overlaying fdto)
> > > needs more space while -FDT_ERR_NOSPACE is used for cases when
> > > 1st fdto (base fdto) needs more space.
> >
> > Ah, I see. I can see the reason now, but it's still a deeply ugly
> > interface.
> >
> > Hmm... why do you need to ever expand the applied size? It's obvious
> > you'd need to expand the based dtbo, but not why you'd ever need to
> > expand the one you're applying on top.
>
> Since, we are updating phandle references of fragments & __local_fixups__ of
> 2nd dtbo so we need to check that.
Updating phandle references doesn't usually require expanding the
tree, since phandles have a fixed size. Have you actually hit running
out of space for the dtb in practice, or are you just assuming you
need this because you're making modifications to the dtbo.
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-06-29 2:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 9:10 [PATCH v3 0/4] Introduce fdt_overlay_merge() to allow merge of overlay blobs Wasim Nazir
2025-05-19 9:10 ` [PATCH v3 1/4] libfdt: overlay_merge: Introduce fdt_overlay_merge() Wasim Nazir
2025-05-19 17:17 ` Trilok Soni
2025-05-30 14:38 ` Wasim Nazir
2025-05-21 4:23 ` David Gibson
2025-05-30 12:28 ` Wasim Nazir
2025-06-03 11:09 ` David Gibson
2025-06-27 10:31 ` Wasim Nazir
2025-06-28 11:02 ` David Gibson [this message]
2025-05-19 9:10 ` [PATCH v3 2/4] libfdt: overlay_merge: Rename & copy overlay fragments and their properties Wasim Nazir
2025-05-19 9:10 ` [PATCH v3 3/4] libfdt: overlay_merge: Update phandles, symbols, fixups & local_fixups Wasim Nazir
2025-05-19 9:10 ` [PATCH v3 4/4] fdtoverlaymerge: A tool that merges overlays Wasim Nazir
2025-05-23 13:44 ` Simon Glass
2025-05-30 14:55 ` Wasim Nazir
2025-05-19 17:15 ` [PATCH v3 0/4] Introduce fdt_overlay_merge() to allow merge of overlay blobs Trilok Soni
2025-05-30 14:42 ` Wasim Nazir
2025-05-21 4:20 ` David Gibson
2025-05-30 14:36 ` Wasim Nazir
2025-06-03 11:05 ` David Gibson
2025-06-27 10:15 ` Wasim Nazir
2025-06-28 10:55 ` David Gibson
2025-09-02 10:35 ` Wasim Nazir
2025-09-02 12:49 ` Konrad Dybcio
2025-09-02 12:51 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aF_Luosqutkq6CVo@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=devicetree-compiler@vger.kernel.org \
--cc=kernel@oss.qualcomm.com \
--cc=kernel@quicinc.com \
--cc=quic_wasimn@quicinc.com \
--cc=vatsa@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).