All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
@ 2025-05-02 18:38 Eric Schikschneit
  2025-05-03  2:10 ` Simon Glass
  2025-05-16 16:28 ` Tom Rini
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Schikschneit @ 2025-05-02 18:38 UTC (permalink / raw)
  To: u-boot; +Cc: Eric Schikschneit

This will allow arch(s) that use device tree blobs to pad the end of the
device tree so they can be modified by board files at run time. This will
help prevent errors such as FDT_ERR_NOSPACE from occuring.

Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
---
 arch/Kconfig                 | 11 +++++++++++
 arch/arc/dts/Makefile        |  6 +++++-
 arch/arm/dts/Makefile        |  4 ++++
 arch/m68k/dts/Makefile       |  6 +++++-
 arch/microblaze/dts/Makefile |  6 +++++-
 arch/nios2/dts/Makefile      |  6 +++++-
 arch/powerpc/dts/Makefile    |  4 ++++
 arch/riscv/dts/Makefile      |  6 +++++-
 arch/sandbox/dts/Makefile    |  6 +++++-
 arch/x86/dts/Makefile        |  8 +++++++-
 10 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index ea33d07c086..a85f751d1e6 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -63,6 +63,17 @@ config SYS_CACHELINE_SIZE
 	default 64 if RISCV
 	default 32 if MIPS
 
+config SYS_DTC_PAD
+	bool "Enable DTC padding"
+	help
+	  This will allow the final device tree of your specified arch to
+	  have pad space at the end. This enables the ability for the device
+	  tree to be modified in place by board files.
+
+config SYS_DTC_PAD_BYTES
+	int "Size in bytes to pad device tree blob"
+	default 4096 if SYS_DTC_PAD
+
 config LINKER_LIST_ALIGN
 	int
 	default 32 if SANDBOX
diff --git a/arch/arc/dts/Makefile b/arch/arc/dts/Makefile
index fe6ad7b849a..fee5d7baae6 100644
--- a/arch/arc/dts/Makefile
+++ b/arch/arc/dts/Makefile
@@ -11,4 +11,8 @@ dtb-$(CONFIG_TARGET_IOT_DEVKIT) +=  iot_devkit.dtb
 include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
-DTC_FLAGS += -R 4 -p 0x1000
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 82f5c374f10..8c6bd53172f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1213,5 +1213,9 @@ include $(srctree)/scripts/Makefile.dts
 # Add any required device tree compiler flags here
 DTC_FLAGS += -a 0x8
 
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
+
 DTC_FLAGS_imx8mp-dhcom-som-overlay-rev100 += -Wno-avoid_default_addr_size -Wno-reg_format
 DTC_FLAGS_imx8mp-dhcom-pdk3-overlay-rev100 += -Wno-avoid_default_addr_size -Wno-reg_format
diff --git a/arch/m68k/dts/Makefile b/arch/m68k/dts/Makefile
index 8b354b9c570..2fda1f5081e 100644
--- a/arch/m68k/dts/Makefile
+++ b/arch/m68k/dts/Makefile
@@ -21,4 +21,8 @@ dtb-$(CONFIG_TARGET_STMARK2) += stmark2.dtb
 include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
-DTC_FLAGS += -R 4 -p 0x1000
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/microblaze/dts/Makefile b/arch/microblaze/dts/Makefile
index 9be902d3bb1..d0b6c185e7e 100644
--- a/arch/microblaze/dts/Makefile
+++ b/arch/microblaze/dts/Makefile
@@ -5,4 +5,8 @@ dtb-y += $(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)).dtb
 include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
-DTC_FLAGS += -R 4 -p 0x1000
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/nios2/dts/Makefile b/arch/nios2/dts/Makefile
index d77db9762a1..aefbb7815ec 100644
--- a/arch/nios2/dts/Makefile
+++ b/arch/nios2/dts/Makefile
@@ -5,4 +5,8 @@ dtb-y += $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%).dtb
 include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
-DTC_FLAGS += -R 4 -p 0x1000
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/powerpc/dts/Makefile b/arch/powerpc/dts/Makefile
index 766b0c05951..c39e04c9544 100644
--- a/arch/powerpc/dts/Makefile
+++ b/arch/powerpc/dts/Makefile
@@ -37,3 +37,7 @@ include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
 DTC_FLAGS +=
+
+ifdef CONFIG_SYS_DTC_PAD
+    DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile
index cf1872f3fdc..fd4ed512aaa 100644
--- a/arch/riscv/dts/Makefile
+++ b/arch/riscv/dts/Makefile
@@ -19,4 +19,8 @@ dtb-$(CONFIG_TARGET_ASPEED_AST2700_IBEX) += ast2700-ibex.dtb
 include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
-DTC_FLAGS += -R 4 -p 0x1000
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile
index 1c9fb4a4566..1911b25700f 100644
--- a/arch/sandbox/dts/Makefile
+++ b/arch/sandbox/dts/Makefile
@@ -11,4 +11,8 @@ dtb-$(CONFIG_CMD_EXTENSION) += overlay0.dtbo overlay1.dtbo
 include $(srctree)/scripts/Makefile.dts
 
 # Add any required device tree compiler flags here
-DTC_FLAGS += -R 4 -p 0x1000
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+       DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+endif
diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile
index 9a46726e026..6da4364116e 100644
--- a/arch/x86/dts/Makefile
+++ b/arch/x86/dts/Makefile
@@ -24,4 +24,10 @@ dtb-y += bayleybay.dtb \
 
 include $(srctree)/scripts/Makefile.dts
 
-DTC_FLAGS += -R 4 -p $(if $(CONFIG_EFI_APP),0x8000,0x1000)
+DTC_FLAGS += -R 4
+
+ifdef CONFIG_SYS_DTC_PAD
+	DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
+else
+	DTC_FLAGS += -p $(if $(CONFIG_EFI_APP),0x8000,0x1000)
+endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-02 18:38 [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob Eric Schikschneit
@ 2025-05-03  2:10 ` Simon Glass
  2025-05-05 18:09   ` Tom Rini
  2025-05-16 16:28 ` Tom Rini
  1 sibling, 1 reply; 9+ messages in thread
From: Simon Glass @ 2025-05-03  2:10 UTC (permalink / raw)
  To: Eric Schikschneit; +Cc: u-boot

Hi Eric,

On Fri, 2 May 2025 at 14:06, Eric Schikschneit
<eric.schikschneit@novatechautomation.com> wrote:
>
> This will allow arch(s) that use device tree blobs to pad the end of the
> device tree so they can be modified by board files at run time. This will
> help prevent errors such as FDT_ERR_NOSPACE from occuring.
>
> Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
> ---
>  arch/Kconfig                 | 11 +++++++++++
>  arch/arc/dts/Makefile        |  6 +++++-
>  arch/arm/dts/Makefile        |  4 ++++
>  arch/m68k/dts/Makefile       |  6 +++++-
>  arch/microblaze/dts/Makefile |  6 +++++-
>  arch/nios2/dts/Makefile      |  6 +++++-
>  arch/powerpc/dts/Makefile    |  4 ++++
>  arch/riscv/dts/Makefile      |  6 +++++-
>  arch/sandbox/dts/Makefile    |  6 +++++-
>  arch/x86/dts/Makefile        |  8 +++++++-
>  10 files changed, 56 insertions(+), 7 deletions(-)
>

This is not a board-specific feature. You could try this:

https://patchwork.ozlabs.org/project/uboot/patch/20241206131113.2865416-3-sjg@chromium.org/

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-03  2:10 ` Simon Glass
@ 2025-05-05 18:09   ` Tom Rini
  2025-05-06 12:49     ` Eric Schikschneit
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2025-05-05 18:09 UTC (permalink / raw)
  To: Simon Glass, Eric Schikschneit; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

On Fri, May 02, 2025 at 08:10:33PM -0600, Simon Glass wrote:
> Hi Eric,
> 
> On Fri, 2 May 2025 at 14:06, Eric Schikschneit
> <eric.schikschneit@novatechautomation.com> wrote:
> >
> > This will allow arch(s) that use device tree blobs to pad the end of the
> > device tree so they can be modified by board files at run time. This will
> > help prevent errors such as FDT_ERR_NOSPACE from occuring.
> >
> > Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
> > ---
> >  arch/Kconfig                 | 11 +++++++++++
> >  arch/arc/dts/Makefile        |  6 +++++-
> >  arch/arm/dts/Makefile        |  4 ++++
> >  arch/m68k/dts/Makefile       |  6 +++++-
> >  arch/microblaze/dts/Makefile |  6 +++++-
> >  arch/nios2/dts/Makefile      |  6 +++++-
> >  arch/powerpc/dts/Makefile    |  4 ++++
> >  arch/riscv/dts/Makefile      |  6 +++++-
> >  arch/sandbox/dts/Makefile    |  6 +++++-
> >  arch/x86/dts/Makefile        |  8 +++++++-
> >  10 files changed, 56 insertions(+), 7 deletions(-)
> >
> 
> This is not a board-specific feature. You could try this:
> 
> https://patchwork.ozlabs.org/project/uboot/patch/20241206131113.2865416-3-sjg@chromium.org/

Simon, can you please read your links before sending them to other
people? There's several things wrong with that patch so suggesting
someone else try it and see is not helpful.

Eric, for your platform can you expand the value used by SYS_FDT_PAD or
is that not updating things in the correct spot for your use case?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-05 18:09   ` Tom Rini
@ 2025-05-06 12:49     ` Eric Schikschneit
  2025-05-06 13:24       ` Simon Glass
  2025-05-06 16:58       ` Tom Rini
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Schikschneit @ 2025-05-06 12:49 UTC (permalink / raw)
  To: Tom Rini, Simon Glass; +Cc: u-boot@lists.denx.de

Hello Tom,

The link that Simon sent does not add padding at the end. I have tried the approach with SYS_FDT_PAD first and my platform (imx6) still has issues when trying to modify the device tree from the board file. It still returns FDT_ERR_NOSPACE with that option. The commit I sent simply adds a Kconfig option to something we are already doing (passing the -p flag) on multiple platforms behind the scenes to the device tree compiler. I have tested and proven on my platform that this allows live modification of the device tree in the board file.


Eric Schikschneit

Senior Embedded Linux Engineer III  ​



NovaTech, LLC

13555 W. 107th Street | Lenexa, KS 66215​

O: 913.451.1880​

  ​

novatechautomation.com<http://www.novatechautomation.com/> | NovaTechLinkedIn<https://www.linkedin.com/company/565017>

Receipt of this email implies compliance with our terms and conditions<https://www.novatechautomation.com/email-terms-conditions>.


________________________________
From: Tom Rini
Sent: Monday, May 5, 2025 1:09 PM
To: Simon Glass; Eric Schikschneit
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob

On Fri, May 02, 2025 at 08:10:33PM -0600, Simon Glass wrote:
> Hi Eric,
>
> On Fri, 2 May 2025 at 14:06, Eric Schikschneit
> <eric.schikschneit@novatechautomation.com> wrote:
> >
> > This will allow arch(s) that use device tree blobs to pad the end of the
> > device tree so they can be modified by board files at run time. This will
> > help prevent errors such as FDT_ERR_NOSPACE from occuring.
> >
> > Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
> > ---
> >  arch/Kconfig                 | 11 +++++++++++
> >  arch/arc/dts/Makefile        |  6 +++++-
> >  arch/arm/dts/Makefile        |  4 ++++
> >  arch/m68k/dts/Makefile       |  6 +++++-
> >  arch/microblaze/dts/Makefile |  6 +++++-
> >  arch/nios2/dts/Makefile      |  6 +++++-
> >  arch/powerpc/dts/Makefile    |  4 ++++
> >  arch/riscv/dts/Makefile      |  6 +++++-
> >  arch/sandbox/dts/Makefile    |  6 +++++-
> >  arch/x86/dts/Makefile        |  8 +++++++-
> >  10 files changed, 56 insertions(+), 7 deletions(-)
> >
>
> This is not a board-specific feature. You could try this:
>
> https://patchwork.ozlabs.org/project/uboot/patch/20241206131113.2865416-3-sjg@chromium.org/

Simon, can you please read your links before sending them to other
people? There's several things wrong with that patch so suggesting
someone else try it and see is not helpful.

Eric, for your platform can you expand the value used by SYS_FDT_PAD or
is that not updating things in the correct spot for your use case?

--
Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-06 12:49     ` Eric Schikschneit
@ 2025-05-06 13:24       ` Simon Glass
  2025-05-06 16:58       ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2025-05-06 13:24 UTC (permalink / raw)
  To: Eric Schikschneit; +Cc: Tom Rini, u-boot@lists.denx.de

Hi Eric,

On Tue, 6 May 2025 at 14:50, Eric Schikschneit
<eric.schikschneit@novatechautomation.com> wrote:
>
> Hello Tom,
>
> The link that Simon sent does not add padding at the end. I have tried the approach with SYS_FDT_PAD first and my platform (imx6) still has issues when trying to modify the device tree from the board file. It still returns FDT_ERR_NOSPACE with that option. The commit I sent simply adds a Kconfig option to something we are already doing (passing the -p flag) on multiple platforms behind the scenes to the device tree compiler. I have tested and proven on my platform that this allows live modification of the device tree in the board file.

Is it possible that you have fdt_high environment variable set? That's
the only way I know of that boot_relocate_fdt() can be skipped.

Regards,
Simon


>
> Eric Schikschneit
>
> Senior Embedded Linux Engineer III
>
>
>
> NovaTech, LLC
>
> 13555 W. 107th Street | Lenexa, KS 66215
>
> O: 913.451.1880
>
>
>
> novatechautomation.com | NovaTechLinkedIn
>
> Receipt of this email implies compliance with our terms and conditions.
>
>
>
> ________________________________
> From: Tom Rini
> Sent: Monday, May 5, 2025 1:09 PM
> To: Simon Glass; Eric Schikschneit
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
>
> On Fri, May 02, 2025 at 08:10:33PM -0600, Simon Glass wrote:
> > Hi Eric,
> >
> > On Fri, 2 May 2025 at 14:06, Eric Schikschneit
> > <eric.schikschneit@novatechautomation.com> wrote:
> > >
> > > This will allow arch(s) that use device tree blobs to pad the end of the
> > > device tree so they can be modified by board files at run time. This will
> > > help prevent errors such as FDT_ERR_NOSPACE from occuring.
> > >
> > > Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
> > > ---
> > >  arch/Kconfig                 | 11 +++++++++++
> > >  arch/arc/dts/Makefile        |  6 +++++-
> > >  arch/arm/dts/Makefile        |  4 ++++
> > >  arch/m68k/dts/Makefile       |  6 +++++-
> > >  arch/microblaze/dts/Makefile |  6 +++++-
> > >  arch/nios2/dts/Makefile      |  6 +++++-
> > >  arch/powerpc/dts/Makefile    |  4 ++++
> > >  arch/riscv/dts/Makefile      |  6 +++++-
> > >  arch/sandbox/dts/Makefile    |  6 +++++-
> > >  arch/x86/dts/Makefile        |  8 +++++++-
> > >  10 files changed, 56 insertions(+), 7 deletions(-)
> > >
> >
> > This is not a board-specific feature. You could try this:
> >
> > https://patchwork.ozlabs.org/project/uboot/patch/20241206131113.2865416-3-sjg@chromium.org/
>
> Simon, can you please read your links before sending them to other
> people? There's several things wrong with that patch so suggesting
> someone else try it and see is not helpful.
>
> Eric, for your platform can you expand the value used by SYS_FDT_PAD or
> is that not updating things in the correct spot for your use case?
>
> --
> Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-06 12:49     ` Eric Schikschneit
  2025-05-06 13:24       ` Simon Glass
@ 2025-05-06 16:58       ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2025-05-06 16:58 UTC (permalink / raw)
  To: Eric Schikschneit; +Cc: Simon Glass, u-boot@lists.denx.de

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

On Tue, May 06, 2025 at 12:49:55PM +0000, Eric Schikschneit wrote:

> Hello Tom,
> 
> The link that Simon sent does not add padding at the end. I have tried
> the approach with SYS_FDT_PAD first and my platform (imx6) still has
> issues when trying to modify the device tree from the board file. It
> still returns FDT_ERR_NOSPACE with that option. The commit I sent
> simply adds a Kconfig option to something we are already doing
> (passing the -p flag) on multiple platforms behind the scenes to the
> device tree compiler. I have tested and proven on my platform that
> this allows live modification of the device tree in the board file.

Ah, that's a good data point, thanks. Simon has a good follow-up
question about fdt_high being set to 0xffffffff and that being the root
cause (and so, undo that) being the other solution. And then in turn it
perhaps being past time for me to forcefully undo that on the boards
that snuck in that setting ages ago.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-02 18:38 [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob Eric Schikschneit
  2025-05-03  2:10 ` Simon Glass
@ 2025-05-16 16:28 ` Tom Rini
  2025-05-19 14:58   ` Eric Schikschneit
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Rini @ 2025-05-16 16:28 UTC (permalink / raw)
  To: Eric Schikschneit; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

On Fri, May 02, 2025 at 01:38:26PM -0500, Eric Schikschneit wrote:

> This will allow arch(s) that use device tree blobs to pad the end of the
> device tree so they can be modified by board files at run time. This will
> help prevent errors such as FDT_ERR_NOSPACE from occuring.
> 
> Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
> ---
>  arch/Kconfig                 | 11 +++++++++++
>  arch/arc/dts/Makefile        |  6 +++++-
>  arch/arm/dts/Makefile        |  4 ++++
>  arch/m68k/dts/Makefile       |  6 +++++-
>  arch/microblaze/dts/Makefile |  6 +++++-
>  arch/nios2/dts/Makefile      |  6 +++++-
>  arch/powerpc/dts/Makefile    |  4 ++++
>  arch/riscv/dts/Makefile      |  6 +++++-
>  arch/sandbox/dts/Makefile    |  6 +++++-
>  arch/x86/dts/Makefile        |  8 +++++++-
>  10 files changed, 56 insertions(+), 7 deletions(-)

I like the concept and the cleanup. However, I think we should:
- Put the line
DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
in scripts/Makefile.dts with the rest of the DTC_LOGIC as:
ifneq $(CONFIG_SYS_DTC_PAD_BYTES,0)
DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
endif

Then we can:
> diff --git a/arch/Kconfig b/arch/Kconfig
> index ea33d07c086..a85f751d1e6 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -63,6 +63,17 @@ config SYS_CACHELINE_SIZE
>  	default 64 if RISCV
>  	default 32 if MIPS
>  
> +config SYS_DTC_PAD
> +	bool "Enable DTC padding"
> +	help
> +	  This will allow the final device tree of your specified arch to
> +	  have pad space at the end. This enables the ability for the device
> +	  tree to be modified in place by board files.

Drop this.

> +config SYS_DTC_PAD_BYTES
> +	int "Size in bytes to pad device tree blob"
> +	default 4096 if SYS_DTC_PAD

And change the defaults to match the existing users, roughly:
	default 32768 if X86 && EFI_APP
	default 4096 if ARC || M68K || MICROBLAZE || NIOS2 || RCAR_64 \
		|| RISCV || SANDBOX || (X86 && !EFI_APP)
	default 0

And then we drop the -p lines from all of the other DTC_FLAGS.

Thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-16 16:28 ` Tom Rini
@ 2025-05-19 14:58   ` Eric Schikschneit
  2025-05-19 15:00     ` Tom Rini
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Schikschneit @ 2025-05-19 14:58 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot@lists.denx.de

Hello Tom, I have made the changes as discussed and rebased on master. You can find the latest version of my commit here:

https://github.com/emz229/u-boot/commit/739fe94e1f8096a90241f5a9348f3dcce4eb97c1

With your approval I can issue a PR.


Eric Schikschneit

Senior Embedded Linux Engineer III  ​



NovaTech, LLC

13555 W. 107th Street | Lenexa, KS 66215​

O: 913.451.1880​

  ​

novatechautomation.com<http://www.novatechautomation.com/> | NovaTechLinkedIn<https://www.linkedin.com/company/565017>

Receipt of this email implies compliance with our terms and conditions<https://www.novatechautomation.com/email-terms-conditions>.


________________________________
From: Tom Rini
Sent: Friday, May 16, 2025 11:28 AM
To: Eric Schikschneit
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob

On Fri, May 02, 2025 at 01:38:26PM -0500, Eric Schikschneit wrote:

> This will allow arch(s) that use device tree blobs to pad the end of the
> device tree so they can be modified by board files at run time. This will
> help prevent errors such as FDT_ERR_NOSPACE from occuring.
>
> Signed-off-by: Eric Schikschneit <eric.schikschneit@novatechautomation.com>
> ---
>  arch/Kconfig                 | 11 +++++++++++
>  arch/arc/dts/Makefile        |  6 +++++-
>  arch/arm/dts/Makefile        |  4 ++++
>  arch/m68k/dts/Makefile       |  6 +++++-
>  arch/microblaze/dts/Makefile |  6 +++++-
>  arch/nios2/dts/Makefile      |  6 +++++-
>  arch/powerpc/dts/Makefile    |  4 ++++
>  arch/riscv/dts/Makefile      |  6 +++++-
>  arch/sandbox/dts/Makefile    |  6 +++++-
>  arch/x86/dts/Makefile        |  8 +++++++-
>  10 files changed, 56 insertions(+), 7 deletions(-)

I like the concept and the cleanup. However, I think we should:
- Put the line
DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
in scripts/Makefile.dts with the rest of the DTC_LOGIC as:
ifneq $(CONFIG_SYS_DTC_PAD_BYTES,0)
DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
endif

Then we can:
> diff --git a/arch/Kconfig b/arch/Kconfig
> index ea33d07c086..a85f751d1e6 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -63,6 +63,17 @@ config SYS_CACHELINE_SIZE
>        default 64 if RISCV
>        default 32 if MIPS
>
> +config SYS_DTC_PAD
> +     bool "Enable DTC padding"
> +     help
> +       This will allow the final device tree of your specified arch to
> +       have pad space at the end. This enables the ability for the device
> +       tree to be modified in place by board files.

Drop this.

> +config SYS_DTC_PAD_BYTES
> +     int "Size in bytes to pad device tree blob"
> +     default 4096 if SYS_DTC_PAD

And change the defaults to match the existing users, roughly:
        default 32768 if X86 && EFI_APP
        default 4096 if ARC || M68K || MICROBLAZE || NIOS2 || RCAR_64 \
                || RISCV || SANDBOX || (X86 && !EFI_APP)
        default 0

And then we drop the -p lines from all of the other DTC_FLAGS.

Thanks!

--
Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob
  2025-05-19 14:58   ` Eric Schikschneit
@ 2025-05-19 15:00     ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2025-05-19 15:00 UTC (permalink / raw)
  To: Eric Schikschneit; +Cc: u-boot@lists.denx.de

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

On Mon, May 19, 2025 at 02:58:38PM +0000, Eric Schikschneit wrote:

> Hello Tom, I have made the changes as discussed and rebased on master. You can find the latest version of my commit here:
> 
> https://github.com/emz229/u-boot/commit/739fe94e1f8096a90241f5a9348f3dcce4eb97c1
> 
> With your approval I can issue a PR.

Looks good, thanks. Please email the patch like the last one.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-05-19 15:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 18:38 [PATCH] [RFC]: dtc: Add Kconfig option to pad device tree blob Eric Schikschneit
2025-05-03  2:10 ` Simon Glass
2025-05-05 18:09   ` Tom Rini
2025-05-06 12:49     ` Eric Schikschneit
2025-05-06 13:24       ` Simon Glass
2025-05-06 16:58       ` Tom Rini
2025-05-16 16:28 ` Tom Rini
2025-05-19 14:58   ` Eric Schikschneit
2025-05-19 15:00     ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.