fdt: Make OF_BOARD a boolean option
Subsystems (9)
v5 cover fdt: Make OF_BOARD a boolean option
With Ilias' efforts we have dropped OF_PRIOR_STAGE and OF_HOSTFILE so there are only three ways to obtain a devicetree:
- OF_SEPARATE - the normal way, where the devicetree is built and appended to U-Boot
- OF_EMBED - for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
- OF_BOARD - the board figures it out on its own
The last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in this
series: "doc: Add documentation about devicetree usage"
In practice, OF_BOARD is not really distinct from OF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.
So it makes no sense to have OF_BOARD as a 'choice'. It should be an option, available with either OF_SEPARATE or OF_EMBED.
This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Changes in v5:
- Bring into the OF_BOARD series
- Rebase to master and drop mention of OF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean up fdtdec_setup() and surrounds
Changes in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now that OF_CONTROL is in the docs
Changes in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain that OF_BOARD will still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'
Ilias Apalodimas (1):
sandbox: Remove OF_HOSTFILE
Simon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file for qemu_arm
arm: qemu: Add a devicetree file for qemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file for rpi_4
arm: vexpress: Add a devicetree file for juno
arm: xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm: xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: Make OF_BOARD a bool option
Drop CONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()
fdt: Drop #ifdefs with MULTI_DTB_FIT
fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()
fdt: Drop #ifdef around board_fdt_blob_setup()
fdt: Use if() for fdtcontroladdr check
fdt: Drop OF_CONTROL check in fdtdec_setup()
fdt: Drop remaining preprocessor macros in fdtdec_setup()
fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Makefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 +++++++++++++++++++++ arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rst
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 1/26 sandbox: Remove OF_HOSTFILE
From: Ilias Apalodimas <[email protected]>
OF_HOSTFILE is used on sandbox configs only. Although it's pretty unique not a source of any confusions, we are better of having simple config options for the DTB.
So let's replace that with the existing OF_BOARD. This will make U-Boot have only three different config options for the DTB origin.
- OF_SEPARATE, build separately from U-Boot
- OF_BOARD, board specific way of providing the DTB
- OF_EMBED embedded in the u-boot binary, but discouraged from being used in production
---
(no changes since v1)
Makefile | 6 +++--- arch/sandbox/cpu/cpu.c | 21 ++++++++++++--------- arch/sandbox/include/asm/u-boot-sandbox.h | 8 -------- configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- doc/develop/devicetree/control.rst | 7 +++---- dts/Kconfig | 9 --------- lib/fdtdec.c | 5 ----- scripts/Makefile.spl | 4 ++-- 13 files changed, 26 insertions(+), 46 deletions(-)
Makefile +3 -3
@@ -947,7 +947,7 @@ INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif -INPUTS-$(CONFIG_OF_HOSTFILE) += u-boot.dtb +INPUTS-$(CONFIG_SANDBOX) += u-boot.dtb ifneq ($(CONFIG_SPL_TARGET),) INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) endif
@@ -1407,7 +1407,7 @@ u-boot-lzma.img: u-boot.bin.lzma FORCE u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ ,$(UBOOT_BIN)) FORCE $(call if_changed,mkimage) $(BOARD_SIZE_CHECK)
@@ -1421,7 +1421,7 @@ MKIMAGEFLAGS_u-boot.itb += -B 0x8 ifdef U_BOOT_ITS u-boot.itb: u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \ $(U_BOOT_ITS) FORCE $(call if_changed,mkfitimage) $(BOARD_SIZE_CHECK)
arch/sandbox/cpu/cpu.c +12 -9
@@ -291,44 +291,47 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop) { } -int sandbox_read_fdt_from_file (void ) +void *board_fdt_blob_setup (void ) {struct sandbox_state *state =state_get_current ();const char *fname = state->fdt_fname; -void *blob; +void *blob =NULL ;loff_t size;int err;int fd; +printf ("SETUP BLOB\n" ); blob =map_sysmem (CONFIG_SYS_FDT_LOAD_ADDR ,0 );if (!state->fdt_fname) { err =fdt_create_empty_tree (blob,256 );if (!err) goto done;printf ("Unable to create empty FDT: %s\n" ,fdt_strerror (err)); -return -EINVAL ; + goto fail; } err =os_get_filesize (fname, &size);if (err <0 ) {printf ("Failed to file FDT file '%s'\n" , fname); -return err; + goto fail; } fd =os_open (fname,OS_O_RDONLY );if (fd <0 ) {printf ("Failed to open FDT file '%s'\n" , fname); -return -EACCES ; + goto fail; } +if (os_read (fd, blob, size) != size) {os_close (fd); -return -EIO ; +printf ("Failed to read file '%s'\n" , fname); + goto fail; }os_close (fd); done: - gd->fdt_blob = blob; - -return 0 ; +return blob; +fail: +return NULL ; }ulong timer_get_boot_us (void )
arch/sandbox/include/asm/u-boot-sandbox.h +0 -8
@@ -76,14 +76,6 @@ int pci_unmap_physmem(const void *addr, unsigned long len,*/ void sandbox_set_enable_pci_map (int enable); -/** -* sandbox_read_fdt_from_file() - Read a device tree from a file -* -* Read a device tree file from a host file and set it up for use as the -* control FDT. -*/ -int sandbox_read_fdt_from_file (void ); -/** * sandbox_reset() - reset sandbox *
configs/sandbox64_defconfig +1 -1
@@ -88,7 +88,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host"
configs/sandbox_defconfig +1 -1
@@ -113,7 +113,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host"
configs/sandbox_flattree_defconfig +1 -1
@@ -69,7 +69,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host"
configs/sandbox_noinst_defconfig +1 -1
@@ -88,7 +88,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_SPL_OF_PLATDATA=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y
configs/sandbox_spl_defconfig +1 -1
@@ -89,7 +89,7 @@ CONFIG_MAC_PARTITION=y CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_SPL_OF_PLATDATA=y CONFIG_SPL_OF_PLATDATA_INST=y CONFIG_ENV_IS_NOWHERE=y
configs/tools-only_defconfig +1 -1
@@ -16,7 +16,7 @@ CONFIG_AVB_BUF_SIZE=0x8192 CONFIG_BOOTP_DNS2=y # CONFIG_CMD_DATE is not set CONFIG_OF_CONTROL=y -CONFIG_OF_HOSTFILE=y +CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_IP_DEFRAG=y
doc/develop/devicetree/control.rst +3 -4
@@ -108,10 +108,9 @@ If CONFIG_OF_BOARD is defined, a board-specific routine will provide the devicetree at runtime, for example if an earlier bootloader stage creates it and passes it to U-Boot. -If CONFIG_OF_HOSTFILE is defined, then it will be read from a file on -startup. This is only useful for sandbox. Use the -d flag to U-Boot to -specify the file to read, -D for the default and -T for the test devicetree, -used to run sandbox unit tests. +If CONFIG_SANDBOX is defined, then it will be read from a file on +startup. Use the -d flag to U-Boot to specify the file to read, -D for the +default and -T for the test devicetree, used to run sandbox unit tests. You cannot use more than one of these options at the same time.
dts/Kconfig +0 -9
@@ -115,20 +115,11 @@ config OF_EMBED config OF_BOARD bool "Provided by the board (e.g a previous loader) at runtime" - depends on !SANDBOX help If this option is enabled, the device tree will be provided by the board at runtime if the board supports it, instead of being bundled with the image. -config OF_HOSTFILE - bool "Host filed DTB for DT control" - depends on SANDBOX - help - If this option is enabled, DTB will be read from a file on startup. - This is only useful for Sandbox. Use the -d flag to U-Boot to - specify the file to read. - endchoice config DEFAULT_DEVICE_TREE
lib/fdtdec.c +0 -5
@@ -1608,11 +1608,6 @@ int fdtdec_setup(void)# elif defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* Allow the board to override the fdt address. */ gd->fdt_blob =board_fdt_blob_setup (); -# elif defined(CONFIG_OF_HOSTFILE ) -if (sandbox_read_fdt_from_file ()) { -puts ("Failed to read control FDT\n" ); -return -1 ; - }# endif # ifndef CONFIG_SPL_BUILD /* Allow the early environment to override the fdt address */
scripts/Makefile.spl +2 -2
@@ -297,10 +297,10 @@ endif # Build the .dtb file if needed # - OF_REAL is enabled -# - we have either OF_SEPARATE or OF_HOSTFILE +# - we have OF_SEPARATE build_dtb := ifneq ($(CONFIG_$(SPL_TPL_)OF_REAL),) -ifeq ($(CONFIG_OF_SEPARATE)$(CONFIG_OF_HOSTFILE),y) +ifeq ($(CONFIG_OF_SEPARATE),y) build_dtb := y endif endif
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 2/26 doc: Add documentation about devicetree usage
In reply to Simon GlassAt present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various CONFIG_OF_... options.
---
This patch attracted quite a bit of discussion here:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
I have not included the text suggested by François. While I agree that it would be useful to have an introduction in this space, I do not agree that we should have two devicetrees or that U-Boot should not have its own things in the devicetree, so it is not clear to me what we should actually write.
The 'Devicetree Control in U-Boot' docs were recently merged and these provide some base info, for now.
Changes in v5:
- Bring into the OF_BOARD series
- Rebase to master and drop mention of OF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
Changes in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now that OF_CONTROL is in the docs
Changes in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain that OF_BOARD will still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'
doc/develop/devicetree/dt_update.rst | 556 +++++++++++++++++++++++++++ doc/develop/devicetree/index.rst | 1 + 2 files changed, 557 insertions(+) create mode 100644 doc/develop/devicetree/dt_update.rst
doc/develop/devicetree/dt_update.rst new file +556 -0
@@ -0,0 +1,556 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Updating the devicetree +======================= + +U-Boot uses devicetree for runtime configuration and storing required blobs or +any other information it needs to operate. This is called the 'control' +devicetree since it controls U-Boot. It is possible to update the control +devicetree separately from actually building U-Boot. This provides a good degree +of control and flexibility for firmware that uses U-Boot in conjunction with +other project. + +There are many reasons why it is useful to modify the devicetree after building +it: + +- Configuration can be changed, e.g. which UART to use +- A serial number can be added +- Public keys can be added to allow image verification +- Console output can be changed (e.g. to select serial or vidconsole) + +This section describes how to work with devicetree to accomplish your goals. + +See also :doc:`../devicetree/control` for a basic summary of the available +features. + + +Devicetree source +----------------- + +Every board in U-Boot must include a devicetree sufficient to build and boot +that board on suitable hardware (or emulation). This is specified using the +`CONFIG DEFAULT_DEVICE_TREE` option. + + +Current situation (October 2021) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As an aside, at present U-Boot allows `CONFIG_DEFAULT_DEVICE_TREE` to be empty, +e.g. if `CONFIG_OF_BOARD` is used. This has unfortunately created an enormous +amount of confusion and some wasted effort. This was not intended. Support for +an empty `CONFIG_DEFAULT_DEVICE_TREE` will be dropped soon. + +Some of the problems created are: + +- It is not obvious that the devicetree is coming from another project + +- There is no way to see even a sample devicetree for these platform in U-Boot, + so it is hard to know what is going on, e.g. which devices are typically + present + +- The other project may not provide a way to support U-Boot's requirements for + devicetree, such as the /config node. Note: On the U-Boot mailing linst, this + was only discovered after weeks of discussion and confusion + +- For QEMU specifically, consulting two QEMU source files is required, for which + there are no references in U-Boot documentation. The code is generating a + devicetree, but it is not clear what controls affect this generation. + +Specifically on the changes in U-Bootm `CONFIG_OF_BOARD` was added in +rpi_patch_ for Raspberry Pi, which does have an in-tree devicetree, but this +feature has since been used for boards that don't + +Once this bug is fixed, CONFIG_OF_BOARD will override (at runtime) the +evicetree suppled with U-Boot, but will otherwise use CONFIG_OF_SEPARATE for the +in-tree build. So these two will become options, moving out of the 'choice' in +`dts/Kconfig`. + +This means that there is a basic devicetree build in the U-Boot tree, for +build-testing, consistency and documentation purposes, but at runtime U-Boot can +accept its devicetree from another source. The in-tree devicetree may contain +U-Boot-specific features (in u-boot*.dtsi files) and this may prove useful for +the other project, so it can ensure that U-Boot functions correctly and supports +all its expected features. + +To be clear, while U-Boot has its own copy of the devicetree source for each +board, this must match the Linux source, perhaps with some u-boot.dtsi +additions. The intent here is not to create a separate binding, just to provide +a representative devicetree in U-Boot. + +Offending boards are: + +- rpi_4 and rpi_4_32b (other rpi boards do have an in-tree devicetree) +- qemu_arm64 +- qemu_arm +- qemu-ppce500 +- qemu-riscv32 +- qemu-riscv32_smode +- qemu-riscv64 +- qemu-riscv64_smode + +All of these need to have a devicetree added in-tree. This is targeted to be +fixed in the 2022.01 release. + + +Building the devicetree +----------------------- + +U-Boot automatically builds the devicetree for a board, from the +`arch/<arch>/dts` directory. The Makefile in those directories has rules for +building devicetree files. It is preferable to avoid target-specific rules in +those files: i.e. all boards for a particular SoC should be built at once, +where practical. Apart from simplifying the Makefile, this helps to efficiently +(and immediately) ensure that changes in one board's DT do not break others that +are related. Building devicetrees is fast, so performance is seldom a concern +here. + + +Overriding the default devicetree +--------------------------------- + +When building U-Boot, the `DEVICE_TREE` environment variable allows the +default devicetree file to be overridden at build time. This can be useful if +modifications have to be made to the in-tree devicetree file, for the benefit +of a downstream build system. Note that the in-tree devicetree must be +sufficient to build and boot, so this is not a way to bypass that requirement. + + +Modifying the devicetree after building +--------------------------------------- + +While it is generally painful and hacky to modify the code or rodata of a +program after it is built, in many cases it is useful to do so, e.g. to add +configuration information like serial numbers, enabling/disabling features, etc. + +Devicetree provides a very nice solution to these problems since it is +structured data and it is relatively easy to change it, even in binary form +(see fdtput). + +U-Boot takes care that the devicetree is easily accessible after the build +process. In fact it is placed in a separate file called `u-boot.dtb`. If the +build system wants to modify or replace that file, it can do so. Then all that +is needed is to run `binman update` to update the file inside the image. If +binman is not used, then `u-boot-nodtb.bin` and the new `u-boot.dtb` can simply +be concatenated to achieve the desired result. U-Boot happily copes with the +devicetree growing or shrinking. + +The `u-boot.bin` image contains both pieces. While it is possible to locate the +devicetree within the image using the signature at the start of the file, this +is a bit messy. + +This is why `CONFIG_OF_SEPARATE` should always be used when building U-Boot. +The `CONFIG_OF_EMBED` option embeds the devicetree somewhere in the U-Boot ELF +image as rodata, meaning that it is hard to find it and it cannot increase in +size. + +When modifying the devicetree, the different cases to consider are as follows: + +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the `cat` + operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. If the EFL + file is available, then the _dtb_dt_begin and __dtb_dt_end symbols can be + examined to find it. While it is possible to contract the file, it is not + possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that the correct + one is provided to U-Boot. How this is done depends entirely on the + implementation of this option for the board. It might require injecting the + changes into a different project somehow using tooling available there, or + it might involve merging an overlay file at runtime to obtain the desired + result. + + +Use of U-Boot /config node +-------------------------- + +A common problem with firmware is that many builds are needed to deal with the +slight variations between different, related models. For example, one model may +have a TPM and another may not. Devicetree provides an excellent solution to +this problem, in that the devicetree to actually use on a platform can be +injected in the factory based on which model is being manufactured at the time. + +A related problem causing build proliferation is dealing with the differences +between development firmware, developer-friendly firmware (e.g. with all +security features present but with the ability to access the command line), +test firmware (which runs tests used in the factory), final production firmware +(before signing), signed firmware (where the signatures have been inserted) and +the like. Ideally all or most of these should use the same U-Boot build, with +just some options to determine the features available. For example, being able +to control whether the UART console or JTAG are available, on any image, is a +great debugging aid. + +When the firmware consists of multiple parts, it is helpful that all operate +the same way at runtime, regardless of how they were built. This can be achieved +by passing the runtime configuration (e.g. 'enable UART console) along the chain +through each firmware stage. It is frustrating to have to replicate a bug on +production firmware which does happen on developer firmware, because they are +completely different builds. + +The /config node provides useful functionality for this. It allows the different +controls to be 'factored out' of the U-Boot binary, so they can be controlled +separately from the initial source-code build. The node can be easily updated by +a build or factory tool and can control various features in U-Boot. It is +similar in concept to a Kconfig option, except that it can be changed after +U-Boot is built. + +The /config node is similar in concept to the `/chosen node`_ except that it is +for passing information *into* firmware instead of from firmware to the +Operating System. Also, while Linux has a (sometimes extremely long) command +line, U-Boot does not support this. The devicetree provides a more structured +approach in any case. + + +Devicetree in another project +----------------------------- + +In some cases U-Boot receive its devicetree at runtime from a program that calls +it. For example ARM's Trusted Firmware A (`TF-A`_) may have a devicetree that it +passes to U-Boot. This overrides any devicetree build by U-Boot. When packaging +the firmware, the U-Boot devicetree may in fact be left out if it can be +guaranteed that it will receive one from another project. + +In this case, the devicetree in the other project must track U-Boot's use of +device tree, for the following reasons: + +- U-Boot only has one devicetree. See `Why not have two devicetrees?`_. +- For a consistent firmware build, decisions made in early stages should be + communicated to later ones at runtime. For example, if the serial console is + enabled in an early stage, it should be enabled in U-Boot too. +- U-Boot is quite capable of managing its own copy of the devicetree. If + another project wants to bypass this (often for good reason), it is reasonable + that it should take on the (fairly small) requirements that U-Boot features + that rely on devicetree are still available +- The point here is not that *U-Boot needs this extra node*, or *U-Boot needs + to have this public key*. These features are present in U-Boot in service of + the entire firmware system. If the U-Boot features are used, but cannot be + supported in the normal way, then there is pressure to implement these + features in other ways. In the end, we would have a different mechanism for + every other project that uses U-Boot. This introduces duplicate ways of doing + the same thing, needlessly increases the complexity of the U-Boot source code, + forces authors to consider parallel implementations when writing new features, + makes U-Boot harder to test, complicates documentation and confuses the + runtime flow of U-Boot. If every board did things its own way rather than + contributing to the common code, U-Boot would lose a lot of its cross-platform + value. + +The above does not indicate *bad design* within U-Boot. Devicetree is a core +component of U-Boot and U-Boot makes use of it to the full. It solves a myriad +of problems that would otherwise need their own special C struct, binary format, +special property, tooling for viewing and updating, etc. + +Specifically, the other project must provide a way to add configuration and +other information to the devicetree for use by U-Boot, such as the /config node. +Note that the U-Boot in-tree devicetree source must be sufficient to build and +boot, so this is not a way to bypass that requirement. + +If binman is used, the devicetree source in U-Boot must contain the binman +definition so that a valid image can be build. This helps people discover what +other firmware components are needed and seek out appropriate documentation. + +If verified boot is used, the project must provide a way to inject a public key, +certificate or other material into the U-Boot devicetree so that it is available +to U-Boot at runtime. See `Signing with U-Boot devicetree`_. This may be +through tooling in the project itself or by making use of U-Boot's tooling. + + +Devicetree generated on-the-fly in another project +-------------------------------------------------- + +In some rare cases, another project may wish to create a devicetree for U-Boot +entirely on-the-fly, then pass it to U-Boot at runtime. The only known example +of this at the time of writing (2021) is QEMU, for ARM (`QEMU ARM`_) and +RISC-V (`QEMU RISC-V`_). + +In effect, when the board boots, U-Boot is *downstream* of the other project. +It is entirely reliant on that project for its correct operation. + +This does not mean to imply that the other project is creating its own, +incompatible devicetree. In fact QEMU generates a valid devicetree which is +suitable for both U-Boot and Linux. It is quite normal for a devicetree to be +present in flash and be made available to U-Boot at runtime. What matters is +where the devicetree comes from. If the other project builds a devicetree for +U-Boot then it needs to support adding the things needed by U-Boot features. +Without them, for example: + +- U-Boot may not boot because too many devices are enabled before relocation +- U-Boot may not have access to the developer or production public keys used for + signing +- U-Boot may not support controlling whether the console is enabled +- U-Boot may not be know which MMC device to boot from +- U-Boot may not be able to find other firmware components that it needs to load + +Normally, supporting U-Boot's features is trivial, since the devicetree compiler +(dtc) can compile the source, including any U-Boot pieces. So the burden is +extremely low. + +In this case, the devicetree in the other project must track U-Boot's use of +device tree, so that it remains compatible. See `Devicetree in another project`_ +for reasons why. + +If a particular version of the project is needed for a particular version of +U-Boot, that must be documented in both projects. + +Further, it must provide a way to add configuration and other information to +the devicetree for use by U-Boot, such as the `/config` node and the tags used +by driver model. Note that the U-Boot in-tree devicetree must be sufficient to +build and boot, so this is not a way to bypass that requirement. + +More specifically, tooling or command-line arguments must provide a way to +add a `/config` node or items within that node, so that U-Boot can receive a +suitable configuration. It must provide a way of adding `u-boot,dm-...` tags for +correct operation of driver model. These options can then be used as part of the +build process, which puts the firmware image together. For binman, a way must be +provided to add the binman definition into the devicetree in the same way. + +One way to do this is to allow a .dtsi file to be merged in with the generated +devicetree. + +Note that the burden goes both ways. If a new feature is added to U-Boot which +needs support in another project, then the author of the U-Boot patch must add +any required support to the other project. + + +Passing the devicetree through to Linux +--------------------------------------- + +Ideally U-Boot and Linux use the same devicetree source, even though it is +hosted in separate projects. U-Boot adds some extra pieces, such as the +`config/` node and tags like `u-boot,dm-spl`. Linux adds some extra pieces, such +as `linux,default-trigger` and `linux,code`. This should not interfere with +each other. + +In principle it is possible for U-Boot's control devicetree to be passed to +Linux. This is, after all, one of the goals of devicetree and the original +Open Firmware project, to have the firmware provide the hardware description to +the Operating System. + +For boards where this approach is used, care must be taken. U-Boot typically +needs to 'fix up' the devicetree before passing it to Linux, e.g. to add +information about the memory map, about which serial console is used, provide +the kernel address space layout randomization (KASLR) seed or select whether the +console should be silenced for a faster boot. + +Fix-ups involve modifying the devicetree. If the control devicetree is used, +that means the control devicetree could be modified, while U-Boot is using it. +Removing a device and reinserting it can cause problems if the devicetree offset +has changed, for example, since the device will be unable to locates its +devicetree properties at the expected devicetree offset, which is a fixed +integer. + +To deal with this, it is recommended to employ one or more of the following +approaches: + +- Make a copy of the devicetree and 'fix up' the copy, leaving the control + devicetree alone +- Enable `CONFIG_OF_LIVE` so that U-Boot makes its own copy of the devicetree + during relocation; fixups then happen on the original flat tree +- Ensure that fix-ups happen after all loading has happened and U-Boot has + completed image verification + +In practice,the last point is typically observed, since boot_prep_linux() is +called just before jumping to Linux, long after signature verification, for +example. But it is important to make sure that this line is not blurred, +particularly if untrusted user data is involved. + + +Devicetree use cases that must be supported +------------------------------------------- + +Regardless of how the devicetree is provided to U-Boot at runtime, various +U-Boot features must be fully supported. This section describes some of these +features and the implications for other projects. + +If U-Boot uses its own in-tree devicetree these features are supported +automatically. + + +Signing with U-Boot devicetree +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +U-Boot supports signing a payload so that it can be verified to have been +created by a party owning a private key. This is called verified boot in U-Boot +(see doc/uImage.FIT/verified-boot.txt). + +Typically this works by creating a FIT and then running the `mkimage` tool to +add signatures for particular images. As part of this process, `mkimage` writes +a public key to the U-Boot devicetree, although this can be done separately. +See fdt_add_pubkey_ for patches for a suitable tool, for example. + +As with all configuration information, if another project is providing the +devicetree to U-Boot, it must provide a way to add this public key into the +devicetree it passes to U-Boot. This could be via a tooling option, making use +of `mkimage`, or allowing a .dtsi file to be merged in with what is generated in +the other project. + + +Providing the binman image definition +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In complex systems U-Boot must locate and make use of other firmware components, +such as images for the user interface, files containing peripheral firmware, +multiple copies of U-Boot for use with A/B boot, etc. U-Boot uses +:doc:`Binman <../package/binman>` as a standard way of putting an image +together. + +Typically this works by running binman with the devicetree as an input, to +create the file image. Binman then outputs an updated devicetree which is +packed in the firmware image, so U-Boot can access the binman definition and +locate all the components. + +As with all configuration information, if another project is providing the +devicetree to U-Boot, it must provide a way to add this binman definition into +the devicetree it passes to U-Boot. This could be via a tooling option, making +use of `binman`, or alowing a .dtsi file to be merged in with what is generated +in the other project. + + +Protecting the devicetree +------------------------- + +U-Boot relies heavily on devicetree for correct operation. A corrupt or invalid +device can cause U-Boot to fail to start, behave incorrectly, crash (e.g. if +`CONFIG_OF_LIBFDT_ASSUME_MASK` is adjusted, or fail to boot an Operating System. +Within U-Boot, the devicetree is as important as any other part of the source +code. At ruuntime, the devicetree can be considered to be structured rodata. + +With secure systems, care must be taken that the devicetree is valid: + +- If the code / rodata has a hash or signature, the devicetree should also, if + they are packaged separately. +- If the code / rodata is write-protected when running, the devicetree should be + also. Note that U-Boot relocates its code and devicetree, so this is not as + simple as it sounds. U-Boot must write-protect these items after relocating. + + +Why does U-Boot have its nodes and properties? +---------------------------------------------- + +See also :doc:`../devicetree/intro`. + +There has been pushback at the concept that U-Boot dares have its own nodes and +properties in the devicetree. + +Apart from these nodes and properties, U-Boot uses the same bindings as Linux. +A `u-boot.dtsi` file helps to keep U-Boot-specific changes in separate files, +making it easier to keep devicetree source files in U-Boot in sync with Linux. + +As a counter-example, the Zephyr OS project takes a different approach. It uses +entirely different bindings, in general, making no effort to sync devicetree +source files with Linux. U-Boot strives to be compatible with Linux in a number +of ways, such as source code style and common APIs, to aid porting of code +between the projects. Devicetree is another way where U-Boot and Linux follow a +similar approach. + +Fundamentally, the idea that U-Boot cannot have its own tags flies in the face +of the devicetree specification (see dtspec_), which says: + + Nonstandard property names should specify a **unique string prefix**, such as + a stock ticker symbol, identifying the name of the company **or organization** + that defined the property. Examples: + + - fsl,channel-fifo-len + - ibm,ppc-interrupt-server#s + - **linux**,network-index + +It is also fundamentally unbalanced. Linux has many tags of its own (some 36 in +version 5.13) and at least one Linux-specific node, even if you ignore things +like flash partitions which clearly provide configuration information to Linux. + +Practically speaking there are many reasons why U-Boot has its own nodes and +properties. Some examples: + +- Binding every device before relocation even if it won't be used, consumes time + and memory: tags on each node can specify which are needed in SPL or before + relocation. Linux has no such constraints. + +- Requiring the full clock tree to be up and running just to get the debug UART + running is inefficient. It is also and self-defeating, since if that much + code is working properly, you probably don't need the debug UART. A devicetree + property to provide the UART input-clock frequency is a simple solution. + +- U-Boot does not have a user space to provide policy and configuration. It + cannot do what Linux does and run programs and look up filesystems to figure + out how to boot. + + +Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot. + +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. + +- **Signing flow** - The current signing flow is simple as it involves running + `mkimage` with the U-Boot devicetree. This would have to be updated to use the + special devicetree. Some way of telling the user that they have done it wrong + would have to be invented. + +Overall, adding a second devicetree would create enormous confusion and +complexity. It seems a lot cheaper to solve this by a change of attitude. + + +.. _rpi_patch: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/ +.. _`TF-A`: https://www.trustedfirmware.org/projects/tf-a +.. _`QEMU ARM`: https://github.com/qemu/qemu/blob/master/hw/arm/virt.c +.. _`QEMU RISC-V`: https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c +.. _`/chosen node`: https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt +.. _fdt_add_pubkey: https://patchwork.ozlabs.org/project/uboot/list/?series=157843&state=* +.. _dtspec: https://www.devicetree.org/specifications/
doc/develop/devicetree/index.rst +1 -0
@@ -11,3 +11,4 @@ build-time and runtime configuration. intro control + dt_update
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Simon,
Quoted 1 line
+
[...]
Quoted 16 lines
doc/develop/devicetree/dt_update.rst new file +16
-0+This is why `CONFIG_OF_SEPARATE` should always be used when building U-Boot. +The `CONFIG_OF_EMBED` option embeds the devicetree somewhere in the U-Boot ELF +image as rodata, meaning that it is hard to find it and it cannot increase in +size. + +When modifying the devicetree, the different cases to consider are as follows: + +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the `cat` + operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. If the EFL + file is available, then the _dtb_dt_begin and __dtb_dt_end symbols can be + examined to find it. While it is possible to contract the file, it is not
doc/develop/devicetree/dt_update.rst line 166
Quoted 10 lines
doc/develop/devicetree/dt_update.rst new file +10
-0+ possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that the correct + one is provided to U-Boot. How this is done depends entirely on the + implementation of this option for the board. It might require injecting the + changes into a different project somehow using tooling available there, or + it might involve merging an overlay file at runtime to obtain the desired + result.
I thought this document was trying to describe the current situation in U-Boot. If so, the current CONFIG_OF_BOARD usage is far from what we have here.
[...]
Regards
/Ilias
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Ilias,
Quoted 29 lines · Ilias Apalodimas
Hi Simon,
Quoted 1 line
+
[...]
Quoted 22 lines
doc/develop/devicetree/dt_update.rst new file +22
-0+This is why `CONFIG_OF_SEPARATE` should always be used when building U-Boot. +The `CONFIG_OF_EMBED` option embeds the devicetree somewhere in the U-Boot ELF +image as rodata, meaning that it is hard to find it and it cannot increase in +size. + +When modifying the devicetree, the different cases to consider are as follows: + +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the `cat` + operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. If the EFL + file is available, then the _dtb_dt_begin and __dtb_dt_end symbols can be + examined to find it. While it is possible to contract the file, it is not + possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that the correct + one is provided to U-Boot. How this is done depends entirely on the
Quoted 8 lines
doc/develop/devicetree/dt_update.rst line 166
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+ implementation of this option for the board. It might require injecting the + changes into a different project somehow using tooling available there, or + it might involve merging an overlay file at runtime to obtain the desired + result.I thought this document was trying to describe the current situation in U-Boot. If so, the current
CONFIG_OF_BOARDusage is far from what we have here.
Can you be more specific? What is the difference here? Also see the doc update later in the series, after OF_BOARD becomes a bool option.
Regards,
SImon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Quoted 43 lines · Simon Glass
Hi Ilias,
Quoted 29 lines · Ilias Apalodimas
Hi Simon,
Quoted 1 line
+
[...]
Quoted 22 lines
doc/develop/devicetree/dt_update.rst new file +22
-0+This is why `CONFIG_OF_SEPARATE` should always be used when building U-Boot. +The `CONFIG_OF_EMBED` option embeds the devicetree somewhere in the U-Boot ELF +image as rodata, meaning that it is hard to find it and it cannot increase in +size. + +When modifying the devicetree, the different cases to consider are as follows: + +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the `cat` + operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. If the EFL + file is available, then the _dtb_dt_begin and __dtb_dt_end symbols can be + examined to find it. While it is possible to contract the file, it is not + possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that the correct + one is provided to U-Boot. How this is done depends entirely on theQuoted 8 lines
doc/develop/devicetree/dt_update.rst line 166
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+ implementation of this option for the board. It might require injecting the + changes into a different project somehow using tooling available there, or + it might involve merging an overlay file at runtime to obtain the desired + result.I thought this document was trying to describe the current situation in U-Boot. If so, the current
CONFIG_OF_BOARDusage is far from what we have here.
Quoted 2 lines
Can you be more specific? What is the difference here? Also see the doc update later in the series, after
OF_BOARDbecomes a bool option.
The doc you sent says "devicetree must be modified so that the correct one is provided to U-Boot. By this I assume you mean the 'config/' node etc right? If that's the case this is *not* what is currently happening. We simply replace the entire device tree with whatever was configured.
Regards
/Ilias
Quoted 3 lines
Regards,
SImon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
In reply to Simon GlassHi Simon,
Quoted 819 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.Signed-off-by Simon Glass <[email protected]>Reviewed-by Marcel Ziswiler <[email protected]>---
This patch attracted quite a bit of discussion here:https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
I have not included the text suggested by François. While I agree that it would be useful to have an introduction in this space, I do not agree that we should have two devicetrees or that U-Boot should not have its own things in the devicetree, so it is not clear to me what we should actually write.
The 'Devicetree Control in U-Boot' docs were recently merged and these provide some base info, for now.
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemuChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now thatOF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'doc/develop/devicetree/dt_update.rst | 556 +++++++++++++++++++++++++++ doc/develop/devicetree/index.rst | 1 + 2 files changed, 557 insertions(+) create mode 100644 doc/develop/devicetree/dt_update.rstdoc/develop/devicetree/dt_update.rst new file +6
-0@@ -0,0 +1,556 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Updating the devicetree +======================= + +U-Boot uses devicetree for runtime configuration and storing requiredblobs or
doc/develop/devicetree/dt_update.rst new file +3
-0+any other information it needs to operate. This is called the 'control' +devicetree since it controls U-Boot. It is possible to update the control +devicetree separately from actually building U-Boot. This provides a gooddegree
+of control and flexibility for firmware that uses U-Boot in conjunction withdoc/develop/devicetree/dt_update.rst new file +3
-0+other project. + +There are many reasons why it is useful to modify the devicetree afterbuilding
doc/develop/devicetree/dt_update.rst new file +8
-0+it: + +- Configuration can be changed, e.g. which UART to use +- A serial number can be added +- Public keys can be added to allow image verification +- Console output can be changed (e.g. to select serial or vidconsole) + +This section describes how to work with devicetree to accomplish yourgoals.
doc/develop/devicetree/dt_update.rst new file +9
-0+ +See also :doc:`../devicetree/control` for a basic summary of the available +features. + + +Devicetree source +----------------- + +Every board in U-Boot must include a devicetree sufficient to build andboot
+that board on suitable hardware (or emulation). This is specified using the
+CONFIG DEFAULT_DEVICE_TREEoption.doc/develop/devicetree/dt_update.rst new file +6
-0+ + +Current situation (October 2021) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As an aside, at present U-Boot allows `CONFIG_DEFAULT_DEVICE_TREE` to beempty,
+e.g. ifCONFIG_OF_BOARDis used. This has unfortunately created an enormous
+amount of confusion and some wasted effort. This was not intended. Support fordoc/develop/devicetree/dt_update.rst new file +7
-0+an empty `CONFIG_DEFAULT_DEVICE_TREE` will be dropped soon. + +Some of the problems created are: + +- It is not obvious that the devicetree is coming from another project + +- There is no way to see even a sample devicetree for these platform inU-Boot,
doc/develop/devicetree/dt_update.rst new file +4
-0+ so it is hard to know what is going on, e.g. which devices are typically + present + +- The other project may not provide a way to support U-Boot'srequirements for
+ devicetree, such as the /config node. Note: On the U-Boot mailing linst, thisdoc/develop/devicetree/dt_update.rst new file +3
-0+ was only discovered after weeks of discussion and confusion + +- For QEMU specifically, consulting two QEMU source files is required,for which
+ there are no references in U-Boot documentation. The code is generating adoc/develop/devicetree/dt_update.rst new file +4
-0+ devicetree, but it is not clear what controls affect this generation. + +Specifically on the changes in U-Bootm `CONFIG_OF_BOARD` was added in +rpi_patch_ for Raspberry Pi, which does have an in-tree devicetree, butthis
doc/develop/devicetree/dt_update.rst new file +4
-0+feature has since been used for boards that don't + +Once this bug is fixed, CONFIG_OF_BOARD will override (at runtime) the +evicetree suppled with U-Boot, but will otherwise use CONFIG_OF_SEPARATEfor the
+in-tree build. So these two will become options, moving out of the 'choice' in
+dts/Kconfig.doc/develop/devicetree/dt_update.rst new file +3
-0+ +This means that there is a basic devicetree build in the U-Boot tree, for +build-testing, consistency and documentation purposes, but at runtimeU-Boot can
+accept its devicetree from another source. The in-tree devicetree may contain
+U-Boot-specific features (in u-boot*.dtsi files) and this may prove useful for
+the other project, so it can ensure that U-Boot functions correctly and supportsdoc/develop/devicetree/dt_update.rst new file +3
-0+all its expected features. + +To be clear, while U-Boot has its own copy of the devicetree source foreach
doc/develop/devicetree/dt_update.rst new file +2
-0+board, this must match the Linux source, perhaps with some u-boot.dtsi +additions. The intent here is not to create a separate binding, just toprovide
doc/develop/devicetree/dt_update.rst new file +14
-0+a representative devicetree in U-Boot. + +Offending boards are: + +- rpi_4 and rpi_4_32b (other rpi boards do have an in-tree devicetree) +- qemu_arm64 +- qemu_arm +- qemu-ppce500 +- qemu-riscv32 +- qemu-riscv32_smode +- qemu-riscv64 +- qemu-riscv64_smode + +All of these need to have a devicetree added in-tree. This is targeted tobe
doc/develop/devicetree/dt_update.rst new file +8
-0+fixed in the 2022.01 release. + + +Building the devicetree +----------------------- + +U-Boot automatically builds the devicetree for a board, from the +`arch/<arch>/dts` directory. The Makefile in those directories has rulesfor
+building devicetree files. It is preferable to avoid target-specific rules indoc/develop/devicetree/dt_update.rst new file +2
-0+those files: i.e. all boards for a particular SoC should be built at once, +where practical. Apart from simplifying the Makefile, this helps toefficiently
+(and immediately) ensure that changes in one board's DT do not break others that
+are related. Building devicetrees is fast, so performance is seldom a concerndoc/develop/devicetree/dt_update.rst new file +8
-0+here. + + +Overriding the default devicetree +--------------------------------- + +When building U-Boot, the `DEVICE_TREE` environment variable allows the +default devicetree file to be overridden at build time. This can beuseful if
+modifications have to be made to the in-tree devicetree file, for the benefitdoc/develop/devicetree/dt_update.rst new file +2
-0+of a downstream build system. Note that the in-tree devicetree must be +sufficient to build and boot, so this is not a way to bypass thatrequirement.
doc/develop/devicetree/dt_update.rst new file +7
-0+ + +Modifying the devicetree after building +--------------------------------------- + +While it is generally painful and hacky to modify the code or rodata of a +program after it is built, in many cases it is useful to do so, e.g. toadd
+configuration information like serial numbers, enabling/disabling features, etc.doc/develop/devicetree/dt_update.rst new file +3
-0+ +Devicetree provides a very nice solution to these problems since it is +structured data and it is relatively easy to change it, even in binaryform
doc/develop/devicetree/dt_update.rst new file +4
-0+(see fdtput). + +U-Boot takes care that the devicetree is easily accessible after the build +process. In fact it is placed in a separate file called `u-boot.dtb`. Ifthe
+build system wants to modify or replace that file, it can do so. Then all that
+is needed is to runbinman updateto update the file inside the image. If
+binman is not used, thenu-boot-nodtb.binand the newu-boot.dtbcan simply
+be concatenated to achieve the desired result. U-Boot happily copes with thedoc/develop/devicetree/dt_update.rst new file +3
-0+devicetree growing or shrinking. + +The `u-boot.bin` image contains both pieces. While it is possible tolocate the
+devicetree within the image using the signature at the start of the file, thisdoc/develop/devicetree/dt_update.rst new file +3
-0+is a bit messy. + +This is why `CONFIG_OF_SEPARATE` should always be used when buildingU-Boot.
+TheCONFIG_OF_EMBEDoption embeds the devicetree somewhere in the U-Boot ELF
+image as rodata, meaning that it is hard to find it and it cannot increase indoc/develop/devicetree/dt_update.rst new file +3
-0+size. + +When modifying the devicetree, the different cases to consider are asfollows:
doc/develop/devicetree/dt_update.rst new file +8
-0+ +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the `cat` + operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. If theEFL
+ file is available, then the_dtb_dt_beginand__dtb_dt_endsymbols
can be
+ examined to find it. While it is possible to contract the file, it is
notdoc/develop/devicetree/dt_update.rst new file +7
-0+ possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that the correct + one is provided to U-Boot. How this is done depends entirely on the + implementation of this option for the board. It might requireinjecting the
+ changes into a different project somehow using tooling available
there, or
+ it might involve merging an overlay file at runtime to obtain the
desireddoc/develop/devicetree/dt_update.rst new file +7
-0+ result. + + +Use of U-Boot /config node +-------------------------- + +A common problem with firmware is that many builds are needed to dealwith the
+slight variations between different, related models. For example, one model may
+have a TPM and another may not. Devicetree provides an excellent solution todoc/develop/devicetree/dt_update.rst new file +2
-0+this problem, in that the devicetree to actually use on a platform can be +injected in the factory based on which model is being manufactured at thetime.
doc/develop/devicetree/dt_update.rst new file +2
-0+ +A related problem causing build proliferation is dealing with thedifferences
doc/develop/devicetree/dt_update.rst new file +2
-0+between development firmware, developer-friendly firmware (e.g. with all +security features present but with the ability to access the commandline),
+test firmware (which runs tests used in the factory), final production firmware
+(before signing), signed firmware (where the signatures have been inserted) and
+the like. Ideally all or most of these should use the same U-Boot build, with
+just some options to determine the features available. For example, being able
+to control whether the UART console or JTAG are available, on any image, is adoc/develop/devicetree/dt_update.rst new file +3
-0+great debugging aid. + +When the firmware consists of multiple parts, it is helpful that alloperate
+the same way at runtime, regardless of how they were built. This can be achieved
+by passing the runtime configuration (e.g. 'enable UART console) along the chain
+through each firmware stage. It is frustrating to have to replicate a bug on
+production firmware which does happen on developer firmware, because they aredoc/develop/devicetree/dt_update.rst new file +3
-0+completely different builds. + +The /config node provides useful functionality for this. It allows thedifferent
+controls to be 'factored out' of the U-Boot binary, so they can be controlled
+separately from the initial source-code build. The node can be easily updated bydoc/develop/devicetree/dt_update.rst new file +2
-0+a build or factory tool and can control various features in U-Boot. It is +similar in concept to a Kconfig option, except that it can be changedafter
doc/develop/devicetree/dt_update.rst new file +3
-0+U-Boot is built. + +The /config node is similar in concept to the `/chosen node`_ except thatit is
doc/develop/devicetree/dt_update.rst new file +2
-0+for passing information *into* firmware instead of from firmware to the +Operating System. Also, while Linux has a (sometimes extremely long)command
+line, U-Boot does not support this. The devicetree provides a more structureddoc/develop/devicetree/dt_update.rst new file +7
-0+approach in any case. + + +Devicetree in another project +----------------------------- + +In some cases U-Boot receive its devicetree at runtime from a programthat calls
+it. For example ARM's Trusted Firmware A (TF-A_) may have a devicetree that it
+passes to U-Boot. This overrides any devicetree build by U-Boot. When packagingdoc/develop/devicetree/dt_update.rst new file +4
-0+the firmware, the U-Boot devicetree may in fact be left out if it can be +guaranteed that it will receive one from another project. + +In this case, the devicetree in the other project must track U-Boot's useof
doc/develop/devicetree/dt_update.rst new file +4
-0+device tree, for the following reasons: + +- U-Boot only has one devicetree. See `Why not have two devicetrees?`_. +- For a consistent firmware build, decisions made in early stages shouldbe
+ communicated to later ones at runtime. For example, if the serial console isdoc/develop/devicetree/dt_update.rst new file +3
-0+ enabled in an early stage, it should be enabled in U-Boot too. +- U-Boot is quite capable of managing its own copy of the devicetree. If + another project wants to bypass this (often for good reason), it isreasonable
+ that it should take on the (fairly small) requirements that U-Boot features
+ that rely on devicetree are still available
+- The point here is not that *U-Boot needs this extra node*, or *U-Boot needs
+ to have this public key*. These features are present in U-Boot in service of
+ the entire firmware system. If the U-Boot features are used, but cannot bedoc/develop/devicetree/dt_update.rst new file +2
-0+ supported in the normal way, then there is pressure to implement these + features in other ways. In the end, we would have a different mechanismfor
+ every other project that uses U-Boot. This introduces duplicate ways of doing
+ the same thing, needlessly increases the complexity of the U-Boot source code,
+ forces authors to consider parallel implementations when writing new features,doc/develop/devicetree/dt_update.rst new file +2
-0+ makes U-Boot harder to test, complicates documentation and confuses the + runtime flow of U-Boot. If every board did things its own way ratherthan
+ contributing to the common code, U-Boot would lose a lot of its cross-platformdoc/develop/devicetree/dt_update.rst new file +3
-0+ value. + +The above does not indicate *bad design* within U-Boot. Devicetree is acore
+component of U-Boot and U-Boot makes use of it to the full. It solves a myriad
+of problems that would otherwise need their own special C struct, binary format,doc/develop/devicetree/dt_update.rst new file +3
-0+special property, tooling for viewing and updating, etc. + +Specifically, the other project must provide a way to add configurationand
+other information to the devicetree for use by U-Boot, such as the /config node.
+Note that the U-Boot in-tree devicetree source must be sufficient to build anddoc/develop/devicetree/dt_update.rst new file +4
-0+boot, so this is not a way to bypass that requirement. + +If binman is used, the devicetree source in U-Boot must contain the binman +definition so that a valid image can be build. This helps people discoverwhat
+other firmware components are needed and seek out appropriate documentation.doc/develop/devicetree/dt_update.rst new file +2
-0+ +If verified boot is used, the project must provide a way to inject apublic key,
+certificate or other material into the U-Boot devicetree so that it is availabledoc/develop/devicetree/dt_update.rst new file +2
-0+to U-Boot at runtime. See `Signing with U-Boot devicetree`_. This may be +through tooling in the project itself or by making use of U-Boot'stooling.
doc/develop/devicetree/dt_update.rst new file +6
-0+ + +Devicetree generated on-the-fly in another project +-------------------------------------------------- + +In some rare cases, another project may wish to create a devicetree forU-Boot
+entirely on-the-fly, then pass it to U-Boot at runtime. The only known exampledoc/develop/devicetree/dt_update.rst new file +4
-0+of this at the time of writing (2021) is QEMU, for ARM (`QEMU ARM`_) and +RISC-V (`QEMU RISC-V`_). + +In effect, when the board boots, U-Boot is *downstream* of the otherproject.
doc/develop/devicetree/dt_update.rst new file +4
-0+It is entirely reliant on that project for its correct operation. + +This does not mean to imply that the other project is creating its own, +incompatible devicetree. In fact QEMU generates a valid devicetree whichis
+suitable for both U-Boot and Linux. It is quite normal for a devicetree to be
+present in flash and be made available to U-Boot at runtime. What matters is
+where the devicetree comes from. If the other project builds a devicetree for
+U-Boot then it needs to support adding the things needed by U-Boot features.doc/develop/devicetree/dt_update.rst new file +3
-0+Without them, for example: + +- U-Boot may not boot because too many devices are enabled beforerelocation
+- U-Boot may not have access to the developer or production public keys used for
+ signing+- U-Boot may not support controlling whether the console is enabled +- U-Boot may not be know which MMC device to boot from +- U-Boot may not be able to find other firmware components that it needsto load
doc/develop/devicetree/dt_update.rst new file +2
-0+ +Normally, supporting U-Boot's features is trivial, since the devicetreecompiler
+(dtc) can compile the source, including any U-Boot pieces. So the burden isdoc/develop/devicetree/dt_update.rst new file +3
-0+extremely low. + +In this case, the devicetree in the other project must track U-Boot's useof
+device tree, so that it remains compatible. SeeDevicetree in another project_doc/develop/devicetree/dt_update.rst new file +3
-0+for reasons why. + +If a particular version of the project is needed for a particular versionof
doc/develop/devicetree/dt_update.rst new file +3
-0+U-Boot, that must be documented in both projects. + +Further, it must provide a way to add configuration and other informationto
+the devicetree for use by U-Boot, such as the/confignode and the tags used
+by driver model. Note that the U-Boot in-tree devicetree must be sufficient todoc/develop/devicetree/dt_update.rst new file +4
-0+build and boot, so this is not a way to bypass that requirement. + +More specifically, tooling or command-line arguments must provide a way to +add a `/config` node or items within that node, so that U-Boot canreceive a
+suitable configuration. It must provide a way of addingu-boot,dm-...tags for
+correct operation of driver model. These options can then be used as part of the
+build process, which puts the firmware image together. For binman, a way must bedoc/develop/devicetree/dt_update.rst new file +3
-0+provided to add the binman definition into the devicetree in the same way. + +One way to do this is to allow a .dtsi file to be merged in with thegenerated
doc/develop/devicetree/dt_update.rst new file +3
-0+devicetree. + +Note that the burden goes both ways. If a new feature is added to U-Bootwhich
+needs support in another project, then the author of the U-Boot patch must adddoc/develop/devicetree/dt_update.rst new file +9
-0+any required support to the other project. + + +Passing the devicetree through to Linux +--------------------------------------- + +Ideally U-Boot and Linux use the same devicetree source, even though it is +hosted in separate projects. U-Boot adds some extra pieces, such as the +`config/` node and tags like `u-boot,dm-spl`. Linux adds some extrapieces, such
+aslinux,default-triggerandlinux,code. This should not interfere withdoc/develop/devicetree/dt_update.rst new file +3
-0+each other. + +In principle it is possible for U-Boot's control devicetree to be passedto
doc/develop/devicetree/dt_update.rst new file +2
-0+Linux. This is, after all, one of the goals of devicetree and the original +Open Firmware project, to have the firmware provide the hardwaredescription to
doc/develop/devicetree/dt_update.rst new file +3
-0+the Operating System. + +For boards where this approach is used, care must be taken. U-Boottypically
doc/develop/devicetree/dt_update.rst new file +2
-0+needs to 'fix up' the devicetree before passing it to Linux, e.g. to add +information about the memory map, about which serial console is used,provide
+the kernel address space layout randomization (KASLR) seed or select whether thedoc/develop/devicetree/dt_update.rst new file +3
-0+console should be silenced for a faster boot. + +Fix-ups involve modifying the devicetree. If the control devicetree isused,
+that means the control devicetree could be modified, while U-Boot is using it.
+Removing a device and reinserting it can cause problems if the devicetree offsetdoc/develop/devicetree/dt_update.rst new file +5
-0+has changed, for example, since the device will be unable to locates its +devicetree properties at the expected devicetree offset, which is a fixed +integer. + +To deal with this, it is recommended to employ one or more of thefollowing
doc/develop/devicetree/dt_update.rst new file +5
-0+approaches: + +- Make a copy of the devicetree and 'fix up' the copy, leaving the control + devicetree alone +- Enable `CONFIG_OF_LIVE` so that U-Boot makes its own copy of thedevicetree
doc/develop/devicetree/dt_update.rst new file +5
-0+ during relocation; fixups then happen on the original flat tree +- Ensure that fix-ups happen after all loading has happened and U-Boot has + completed image verification + +In practice,the last point is typically observed, since boot_prep_linux()is
+called just before jumping to Linux, long after signature verification, fordoc/develop/devicetree/dt_update.rst new file +9
-0+example. But it is important to make sure that this line is not blurred, +particularly if untrusted user data is involved. + + +Devicetree use cases that must be supported +------------------------------------------- + +Regardless of how the devicetree is provided to U-Boot at runtime, various +U-Boot features must be fully supported. This section describes some ofthese
doc/develop/devicetree/dt_update.rst new file +11
-0+features and the implications for other projects. + +If U-Boot uses its own in-tree devicetree these features are supported +automatically. + + +Signing with U-Boot devicetree +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +U-Boot supports signing a payload so that it can be verified to have been +created by a party owning a private key. This is called verified boot inU-Boot
doc/develop/devicetree/dt_update.rst new file +3
-0+(see doc/uImage.FIT/verified-boot.txt). + +Typically this works by creating a FIT and then running the `mkimage`tool to
+add signatures for particular images. As part of this process,mkimagewrites
+a public key to the U-Boot devicetree, although this can be done separately.doc/develop/devicetree/dt_update.rst new file +4
-0+See fdt_add_pubkey_ for patches for a suitable tool, for example. + +As with all configuration information, if another project is providing the +devicetree to U-Boot, it must provide a way to add this public key intothe
+devicetree it passes to U-Boot. This could be via a tooling option, making use
+ofmkimage, or allowing a .dtsi file to be merged in with what is generated indoc/develop/devicetree/dt_update.rst new file +7
-0+the other project. + + +Providing the binman image definition +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In complex systems U-Boot must locate and make use of other firmwarecomponents,
+such as images for the user interface, files containing peripheral firmware,doc/develop/devicetree/dt_update.rst new file +7
-0+multiple copies of U-Boot for use with A/B boot, etc. U-Boot uses +:doc:`Binman <../package/binman>` as a standard way of putting an image +together. + +Typically this works by running binman with the devicetree as an input, to +create the file image. Binman then outputs an updated devicetree which is +packed in the firmware image, so U-Boot can access the binman definitionand
doc/develop/devicetree/dt_update.rst new file +4
-0+locate all the components. + +As with all configuration information, if another project is providing the +devicetree to U-Boot, it must provide a way to add this binman definitioninto
+the devicetree it passes to U-Boot. This could be via a tooling option, making
+use ofbinman, or alowing a .dtsi file to be merged in with what is generateddoc/develop/devicetree/dt_update.rst new file +7
-0+in the other project. + + +Protecting the devicetree +------------------------- + +U-Boot relies heavily on devicetree for correct operation. A corrupt orinvalid
+device can cause U-Boot to fail to start, behave incorrectly, crash (e.g. if
+CONFIG_OF_LIBFDT_ASSUME_MASKis adjusted, or fail to boot an Operating System.
+Within U-Boot, the devicetree is as important as any other part of the source
+code. At ruuntime, the devicetree can be considered to be structured rodata.doc/develop/devicetree/dt_update.rst new file +4
-0+ +With secure systems, care must be taken that the devicetree is valid: + +- If the code / rodata has a hash or signature, the devicetree shouldalso, if
+ they are packaged separately.
+- If the code / rodata is write-protected when running, the devicetree should be
+ also. Note that U-Boot relocates its code and devicetree, so this is not as
+ simple as it sounds. U-Boot must write-protect these items after relocating.doc/develop/devicetree/dt_update.rst new file +8
-0+ + +Why does U-Boot have its nodes and properties? +---------------------------------------------- + +See also :doc:`../devicetree/intro`. + +There has been pushback at the concept that U-Boot dares have its ownnodes and
doc/develop/devicetree/dt_update.rst new file +3
-0+properties in the devicetree. + +Apart from these nodes and properties, U-Boot uses the same bindings asLinux.
+Au-boot.dtsifile helps to keep U-Boot-specific changes in separate files,
+making it easier to keep devicetree source files in U-Boot in sync with Linux.doc/develop/devicetree/dt_update.rst new file +2
-0+ +As a counter-example, the Zephyr OS project takes a different approach.It uses
+entirely different bindings, in general, making no effort to sync devicetree
+source files with Linux. U-Boot strives to be compatible with Linux in a numberdoc/develop/devicetree/dt_update.rst new file +2
-0+of ways, such as source code style and common APIs, to aid porting of code +between the projects. Devicetree is another way where U-Boot and Linuxfollow a
doc/develop/devicetree/dt_update.rst new file +3
-0+similar approach. + +Fundamentally, the idea that U-Boot cannot have its own tags flies in theface
doc/develop/devicetree/dt_update.rst new file +3
-0+of the devicetree specification (see dtspec_), which says: + + Nonstandard property names should specify a **unique string prefix**,such as
+ a stock ticker symbol, identifying the name of the company **or organization**doc/develop/devicetree/dt_update.rst new file +7
-0+ that defined the property. Examples: + + - fsl,channel-fifo-len + - ibm,ppc-interrupt-server#s + - **linux**,network-index + +It is also fundamentally unbalanced. Linux has many tags of its own (some36 in
+version 5.13) and at least one Linux-specific node, even if you ignore things
+like flash partitions which clearly provide configuration information to Linux.doc/develop/devicetree/dt_update.rst new file +2
-0+ +Practically speaking there are many reasons why U-Boot has its own nodesand
doc/develop/devicetree/dt_update.rst new file +3
-0+properties. Some examples: + +- Binding every device before relocation even if it won't be used,consumes time
+ and memory: tags on each node can specify which are needed in SPL or beforedoc/develop/devicetree/dt_update.rst new file +3
-0+ relocation. Linux has no such constraints. + +- Requiring the full clock tree to be up and running just to get thedebug UART
+ running is inefficient. It is also and self-defeating, since if that much
+ code is working properly, you probably don't need the debug UART. A devicetreedoc/develop/devicetree/dt_update.rst new file +3
-0+ property to provide the UART input-clock frequency is a simple solution. + +- U-Boot does not have a user space to provide policy and configuration.It
+ cannot do what Linux does and run programs and look up filesystems to figuredoc/develop/devicetree/dt_update.rst new file +7
-0+ out how to boot. + + +Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its ownnodes and
doc/develop/devicetree/dt_update.rst new file +2
-0+properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else(here
doc/develop/devicetree/dt_update.rst new file +3
-0+called `linux`). + +On the positive side, it might quieten the discussion alluded to in thesection
doc/develop/devicetree/dt_update.rst new file +4
-0+above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its ownbindings.
+ It would not be necessary to put au-boot,prefix on anything. People comingdoc/develop/devicetree/dt_update.rst new file +4
-0+ across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing thedevicetree. This
+ would need to be expanded to support two trees. Features which need to access
+ both (such as a device driver which reads the special devicetree to get somedoc/develop/devicetree/dt_update.rst new file +3
-0+ configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desiresit? If
+ so, how is this managed in tooling? Does it happen during the build, in whichdoc/develop/devicetree/dt_update.rst new file +4
-0+ case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more codepaths. It
doc/develop/devicetree/dt_update.rst new file +2
-0+ requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation wouldcertainly
doc/develop/devicetree/dt_update.rst new file +3
-0+ not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the piecesneeded for
+ U-Boot for a particular board. Would we use these same files for the specialdoc/develop/devicetree/dt_update.rst new file +3
-0+ devicetree? + +- **Complexity** - Two devicetrees complicates the build system since itmust
+ build and package them both. Errors must be reported in such a way that itdoc/develop/devicetree/dt_update.rst new file +3
-0+ is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by drivermodel
doc/develop/devicetree/dt_update.rst new file +2
-0+ are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extravalidation would
doc/develop/devicetree/dt_update.rst new file +3
-0+ be needed? + +- **Storage** - How would the two devicetrees be stored in the image? Atpresent
+ we simply concatenate the U-Boot binary and the devicetree. We could add the
+ special devicetree before the Linux one, so two are concatenated, but it is
+ not pretty. We could use binman to support more complex arrangements, but onlydoc/develop/devicetree/dt_update.rst new file +3
-0+ some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files toU-Boot at
+ runtime? Presumably this would just be too painful. But if it doesn't, it
+ would be unable to configure run-time features of U-Boot during the boot.
+
+- **Confusion** - No other project has two devicetrees. U-Boot would be in the
+ unfortunate position of having to describe this fact to new users, along with
doc/develop/devicetree/dt_update.rst line 540
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ the (arguably contrived) reason for the arrangement. +
False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.
+- **Signing flow** - The current signing flow is simple as it involves
Quoted 36 lines
running
+mkimagewith the U-Boot devicetree. This would have to be updated to use the
+ special devicetree. Some way of telling the user that they have done it wrongdoc/develop/devicetree/dt_update.rst new file +7
-0+ would have to be invented. + +Overall, adding a second devicetree would create enormous confusion and +complexity. It seems a lot cheaper to solve this by a change of attitude. + + +.. _rpi_patch:https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
+.. _TF-A: https://www.trustedfirmware.org/projects/tf-a
+.. _QEMU ARM: https://github.com/qemu/qemu/blob/master/hw/arm/virt.c
+.. _QEMU RISC-V:
https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c
+.. _/chosen node:
https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt
+.._fdt_add_pubkey:
https://patchwork.ozlabs.org/project/uboot/list/?series=157843&state=*
+.._dtspec: https://www.devicetree.org/specifications/doc/develop/devicetree/index.rst +1
-1@@ -11,3 +11,4 @@ build-time and runtime configuration. intro control + dt_update --2.33.0.1079.g6e70778dc9-goog
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi François,
Quoted 601 lines · François Ozog
Hi Simon,
Quoted 597 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.Signed-off-by Simon Glass <[email protected]>Reviewed-by Marcel Ziswiler <[email protected]>---
This patch attracted quite a bit of discussion here:https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
I have not included the text suggested by François. While I agree that it would be useful to have an introduction in this space, I do not agree that we should have two devicetrees or that U-Boot should not have its own things in the devicetree, so it is not clear to me what we should actually write.
The 'Devicetree Control in U-Boot' docs were recently merged and these provide some base info, for now.
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemuChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now thatOF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'doc/develop/devicetree/dt_update.rst | 556 +++++++++++++++++++++++++++ doc/develop/devicetree/index.rst | 1 + 2 files changed, 557 insertions(+) create mode 100644 doc/develop/devicetree/dt_update.rstdoc/develop/devicetree/dt_update.rst new file +535
-0@@ -0,0 +1,556 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Updating the devicetree +======================= + +U-Boot uses devicetree for runtime configuration and storing required blobs or +any other information it needs to operate. This is called the 'control' +devicetree since it controls U-Boot. It is possible to update the control +devicetree separately from actually building U-Boot. This provides a good degree +of control and flexibility for firmware that uses U-Boot in conjunction with +other project. + +There are many reasons why it is useful to modify the devicetree after building +it: + +- Configuration can be changed, e.g. which UART to use +- A serial number can be added +- Public keys can be added to allow image verification +- Console output can be changed (e.g. to select serial or vidconsole) + +This section describes how to work with devicetree to accomplish your goals. + +See also :doc:`../devicetree/control` for a basic summary of the available +features. + + +Devicetree source +----------------- + +Every board in U-Boot must include a devicetree sufficient to build and boot +that board on suitable hardware (or emulation). This is specified using the +`CONFIG DEFAULT_DEVICE_TREE` option. + + +Current situation (October 2021) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As an aside, at present U-Boot allows `CONFIG_DEFAULT_DEVICE_TREE` to be empty, +e.g. if `CONFIG_OF_BOARD` is used. This has unfortunately created an enormous +amount of confusion and some wasted effort. This was not intended. Support for +an empty `CONFIG_DEFAULT_DEVICE_TREE` will be dropped soon. + +Some of the problems created are: + +- It is not obvious that the devicetree is coming from another project + +- There is no way to see even a sample devicetree for these platform in U-Boot, + so it is hard to know what is going on, e.g. which devices are typically + present + +- The other project may not provide a way to support U-Boot's requirements for + devicetree, such as the /config node. Note: On the U-Boot mailing linst, this + was only discovered after weeks of discussion and confusion + +- For QEMU specifically, consulting two QEMU source files is required, for which + there are no references in U-Boot documentation. The code is generating a + devicetree, but it is not clear what controls affect this generation. + +Specifically on the changes in U-Bootm `CONFIG_OF_BOARD` was added in +rpi_patch_ for Raspberry Pi, which does have an in-tree devicetree, but this +feature has since been used for boards that don't + +Once this bug is fixed, CONFIG_OF_BOARD will override (at runtime) the +evicetree suppled with U-Boot, but will otherwise use CONFIG_OF_SEPARATE for the +in-tree build. So these two will become options, moving out of the 'choice' in +`dts/Kconfig`. + +This means that there is a basic devicetree build in the U-Boot tree, for +build-testing, consistency and documentation purposes, but at runtime U-Boot can +accept its devicetree from another source. The in-tree devicetree may contain +U-Boot-specific features (in u-boot*.dtsi files) and this may prove useful for +the other project, so it can ensure that U-Boot functions correctly and supports +all its expected features. + +To be clear, while U-Boot has its own copy of the devicetree source for each +board, this must match the Linux source, perhaps with some u-boot.dtsi +additions. The intent here is not to create a separate binding, just to provide +a representative devicetree in U-Boot. + +Offending boards are: + +- rpi_4 and rpi_4_32b (other rpi boards do have an in-tree devicetree) +- qemu_arm64 +- qemu_arm +- qemu-ppce500 +- qemu-riscv32 +- qemu-riscv32_smode +- qemu-riscv64 +- qemu-riscv64_smode + +All of these need to have a devicetree added in-tree. This is targeted to be +fixed in the 2022.01 release. + + +Building the devicetree +----------------------- + +U-Boot automatically builds the devicetree for a board, from the +`arch/<arch>/dts` directory. The Makefile in those directories has rules for +building devicetree files. It is preferable to avoid target-specific rules in +those files: i.e. all boards for a particular SoC should be built at once, +where practical. Apart from simplifying the Makefile, this helps to efficiently +(and immediately) ensure that changes in one board's DT do not break others that +are related. Building devicetrees is fast, so performance is seldom a concern +here. + + +Overriding the default devicetree +--------------------------------- + +When building U-Boot, the `DEVICE_TREE` environment variable allows the +default devicetree file to be overridden at build time. This can be useful if +modifications have to be made to the in-tree devicetree file, for the benefit +of a downstream build system. Note that the in-tree devicetree must be +sufficient to build and boot, so this is not a way to bypass that requirement. + + +Modifying the devicetree after building +--------------------------------------- + +While it is generally painful and hacky to modify the code or rodata of a +program after it is built, in many cases it is useful to do so, e.g. to add +configuration information like serial numbers, enabling/disabling features, etc. + +Devicetree provides a very nice solution to these problems since it is +structured data and it is relatively easy to change it, even in binary form +(see fdtput). + +U-Boot takes care that the devicetree is easily accessible after the build +process. In fact it is placed in a separate file called `u-boot.dtb`. If the +build system wants to modify or replace that file, it can do so. Then all that +is needed is to run `binman update` to update the file inside the image. If +binman is not used, then `u-boot-nodtb.bin` and the new `u-boot.dtb` can simply +be concatenated to achieve the desired result. U-Boot happily copes with the +devicetree growing or shrinking. + +The `u-boot.bin` image contains both pieces. While it is possible to locate the +devicetree within the image using the signature at the start of the file, this +is a bit messy. + +This is why `CONFIG_OF_SEPARATE` should always be used when building U-Boot. +The `CONFIG_OF_EMBED` option embeds the devicetree somewhere in the U-Boot ELF +image as rodata, meaning that it is hard to find it and it cannot increase in +size. + +When modifying the devicetree, the different cases to consider are as follows: + +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the `cat` + operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. If the EFL + file is available, then the _dtb_dt_begin and __dtb_dt_end symbols can be + examined to find it. While it is possible to contract the file, it is not + possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that the correct + one is provided to U-Boot. How this is done depends entirely on the + implementation of this option for the board. It might require injecting the + changes into a different project somehow using tooling available there, or + it might involve merging an overlay file at runtime to obtain the desired + result. + + +Use of U-Boot /config node +-------------------------- + +A common problem with firmware is that many builds are needed to deal with the +slight variations between different, related models. For example, one model may +have a TPM and another may not. Devicetree provides an excellent solution to +this problem, in that the devicetree to actually use on a platform can be +injected in the factory based on which model is being manufactured at the time. + +A related problem causing build proliferation is dealing with the differences +between development firmware, developer-friendly firmware (e.g. with all +security features present but with the ability to access the command line), +test firmware (which runs tests used in the factory), final production firmware +(before signing), signed firmware (where the signatures have been inserted) and +the like. Ideally all or most of these should use the same U-Boot build, with +just some options to determine the features available. For example, being able +to control whether the UART console or JTAG are available, on any image, is a +great debugging aid. + +When the firmware consists of multiple parts, it is helpful that all operate +the same way at runtime, regardless of how they were built. This can be achieved +by passing the runtime configuration (e.g. 'enable UART console) along the chain +through each firmware stage. It is frustrating to have to replicate a bug on +production firmware which does happen on developer firmware, because they are +completely different builds. + +The /config node provides useful functionality for this. It allows the different +controls to be 'factored out' of the U-Boot binary, so they can be controlled +separately from the initial source-code build. The node can be easily updated by +a build or factory tool and can control various features in U-Boot. It is +similar in concept to a Kconfig option, except that it can be changed after +U-Boot is built. + +The /config node is similar in concept to the `/chosen node`_ except that it is +for passing information *into* firmware instead of from firmware to the +Operating System. Also, while Linux has a (sometimes extremely long) command +line, U-Boot does not support this. The devicetree provides a more structured +approach in any case. + + +Devicetree in another project +----------------------------- + +In some cases U-Boot receive its devicetree at runtime from a program that calls +it. For example ARM's Trusted Firmware A (`TF-A`_) may have a devicetree that it +passes to U-Boot. This overrides any devicetree build by U-Boot. When packaging +the firmware, the U-Boot devicetree may in fact be left out if it can be +guaranteed that it will receive one from another project. + +In this case, the devicetree in the other project must track U-Boot's use of +device tree, for the following reasons: + +- U-Boot only has one devicetree. See `Why not have two devicetrees?`_. +- For a consistent firmware build, decisions made in early stages should be + communicated to later ones at runtime. For example, if the serial console is + enabled in an early stage, it should be enabled in U-Boot too. +- U-Boot is quite capable of managing its own copy of the devicetree. If + another project wants to bypass this (often for good reason), it is reasonable + that it should take on the (fairly small) requirements that U-Boot features + that rely on devicetree are still available +- The point here is not that *U-Boot needs this extra node*, or *U-Boot needs + to have this public key*. These features are present in U-Boot in service of + the entire firmware system. If the U-Boot features are used, but cannot be + supported in the normal way, then there is pressure to implement these + features in other ways. In the end, we would have a different mechanism for + every other project that uses U-Boot. This introduces duplicate ways of doing + the same thing, needlessly increases the complexity of the U-Boot source code, + forces authors to consider parallel implementations when writing new features, + makes U-Boot harder to test, complicates documentation and confuses the + runtime flow of U-Boot. If every board did things its own way rather than + contributing to the common code, U-Boot would lose a lot of its cross-platform + value. + +The above does not indicate *bad design* within U-Boot. Devicetree is a core +component of U-Boot and U-Boot makes use of it to the full. It solves a myriad +of problems that would otherwise need their own special C struct, binary format, +special property, tooling for viewing and updating, etc. + +Specifically, the other project must provide a way to add configuration and +other information to the devicetree for use by U-Boot, such as the /config node. +Note that the U-Boot in-tree devicetree source must be sufficient to build and +boot, so this is not a way to bypass that requirement. + +If binman is used, the devicetree source in U-Boot must contain the binman +definition so that a valid image can be build. This helps people discover what +other firmware components are needed and seek out appropriate documentation. + +If verified boot is used, the project must provide a way to inject a public key, +certificate or other material into the U-Boot devicetree so that it is available +to U-Boot at runtime. See `Signing with U-Boot devicetree`_. This may be +through tooling in the project itself or by making use of U-Boot's tooling. + + +Devicetree generated on-the-fly in another project +-------------------------------------------------- + +In some rare cases, another project may wish to create a devicetree for U-Boot +entirely on-the-fly, then pass it to U-Boot at runtime. The only known example +of this at the time of writing (2021) is QEMU, for ARM (`QEMU ARM`_) and +RISC-V (`QEMU RISC-V`_). + +In effect, when the board boots, U-Boot is *downstream* of the other project. +It is entirely reliant on that project for its correct operation. + +This does not mean to imply that the other project is creating its own, +incompatible devicetree. In fact QEMU generates a valid devicetree which is +suitable for both U-Boot and Linux. It is quite normal for a devicetree to be +present in flash and be made available to U-Boot at runtime. What matters is +where the devicetree comes from. If the other project builds a devicetree for +U-Boot then it needs to support adding the things needed by U-Boot features. +Without them, for example: + +- U-Boot may not boot because too many devices are enabled before relocation +- U-Boot may not have access to the developer or production public keys used for + signing +- U-Boot may not support controlling whether the console is enabled +- U-Boot may not be know which MMC device to boot from +- U-Boot may not be able to find other firmware components that it needs to load + +Normally, supporting U-Boot's features is trivial, since the devicetree compiler +(dtc) can compile the source, including any U-Boot pieces. So the burden is +extremely low. + +In this case, the devicetree in the other project must track U-Boot's use of +device tree, so that it remains compatible. See `Devicetree in another project`_ +for reasons why. + +If a particular version of the project is needed for a particular version of +U-Boot, that must be documented in both projects. + +Further, it must provide a way to add configuration and other information to +the devicetree for use by U-Boot, such as the `/config` node and the tags used +by driver model. Note that the U-Boot in-tree devicetree must be sufficient to +build and boot, so this is not a way to bypass that requirement. + +More specifically, tooling or command-line arguments must provide a way to +add a `/config` node or items within that node, so that U-Boot can receive a +suitable configuration. It must provide a way of adding `u-boot,dm-...` tags for +correct operation of driver model. These options can then be used as part of the +build process, which puts the firmware image together. For binman, a way must be +provided to add the binman definition into the devicetree in the same way. + +One way to do this is to allow a .dtsi file to be merged in with the generated +devicetree. + +Note that the burden goes both ways. If a new feature is added to U-Boot which +needs support in another project, then the author of the U-Boot patch must add +any required support to the other project. + + +Passing the devicetree through to Linux +--------------------------------------- + +Ideally U-Boot and Linux use the same devicetree source, even though it is +hosted in separate projects. U-Boot adds some extra pieces, such as the +`config/` node and tags like `u-boot,dm-spl`. Linux adds some extra pieces, such +as `linux,default-trigger` and `linux,code`. This should not interfere with +each other. + +In principle it is possible for U-Boot's control devicetree to be passed to +Linux. This is, after all, one of the goals of devicetree and the original +Open Firmware project, to have the firmware provide the hardware description to +the Operating System. + +For boards where this approach is used, care must be taken. U-Boot typically +needs to 'fix up' the devicetree before passing it to Linux, e.g. to add +information about the memory map, about which serial console is used, provide +the kernel address space layout randomization (KASLR) seed or select whether the +console should be silenced for a faster boot. + +Fix-ups involve modifying the devicetree. If the control devicetree is used, +that means the control devicetree could be modified, while U-Boot is using it. +Removing a device and reinserting it can cause problems if the devicetree offset +has changed, for example, since the device will be unable to locates its +devicetree properties at the expected devicetree offset, which is a fixed +integer. + +To deal with this, it is recommended to employ one or more of the following +approaches: + +- Make a copy of the devicetree and 'fix up' the copy, leaving the control + devicetree alone +- Enable `CONFIG_OF_LIVE` so that U-Boot makes its own copy of the devicetree + during relocation; fixups then happen on the original flat tree +- Ensure that fix-ups happen after all loading has happened and U-Boot has + completed image verification + +In practice,the last point is typically observed, since boot_prep_linux() is +called just before jumping to Linux, long after signature verification, for +example. But it is important to make sure that this line is not blurred, +particularly if untrusted user data is involved. + + +Devicetree use cases that must be supported +------------------------------------------- + +Regardless of how the devicetree is provided to U-Boot at runtime, various +U-Boot features must be fully supported. This section describes some of these +features and the implications for other projects. + +If U-Boot uses its own in-tree devicetree these features are supported +automatically. + + +Signing with U-Boot devicetree +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +U-Boot supports signing a payload so that it can be verified to have been +created by a party owning a private key. This is called verified boot in U-Boot +(see doc/uImage.FIT/verified-boot.txt). + +Typically this works by creating a FIT and then running the `mkimage` tool to +add signatures for particular images. As part of this process, `mkimage` writes +a public key to the U-Boot devicetree, although this can be done separately. +See fdt_add_pubkey_ for patches for a suitable tool, for example. + +As with all configuration information, if another project is providing the +devicetree to U-Boot, it must provide a way to add this public key into the +devicetree it passes to U-Boot. This could be via a tooling option, making use +of `mkimage`, or allowing a .dtsi file to be merged in with what is generated in +the other project. + + +Providing the binman image definition +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In complex systems U-Boot must locate and make use of other firmware components, +such as images for the user interface, files containing peripheral firmware, +multiple copies of U-Boot for use with A/B boot, etc. U-Boot uses +:doc:`Binman <../package/binman>` as a standard way of putting an image +together. + +Typically this works by running binman with the devicetree as an input, to +create the file image. Binman then outputs an updated devicetree which is +packed in the firmware image, so U-Boot can access the binman definition and +locate all the components. + +As with all configuration information, if another project is providing the +devicetree to U-Boot, it must provide a way to add this binman definition into +the devicetree it passes to U-Boot. This could be via a tooling option, making +use of `binman`, or alowing a .dtsi file to be merged in with what is generated +in the other project. + + +Protecting the devicetree +------------------------- + +U-Boot relies heavily on devicetree for correct operation. A corrupt or invalid +device can cause U-Boot to fail to start, behave incorrectly, crash (e.g. if +`CONFIG_OF_LIBFDT_ASSUME_MASK` is adjusted, or fail to boot an Operating System. +Within U-Boot, the devicetree is as important as any other part of the source +code. At ruuntime, the devicetree can be considered to be structured rodata. + +With secure systems, care must be taken that the devicetree is valid: + +- If the code / rodata has a hash or signature, the devicetree should also, if + they are packaged separately. +- If the code / rodata is write-protected when running, the devicetree should be + also. Note that U-Boot relocates its code and devicetree, so this is not as + simple as it sounds. U-Boot must write-protect these items after relocating. + + +Why does U-Boot have its nodes and properties? +---------------------------------------------- + +See also :doc:`../devicetree/intro`. + +There has been pushback at the concept that U-Boot dares have its own nodes and +properties in the devicetree. + +Apart from these nodes and properties, U-Boot uses the same bindings as Linux. +A `u-boot.dtsi` file helps to keep U-Boot-specific changes in separate files, +making it easier to keep devicetree source files in U-Boot in sync with Linux. + +As a counter-example, the Zephyr OS project takes a different approach. It uses +entirely different bindings, in general, making no effort to sync devicetree +source files with Linux. U-Boot strives to be compatible with Linux in a number +of ways, such as source code style and common APIs, to aid porting of code +between the projects. Devicetree is another way where U-Boot and Linux follow a +similar approach. + +Fundamentally, the idea that U-Boot cannot have its own tags flies in the face +of the devicetree specification (see dtspec_), which says: + + Nonstandard property names should specify a **unique string prefix**, such as + a stock ticker symbol, identifying the name of the company **or organization** + that defined the property. Examples: + + - fsl,channel-fifo-len + - ibm,ppc-interrupt-server#s + - **linux**,network-index + +It is also fundamentally unbalanced. Linux has many tags of its own (some 36 in +version 5.13) and at least one Linux-specific node, even if you ignore things +like flash partitions which clearly provide configuration information to Linux. + +Practically speaking there are many reasons why U-Boot has its own nodes and +properties. Some examples: + +- Binding every device before relocation even if it won't be used, consumes time + and memory: tags on each node can specify which are needed in SPL or before + relocation. Linux has no such constraints. + +- Requiring the full clock tree to be up and running just to get the debug UART + running is inefficient. It is also and self-defeating, since if that much + code is working properly, you probably don't need the debug UART. A devicetree + property to provide the UART input-clock frequency is a simple solution. + +- U-Boot does not have a user space to provide policy and configuration. It + cannot do what Linux does and run programs and look up filesystems to figure + out how to boot. + + +Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.
Quoted 8 lines
doc/develop/devicetree/dt_update.rst line 540
Quoted 5 lines
doc/develop/devicetree/dt_update.rst new file +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.
Can you provided a link and I can update this.
Quoted 3 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.
I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees. But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you". If there is a use case for that, please can you be specific about what we cannot do with a combined devicetree?
Regards,
Simon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Quoted 873 lines · Simon Glass
Hi François,
Quoted 16 lines · François Ozog
Hi Simon,
Quoted 12 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.Signed-off-by Simon Glass <[email protected]>Reviewed-by Marcel Ziswiler <[email protected]>---
This patch attracted quite a bit of discussion here:https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 4 lines
Quoted 4 lines
I have not included the text suggested by François. While I agree that it would be useful to have an introduction in this space, I do not agree that we should have two devicetrees or that U-Boot should not have its
own
Quoted 1 line
Quoted 1 line
things in the devicetree, so it is not clear to me what we should
actually
Quoted 11 lines
Quoted 11 lines
write.
The 'Devicetree Control in U-Boot' docs were recently merged and these provide some base info, for now.
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemuQuoted 3 lines
Quoted 3 lines
Changes in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specificthings
Quoted 10 lines
Quoted 10 lines
- Move to doc/develop/devicetree now that
OF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the samedevicetree
Quoted 10 lines
Quoted 10 lines
in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Quoted 6 lines
Review
Quoted 6 lines
doc/develop/devicetree/dt_update.rst | 556 +++++++++++++++++++++++++++ doc/develop/devicetree/index.rst | 1 + 2 files changed, 557 insertions(+) create mode 100644 doc/develop/devicetree/dt_update.rst(quoted diff) +0
-0
b/doc/develop/devicetree/dt_update.rstQuoted 11 lines
doc/develop/devicetree/dt_update.rst line 6
Quoted 11 lines
new file mode 100644
index 00000000000..3d4902e3592doc/develop/devicetree/dt_update.rst new file +6
-0@@ -0,0 +1,556 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Updating the devicetree +======================= + +U-Boot uses devicetree for runtime configuration and storing requiredblobs or
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 8
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+any other information it needs to operate. This is called the 'control' +devicetree since it controls U-Boot. It is possible to update thecontrol
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 9
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+devicetree separately from actually building U-Boot. This provides agood degree
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 10
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+of control and flexibility for firmware that uses U-Boot inconjunction with
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+other project. + +There are many reasons why it is useful to modify the devicetree afterbuilding
Quoted 8 lines
doc/develop/devicetree/dt_update.rst
Quoted 8 lines
doc/develop/devicetree/dt_update.rst new file +8
-0+it: + +- Configuration can be changed, e.g. which UART to use +- A serial number can be added +- Public keys can be added to allow image verification +- Console output can be changed (e.g. to select serial or vidconsole) + +This section describes how to work with devicetree to accomplish yourgoals.
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 23
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ +See also :doc:`../devicetree/control` for a basic summary of theavailable
Quoted 7 lines
doc/develop/devicetree/dt_update.rst
Quoted 7 lines
doc/develop/devicetree/dt_update.rst new file +7
-0+features. + + +Devicetree source +----------------- + +Every board in U-Boot must include a devicetree sufficient to buildand boot
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 31
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+that board on suitable hardware (or emulation). This is specifiedusing the
Quoted 7 lines
doc/develop/devicetree/dt_update.rst
Quoted 7 lines
doc/develop/devicetree/dt_update.rst new file +7
-0+`CONFIG DEFAULT_DEVICE_TREE` option. + + +Current situation (October 2021) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As an aside, at present U-Boot allows `CONFIG_DEFAULT_DEVICE_TREE` tobe empty,
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 39
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+e.g. if `CONFIG_OF_BOARD` is used. This has unfortunately created anenormous
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 40
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+amount of confusion and some wasted effort. This was not intended.Support for
Quoted 7 lines
doc/develop/devicetree/dt_update.rst
Quoted 7 lines
doc/develop/devicetree/dt_update.rst new file +7
-0+an empty `CONFIG_DEFAULT_DEVICE_TREE` will be dropped soon. + +Some of the problems created are: + +- It is not obvious that the devicetree is coming from another project + +- There is no way to see even a sample devicetree for these platformin U-Boot,
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 48
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ so it is hard to know what is going on, e.g. which devices aretypically
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ present + +- The other project may not provide a way to support U-Boot'srequirements for
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 52
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ devicetree, such as the /config node. Note: On the U-Boot mailinglinst, this
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ was only discovered after weeks of discussion and confusion + +- For QEMU specifically, consulting two QEMU source files is required,for which
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 56
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ there are no references in U-Boot documentation. The code isgenerating a
Quoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+ devicetree, but it is not clear what controls affect this generation. + +Specifically on the changes in U-Bootm `CONFIG_OF_BOARD` was added in +rpi_patch_ for Raspberry Pi, which does have an in-tree devicetree,but this
Quoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+feature has since been used for boards that don't + +Once this bug is fixed, CONFIG_OF_BOARD will override (at runtime) the +evicetree suppled with U-Boot, but will otherwise use
CONFIG_OF_SEPARATEfor theQuoted 1 line
doc/develop/devicetree/dt_update.rst line 65
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+in-tree build. So these two will become options, moving out of the'choice' in
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+`dts/Kconfig`. + +This means that there is a basic devicetree build in the U-Boot tree,for
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 69
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+build-testing, consistency and documentation purposes, but at runtimeU-Boot can
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 70
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+accept its devicetree from another source. The in-tree devicetree maycontain
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 71
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+U-Boot-specific features (in u-boot*.dtsi files) and this may proveuseful for
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 72
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+the other project, so it can ensure that U-Boot functions correctlyand supports
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+all its expected features. + +To be clear, while U-Boot has its own copy of the devicetree sourcefor each
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 77
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+board, this must match the Linux source, perhaps with some u-boot.dtsi +additions. The intent here is not to create a separate binding, justto provide
Quoted 6 lines
Quoted 6 lines
doc/develop/devicetree/dt_update.rst new file +6
-0+a representative devicetree in U-Boot. + +Offending boards are: + +- rpi_4 and rpi_4_32b (other rpi boards do have an in-tree devicetree) +- qemu_arm64Quoted 8 lines
doc/develop/devicetree/dt_update.rst
Quoted 8 lines
doc/develop/devicetree/dt_update.rst new file +8
-0+- qemu_arm +- qemu-ppce500 +- qemu-riscv32 +- qemu-riscv32_smode +- qemu-riscv64 +- qemu-riscv64_smode + +All of these need to have a devicetree added in-tree. This is targetedto be
Quoted 8 lines
doc/develop/devicetree/dt_update.rst
Quoted 8 lines
doc/develop/devicetree/dt_update.rst new file +8
-0+fixed in the 2022.01 release. + + +Building the devicetree +----------------------- + +U-Boot automatically builds the devicetree for a board, from the +`arch/<arch>/dts` directory. The Makefile in those directories hasrules for
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 100
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+building devicetree files. It is preferable to avoid target-specificrules in
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 101
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+those files: i.e. all boards for a particular SoC should be built atonce,
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 102
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+where practical. Apart from simplifying the Makefile, this helps toefficiently
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 103
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+(and immediately) ensure that changes in one board's DT do not breakothers that
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 104
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+are related. Building devicetrees is fast, so performance is seldom aconcern
Quoted 8 lines
doc/develop/devicetree/dt_update.rst
Quoted 8 lines
doc/develop/devicetree/dt_update.rst new file +8
-0+here. + + +Overriding the default devicetree +--------------------------------- + +When building U-Boot, the `DEVICE_TREE` environment variable allows the +default devicetree file to be overridden at build time. This can beuseful if
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 113
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+modifications have to be made to the in-tree devicetree file, for thebenefit
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 115
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+of a downstream build system. Note that the in-tree devicetree must be +sufficient to build and boot, so this is not a way to bypass thatrequirement.
Quoted 6 lines
doc/develop/devicetree/dt_update.rst
Quoted 6 lines
doc/develop/devicetree/dt_update.rst new file +6
-0+ + +Modifying the devicetree after building +--------------------------------------- + +While it is generally painful and hacky to modify the code or rodataof a
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 122
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+program after it is built, in many cases it is useful to do so, e.g.to add
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 123
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+configuration information like serial numbers, enabling/disablingfeatures, etc.
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ +Devicetree provides a very nice solution to these problems since it is +structured data and it is relatively easy to change it, even in binaryform
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+(see fdtput). + +U-Boot takes care that the devicetree is easily accessible after thebuild
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 130
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+process. In fact it is placed in a separate file called `u-boot.dtb`.If the
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 131
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+build system wants to modify or replace that file, it can do so. Thenall that
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 132
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+is needed is to run `binman update` to update the file inside theimage. If
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 133
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+binman is not used, then `u-boot-nodtb.bin` and the new `u-boot.dtb`can simply
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 134
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+be concatenated to achieve the desired result. U-Boot happily copeswith the
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+devicetree growing or shrinking. + +The `u-boot.bin` image contains both pieces. While it is possible tolocate the
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 138
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+devicetree within the image using the signature at the start of thefile, this
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+is a bit messy. + +This is why `CONFIG_OF_SEPARATE` should always be used when buildingU-Boot.
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 142
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+The `CONFIG_OF_EMBED` option embeds the devicetree somewhere in theU-Boot ELF
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 143
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+image as rodata, meaning that it is hard to find it and it cannotincrease in
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+size. + +When modifying the devicetree, the different cases to consider are asfollows:
Quoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+ +- CONFIG_OF_SEPARATE + This is easy, described above. Just change, replace or rebuild the + devicetree so it suits your needs, then rerun binman or redo the
catQuoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+ operation to join `u-boot-nodtb.bin` and the new `u-boot.dtb` + +- CONFIG_OF_EMBED + This is tricky, since the devicetree cannot easily be located. Ifthe EFL
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 155
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ file is available, then the _dtb_dt_begin and __dtb_dt_end symbolscan be
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 156
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ examined to find it. While it is possible to contract the file, itis not
Quoted 5 lines
doc/develop/devicetree/dt_update.rst
Quoted 5 lines
doc/develop/devicetree/dt_update.rst new file +5
-0+ possible to expand the file since that would involve re-linking + +- CONFIG_OF_BOARD + This is a board-specific situation, so needs to be considered on a + case-by-case base. The devicetree must be modified so that thecorrect
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 163
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ one is provided to U-Boot. How this is done depends entirely on the + implementation of this option for the board. It might requireinjecting the
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 164
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ changes into a different project somehow using tooling availablethere, or
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 165
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ it might involve merging an overlay file at runtime to obtain thedesired
Quoted 7 lines
doc/develop/devicetree/dt_update.rst
Quoted 7 lines
doc/develop/devicetree/dt_update.rst new file +7
-0+ result. + + +Use of U-Boot /config node +-------------------------- + +A common problem with firmware is that many builds are needed to dealwith the
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 173
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+slight variations between different, related models. For example, onemodel may
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 174
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+have a TPM and another may not. Devicetree provides an excellentsolution to
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 175
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+this problem, in that the devicetree to actually use on a platform canbe
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 176
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+injected in the factory based on which model is being manufactured atthe time.
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 178
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ +A related problem causing build proliferation is dealing with thedifferences
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 179
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+between development firmware, developer-friendly firmware (e.g. withall
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 180
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+security features present but with the ability to access the commandline),
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 181
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+test firmware (which runs tests used in the factory), final productionfirmware
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 182
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+(before signing), signed firmware (where the signatures have beeninserted) and
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 183
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+the like. Ideally all or most of these should use the same U-Bootbuild, with
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 184
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+just some options to determine the features available. For example,being able
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 185
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+to control whether the UART console or JTAG are available, on anyimage, is a
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+great debugging aid. + +When the firmware consists of multiple parts, it is helpful that alloperate
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 189
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+the same way at runtime, regardless of how they were built. This canbe achieved
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 190
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+by passing the runtime configuration (e.g. 'enable UART console) alongthe chain
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 191
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+through each firmware stage. It is frustrating to have to replicate abug on
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 192
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+production firmware which does happen on developer firmware, becausethey are
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+completely different builds. + +The /config node provides useful functionality for this. It allows thedifferent
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 196
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+controls to be 'factored out' of the U-Boot binary, so they can becontrolled
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 197
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+separately from the initial source-code build. The node can be easilyupdated by
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 198
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+a build or factory tool and can control various features in U-Boot. Itis
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 199
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+similar in concept to a Kconfig option, except that it can be changedafter
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+U-Boot is built. + +The /config node is similar in concept to the `/chosen node`_ exceptthat it is
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 204
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+for passing information *into* firmware instead of from firmware to the +Operating System. Also, while Linux has a (sometimes extremely long)command
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 205
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+line, U-Boot does not support this. The devicetree provides a morestructured
Quoted 7 lines
doc/develop/devicetree/dt_update.rst
Quoted 7 lines
doc/develop/devicetree/dt_update.rst new file +7
-0+approach in any case. + + +Devicetree in another project +----------------------------- + +In some cases U-Boot receive its devicetree at runtime from a programthat calls
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 213
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+it. For example ARM's Trusted Firmware A (`TF-A`_) may have adevicetree that it
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 214
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+passes to U-Boot. This overrides any devicetree build by U-Boot. Whenpackaging
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 215
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+the firmware, the U-Boot devicetree may in fact be left out if it canbe
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+guaranteed that it will receive one from another project. + +In this case, the devicetree in the other project must track U-Boot'suse of
Quoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+device tree, for the following reasons: + +- U-Boot only has one devicetree. See `Why not have two devicetrees?`_. +- For a consistent firmware build, decisions made in early stagesshould be
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 223
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ communicated to later ones at runtime. For example, if the serialconsole is
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 225
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ enabled in an early stage, it should be enabled in U-Boot too. +- U-Boot is quite capable of managing its own copy of the devicetree.If
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 226
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ another project wants to bypass this (often for good reason), it isreasonable
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 227
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ that it should take on the (fairly small) requirements that U-Bootfeatures
Quoted 2 lines
doc/develop/devicetree/dt_update.rst line 229
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ that rely on devicetree are still available +- The point here is not that *U-Boot needs this extra node*, or*U-Boot needs
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 230
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ to have this public key*. These features are present in U-Boot inservice of
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 231
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ the entire firmware system. If the U-Boot features are used, butcannot be
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 232
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ supported in the normal way, then there is pressure to implementthese
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 233
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ features in other ways. In the end, we would have a differentmechanism for
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 234
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ every other project that uses U-Boot. This introduces duplicate waysof doing
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 235
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ the same thing, needlessly increases the complexity of the U-Bootsource code,
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 236
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ forces authors to consider parallel implementations when writing newfeatures,
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 237
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ makes U-Boot harder to test, complicates documentation and confusesthe
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 238
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ runtime flow of U-Boot. If every board did things its own way ratherthan
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 239
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+ contributing to the common code, U-Boot would lose a lot of itscross-platform
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ value. + +The above does not indicate *bad design* within U-Boot. Devicetree isa core
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 243
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+component of U-Boot and U-Boot makes use of it to the full. It solvesa myriad
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 244
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+of problems that would otherwise need their own special C struct,binary format,
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+special property, tooling for viewing and updating, etc. + +Specifically, the other project must provide a way to addconfiguration and
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 248
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+other information to the devicetree for use by U-Boot, such as the/config node.
Quoted 1 line
doc/develop/devicetree/dt_update.rst line 249
Quoted 1 line
doc/develop/devicetree/dt_update.rst new file +1
-0+Note that the U-Boot in-tree devicetree source must be sufficient tobuild and
433 lines not shown · raw message
Quoted 9 lines
7 lines not shown · raw message
47 lines not shown · raw message
Part of this message is not shown here. View the raw message.
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi François,
Quoted 18 lines · François Ozog
Quoted 14 lines · Simon Glass
Hi François,
Quoted 10 lines · François Ozog
Hi Simon,
Quoted 6 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.
[..]
Quoted 71 lines
Quoted 63 lines
Quoted 54 lines
Quoted 54 lines
doc/develop/devicetree/dt_update.rst new file +54
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.Quoted 8 lines
doc/develop/devicetree/dt_update.rst line 540
Quoted 5 lines
doc/develop/devicetree/dt_update.rst new file +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.Quoted 1 line
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Bindings:
for FCONF: https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
for FF-A: https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
For chain-of-trust: https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.html
Quoted 4 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
From there you can wander and see how dynamic config sections of the FIP can contain component specific DTs. U-Boot "private" DT could be securely stored inNT_FW_CONFIGsection.
OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification: this is the associated content certificate section that contains the valid hashes).
What does NT mean? I suppose FW means firmware.
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
Quoted 4 lines
Quoted 4 lines
If there
is a use case for that, please can you be specific about what we cannot do with a combined devicetree?
Regards,
SImon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Simon,
Quoted 140 lines · Simon Glass
Hi François,
Quoted 8 lines · François Ozog
Quoted 4 lines · Simon Glass
Hi François,
On Tue, 26 Oct 2021 at 08:31, François Ozog <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Hi Simon,
Quoted 2 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in
U-Boot
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having itsown nodes and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+properties, another idea proposed is to have two devicetrees, one
for the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+U-Boot-specific bits (here called
special) and one for everythingelse (here
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+called `linux`). + +On the positive side, it might quieten the discussion alluded to inthe section
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+above. But there are many negatives to consider and many open
questions to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+resolve. + +- **Bindings** - Presumably the special devicetree would have itsown bindings.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ It would not be necessary to put a
u-boot,prefix on anything.People coming
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ across the devicetree source would wonder how it fits in with the
Linux
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing thedevicetree. This
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would need to be expanded to support two trees. Features which
need to access
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ both (such as a device driver which reads the special devicetree
to get some
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ configuration info) could become quite confusing to read and
write.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Merging** - Can the two devicetree be merged if a platformdesires it? If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ so, how is this managed in tooling? Does it happen during the
build, in which
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ case they are not really separate at all. Or does U-Boot merge
them at
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and morecode paths. It
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ requires that both be made available to the code in U-Boot, e.g.
via a
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ separate pointer or argument or API. Overall the separation would
certainly
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide thepieces needed for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ U-Boot for a particular board. Would we use these same files for
the special
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ devicetree? + +- **Complexity** - Two devicetrees complicates the build systemsince it must
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ build and package them both. Errors must be reported in such a
way that it
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used bydriver model
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ are currently placed in the nodes they relate to. How would these
tags
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ reference a node that is in a separate devicetree? What extra
validation would
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ be needed? + +- **Storage** - How would the two devicetrees be stored in theimage? At present
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ we simply concatenate the U-Boot binary and the devicetree. We
could add the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ special devicetree before the Linux one, so two are concatenated,
but it is
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ not pretty. We could use binman to support more complex
arrangements, but only
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree filesto U-Boot at
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ runtime? Presumably this would just be too painful. But if it
doesn't, it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would be unable to configure run-time features of U-Boot during
the boot.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Confusion** - No other project has two devicetrees. U-Bootwould be in the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ unfortunate position of having to describe this fact to new
users, along with
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
doc/develop/devicetree/dt_update.rst line 540
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDTobjects, some for "dynamic" configuration purposes.
Quoted 4 lines
Quoted 2 lines
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Quoted 2 lines
Bindings:
for FCONF:https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
Quoted 1 line
for FF-A:
https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
Quoted 1 line
For chain-of-trust:
https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.html
Quoted 3 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
Quoted 8 lines
Quoted 1 line
From there you can wander and see how dynamic config sections of the FIP
can contain component specific DTs.
Quoted 1 line
U-Boot "private" DT could be securely stored in
NT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device
trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
- the one that it gets from the FIP and contains runtime configuration parameters, accessed through FCONF library)
Quoted 31 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in
addition to operating system
Quoted 1 line
Quoted 1 line
Quoted 1 line
As Ilias said, this is not about documentation about the current use
of DT in U-Boot, but justification of your views on DT.
Quoted 1 line
Quoted 1 line
Quoted 1 line
If taken by the letter, I feel (may be wrong though) that your views
prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.
Quoted 6 lines
Quoted 4 lines
I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be
passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
OK good.
Quoted 8 lines
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of aFIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification:
this is the associated content certificate section that contains the valid hashes).What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world. It feels unfortunate to say non trusted while it is trusted but running outside secure world ;-)
Quoted 10 lines
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to
propose text.
Quoted 6 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running on
other micro-controllers of a board.
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will have to deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world).
So in a word, trying to do this is a big undertaking, but you can try. In a short term future (see Alibaba and Marvell announcements) you will have to deal with Arm v9 realms and associated firmware.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
If there
is a use case for that, please can you be specific about what we cannot do with a combined devicetree?Regards,
SImon
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi François,
Quoted 138 lines · François Ozog
Hi Simon,
Quoted 96 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 14 lines · Simon Glass
Hi François,
Quoted 10 lines · François Ozog
Hi Simon,
Quoted 6 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 71 lines
Quoted 63 lines
Quoted 54 lines
Quoted 54 lines
doc/develop/devicetree/dt_update.rst new file +54
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.Quoted 8 lines
doc/develop/devicetree/dt_update.rst line 540
Quoted 5 lines
doc/develop/devicetree/dt_update.rst new file +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.Quoted 1 line
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Bindings:
for FCONF: https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
for FF-A: https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
For chain-of-trust: https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.htmlQuoted 8 lines
Quoted 4 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
From there you can wander and see how dynamic config sections of the FIP can contain component specific DTs. U-Boot "private" DT could be securely stored inNT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
- the one that it gets from the FIP and contains runtime configuration parameters, accessed through FCONF library)Quoted 25 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
Quoted 8 lines
Quoted 5 lines
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification: this is the associated content certificate section that contains the valid hashes).What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world.
It feels unfortunate to say non trusted while it is trusted but running outside secure world ;-)
OK, good, so long as it doesn't mean Windows NT I am happy.
Quoted 10 lines
Quoted 9 lines
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to propose text.
I mean add an entry type to binman for FIP. It supports CBFS already, for example.
Quoted 11 lines
Quoted 7 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running on other micro-controllers of a board.
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will have to deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world). So in a word, trying to do this is a big undertaking, but you can try.
Binman supports adding firmware for microcontrollers. For example, see here:
https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/dts/flashmap-16mb-x86-rw.dtsi#L64
That is a Chrome OS EC binary, one of three in the image.
This is not ARM-specific. That image is actually for x86 Apollo Lake.
Quoted 1 line
In a short term future (see Alibaba and Marvell announcements) you will have to deal with Arm v9 realms and associated firmware.
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
If there
is a use case for that, please can you be specific about what we cannot do with a combined devicetree?
Regards,
SImon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Quoted 187 lines · Simon Glass
Hi François,
Quoted 138 lines · François Ozog
Hi Simon,
Quoted 96 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 14 lines · Simon Glass
Hi François,
Quoted 10 lines · François Ozog
Hi Simon,
Quoted 6 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 71 lines
Quoted 63 lines
Quoted 54 lines
Quoted 54 lines
(quoted diff) +54
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.Quoted 1 line
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Bindings:
for FCONF: https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
for FF-A: https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
For chain-of-trust: https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.htmlQuoted 8 lines
Quoted 4 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
From there you can wander and see how dynamic config sections of the FIP can contain component specific DTs. U-Boot "private" DT could be securely stored inNT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
- the one that it gets from the FIP and contains runtime configuration parameters, accessed through FCONF library)Quoted 25 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
Quoted 8 lines
Quoted 5 lines
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification: this is the associated content certificate section that contains the valid hashes).What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world.
It feels unfortunate to say non trusted while it is trusted but running outside secure world ;-)OK, good, so long as it doesn't mean Windows NT I am happy.
Quoted 10 lines
Quoted 9 lines
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to propose text.
I mean add an entry type to binman for FIP. It supports CBFS already, for example.
Quoted 11 lines
Quoted 7 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running on other micro-controllers of a board.
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will have to deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world). So in a word, trying to do this is a big undertaking, but you can try.Binman supports adding firmware for microcontrollers. For example, see here:
https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/dts/flashmap-16mb-x86-rw.dtsi#L64
That is a Chrome OS EC binary, one of three in the image.
This is not ARM-specific. That image is actually for x86 Apollo Lake.
Quoted 8 lines
Quoted 1 line
In a short term future (see Alibaba and Marvell announcements) you will have to deal with Arm v9 realms and associated firmware.
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8 efi_loader: selftest: enable APPEND_WRITE tests 3fc2b16335721 cmd: bootefi: carve out efi_selftest code from do_bootefi() 1170fee695197 efi_selftest: fix variables test for GetNextVariableName() ce62b0f8f45f1 test/py: Fix efidebug related tests450596f2ac3fd test/py: efi_capsule: test for FIT image capsule de489d82e3189 test: test the ESRT creation57be8cdce35 test/py: efi_secboot: small rework for adding a new test e1174c566a61c test/py: efi_secboot: add test for intermediate certificates 479ab6c17eda7 efi_selftest: add selftests for loadfile2 used to load initramfs
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Regards
/Ilias
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Ilias,
Quoted 219 lines · Ilias Apalodimas
Quoted 187 lines · Simon Glass
Hi François,
Quoted 138 lines · François Ozog
Hi Simon,
Quoted 96 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 14 lines · Simon Glass
Hi François,
Quoted 10 lines · François Ozog
Hi Simon,
Quoted 6 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 71 lines
Quoted 63 lines
Quoted 54 lines
Quoted 54 lines
(quoted diff) +54
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.Quoted 1 line
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Bindings:
for FCONF: https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
for FF-A: https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
For chain-of-trust: https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.htmlQuoted 8 lines
Quoted 4 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
From there you can wander and see how dynamic config sections of the FIP can contain component specific DTs. U-Boot "private" DT could be securely stored inNT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
- the one that it gets from the FIP and contains runtime configuration parameters, accessed through FCONF library)Quoted 25 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
Quoted 8 lines
Quoted 5 lines
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification: this is the associated content certificate section that contains the valid hashes).What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world.
It feels unfortunate to say non trusted while it is trusted but running outside secure world ;-)OK, good, so long as it doesn't mean Windows NT I am happy.
Quoted 10 lines
Quoted 9 lines
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to propose text.
I mean add an entry type to binman for FIP. It supports CBFS already, for example.
Quoted 11 lines
Quoted 7 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running on other micro-controllers of a board.
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will have to deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world). So in a word, trying to do this is a big undertaking, but you can try.Binman supports adding firmware for microcontrollers. For example, see here:
https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/dts/flashmap-16mb-x86-rw.dtsi#L64
That is a Chrome OS EC binary, one of three in the image.
This is not ARM-specific. That image is actually for x86 Apollo Lake.
Quoted 8 lines
Quoted 1 line
In a short term future (see Alibaba and Marvell announcements) you will have to deal with Arm v9 realms and associated firmware.
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfs
Quoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
I'm sorry if you find this a bit sharp. But someone needs to be pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that? I am very happy to help and provide part of the solution, but it needs a shared vision.
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
Regards,
Simon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Simon,
[...]
Quoted 29 lines
Quoted 29 lines
Quoted 7 lines
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfs
Quoted 8 lines
Quoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into
There's no pushback at all, apart from the TPM one. (and for a very good
reason I've explained over and over again). In fact we add the sefltests
as part of our patchsets.
Quoted 6 lines
the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
I guess you mean [1]. I've lost count of how many times I responded to this. Threads [2], [3] and [4] are just a few examples, so I just got tired or replying the same thing over and over.
So bottom line, we are contributing selftests as always, we just don't agree with the way *you* want this specific TPM test, trying to force us into sandbox. So instead of respecting what we have (which btw is acceptable from u-boot's perspective and cleans up a lot of the TPM crud along the way), you went ahead making misleading statements on the selftests we contribute, in general. What's even more annoying is that, as I showed you, we pretty much add a selftest for *every* feature we add. Excellent ... that's certainly ... encouraging ... and very productive.
Quoted 5 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
Of course I disagree. People decided not to use SPL for their own reasons. I am certainly not qualified to answer why Arm choose to do that, but it seems to be common nowdays (risc-v/OpenSBI). All Linaro is doing is making sure U-Boot is compatible and remains the de-facto choice for embedded boot loaders playing nicely with all the new FSBLs come up with. If you cosinder SPL and U-Boot the center of the known universe, we certainly view things differently. FWIW it's *our* work mostly that made U-Boot SystemReady compliant, which is something Arm pushes for [5].
Quoted 1 line
I'm sorry if you find this a bit sharp.
Which part? The first one wrt to selftests is not sharp. It's manipulative and utterly unacceptable for me, not to mention entirely fabricated.
The latter on bootloading fragmentation, I am always happy to discuss.
Quoted 6 lines
But someone needs to be
pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that? I am very happy to help and provide part of the solution, but it needs a shared vision.
There's a TF-A mailing list, we can certainly engage there and try to align our ideas/designs.
Quoted 13 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
Quoted 7 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
Maybe, hopefully travelling will restart soon.
[1] https://lore.kernel.org/u-boot/CAPnjgZ2mmcUKz0v=ysSvf17c6ab++-hEpO4rc0OeeAEz7pFA2g@mail.gmail.com/
[2] https://lore.kernel.org/u-boot/[email protected]/
[3] https://lore.kernel.org/u-boot/CAC_iWjLWxPyEwPpG7v=1U1sxLOD4LXF+Vm+cGTHom9Mpz9pAgw@mail.gmail.com/
[4] https://lore.kernel.org/u-boot/[email protected]/
[5] https://www.arm.com/why-arm/architecture/systems/systemready-certification-program/ir?_ga=2.140829686.578781084.1635493248-857780164.1580291819
Regards
/Ilias
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Quoted 39 lines · Ilias Apalodimas
Hi Simon,
[...]
Quoted 35 lines
Quoted 34 lines
Quoted 7 lines
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfsand I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Quoted 6 lines
Quoted 2 lines
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into
There's no pushback at all, apart from the TPM one. (and for a very good
reason I've explained over and over again). In fact we add the sefltests
as part of our patchsets.
And, for that set of TPM things, I agree with NOT making sandbox the requirement there. As QEMU is able to provide a TPM that will see real world usage, that's what we need to validate against primarily.
Quoted 26 lines
Quoted 6 lines
the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
I guess you mean [1]. I've lost count of how many times I responded to this. Threads [2], [3] and [4] are just a few examples, so I just got tired or replying the same thing over and over.
So bottom line, we are contributing selftests as always, we just don't agree with the way *you* want this specific TPM test, trying to force us into sandbox. So instead of respecting what we have (which btw is acceptable from u-boot's perspective and cleans up a lot of the TPM crud along the way), you went ahead making misleading statements on the selftests we contribute, in general. What's even more annoying is that, as I showed you, we pretty much add a selftest for *every* feature we add. Excellent ... that's certainly ... encouraging ... and very productive.
Quoted 5 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
Quoted 8 lines
Of course I disagree. People decided not to use SPL for their own reasons. I am certainly not qualified to answer why Arm choose to do that, but it seems to be common nowdays (risc-v/OpenSBI). All Linaro is doing is making sure U-Boot is compatible and remains the de-facto choice for embedded boot loaders playing nicely with all the new FSBLs come up with. If you cosinder SPL and U-Boot the center of the known universe, we certainly view things differently. FWIW it's *our* work mostly that made U-Boot SystemReady compliant, which is something Arm pushes for [5].
Let me say for the record that I am appreciative of the fact the Linaro has been putting so much effort in to U-Boot, both in terms of tests and also in general SystemReady compliance work.
Signature · 1 line
Tom
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
In reply to Ilias ApalodimasHi Ilias,
Quoted 82 lines · Ilias Apalodimas
Hi Simon,
[...]
Quoted 29 lines
Quoted 29 lines
Quoted 7 lines
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfsQuoted 8 lines
Quoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into
There's no pushback at all, apart from the TPM one. (and for a very good
reason I've explained over and over again). In fact we add the sefltests
as part of our patchsets.Quoted 6 lines
the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
I guess you mean [1]. I've lost count of how many times I responded to this. Threads [2], [3] and [4] are just a few examples, so I just got tired or replying the same thing over and over.
So bottom line, we are contributing selftests as always, we just don't agree with the way *you* want this specific TPM test, trying to force us into sandbox. So instead of respecting what we have (which btw is acceptable from u-boot's perspective and cleans up a lot of the TPM crud along the way), you went ahead making misleading statements on the selftests we contribute, in general. What's even more annoying is that, as I showed you, we pretty much add a selftest for *every* feature we add. Excellent ... that's certainly ... encouraging ... and very productive.
Quoted 5 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
Of course I disagree. People decided not to use SPL for their own reasons. I am certainly not qualified to answer why Arm choose to do that, but it seems to be common nowdays (risc-v/OpenSBI). All Linaro is doing is making sure U-Boot is compatible and remains the de-facto choice for embedded boot loaders playing nicely with all the new FSBLs come up with. If you cosinder SPL and U-Boot the center of the known universe, we certainly view things differently. FWIW it's *our* work mostly that made U-Boot SystemReady compliant, which is something Arm pushes for [5].
Quoted 7 lines
Quoted 1 line
I'm sorry if you find this a bit sharp.
Which part? The first one wrt to selftests is not sharp. It's manipulative and utterly unacceptable for me, not to mention entirely fabricated.
The latter on bootloading fragmentation, I am always happy to discuss.
My comment was about the push-back I feel I have received when requesting tests. It was a poor choice of words since it suggests this is an ongoing problem when in fact many tests have been written. So I would like to withdraw that and I am sorry for saying that and for upsetting you. I certainly agree that Linaro has written lots of tests and this is great. Thank you to you and Linaro for that. The business of how the tests are written can be handled in other threads.
Quoted 27 lines
Quoted 7 lines
But someone needs to be
pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that? I am very happy to help and provide part of the solution, but it needs a shared vision.There's a TF-A mailing list, we can certainly engage there and try to align our ideas/designs.
Quoted 16 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Quoted 6 lines
Quoted 4 lines
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
Maybe, hopefully travelling will restart soon.
I think the whole issue in this thread comes down to a matter of alignment.
As you can tell, I am frustrated with where things are headed and hope we can course-correct at some point.
Regards,
Simon
Quoted 9 lines
[1] https://lore.kernel.org/u-boot/CAPnjgZ2mmcUKz0v=ysSvf17c6ab++-hEpO4rc0OeeAEz7pFA2g@mail.gmail.com/
[2] https://lore.kernel.org/u-boot/[email protected]/
[3] https://lore.kernel.org/u-boot/CAC_iWjLWxPyEwPpG7v=1U1sxLOD4LXF+Vm+cGTHom9Mpz9pAgw@mail.gmail.com/
[4] https://lore.kernel.org/u-boot/[email protected]/
[5] https://www.arm.com/why-arm/architecture/systems/systemready-certification-program/ir?_ga=2.140829686.578781084.1635493248-857780164.1580291819Regards
/Ilias
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Simon,
[...]
Quoted 86 lines
Quoted 78 lines
Quoted 30 lines
Quoted 30 lines
Quoted 8 lines
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfsQuoted 8 lines
Quoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into
There's no pushback at all, apart from the TPM one. (and for a very good
reason I've explained over and over again). In fact we add the sefltests
as part of our patchsets.Quoted 6 lines
the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
I guess you mean [1]. I've lost count of how many times I responded to this. Threads [2], [3] and [4] are just a few examples, so I just got tired or replying the same thing over and over.
So bottom line, we are contributing selftests as always, we just don't agree with the way *you* want this specific TPM test, trying to force us into sandbox. So instead of respecting what we have (which btw is acceptable from u-boot's perspective and cleans up a lot of the TPM crud along the way), you went ahead making misleading statements on the selftests we contribute, in general. What's even more annoying is that, as I showed you, we pretty much add a selftest for *every* feature we add. Excellent ... that's certainly ... encouraging ... and very productive.
Quoted 5 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
Of course I disagree. People decided not to use SPL for their own reasons. I am certainly not qualified to answer why Arm choose to do that, but it seems to be common nowdays (risc-v/OpenSBI). All Linaro is doing is making sure U-Boot is compatible and remains the de-facto choice for embedded boot loaders playing nicely with all the new FSBLs come up with. If you cosinder SPL and U-Boot the center of the known universe, we certainly view things differently. FWIW it's *our* work mostly that made U-Boot SystemReady compliant, which is something Arm pushes for [5].
Quoted 7 lines
Quoted 1 line
I'm sorry if you find this a bit sharp.
Which part? The first one wrt to selftests is not sharp. It's manipulative and utterly unacceptable for me, not to mention entirely fabricated.
The latter on bootloading fragmentation, I am always happy to discuss.
Quoted 7 lines
My comment was about the push-back I feel I have received when requesting tests. It was a poor choice of words since it suggests this is an ongoing problem when in fact many tests have been written. So I would like to withdraw that and I am sorry for saying that and for upsetting you. I certainly agree that Linaro has written lots of tests and this is great. Thank you to you and Linaro for that. The business of how the tests are written can be handled in other threads.
Thanks, I appreciate this. Let's just forget this ever happened. The discussions are usually constructive and I am happy with the general progress, despite of the differences of opinion.
Quoted 33 lines
Quoted 33 lines
Quoted 8 lines
But someone needs to be
pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that? I am very happy to help and provide part of the solution, but it needs a shared vision.There's a TF-A mailing list, we can certainly engage there and try to align our ideas/designs.
Quoted 20 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
Quoted 6 lines
Quoted 1 line
Maybe, hopefully travelling will restart soon.
I think the whole issue in this thread comes down to a matter of alignment.
As you can tell, I am frustrated with where things are headed and hope we can course-correct at some point.
This is a matter of perspective to me. I've accepted the fact that firmware gets more complex. Whether I personally like it or not is a different story. One thing that's clear to me though is that we either have to adapt, or slowly become irrelevant.
Thanks
/Ilias
Quoted 14 lines
Regards,
SimonQuoted 9 lines
[1] https://lore.kernel.org/u-boot/CAPnjgZ2mmcUKz0v=ysSvf17c6ab++-hEpO4rc0OeeAEz7pFA2g@mail.gmail.com/
[2] https://lore.kernel.org/u-boot/[email protected]/
[3] https://lore.kernel.org/u-boot/CAC_iWjLWxPyEwPpG7v=1U1sxLOD4LXF+Vm+cGTHom9Mpz9pAgw@mail.gmail.com/
[4] https://lore.kernel.org/u-boot/[email protected]/
[5] https://www.arm.com/why-arm/architecture/systems/systemready-certification-program/ir?_ga=2.140829686.578781084.1635493248-857780164.1580291819Regards
/Ilias
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Ilias,
Quoted 99 lines · Ilias Apalodimas
Hi Simon,
[...]
Quoted 86 lines
Quoted 78 lines
Quoted 30 lines
Quoted 30 lines
Quoted 8 lines
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfsQuoted 8 lines
Quoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into
There's no pushback at all, apart from the TPM one. (and for a very good
reason I've explained over and over again). In fact we add the sefltests
as part of our patchsets.Quoted 6 lines
the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
I guess you mean [1]. I've lost count of how many times I responded to this. Threads [2], [3] and [4] are just a few examples, so I just got tired or replying the same thing over and over.
So bottom line, we are contributing selftests as always, we just don't agree with the way *you* want this specific TPM test, trying to force us into sandbox. So instead of respecting what we have (which btw is acceptable from u-boot's perspective and cleans up a lot of the TPM crud along the way), you went ahead making misleading statements on the selftests we contribute, in general. What's even more annoying is that, as I showed you, we pretty much add a selftest for *every* feature we add. Excellent ... that's certainly ... encouraging ... and very productive.
Quoted 5 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
Of course I disagree. People decided not to use SPL for their own reasons. I am certainly not qualified to answer why Arm choose to do that, but it seems to be common nowdays (risc-v/OpenSBI). All Linaro is doing is making sure U-Boot is compatible and remains the de-facto choice for embedded boot loaders playing nicely with all the new FSBLs come up with. If you cosinder SPL and U-Boot the center of the known universe, we certainly view things differently. FWIW it's *our* work mostly that made U-Boot SystemReady compliant, which is something Arm pushes for [5].
Quoted 7 lines
Quoted 1 line
I'm sorry if you find this a bit sharp.
Which part? The first one wrt to selftests is not sharp. It's manipulative and utterly unacceptable for me, not to mention entirely fabricated.
The latter on bootloading fragmentation, I am always happy to discuss.
Quoted 7 lines
My comment was about the push-back I feel I have received when requesting tests. It was a poor choice of words since it suggests this is an ongoing problem when in fact many tests have been written. So I would like to withdraw that and I am sorry for saying that and for upsetting you. I certainly agree that Linaro has written lots of tests and this is great. Thank you to you and Linaro for that. The business of how the tests are written can be handled in other threads.
Quoted 3 lines
Thanks, I appreciate this. Let's just forget this ever happened. The discussions are usually constructive and I am happy with the general progress, despite of the differences of opinion.
OK thank you. Yes I agree.
Quoted 38 lines
Quoted 38 lines
Quoted 29 lines
Quoted 9 lines
But someone needs to be
pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that? I am very happy to help and provide part of the solution, but it needs a shared vision.There's a TF-A mailing list, we can certainly engage there and try to align our ideas/designs.
Quoted 16 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Quoted 6 lines
Quoted 4 lines
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas? I know you have made big efforts to engage, Ilias. We have spoken many times and I'm sure f2f would be easier.
Maybe, hopefully travelling will restart soon.
I think the whole issue in this thread comes down to a matter of alignment.
Quoted 7 lines
Quoted 2 lines
As you can tell, I am frustrated with where things are headed and hope we can course-correct at some point.
This is a matter of perspective to me. I've accepted the fact that firmware gets more complex. Whether I personally like it or not is a different story. One thing that's clear to me though is that we either have to adapt, or slowly become irrelevant.
I have a lot of ideas here and I think we can do much better, not just on ARM but Intel/AMD also.
I can't imagine how we could discuss these except in-person for a day or two with a whiteboard, so for now I will just let things ride.
Regards,
Simon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
In reply to Simon GlassHi Simon
(I keep getting messages about delivery problems so I don't know what went through or not)
Quoted 239 lines · Simon Glass
Hi Ilias,
Quoted 219 lines · Ilias Apalodimas
Quoted 187 lines · Simon Glass
Hi François,
Quoted 138 lines · François Ozog
Hi Simon,
Quoted 96 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 14 lines · Simon Glass
Hi François,
Quoted 10 lines · François Ozog
Hi Simon,
Quoted 6 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 71 lines
Quoted 63 lines
Quoted 54 lines
Quoted 54 lines
(quoted diff) +54
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.Quoted 1 line
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Bindings:
for FCONF: https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
for FF-A: https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
For chain-of-trust: https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.htmlQuoted 8 lines
Quoted 4 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
From there you can wander and see how dynamic config sections of the FIP can contain component specific DTs. U-Boot "private" DT could be securely stored inNT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
- the one that it gets from the FIP and contains runtime configuration parameters, accessed through FCONF library)Quoted 25 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
Quoted 8 lines
Quoted 5 lines
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification: this is the associated content certificate section that contains the valid hashes).What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world.
It feels unfortunate to say non trusted while it is trusted but running outside secure world ;-)OK, good, so long as it doesn't mean Windows NT I am happy.
Quoted 10 lines
Quoted 9 lines
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to propose text.
I mean add an entry type to binman for FIP. It supports CBFS already, for example.
Quoted 11 lines
Quoted 7 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running on other micro-controllers of a board.
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will have to deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world). So in a word, trying to do this is a big undertaking, but you can try.Binman supports adding firmware for microcontrollers. For example, see here:
https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/dts/flashmap-16mb-x86-rw.dtsi#L64
That is a Chrome OS EC binary, one of three in the image.
This is not ARM-specific. That image is actually for x86 Apollo Lake.
Quoted 8 lines
Quoted 1 line
In a short term future (see Alibaba and Marvell announcements) you will have to deal with Arm v9 realms and associated firmware.
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfsQuoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
Quoted 3 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
You seem to picture the role of the firmware to *only* to boot an operating system. I would be surprised to teach you that secure world is a world of its own
that need to be orchestrated and hosts business related applications that stay available after U-Boot has disappeared from memory
(OK with UEFI runtime services it stills occupies some space but
it should be mostly inactive as Linux own devices - let's not comment
on this particular aspect).
As U-Boot has no code for that world, creating another code base would actually create fragmentation.
The mindset I sense from your comments reminds me when relational databases reached the market. People wanted to fit their business as "relational", killing other
flavors of databases. It took at least a decade to get back to reason and think that
more than one technology is needed with columnar databases, unstructured databases,
KV databases...
U-Boot is a "jewel" for what it does. Let's not try to expand it in areas where it is not meant to be and create fragmentation.
Quoted 5 lines
I'm sorry if you find this a bit sharp. But someone needs to be pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that?
Linaro very creation was to avoid fragmentation in the arm ecosystem and I think we can be proud of what has been accomplished from Linus Torvalds comment on the state of kernel for arm.
We are on a journey to do the same for the firmware.
The first part was on the secure world firmware (that, again, do a lot of stuff for the secure world and happen to also load U-Boot).
The second part is on the contract between U-Boot and the OS, hence our contributions in U-Boot.
I am
Quoted 2 lines
very happy to help and provide part of the solution, but it needs a shared vision.
This vision is entirely explained in Arm Cassini project with more firmware related details in SystemReady and further more details for embedded world in EBBR.
You asked me what was the problem we are trying to solve:
<session from FOSDEM 2021>
"“A BSP is a badly-patched fork of an ancient U-Boot, a badly-patched fork of an ancient Linux, and a badly-patched fork of an ancient Yocto”
“… that, plus often a prehistoric compiler”
</session from FOSDEM 2021>
Adding features in U-Boot is only part of the solution: we need to have a process
to keep boards bootable over time and that simplifies the firmware supply chain. I understand you don't like the choices, but that is an ecosystem choice, not my choice, not Linaro choice, and hopefully you will join us in making it happen.
Quoted 7 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas?
I could not agree more. Mail exchanges tend to self inflate... I remember a BoF in a Connect with 20 people around the table talking about firmware update
and finding a way to make anti-bricking standard across boards (see yet another effort of defragmentation:-)
People started the session with "impossible" in mind, and we came out with a plan.
Now we are close to have it. If we could be on the drawing board, I am sure you would immediately
understand and make a better version of our authentication scheme for those updates..
..and pull the relevant patchset ;-)
(sorry I could not resist pulling your leg at the end)
I know you have made big efforts to engage, Ilias. We
Quoted 4 lines
have spoken many times and I'm sure f2f would be easier.
Regards,
Simon
--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi François,
Quoted 7 lines · François Ozog
Hi Simon
(I keep getting messages about delivery problems so I don't know what went through or not)
I got this one, anyway.
Quoted 279 lines · Simon Glass
Quoted 239 lines
Hi Ilias,
Quoted 219 lines · Ilias Apalodimas
Quoted 187 lines · Simon Glass
Hi François,
Quoted 138 lines · François Ozog
Hi Simon,
Quoted 96 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 14 lines · Simon Glass
Hi François,
Quoted 10 lines · François Ozog
Hi Simon,
Quoted 6 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in U-Boot are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 71 lines
Quoted 63 lines
Quoted 54 lines
Quoted 54 lines
(quoted diff) +54
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having its own nodes and +properties, another idea proposed is to have two devicetrees, one for the +U-Boot-specific bits (here called `special`) and one for everything else (here +called `linux`). + +On the positive side, it might quieten the discussion alluded to in the section +above. But there are many negatives to consider and many open questions to +resolve. + +- **Bindings** - Presumably the special devicetree would have its own bindings. + It would not be necessary to put a `u-boot,` prefix on anything. People coming + across the devicetree source would wonder how it fits in with the Linux + devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing the devicetree. This + would need to be expanded to support two trees. Features which need to access + both (such as a device driver which reads the special devicetree to get some + configuration info) could become quite confusing to read and write. + +- **Merging** - Can the two devicetree be merged if a platform desires it? If + so, how is this managed in tooling? Does it happen during the build, in which + case they are not really separate at all. Or does U-Boot merge them at + runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and more code paths. It + requires that both be made available to the code in U-Boot, e.g. via a + separate pointer or argument or API. Overall the separation would certainly + not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide the pieces needed for + U-Boot for a particular board. Would we use these same files for the special + devicetree? + +- **Complexity** - Two devicetrees complicates the build system since it must + build and package them both. Errors must be reported in such a way that it + is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used by driver model + are currently placed in the nodes they relate to. How would these tags + reference a node that is in a separate devicetree? What extra validation would + be needed? + +- **Storage** - How would the two devicetrees be stored in the image? At present + we simply concatenate the U-Boot binary and the devicetree. We could add the + special devicetree before the Linux one, so two are concatenated, but it is + not pretty. We could use binman to support more complex arrangements, but only + some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree files to U-Boot at + runtime? Presumably this would just be too painful. But if it doesn't, it + would be unable to configure run-time features of U-Boot during the boot.Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ +- **Confusion** - No other project has two devicetrees. U-Boot would be in the + unfortunate position of having to describe this fact to new users, along with + the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDT objects, some for "dynamic" configuration purposes.Quoted 1 line
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Bindings:
for FCONF: https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
for FF-A: https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
For chain-of-trust: https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.htmlQuoted 8 lines
Quoted 4 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
From there you can wander and see how dynamic config sections of the FIP can contain component specific DTs. U-Boot "private" DT could be securely stored inNT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
- the one that it gets from the FIP and contains runtime configuration parameters, accessed through FCONF library)Quoted 25 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in addition to operating system
As Ilias said, this is not about documentation about the current use of DT in U-Boot, but justification of your views on DT.
If taken by the letter, I feel (may be wrong though) that your views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and active devicetrees.
I don't know what is an active device tree. Is it the device tree to be passed to OS?
Yes that's right.
Quoted 5 lines
Quoted 3 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
Quoted 8 lines
Quoted 5 lines
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsection of a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification: this is the associated content certificate section that contains the valid hashes).What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world.
It feels unfortunate to say non trusted while it is trusted but running outside secure world ;-)OK, good, so long as it doesn't mean Windows NT I am happy.
Quoted 10 lines
Quoted 9 lines
It doesn't really matter where it is stored, so long as U-Boot can access it.
Quoted 1 line
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to propose text.
I mean add an entry type to binman for FIP. It supports CBFS already, for example.
Quoted 11 lines
Quoted 7 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running on other micro-controllers of a board.
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will have to deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world). So in a word, trying to do this is a big undertaking, but you can try.Binman supports adding firmware for microcontrollers. For example, see here:
https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/dts/flashmap-16mb-x86-rw.dtsi#L64
That is a Chrome OS EC binary, one of three in the image.
This is not ARM-specific. That image is actually for x86 Apollo Lake.
Quoted 8 lines
Quoted 1 line
In a short term future (see Alibaba and Marvell announcements) you will have to deal with Arm v9 realms and associated firmware.
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
That's completely inaccurate. We've added selftests for *every* single feature we've sent for EFI up to now. Functionality wise the past 2 years we've added
- EFI variables
- EFI secure boot
- capsule updates
- initrd loading
- efi TCG protocol
- ESRT tables
- RNG protocol
5a24239c951e8efi_loader: selftest: enableAPPEND_WRITEtests3fc2b16335721cmd: bootefi: carve outefi_selftestcode fromdo_bootefi()1170fee695197efi_selftest: fix variables test forGetNextVariableName()ce62b0f8f45f1test/py: Fix efidebug related tests450596f2ac3fdtest/py:efi_capsule: test for FIT image capsulede489d82e3189test: test the ESRT creation57be8cdce35test/py:efi_secboot: small rework for adding a new teste1174c566a61ctest/py:efi_secboot: add test for intermediate certificates479ab6c17eda7efi_selftest: add selftests for loadfile2 used to load initramfsQuoted 5 lines
and I am pretty sure I am forgetting more on functionality and selftests.
So basically we've either contributed new selftests for *everything* we've or fixed the existing ones. The only thing that's not merged is the TCG selftests which are on upstream review.
Er, I didn't say or mean that no tests were written, just that there is too much push-back on it. Heinrich put a huge amount of effort into the tests and basically created a strong base for it. Congrats and huge kudos to him. As to Linaro, no offence intended, and it is great that all these tests have been added. Thank you for your efforts and it is very helpful. But I think you miss my point. Or perhaps you don't even agree with it? I sent an email about this on one patch just a day or two ago.
Quoted 3 lines
As to the leadership side (my bigger point), Linaro is leading us all down this fragmented path, with TF-A, FIP, more and more binaries and larger firmware diagrams. Or do you disagree with that too?
You seem to picture the role of the firmware to *only* to boot an operating system. I would be surprised to teach you that secure world is a world of its own
that need to be orchestrated and hosts business related applications that stay available after U-Boot has disappeared from memory
(OK with UEFI runtime services it stills occupies some space but
it should be mostly inactive as Linux own devices - let's not comment
on this particular aspect).
As U-Boot has no code for that world, creating another code base would actually create fragmentation.
The mindset I sense from your comments reminds me when relational databases reached the market. People wanted to fit their business as "relational", killing other
flavors of databases. It took at least a decade to get back to reason and think that
more than one technology is needed with columnar databases, unstructured databases,
KV databases...
U-Boot is a "jewel" for what it does. Let's not try to expand it in areas where it is not meant to be and create fragmentation.Quoted 5 lines
I'm sorry if you find this a bit sharp. But someone needs to be pointing these things out. I don't know who else is doing so. ARM firmware has got noticeably more complicated and fragmented in the last five years, hasn't it? What can Linaro do to address that?
Linaro very creation was to avoid fragmentation in the arm ecosystem and I think we can be proud of what has been accomplished from Linus Torvalds comment on the state of kernel for arm.
We are on a journey to do the same for the firmware.
The first part was on the secure world firmware (that, again, do a lot of stuff for the secure world and happen to also load U-Boot).
The second part is on the contract between U-Boot and the OS, hence our contributions in U-Boot.
I amQuoted 2 lines
very happy to help and provide part of the solution, but it needs a shared vision.
Quoted 16 lines
This vision is entirely explained in Arm Cassini project with more firmware related details in SystemReady and further more details for embedded world in EBBR.
You asked me what was the problem we are trying to solve:
<session from FOSDEM 2021>
"“A BSP is a badly-patched fork of an ancient U-Boot, a badly-patched fork of an ancient Linux, and a badly-patched fork of an ancient Yocto”
“… that, plus often a prehistoric compiler”
</session from FOSDEM 2021>
Adding features in U-Boot is only part of the solution: we need to have a process
to keep boards bootable over time and that simplifies the firmware supply chain. I understand you don't like the choices, but that is an ecosystem choice, not my choice, not Linaro choice, and hopefully you will join us in making it happen.
I believe I am involved, at least. I do make time to engage on a call most weeks. As you say, we don't agree on all the choices. I think the areas of concern I have are devicetree (several issues which I hope we are making progress on), proliferation of binaries and complexity of packaging.
Quoted 8 lines
Quoted 8 lines
It's not even just a Linaro/ARM problem. On the x86 side it is fast becoming a living nightmare.
Perhaps the problem here is just the pandemic response and the inability for people to get into a room and brainstorm / collaborate / hack on ideas?
Quoted 15 lines
I could not agree more. Mail exchanges tend to self inflate... I remember a BoF in a Connect with 20 people around the table talking about firmware update
and finding a way to make anti-bricking standard across boards (see yet another effort of defragmentation:-)
People started the session with "impossible" in mind, and we came out with a plan.
Now we are close to have it. If we could be on the drawing board, I am sure you would immediately
understand and make a better version of our authentication scheme for those updates..
..and pull the relevant patchset ;-)
(sorry I could not resist pulling your leg at the end)
I know you have made big efforts to engage, Ilias. WeQuoted 1 line
have spoken many times and I'm sure f2f would be easier.
OK, well let's hope it all works out. Rome wasn't built in a day. It is an important goal.
Regards,
Simon
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
In reply to Simon GlassHi Simon,
Quoted 255 lines · Simon Glass
Hi François,
Quoted 8 lines · François Ozog
Hi Simon,
Quoted 4 lines · Simon Glass
Hi François,
On Tue, 26 Oct 2021 at 09:57, François Ozog <[email protected]>
Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 8 lines · Simon Glass
Quoted 4 lines
Hi François,
On Tue, 26 Oct 2021 at 08:31, François Ozog <
Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi Simon,
On Tue, 26 Oct 2021 at 02:25, Simon Glass <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
At present some of the ideas and techniques behind devicetree in
U-Boot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
are assumed, implied or unsaid. Add some documentation to cover
how
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
devicetree is build, how it can be modified and the rules about
using
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the various
CONFIG_OF_... options.[..]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from havingits own nodes and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+properties, another idea proposed is to have two devicetrees,
one for the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+U-Boot-specific bits (here called
special) and one foreverything else (here
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+called `linux`). + +On the positive side, it might quieten the discussion alluded toin the section
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+above. But there are many negatives to consider and many open
questions to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+resolve. + +- **Bindings** - Presumably the special devicetree would haveits own bindings.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ It would not be necessary to put a
u-boot,prefix onanything. People coming
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ across the devicetree source would wonder how it fits in with
the Linux
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing thedevicetree. This
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would need to be expanded to support two trees. Features which
need to access
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ both (such as a device driver which reads the special
devicetree to get some
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ configuration info) could become quite confusing to read and
write.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Merging** - Can the two devicetree be merged if a platformdesires it? If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ so, how is this managed in tooling? Does it happen during the
build, in which
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ case they are not really separate at all. Or does U-Boot merge
them at
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and morecode paths. It
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ requires that both be made available to the code in U-Boot,
e.g. via a
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ separate pointer or argument or API. Overall the separation
would certainly
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide thepieces needed for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ U-Boot for a particular board. Would we use these same files
for the special
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ devicetree? + +- **Complexity** - Two devicetrees complicates the build systemsince it must
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ build and package them both. Errors must be reported in such a
way that it
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used bydriver model
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ are currently placed in the nodes they relate to. How would
these tags
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ reference a node that is in a separate devicetree? What extra
validation would
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ be needed? + +- **Storage** - How would the two devicetrees be stored in theimage? At present
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ we simply concatenate the U-Boot binary and the devicetree. We
could add the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ special devicetree before the Linux one, so two are
concatenated, but it is
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ not pretty. We could use binman to support more complex
arrangements, but only
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetreefiles to U-Boot at
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ runtime? Presumably this would just be too painful. But if it
doesn't, it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would be unable to configure run-time features of U-Boot
during the boot.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Confusion** - No other project has two devicetrees. U-Bootwould be in the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ unfortunate position of having to describe this fact to new
users, along with
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDTobjects, some for "dynamic" configuration purposes.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Bindings:
for FCONF:https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
Quoted 1 line
Quoted 1 line
Quoted 1 line
for FF-A:
https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
Quoted 1 line
Quoted 1 line
Quoted 1 line
For chain-of-trust:
https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.html
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
Quoted 1 line
Quoted 1 line
Quoted 1 line
From there you can wander and see how dynamic config sections of the
FIP can contain component specific DTs.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
U-Boot "private" DT could be securely stored in
NT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
If I take a possible scenario: OP-TEE to deal with 3 different device
trees:
Quoted 1 line
- the one that will be passed to the OS and for which it may want to do
some fixups
Quoted 1 line
- the one that it is using to run (it may have secure devices that are
entirely not visible to any normal world OS)
Quoted 1 line
- the one that it gets from the FIP and contains runtime configuration
parameters, accessed through FCONF library)
Quoted 9 lines
Quoted 9 lines
U-Boot also supports multiple devicetrees in the build - e.g. SPL and U-Boot proper. With binman you can create several copies of them for use with A/B boot, for example. But only one is used as a control DTB by a particular U-Boot phase at a time. Do you see what I mean?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
2) STM32MP1 can have dedicated DTBs for TF-A, OP-TEE and U-Boot in
addition to operating system
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
As Ilias said, this is not about documentation about the current
use of DT in U-Boot, but justification of your views on DT.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
If taken by the letter, I feel (may be wrong though) that your
views prevent establish the DT lifecycle and usage as per the desire of vendors, partners and customers that supports Arm SystemReady standards.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I have gone to great efforts to document things here, as they work in U-Boot today. As you know, U-Boot supports separate control and
active
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
devicetrees.
I don't know what is an active device tree. Is it the device tree to
be passed to OS?
Quoted 4 lines
Quoted 4 lines
Yes that's right.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
But if you are wanting to change to multiple control trees within U-Boot, I'd say the answer is "no, thank you".
I see only one control DT.
OK good.
Quoted 1 line
There is a possibility to store it securely in
NT_FW_CONFIGsectionof a FIP. it also has associated signature plus hash mechanisms to attest authenticity of it (do not need signature in DT to allow verification:
this is the associated content certificate section that contains the valid hashes).Quoted 5 lines
Quoted 2 lines
What does NT mean? I suppose FW means firmware.
Non Trusted; it means normal world as opposed to secure world. It feels unfortunate to say non trusted while it is trusted but running
outside secure world ;-)
OK, good, so long as it doesn't mean Windows NT I am happy.
Quoted 3 lines
Quoted 3 lines
It doesn't really matter where it is stored, so long as U-Boot can
access it.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
You can certain have a similar mechanism for binman.
Note that binman is a packaging tool. Perhaps you should add FIP support to it if FIP is going to be required too now?
There may be a need for a FIP explanation. I'll check with other guys to
propose text.
I mean add an entry type to binman for FIP. It supports CBFS already, for example.
Quoted 8 lines
Quoted 7 lines
What I would like, to package up the firmware for ANY board, after all the building is done in various projects:
binman -b <board>
FIP deals with a number of firmwares like the SCP and MCP ones running
on other micro-controllers of a board.
Quoted 2 lines
So in a sense it is an arm targeted tool.
If you want to package firmware for arm boards with binman you will haveto deal with those firmwares as well as secure world and its trusted services as secure partitions that are being developed (including when virtualization is in operation in the secure world).
Quoted 1 line
So in a word, trying to do this is a big undertaking, but you can try.
Binman supports adding firmware for microcontrollers. For example, see here:
https://github.com/sjg20/u-boot/blob/cros-2021.04/cros/dts/flashmap-16mb-x86-rw.dtsi#L64
That is a Chrome OS EC binary, one of three in the image.
Quoted 9 lines
This is not ARM-specific. That image is actually for x86 Apollo Lake.
Quoted 1 line
In a short term future (see Alibaba and Marvell announcements) you will
have to deal with Arm v9 realms and associated firmware.
Why me? Perhaps Linaro could take this on instead of working in a separate tool and domain? You guys could really pull things together and reduce the fragmentation, if you took it on.
Well, what happens in the secure world is getting pretty complex. TFA solves it elegantly so there is no incentive in maintaining a separate code base to do the same.
If I picture things in different way, I would say that it the past pre U-Boot proper was representing 20 and U-Boot proper 80. In new schemes, pre U-Boot can be said 80 and U-Boot proper 20.
Quoted 13 lines
Honestly it is hard enough to even get Linaro people to write a test for code they have written. What gives?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
If there
is a use case for that, please can you be specific about what we cannot do with a combined devicetree?Regards,
SImon
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
In reply to François OzogQuoted 151 lines · François Ozog
Hi Simon,
Quoted 139 lines · Simon Glass
Hi François,
Quoted 8 lines · François Ozog
Quoted 4 lines · Simon Glass
Hi François,
On Tue, 26 Oct 2021 at 08:31, François Ozog <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Hi Simon,
Quoted 2 lines · Simon Glass
At present some of the ideas and techniques behind devicetree in
U-Boot
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
are assumed, implied or unsaid. Add some documentation to cover how devicetree is build, how it can be modified and the rules about using the various
CONFIG_OF_... options.[..]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
doc/develop/devicetree/dt_update.rst
Quoted 4 lines
doc/develop/devicetree/dt_update.rst new file +4
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from having itsown nodes and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+properties, another idea proposed is to have two devicetrees, one
for the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+U-Boot-specific bits (here called
special) and one for everythingelse (here
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+called `linux`). + +On the positive side, it might quieten the discussion alluded to inthe section
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+above. But there are many negatives to consider and many open
questions to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+resolve. + +- **Bindings** - Presumably the special devicetree would have itsown bindings.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ It would not be necessary to put a
u-boot,prefix on anything.People coming
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ across the devicetree source would wonder how it fits in with the
Linux
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing thedevicetree. This
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would need to be expanded to support two trees. Features which
need to access
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ both (such as a device driver which reads the special devicetree
to get some
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ configuration info) could become quite confusing to read and
write.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Merging** - Can the two devicetree be merged if a platformdesires it? If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ so, how is this managed in tooling? Does it happen during the
build, in which
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ case they are not really separate at all. Or does U-Boot merge
them at
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and morecode paths. It
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ requires that both be made available to the code in U-Boot, e.g.
via a
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ separate pointer or argument or API. Overall the separation would
certainly
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide thepieces needed for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ U-Boot for a particular board. Would we use these same files for
the special
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ devicetree? + +- **Complexity** - Two devicetrees complicates the build systemsince it must
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ build and package them both. Errors must be reported in such a
way that it
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used bydriver model
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ are currently placed in the nodes they relate to. How would these
tags
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ reference a node that is in a separate devicetree? What extra
validation would
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ be needed? + +- **Storage** - How would the two devicetrees be stored in theimage? At present
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ we simply concatenate the U-Boot binary and the devicetree. We
could add the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ special devicetree before the Linux one, so two are concatenated,
but it is
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ not pretty. We could use binman to support more complex
arrangements, but only
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
doc/develop/devicetree/dt_update.rst
Quoted 3 lines
doc/develop/devicetree/dt_update.rst new file +3
-0+ some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetree filesto U-Boot at
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ runtime? Presumably this would just be too painful. But if it
doesn't, it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would be unable to configure run-time features of U-Boot during
the boot.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Confusion** - No other project has two devicetrees. U-Bootwould be in the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ unfortunate position of having to describe this fact to new
users, along with
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
doc/develop/devicetree/dt_update.rst line 540
Quoted 2 lines
doc/develop/devicetree/dt_update.rst new file +2
-0+ the (arguably contrived) reason for the arrangement. +False:
1) projects in trustedfirmware.org are built to have multiple FDTobjects, some for "dynamic" configuration purposes.
Quoted 4 lines
Quoted 2 lines
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Quoted 2 lines
Bindings:
for FCONF:https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
Quoted 1 line
for FF-A:
https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
Quoted 1 line
For chain-of-trust:
https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.html
Quoted 3 lines
For some code:
Quoted 7 lines
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
Quoted 1 line
From there you can wander and see how dynamic config sections of the FIP
can contain component specific DTs.
Quoted 1 line
U-Boot "private" DT could be securely stored in
NT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
Quoted 6 lines
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
What relationship does this device tree that OP-TEE is using itself bear to the one is will pass to the OS?
Signature · 1 line
Tom
Re: [PATCH v5 02/26] doc: Add documentation about devicetree usage
Hi Tom
Quoted 184 lines · Tom Rini
Quoted 16 lines · François Ozog
Hi Simon,
Quoted 12 lines · Simon Glass
Hi François,
Quoted 8 lines · François Ozog
Quoted 4 lines · Simon Glass
Hi François,
On Tue, 26 Oct 2021 at 08:31, François Ozog <
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Hi Simon,
On Tue, 26 Oct 2021 at 02:25, Simon Glass <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
At present some of the ideas and techniques behind devicetree in
U-Boot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
are assumed, implied or unsaid. Add some documentation to cover
how
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
devicetree is build, how it can be modified and the rules about
using
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the various
CONFIG_OF_... options.[..]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+Why not have two devicetrees? +----------------------------- + +Setting aside the argument for restricting U-Boot from havingits
Quoted 2 lines
Quoted 2 lines
own nodes and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+properties, another idea proposed is to have two devicetrees,
one
Quoted 2 lines
Quoted 2 lines
for the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+U-Boot-specific bits (here called
special) and one foreverything
Quoted 4 lines
Quoted 4 lines
else (here
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+called `linux`). + +On the positive side, it might quieten the discussion alludedto in
Quoted 6 lines
Quoted 6 lines
the section
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+above. But there are many negatives to consider and many open
questions to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+resolve. + +- **Bindings** - Presumably the special devicetree would haveits
Quoted 2 lines
Quoted 2 lines
own bindings.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ It would not be necessary to put a
u-boot,prefix onanything.
Quoted 2 lines
Quoted 2 lines
People coming
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ across the devicetree source would wonder how it fits in with
the
Quoted 8 lines
Quoted 8 lines
Linux
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ devicetree. + +- **Access** - U-Boot has a nice `ofnode` API for accessing thedevicetree. This
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would need to be expanded to support two trees. Features which
need to access
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ both (such as a device driver which reads the special
devicetree
Quoted 7 lines
Quoted 7 lines
to get some
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ configuration info) could become quite confusing to read and
write.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Merging** - Can the two devicetree be merged if a platformdesires it? If
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ so, how is this managed in tooling? Does it happen during the
Quoted 8 lines
Quoted 8 lines
build, in which
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ case they are not really separate at all. Or does U-Boot merge
them at
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ runtime, in which case this adds time and memory? + +- **Efficiency** - A second device tree adds more code and morecode paths. It
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ requires that both be made available to the code in U-Boot,
e.g.
Quoted 2 lines
Quoted 2 lines
via a
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ separate pointer or argument or API. Overall the separation
would
Quoted 6 lines
Quoted 6 lines
certainly
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ not speed up U-Boot, nor decrease its size. + +- **Source code** - At present `u-boot.dtsi` files provide thepieces needed for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ U-Boot for a particular board. Would we use these same files
for
Quoted 4 lines
Quoted 4 lines
the special
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+ devicetree? + +- **Complexity** - Two devicetrees complicates the build systemQuoted 8 lines
Quoted 8 lines
since it must
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ build and package them both. Errors must be reported in such a
way that it
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ is obvious which one is failing. + +- **Referencing each other** - The `u-boot,dm-xxx` tags used bydriver model
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ are currently placed in the nodes they relate to. How would
these
Quoted 10 lines
Quoted 10 lines
tags
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ reference a node that is in a separate devicetree? What extra
validation would
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ be needed? + +- **Storage** - How would the two devicetrees be stored in theimage? At present
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ we simply concatenate the U-Boot binary and the devicetree. We
could add the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ special devicetree before the Linux one, so two are
concatenated,
Quoted 6 lines
Quoted 6 lines
but it is
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ not pretty. We could use binman to support more complex
arrangements, but only
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3
-0+ some boards use this at present, so it would be a big change. + +- **API** - How would another project provide two devicetreefiles
Quoted 4 lines
Quoted 4 lines
to U-Boot at
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ runtime? Presumably this would just be too painful. But if it
doesn't, it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ would be unable to configure run-time features of U-Boot
during
Quoted 9 lines
Quoted 9 lines
the boot.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+
+- **Confusion** - No other project has two devicetrees. U-Bootwould be in the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ unfortunate position of having to describe this fact to new
users, along with
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
(quoted diff) +2
-0+ the (arguably contrived) reason for the arrangement. +Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
False:
1) projects in trustedfirmware.org are built to have multiple FDTobjects, some for "dynamic" configuration purposes.
Quoted 4 lines
Quoted 2 lines
Can you provided a link and I can update this.
https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/index.html
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Bindings:
for FCONF:https://trustedfirmware-a.readthedocs.io/en/latest/components/fconf/fconf_properties.html
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
for FF-A:
https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
For chain-of-trust:
https://trustedfirmware-a.readthedocs.io/en/latest/components/cot-binding.html
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
For some code:
https://github.com/ARM-software/arm-trusted-firmware/blob/master/tools/fiptool/tbbr_config.c
Quoted 1 line
Quoted 1 line
Quoted 1 line
From there you can wander and see how dynamic config sections of the
FIP
Quoted 6 lines
Quoted 5 lines
can contain component specific DTs.
Quoted 1 line
U-Boot "private" DT could be securely stored in
NT_FW_CONFIGsection.OK I can mention that TF-A supports multiple devicetrees if you like, but I'm not sure we are talking about the same thing.
Quoted 6 lines
If I take a possible scenario: OP-TEE to deal with 3 different device trees:
- the one that will be passed to the OS and for which it may want to do some fixups
- the one that it is using to run (it may have secure devices that are entirely not visible to any normal world OS)
Quoted 2 lines
What relationship does this device tree that OP-TEE is using itself bear to the one is will pass to the OS?
may be none. The DT may contain only secure devices and devices for which there are no Linux drivers (clocks or others).
I am not sure “secure device” is clear. This is a device that is separated by hardware methods to be only accessible by EL3, secure ELx. So even if you have secure mmio range you can’t access it from normal world at all.
Quoted 5 lines
--
Tom
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
PATCH v5 3/26 arm: qemu: Mention -nographic in the docs
In reply to Simon GlassWithout this option QEMU appears to hang. Add it to avoid confusion.
---
(no changes since v1)
doc/board/emulation/qemu-arm.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
doc/board/emulation/qemu-arm.rst +4 -3
@@ -41,14 +41,15 @@ The minimal QEMU command line to get U-Boot up and running is: - For ARM:: - qemu-system-arm -machine virt -bios u-boot.bin + qemu-system-arm -machine virt -nographic -bios u-boot.bin - For AArch64:: - qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin + qemu-system-aarch64 -machine virt -nographic -cpu cortex-a57 -bios u-boot.bin Note that for some odd reason qemu-system-aarch64 needs to be explicitly -told to use a 64-bit CPU or it will boot in 32-bit mode. +told to use a 64-bit CPU or it will boot in 32-bit mode. The -nographic argument +ensures that output appears on the terminal. Use Ctrl-A X to quit. Additional persistent U-boot environment support can be added as follows:
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 4/26 arm: riscv: qemu: Explain how to extract the generated dt
In reply to Simon GlassQEMU currently generates a devicetree for use with U-Boot. Explain how to obtain it.
Also explain how to merge it to produce a devicetree with the U-Boot features included.
---
Changes in v5:
- Merge RISC-V and ARM patches since they are similar
doc/board/emulation/qemu-arm.rst | 3 ++ doc/board/emulation/qemu-riscv.rst | 3 ++ doc/develop/devicetree/dt_qemu.rst | 48 ++++++++++++++++++++++++++++++ doc/develop/devicetree/index.rst | 1 + 4 files changed, 55 insertions(+) create mode 100644 doc/develop/devicetree/dt_qemu.rst
doc/board/emulation/qemu-arm.rst +3 -0
@@ -21,6 +21,9 @@ The 'virt' platform provides the following as the basic functionality: Additionally, a number of optional peripherals can be added to the PCI bus. +See :doc:`../../develop/devicetree/dt_qemu` for information on how to see +the devicetree actually generated by QEMU. + Building U-Boot --------------- Set the CROSS_COMPILE environment variable as usual, and run:
doc/board/emulation/qemu-riscv.rst +3 -0
@@ -13,6 +13,9 @@ The QEMU virt machine models a generic RISC-V virtual machine with support for the VirtIO standard networking and block storage devices. It has CLINT, PLIC, 16550A UART devices in addition to VirtIO and it also uses device-tree to pass configuration information to guest software. It implements RISC-V privileged + +See :doc:`../../develop/devicetree/dt_qemu` for information on how to see +the devicetree actually generated by QEMU. architecture spec v1.10. Building U-Boot
doc/develop/devicetree/dt_qemu.rst new file +48 -0
48 lines not on this page · raw message
doc/develop/devicetree/index.rst +1 -0
@@ -12,3 +12,4 @@ build-time and runtime configuration. intro control dt_update + dt_qemu
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 5/26 arm: qemu: Add a devicetree file for qemu_arm
In reply to Simon GlassAdd this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
---
(no changes since v1)
arch/arm/dts/Makefile | 2 + arch/arm/dts/qemu-arm.dts | 402 +++++++++++++++++++++++++++++++++++++ configs/qemu_arm_defconfig | 1 + 3 files changed, 405 insertions(+) create mode 100644 arch/arm/dts/qemu-arm.dts
arch/arm/dts/Makefile +2 -0
@@ -1153,6 +1153,8 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) += imx8mm-cl-iot-gate-optee.dtb dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb +dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb + targets += $(dtb-y) # Add any required device tree compiler flags here
arch/arm/dts/qemu-arm.dts new file +402 -0
402 lines not on this page · raw message
configs/qemu_arm_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x40000 CONFIG_ENV_SECT_SIZE=0x40000 CONFIG_SYS_MALLOC_LEN=0x1000000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-arm" CONFIG_TARGET_QEMU_ARM_32BIT=y CONFIG_ARMV7_LPAE=y CONFIG_AHCI=y
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 6/26 arm: qemu: Add a devicetree file for qemu_arm64
In reply to Simon GlassAdd this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
---
(no changes since v1)
arch/arm/dts/Makefile | 2 +- arch/arm/dts/qemu-arm64.dts | 381 +++++++++++++++++++++++++++++++++++ configs/qemu_arm64_defconfig | 1 + 3 files changed, 383 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/qemu-arm64.dts
arch/arm/dts/Makefile +1 -1
@@ -1153,7 +1153,7 @@ dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) += imx8mm-cl-iot-gate-optee.dtb dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb -dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb +dtb-$(CONFIG_ARCH_QEMU) += qemu-arm.dtb qemu-arm64.dtb targets += $(dtb-y)
arch/arm/dts/qemu-arm64.dts new file +381 -0
381 lines not on this page · raw message
configs/qemu_arm64_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x40000 CONFIG_ENV_SECT_SIZE=0x40000 CONFIG_SYS_MALLOC_LEN=0x1000000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-arm64" CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x40200000
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated it
thanks
-- PMM
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Peter,
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Quoted 6 lines
Quoted 1 line
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated it
Yes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI. I am able to use QEMU versions that differ by two years, partly because I am not trying to do anything clever.
I have sent a patch to add an indication of where the devicetree came from, to help with visibility on this.
Regards,
Simon
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Simon
Quoted 12 lines · Simon Glass
Hi Peter,
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>
Quoted 7 lines
Quoted 4 lines
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itYes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
Quoted 10 lines
I am able to use
QEMU versions that differ by two years, partly because I am not trying to do anything clever.I have sent a patch to add an indication of where the devicetree came from, to help with visibility on this.
Regards,
Simon
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 24 lines · François Ozog
Hi Simon
Quoted 12 lines · Simon Glass
Hi Peter,
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Quoted 7 lines
Quoted 4 lines
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itYes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
Quoted 6 lines
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
Yes. We need to document how to make development easier. But I'm still not on board with the notion of including DTS files for platforms where the source of truth for the DTB is elsewhere. That's going to bring us a lot more pain.
It is important to make sure our "develop our project" workflow is sane and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for example that the new Pi zero platform is just dtb changes, as far as the linux kernel is concerned which means that for rpi_arm64 (which uses run time dtb) it also just works. And that's what we want to see.
Signature · 1 line
Tom
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Tom,
Quoted 33 lines · Tom Rini
Quoted 24 lines · François Ozog
Hi Simon
Quoted 12 lines · Simon Glass
Hi Peter,
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Quoted 7 lines
Quoted 4 lines
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itYes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
Quoted 6 lines
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
Quoted 4 lines
Yes. We need to document how to make development easier. But I'm still not on board with the notion of including DTS files for platforms where the source of truth for the DTB is elsewhere. That's going to bring us a lot more pain.
Are you talking about QEMU specifically, or Raspberry Pi?
How can we get this resolved? I very much want to get to just having OF_SEPARATE and OF_EMBED as the only available build-time options, with OF_BOARD (and perhaps OF_PASSAGE) as something we can enable for runtime support. I feel that separating the build-time and run-time behaviour is very important. Over time perhaps we will have some success in upstreaming bindings, but for now we have what we have. There is still a lot of pushback on U-Boot having things in the devicetree, although I do see that softening somewhat.
Quoted 7 lines
It is important to make sure our "develop our project" workflow is sane and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for example that the new Pi zero platform is just dtb changes, as far as the linux kernel is concerned which means that for
rpi_arm64(which uses run time dtb) it also just works. And that's what we want to see.
So long as OF_BOARD is enabled then the flow should work as you expect.
Regards,
Simon
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 36 lines · Simon Glass
Hi Tom,
Quoted 33 lines · Tom Rini
Quoted 30 lines · François Ozog
Hi Simon
Quoted 12 lines · Simon Glass
Hi Peter,
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Quoted 7 lines
Quoted 4 lines
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itYes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
Quoted 6 lines
Quoted 4 lines
Yes. We need to document how to make development easier. But I'm still not on board with the notion of including DTS files for platforms where the source of truth for the DTB is elsewhere. That's going to bring us a lot more pain.
Are you talking about QEMU specifically, or Raspberry Pi?
I was using two of the more common and readily available platforms where the source of truth for the DTS/DTB is not (and will not be) U-Boot.
Quoted 8 lines
How can we get this resolved? I very much want to get to just having
OF_SEPARATEandOF_EMBEDas the only available build-time options, withOF_BOARD(and perhapsOF_PASSAGE) as something we can enable for runtime support. I feel that separating the build-time and run-time behaviour is very important. Over time perhaps we will have some success in upstreaming bindings, but for now we have what we have. There is still a lot of pushback on U-Boot having things in the devicetree, although I do see that softening somewhat.
To reiterate, the uniform bit of feedback on this series has been that everyone else disagrees with your notion that we _must_ have a dts in-tree.
Quoted 8 lines
Quoted 6 lines
It is important to make sure our "develop our project" workflow is sane and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for example that the new Pi zero platform is just dtb changes, as far as the linux kernel is concerned which means that for
rpi_arm64(which uses run time dtb) it also just works. And that's what we want to see.So long as
OF_BOARDis enabled then the flow should work as you expect.
Then we need to get things spun such that we can build the platforms where the dtb is given to us, complete and correct, at run time, to not require an in-tree dts that's not going to be used. Documentation (another area we have much improved on these past few years and for which I am grateful for all of the effort behind!) is how we make the developer use-case for those platforms better.
Signature · 1 line
Tom
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Tom,
Quoted 58 lines · Tom Rini
Quoted 36 lines · Simon Glass
Hi Tom,
Quoted 33 lines · Tom Rini
Quoted 30 lines · François Ozog
Hi Simon
Quoted 12 lines · Simon Glass
Hi Peter,
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Quoted 7 lines
Quoted 4 lines
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itYes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.Quoted 6 lines
Quoted 4 lines
Yes. We need to document how to make development easier. But I'm still not on board with the notion of including DTS files for platforms where the source of truth for the DTB is elsewhere. That's going to bring us a lot more pain.
Are you talking about QEMU specifically, or Raspberry Pi?
I was using two of the more common and readily available platforms where the source of truth for the DTS/DTB is not (and will not be) U-Boot.
Quoted 8 lines
How can we get this resolved? I very much want to get to just having
OF_SEPARATEandOF_EMBEDas the only available build-time options, withOF_BOARD(and perhapsOF_PASSAGE) as something we can enable for runtime support. I feel that separating the build-time and run-time behaviour is very important. Over time perhaps we will have some success in upstreaming bindings, but for now we have what we have. There is still a lot of pushback on U-Boot having things in the devicetree, although I do see that softening somewhat.
Quoted 3 lines
To reiterate, the uniform bit of feedback on this series has been that everyone else disagrees with your notion that we _must_ have a dts in-tree.
[I would like everyone to take a deep breath and think about what this actually impacts. I argue the impact outside U-Boot is approximately zero. What are we actually discussing here?]
A few have responded that they can just add the files. I think that is the case for everything except QEMU, right? I think even François agrees with the documentation argument. There is no real burden in adding the files so we can see what is going on, add a binman node, SPL nodes, etc.
So I am going to stand my ground on that one. It affects:
- highbank
- qemu-ppce500
- rpi_4
- xilinx_versal_virt
- octeontx
- xenguest_arm64
- juno
So that is just 7 boards that I want to add devicetree files for. I think that is reasonable and not a burden on these maintainers.
Let me deal with QEMU.
Let's imagine that we were in the state that I am proposing here, which we would be if I were a better devicetree maintainer for U-Boot and had not taken my eye off the ball, basically with my review of [1], where I should have pushed to get a response on the questions before it was applied. That might have triggered me to think about the implications of this at the time.
Anyway, in the state that I am proposing, what problems would we have?
1. QEMU has a DT which only matches the 'standard' invocation as documented at [2]
2. QEMU may get out of date if there is a new release.
I don't think (1) is really a problem. People will have to remove CONFIG_OF_BOARD from configs/qemu_arm_spl_defconfig (or the like) to get into this state, and we have a message now that prints out where the devicetree comes from ("separate" in this case):
Core: 42 devices, 11 uclasses, devicetree: separate
For (2), I tested QEMU 6.1.50 and the only difference from 4.2.1 (a year old) is:
kaslr-seed = <0x2037f53d 0x42c279e8>;
It doesn't affect anything here. It boots the lastest image fine.
Just for interest I went back to 2.5.0 which is nearly 6 years old! There are a few differences like dma-coherent and gpio-keys being added, but again it boots fine.
So in practice that doesn't seem to be a problem from what I can tell.
3. Anything else?
For qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this. If we merge them into qemu with dumpdtb, etc. we are assuming that the node we want to update is present, so this is not really any better than having the devicetree in U-Boot. Actually I think it is worse, since who knows what changes might happen to the devicetree in QEMU which will stop U-Boot from working.
QEMU cannot make changes that don't follow the bindings. U-Boot uses the bindings, so we are good.
It just seems very clear to me that this approach is far superior to U-Boot to the wonky business that we have today.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
It is important to make sure our "develop our project" workflow is sane and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for example that the new Pi zero platform is just dtb changes, as far as the linux kernel is concerned which means that for
rpi_arm64(which uses run time dtb) it also just works. And that's what we want to see.
Quoted 8 lines
Quoted 1 line
So long as
OF_BOARDis enabled then the flow should work as you expect.Then we need to get things spun such that we can build the platforms where the dtb is given to us, complete and correct, at run time, to not require an in-tree dts that's not going to be used. Documentation (another area we have much improved on these past few years and for which I am grateful for all of the effort behind!) is how we make the developer use-case for those platforms better.
I did not expect everyone to love this; this is how we got into the mess we are in. A few people thinking it would be expedient to just do their own thing. But I have come to this after an enormous amount of thought and much discussion. I think sometimes people imagine that I just throw things over the wall to get a reaction. That is not the case.
We need some way to put U-Boot properties in there, at least until things change upstream and within U-Boot. That envisages tooling that is clearly not going to be in place for the upcoming release.
For the test, how about I create a separate qemu build (which I have done, actually, qemu_arm_spl) and control the QEMU flags so we know it will boot. It is for CI so we can keep it in sync and deal with any breakages if people change things in QEMU (as above, this seems to be a theoretical problem).
Again, please take a deep breath and consider how much this actually affects TF-A, QEMU, etc. I'd argue not at all. We are talking about a build-time devicetree in the U-Boot tree. We are not talking about disabling OF_BOARD or removing that option.
Regards,
Simon
[1] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://u-boot.readthedocs.io/en/latest/board/emulation/qemu-arm.html
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Simon
Quoted 80 lines · Simon Glass
Hi Tom,
Quoted 10 lines · Tom Rini
Quoted 8 lines · Simon Glass
Hi Tom,
Quoted 5 lines · Tom Rini
Quoted 3 lines · François Ozog
Hi Simon
Le lun. 1 nov. 2021 à 17:58, Simon Glass <[email protected]> a
écrit :
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi Peter,
On Mon, 1 Nov 2021 at 04:48, Peter Maydell <
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines · wrote:
On Tue, 26 Oct 2021 at 01:33, Simon Glass <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Add this file, generated from qemu, so there is a reference
devicetree
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to work
if:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
1) you run it on the exact same QEMU version you generated it
with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
2) you pass QEMU the exact same command line arguments you
used
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
when you generated it
Yes, I certainly understand that. In general this is not safe,
but in
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
practice it works well enough for development and CI.
You recognize that you hijack a product directory with development
hack
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
facility. There is a test directory to keep things clear. There
can be a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dtsdirectory: I
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
guess that unless someone strongly favors a continuation of the
discussion,
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
you may consider re-shaping the proposal to address concerns.
Yes. We need to document how to make development easier. But I'm
still
Quoted 1 line
Quoted 1 line
Quoted 1 line
not on board with the notion of including DTS files for platforms
where
Quoted 1 line
Quoted 1 line
Quoted 1 line
the source of truth for the DTB is elsewhere. That's going to bring
us
Quoted 17 lines
Quoted 3 lines
Quoted 1 line
a lot more pain.
Are you talking about QEMU specifically, or Raspberry Pi?
I was using two of the more common and readily available platforms where the source of truth for the DTS/DTB is not (and will not be) U-Boot.
Quoted 8 lines
How can we get this resolved? I very much want to get to just having
OF_SEPARATEandOF_EMBEDas the only available build-time options, withOF_BOARD(and perhapsOF_PASSAGE) as something we can enable for runtime support. I feel that separating the build-time and run-time behaviour is very important. Over time perhaps we will have some success in upstreaming bindings, but for now we have what we have. There is still a lot of pushback on U-Boot having things in the devicetree, although I do see that softening somewhat.Quoted 3 lines
To reiterate, the uniform bit of feedback on this series has been that everyone else disagrees with your notion that we _must_ have a dts in-tree.
Quoted 7 lines
[I would like everyone to take a deep breath and think about what this actually impacts. I argue the impact outside U-Boot is approximately zero. What are we actually discussing here?]
A few have responded that they can just add the files. I think that is the case for everything except QEMU, right? I think even François agrees with the documentation argument.
I do providing that the sample goes into documentation, not actionable as a build artifact in the dts directory.
Quoted 47 lines
There is no real burden in
adding the files so we can see what is going on, add a binman node, SPL nodes, etc.So I am going to stand my ground on that one. It affects:
- highbank
- qemu-ppce500
-rpi_4
-xilinx_versal_virt
- octeontx
-xenguest_arm64
- junoSo that is just 7 boards that I want to add devicetree files for. I think that is reasonable and not a burden on these maintainers.
Let me deal with QEMU.
Let's imagine that we were in the state that I am proposing here, which we would be if I were a better devicetree maintainer for U-Boot and had not taken my eye off the ball, basically with my review of [1], where I should have pushed to get a response on the questions before it was applied. That might have triggered me to think about the implications of this at the time.
Anyway, in the state that I am proposing, what problems would we have?
1. QEMU has a DT which only matches the 'standard' invocation as documented at [2]
2. QEMU may get out of date if there is a new release.
I don't think (1) is really a problem. People will have to remove
CONFIG_OF_BOARDfrom configs/qemu_arm_spl_defconfig (or the like) to get into this state, and we have a message now that prints out where the devicetree comes from ("separate" in this case):Core: 42 devices, 11 uclasses, devicetree: separate
For (2), I tested QEMU 6.1.50 and the only difference from 4.2.1 (a year old) is:
kaslr-seed = <
0x2037f53d0x42c279e8>;
Quoted 8 lines
It doesn't affect anything here. It boots the lastest image fine.
Just for interest I went back to 2.5.0 which is nearly 6 years old! There are a few differences like dma-coherent and gpio-keys being added, but again it boots fine.
So in practice that doesn't seem to be a problem from what I can tell.
You are essentially saying “I don’t care about the system design, this DTS simplifies my development work for U-Boot and I checked it works on a useless ‘standard invocation’”
Quoted 5 lines
3. Anything else?
For
qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this.
one clean and easy way would be to upstream a Qemu change to merge a supplied overlay to the generated one. This the same idea as applying the NT_FW_COnFIG overlay in the TFA world. In both cases previous loaders do their job properly for U-Boot : setting up the stage as needed.
Quoted 51 lines
If we merge them into
qemu with dumpdtb, etc. we are assuming that the node we want to update is present, so this is not really any better than having the devicetree in U-Boot. Actually I think it is worse, since who knows what changes might happen to the devicetree in QEMU which will stop U-Boot from working.QEMU cannot make changes that don't follow the bindings. U-Boot uses the bindings, so we are good.
It just seems very clear to me that this approach is far superior to U-Boot to the wonky business that we have today.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
It is important to make sure our "develop our project" workflow is
sane
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for
example
Quoted 1 line
Quoted 1 line
Quoted 1 line
that the new Pi zero platform is just dtb changes, as far as the
linux
Quoted 1 line
Quoted 1 line
Quoted 1 line
kernel is concerned which means that for
rpi_arm64(which uses runtime
Quoted 10 lines
Quoted 3 lines
Quoted 1 line
dtb) it also just works. And that's what we want to see.
So long as
OF_BOARDis enabled then the flow should work as you expect.Then we need to get things spun such that we can build the platforms where the dtb is given to us, complete and correct, at run time, to not require an in-tree dts that's not going to be used. Documentation (another area we have much improved on these past few years and for which I am grateful for all of the effort behind!) is how we make the developer use-case for those platforms better.
I did not expect everyone to love this; this is how we got into the mess we are in. A few people thinking it would be expedient to just do their own thing. But I have come to this after an enormous amount of thought and much discussion. I think sometimes people imagine that I just throw things over the wall to get a reaction. That is not the case.
We need some way to put U-Boot properties in there, at least until things change upstream and within U-Boot. That envisages tooling that is clearly not going to be in place for the upcoming release.
For the test, how about I create a separate qemu build (which I have done, actually,
qemu_arm_spl) and control the QEMU flags so we know it will boot. It is for CI so we can keep it in sync and deal with any breakages if people change things in QEMU (as above, this seems to be a theoretical problem).
Quoted 5 lines
Again, please take a deep breath and consider how much this actually affects TF-A, QEMU, etc. I'd argue not at all. We are talking about a build-time devicetree in the U-Boot tree. We are not talking about disabling
OF_BOARDor removing that option.
It is less about development environnement and respective CIs and more about how we want to deliver products on the market and how the supply chain is organized. U-Boot is a key component of that chain. If something is missing from the previous stages of the chain, don’t try to work around the problem in U-Boot, just propose the change/correction in the relevant project (Qemu, TFA, RPI Videocore…) or ask for help. If nothing can be resolved “the clean way” then we can hack our way out (Qemu fork you proposed). But let’s try the clean path first.
Quoted 8 lines
Regards,
Simon[1]
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://u-boot.readthedocs.io/en/latest/board/emulation/qemu-arm.html
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
On Wed, Nov 03, 2021 at 06:29:20AM +0100, François Ozog wrote:
[snip]
Quoted 9 lines
Quoted 4 lines
3. Anything else?
For
qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this.one clean and easy way would be to upstream a Qemu change to merge a supplied overlay to the generated one. This the same idea as applying the
NT_FW_COnFIGoverlay in the TFA world. In both cases previous loaders do their job properly for U-Boot : setting up the stage as needed.
For the record, I believe Simon did propose this and the QEMU response was that no, you should dumpdtb, combine externally and pass that directly.
Signature · 1 line
Tom
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 8 lines · Tom Rini
On Wed, Nov 03, 2021 at 06:29:20AM +0100, François Ozog wrote:
[snip]Quoted 5 lines
Quoted 4 lines
3. Anything else?
For
qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this.
Quoted 8 lines
Quoted 4 lines
one clean and easy way would be to upstream a Qemu change to merge a supplied overlay to the generated one. This the same idea as applying the
NT_FW_COnFIGoverlay in the TFA world. In both cases previous loaders do their job properly for U-Boot : setting up the stage as needed.For the record, I believe Simon did propose this and the QEMU response was that no, you should dumpdtb, combine externally and pass that directly.
Well, our recommendation really was that the ideal thing would be "you take the dtb that QEMU passes you at runtime, and at runtime combine that with whatever extra information you want". The dumpdtb option is primarily intended as a debug feature, so you can have a look at the dtb QEMU created to see why your OS isn't booting; although you can script stuff up that does a dumpdtb-modify-pass-to-QEMU that is pretty clunky given the need to invoke QEMU twice with matching arguments both times.
-- PMM
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
hi Peter
Le jeu. 4 nov. 2021 à 12:09, Peter Maydell <[email protected]> a écrit :
Quoted 16 lines · Tom Rini
Quoted 10 lines · François Ozog
[snip]
Quoted 7 lines
Quoted 4 lines
3. Anything else?
For
qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this.one clean and easy way would be to upstream a Qemu change to merge a supplied overlay to the generated one. This the same idea as applying
the
Quoted 1 line
Quoted 1 line
NT_FW_COnFIGoverlay in the TFA world. In both cases previous loadersdo
Quoted 2 lines
Quoted 1 line
their job properly for U-Boot : setting up the stage as needed.
Quoted 7 lines
Quoted 3 lines
For the record, I believe Simon did propose this and the QEMU response was that no, you should dumpdtb, combine externally and pass that directly.
Well, our recommendation really was that the ideal thing would be "you take the dtb that QEMU passes you at runtime, and at runtime combine that with whatever extra information you want".
That looks just reasonable this way. Runtime merging may need to be done before control is actually transferred. We have that problem on real board where we need to inject a TPM device for measured boot and it is not énumerable and pluggable. With TFA we have the option to add the TPM description in the NT_FW_CONFIG and merge it at run time.
So we need a « -mergedtb » option for Qemu to have the same capability. This would merge the QEMU generated one with the command line provided.
Quoted 11 lines
The dumpdtb option is primarily intended as a debug feature,
so you can have a look at the dtb QEMU created to see why your OS isn't booting; although you can script stuff up that does a dumpdtb-modify-pass-to-QEMU that is pretty clunky given the need to invoke QEMU twice with matching arguments both times.
-- PMM
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 11 lines · François Ozog
Quoted 4 lines · Peter Maydell
Well, our recommendation really was that the ideal thing would be "you take the dtb that QEMU passes you at runtime, and at runtime combine that with whatever extra information you want".
That looks just reasonable this way.
So we need a « -mergedtb » option for Qemu to have the same capability. This would merge the QEMU generated one with the command line provided.
No, I mean that the guest, ie u-boot, should do the merging, not QEMU.
-- PMM
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Peter
Le jeu. 4 nov. 2021 à 12:41, Peter Maydell <[email protected]> a écrit :
Quoted 9 lines
Quoted 1 line · François Ozog
Le jeu. 4 nov. 2021 à 12:09, Peter Maydell <[email protected]> a
écrit :
Quoted 5 lines
Quoted 4 lines
Well, our recommendation really was that the ideal thing would be "you take the dtb that QEMU passes you at runtime, and at runtime combine that with whatever extra information you want".
Quoted 8 lines
Quoted 5 lines
That looks just reasonable this way.
So we need a « -mergedtb » option for Qemu to have the same capability. This would merge the QEMU generated one with the command line provided.
No, I mean that the guest, ie u-boot, should do the merging, not QEMU.
for most of the cases it works. But, as I tried to explain some cases need earlier merging hence trying to get QEMU do the same thing as TFA as « prior loaders » in the boot chain. Worst case we can have the behavior by booting TFA then U-Boot then Linux under QEMU, but the best would be to get the facility directly when TFA is not on the path of the boot like with the VBE boot flow.
Quoted 4 lines
-- PMM
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
In reply to François OzogHi Simon, and team
Quoted 157 lines · François Ozog
Hi Simon
Quoted 80 lines · Simon Glass
Hi Tom,
Quoted 10 lines · Tom Rini
Quoted 8 lines · Simon Glass
Hi Tom,
Quoted 5 lines · Tom Rini
Quoted 3 lines · François Ozog
Hi Simon
Le lun. 1 nov. 2021 à 17:58, Simon Glass <[email protected]> a
écrit :
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi Peter,
On Mon, 1 Nov 2021 at 04:48, Peter Maydell <
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines · wrote:
On Tue, 26 Oct 2021 at 01:33, Simon Glass <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Add this file, generated from qemu, so there is a reference
devicetree
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to
work if:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
1) you run it on the exact same QEMU version you generated
it with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
2) you pass QEMU the exact same command line arguments you
used
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
when you generated it
Yes, I certainly understand that. In general this is not safe,
but in
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
practice it works well enough for development and CI.
You recognize that you hijack a product directory with
development hack
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
facility. There is a test directory to keep things clear. There
can be a
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dtsdirectory: I
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
guess that unless someone strongly favors a continuation of the
discussion,
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
you may consider re-shaping the proposal to address concerns.
Yes. We need to document how to make development easier. But I'm
still
Quoted 1 line
Quoted 1 line
Quoted 1 line
not on board with the notion of including DTS files for platforms
where
Quoted 1 line
Quoted 1 line
Quoted 1 line
the source of truth for the DTB is elsewhere. That's going to
bring us
Quoted 17 lines
Quoted 3 lines
Quoted 1 line
a lot more pain.
Are you talking about QEMU specifically, or Raspberry Pi?
I was using two of the more common and readily available platforms where the source of truth for the DTS/DTB is not (and will not be) U-Boot.
Quoted 8 lines
How can we get this resolved? I very much want to get to just having
OF_SEPARATEandOF_EMBEDas the only available build-time options, withOF_BOARD(and perhapsOF_PASSAGE) as something we can enable for runtime support. I feel that separating the build-time and run-time behaviour is very important. Over time perhaps we will have some success in upstreaming bindings, but for now we have what we have. There is still a lot of pushback on U-Boot having things in the devicetree, although I do see that softening somewhat.Quoted 3 lines
To reiterate, the uniform bit of feedback on this series has been that everyone else disagrees with your notion that we _must_ have a dts in-tree.
Quoted 7 lines
[I would like everyone to take a deep breath and think about what this actually impacts. I argue the impact outside U-Boot is approximately zero. What are we actually discussing here?]
A few have responded that they can just add the files. I think that is the case for everything except QEMU, right? I think even François agrees with the documentation argument.
I do providing that the sample goes into documentation, not actionable as a build artifact in the dts directory.
Quoted 47 lines
There is no real burden in
adding the files so we can see what is going on, add a binman node, SPL nodes, etc.So I am going to stand my ground on that one. It affects:
- highbank
- qemu-ppce500
-rpi_4
-xilinx_versal_virt
- octeontx
-xenguest_arm64
- junoSo that is just 7 boards that I want to add devicetree files for. I think that is reasonable and not a burden on these maintainers.
Let me deal with QEMU.
Let's imagine that we were in the state that I am proposing here, which we would be if I were a better devicetree maintainer for U-Boot and had not taken my eye off the ball, basically with my review of [1], where I should have pushed to get a response on the questions before it was applied. That might have triggered me to think about the implications of this at the time.
Anyway, in the state that I am proposing, what problems would we have?
1. QEMU has a DT which only matches the 'standard' invocation as documented at [2]
2. QEMU may get out of date if there is a new release.
I don't think (1) is really a problem. People will have to remove
CONFIG_OF_BOARDfrom configs/qemu_arm_spl_defconfig (or the like) to get into this state, and we have a message now that prints out where the devicetree comes from ("separate" in this case):Core: 42 devices, 11 uclasses, devicetree: separate
For (2), I tested QEMU 6.1.50 and the only difference from 4.2.1 (a year old) is:
kaslr-seed = <
0x2037f53d0x42c279e8>;Quoted 8 lines
It doesn't affect anything here. It boots the lastest image fine.
Just for interest I went back to 2.5.0 which is nearly 6 years old! There are a few differences like dma-coherent and gpio-keys being added, but again it boots fine.
So in practice that doesn't seem to be a problem from what I can tell.
You are essentially saying “I don’t care about the system design, this DTS simplifies my development work for U-Boot and I checked it works on a useless ‘standard invocation’”
Quoted 3 lines
3. Anything else?
Quoted 8 lines
Quoted 2 lines
For
qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this.one clean and easy way would be to upstream a Qemu change to merge a supplied overlay to the generated one. This the same idea as applying the
NT_FW_COnFIGoverlay in the TFA world. In both cases previous loaders do their job properly for U-Boot : setting up the stage as needed.
I was pointed to your proposal in Qemu mailing list and added my support to it.
I could not comment on the exact details of the proposal, but commented on the fact that merging a DT fragment provided to Qemu at runtime makes sense and has some precedent in TFA.
Quoted 80 lines
If we merge them into
Quoted 51 lines
qemu with dumpdtb, etc. we are assuming that the node we want to update is present, so this is not really any better than having the devicetree in U-Boot. Actually I think it is worse, since who knows what changes might happen to the devicetree in QEMU which will stop U-Boot from working.
QEMU cannot make changes that don't follow the bindings. U-Boot uses the bindings, so we are good.
It just seems very clear to me that this approach is far superior to U-Boot to the wonky business that we have today.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
It is important to make sure our "develop our project" workflow is
sane
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for
example
Quoted 1 line
Quoted 1 line
Quoted 1 line
that the new Pi zero platform is just dtb changes, as far as the
linux
Quoted 1 line
Quoted 1 line
Quoted 1 line
kernel is concerned which means that for
rpi_arm64(which uses runtime
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
dtb) it also just works. And that's what we want to see.
So long as
OF_BOARDis enabled then the flow should work as youexpect.
Quoted 7 lines
Then we need to get things spun such that we can build the platforms where the dtb is given to us, complete and correct, at run time, to not require an in-tree dts that's not going to be used. Documentation (another area we have much improved on these past few years and for which I am grateful for all of the effort behind!) is how we make the developer use-case for those platforms better.
I did not expect everyone to love this; this is how we got into the mess we are in. A few people thinking it would be expedient to just do their own thing. But I have come to this after an enormous amount of thought and much discussion. I think sometimes people imagine that I just throw things over the wall to get a reaction. That is not the case.
We need some way to put U-Boot properties in there, at least until things change upstream and within U-Boot. That envisages tooling that is clearly not going to be in place for the upcoming release.
For the test, how about I create a separate qemu build (which I have done, actually,
qemu_arm_spl) and control the QEMU flags so we know it will boot. It is for CI so we can keep it in sync and deal with any breakages if people change things in QEMU (as above, this seems to be a theoretical problem).Quoted 5 lines
Again, please take a deep breath and consider how much this actually affects TF-A, QEMU, etc. I'd argue not at all. We are talking about a build-time devicetree in the U-Boot tree. We are not talking about disabling
OF_BOARDor removing that option.It is less about development environnement and respective CIs and more about how we want to deliver products on the market and how the supply chain is organized. U-Boot is a key component of that chain. If something is missing from the previous stages of the chain, don’t try to work around the problem in U-Boot, just propose the change/correction in the relevant project (Qemu, TFA, RPI Videocore…) or ask for help. If nothing can be resolved “the clean way” then we can hack our way out (Qemu fork you proposed). But let’s try the clean path first.
Quoted 8 lines
Regards,
Simon[1]
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://u-boot.readthedocs.io/en/latest/board/emulation/qemu-arm.html--
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
In reply to Simon GlassQuoted 61 lines · Simon Glass
Hi Tom,
Quoted 58 lines · Tom Rini
Quoted 36 lines · Simon Glass
Hi Tom,
Quoted 33 lines · Tom Rini
Quoted 30 lines · François Ozog
Hi Simon
Quoted 12 lines · Simon Glass
Hi Peter,
Quoted 8 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Quoted 7 lines
Quoted 4 lines
Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itYes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools.
I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.Quoted 6 lines
Quoted 4 lines
Yes. We need to document how to make development easier. But I'm still not on board with the notion of including DTS files for platforms where the source of truth for the DTB is elsewhere. That's going to bring us a lot more pain.
Are you talking about QEMU specifically, or Raspberry Pi?
I was using two of the more common and readily available platforms where the source of truth for the DTS/DTB is not (and will not be) U-Boot.
Quoted 8 lines
How can we get this resolved? I very much want to get to just having
OF_SEPARATEandOF_EMBEDas the only available build-time options, withOF_BOARD(and perhapsOF_PASSAGE) as something we can enable for runtime support. I feel that separating the build-time and run-time behaviour is very important. Over time perhaps we will have some success in upstreaming bindings, but for now we have what we have. There is still a lot of pushback on U-Boot having things in the devicetree, although I do see that softening somewhat.
Quoted 7 lines
Quoted 3 lines
To reiterate, the uniform bit of feedback on this series has been that everyone else disagrees with your notion that we _must_ have a dts in-tree.
[I would like everyone to take a deep breath and think about what this actually impacts. I argue the impact outside U-Boot is approximately zero. What are we actually discussing here?]
We're discussing what the point of these files even is. And ensuring that it doesn't lead to some sort of "feature creep" or similar where they do become required to use.
Quoted 1 line
A few have responded that they can just add the files. I think that is
Yes, you've asked a number of people to do something, and given your position with the community they just said OK.
Quoted 4 lines
the case for everything except QEMU, right? I think even François agrees with the documentation argument. There is no real burden in adding the files so we can see what is going on, add a binman node, SPL nodes, etc.
I know François already replied, so I'm replying for myself here. What is the point of these files, if they are not going to ever be used, other than as documentation? So that people that don't have a given platform can more easily browse the device tree for it? That's a documentation fix (doc/board/... should note where to go to find it).
Quoted 10 lines
So I am going to stand my ground on that one. It affects:
- highbank
- qemu-ppce500
-rpi_4
-xilinx_versal_virt
- octeontx
-xenguest_arm64
- juno
Quoted 2 lines
So that is just 7 boards that I want to add devicetree files for. I think that is reasonable and not a burden on these maintainers.
It effects every board where the source of truth for the DT is not the one we're embedding because the hardware doesn't ship with one on it. That's all of the QEMU targets, all of the Pi targets and a growing list of newer hardware too, due to the push for "the hardware should come with the device tree, not the linux kernel" portion of how DT has been intended to work since forever getting realized more often.
Quoted 30 lines
Let me deal with QEMU.
Let's imagine that we were in the state that I am proposing here, which we would be if I were a better devicetree maintainer for U-Boot and had not taken my eye off the ball, basically with my review of [1], where I should have pushed to get a response on the questions before it was applied. That might have triggered me to think about the implications of this at the time.
Anyway, in the state that I am proposing, what problems would we have?
1. QEMU has a DT which only matches the 'standard' invocation as documented at [2]
2. QEMU may get out of date if there is a new release.
I don't think (1) is really a problem. People will have to remove
CONFIG_OF_BOARDfrom configs/qemu_arm_spl_defconfig (or the like) to get into this state, and we have a message now that prints out where the devicetree comes from ("separate" in this case):Core: 42 devices, 11 uclasses, devicetree: separate
For (2), I tested QEMU 6.1.50 and the only difference from 4.2.1 (a year old) is:
kaslr-seed = <
0x2037f53d0x42c279e8>;It doesn't affect anything here. It boots the lastest image fine.
Quoted 7 lines
Just for interest I went back to 2.5.0 which is nearly 6 years old! There are a few differences like dma-coherent and gpio-keys being added, but again it boots fine.
So in practice that doesn't seem to be a problem from what I can tell.
3. Anything else?
Yes, a TPM (or not) existing.
Quoted 8 lines
For
qemu_arm_spl, it *does not boot* unless the U-Boot SPL properties are present. There is no easy way to fix this. If we merge them into qemu with dumpdtb, etc. we are assuming that the node we want to update is present, so this is not really any better than having the devicetree in U-Boot. Actually I think it is worse, since who knows what changes might happen to the devicetree in QEMU which will stop U-Boot from working.
Quoted 5 lines
QEMU cannot make changes that don't follow the bindings. U-Boot uses the bindings, so we are good.
It just seems very clear to me that this approach is far superior to U-Boot to the wonky business that we have today.
We also need to be clear what the point of QEMU virtual machine support is. It's to enable testing of features that we also want to test on real hardware, to the extent possible. The follow up to that point is when we use QEMU to emulate real hardware to again test U-Boot to the extent possible. Given the list of hardware on
https://qemu.readthedocs.io/en/latest/system/target-arm.html (and to be clear, I've not validated every possible board there) I would be hopeful that we can cover all of the features we need on real hardware by emulating specific targets in CI.
Where the source of truth for the device tree is provided to us at run time when we start executing (so yes, the dtb that the Pi firmware assembles from files on the SD card or the one QEMU passes or the one that exists on SPI flash somewhere or ...) we must use that tree. We must not build a full separate tree because that would never be used at run time.
That may mean that some features are not going to be supported right there (so yes, SPL in QEMU virtual machine on ARM) ever, or without some additional reasoning and work because it's useful to end users (figuring out a good way to generate a .dtbo so that the Pi firmware could still have a flawed but possibly better than nothing verified boot flow).
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
It is important to make sure our "develop our project" workflow is sane and relatively pain free. But that needs to not come by making sacrifices to the "use our project" outcome. I would hope for example that the new Pi zero platform is just dtb changes, as far as the linux kernel is concerned which means that for
rpi_arm64(which uses run time dtb) it also just works. And that's what we want to see.Quoted 8 lines
Quoted 1 line
So long as
OF_BOARDis enabled then the flow should work as you expect.Then we need to get things spun such that we can build the platforms where the dtb is given to us, complete and correct, at run time, to not require an in-tree dts that's not going to be used. Documentation (another area we have much improved on these past few years and for which I am grateful for all of the effort behind!) is how we make the developer use-case for those platforms better.
Quoted 6 lines
I did not expect everyone to love this; this is how we got into the mess we are in. A few people thinking it would be expedient to just do their own thing. But I have come to this after an enormous amount of thought and much discussion. I think sometimes people imagine that I just throw things over the wall to get a reaction. That is not the case.
I don't think anyone thinks you're doing this just to see what everyone else thinks. Especially since the feedback has been consistent and uniform disagreement. I also agree that what we're doing today isn't quite what I'd like to see. But that's because when the source of truth for the device tree is external to us, we are not consistent. And we didn't push hard enough earlier on to get bindings we need upstream. Or pushed back hard enough on ourselves to come up with a way to solve some of the problems without the bindings we added.
Quoted 10 lines
We need some way to put U-Boot properties in there, at least until things change upstream and within U-Boot. That envisages tooling that is clearly not going to be in place for the upcoming release.
For the test, how about I create a separate qemu build (which I have done, actually,
qemu_arm_spl) and control the QEMU flags so we know it will boot. It is for CI so we can keep it in sync and deal with any breakages if people change things in QEMU (as above, this seems to be a theoretical problem).
Quoted 4 lines
Again, please take a deep breath and consider how much this actually affects TF-A, QEMU, etc. I'd argue not at all. We are talking about a build-time devicetree in the U-Boot tree. We are not talking about disabling
OF_BOARDor removing that option.
The problem I still have here is that if the source of truth for the device tree on a platform is given to us at run time we must use it. That you've noted the QEMU tree has changed only a little bit isn't super re-assuring. And the Pi platforms show more cases where it's an active problem. And since we should be using the true device tree, not a just for reference tree, why have the copy in tree at all?
Signature · 1 line
Tom
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
In reply to François OzogHi François,
Quoted 21 lines · François Ozog
Hi Simon
Quoted 17 lines · Simon Glass
Hi Peter,
Quoted 12 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated it
Quoted 5 lines
Quoted 2 lines
Yes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools. I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
As stated previously, I would like to have at least a sample DT in-tree for all boards. I cannot see another way to get the Kconfig options in line. If we are able to put these files somewhere else in the future and get them out of U-Boot, with perhaps just an overlay for development purposes, I'd be keen to see it. But for now, this is where we are, I believe.
In this particular case, this is not just a dev hack. It is also for CI tests which need to use a devicetree. See for example here:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 7 lines
Quoted 7 lines
I am able to use
QEMU versions that differ by two years, partly because I am not trying to do anything clever.I have sent a patch to add an indication of where the devicetree came from, to help with visibility on this.
Regards,
Simon
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 24 lines · Simon Glass
Hi François,
Quoted 21 lines · François Ozog
Hi Simon
Quoted 17 lines · Simon Glass
Hi Peter,
Quoted 12 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated it
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools. I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
As stated previously, I would like to have at least a sample DT in-tree for all boards. I cannot see another way to get the
Kconfig
What's the point of having a sample when it's not going to always be correct or may be actively wrong and we can tell interested developers / users how to get the correct DTB/DTS to examine?
Quoted 10 lines
options in line. If we are able to put these files somewhere else in the future and get them out of U-Boot, with perhaps just an overlay for development purposes, I'd be keen to see it. But for now, this is where we are, I believe.
In this particular case, this is not just a dev hack. It is also for CI tests which need to use a devicetree. See for example here:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
This example would probably be better done on vexpress_ca9x4 where we do test in CI via QEMU but do not need to modify a device tree that is passed on to us, we already control the source of truth DTB in this case.
And also yes, I'm behind on reviewing things I need to review.
Signature · 1 line
Tom
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 24 lines · Simon Glass
Hi François,
Quoted 21 lines · François Ozog
Hi Simon
Quoted 17 lines · Simon Glass
Hi Peter,
Quoted 12 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itQuoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools. I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
As stated previously, I would like to have at least a sample DT in-tree for all boards. I cannot see another way to get the
KconfigWhat's the point of having a sample when it's not going to always be correct or may be actively wrong and we can tell interested developers / users how to get the correct DTB/DTS to examine?
Quoted 8 lines
options in line. If we are able to put these files somewhere else in the future and get them out of U-Boot, with perhaps just an overlay for development purposes, I'd be keen to see it. But for now, this is where we are, I believe.
In this particular case, this is not just a dev hack. It is also for CI tests which need to use a devicetree. See for example here:
Quoted 7 lines
Quoted 2 lines
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/This example would probably be better done on
vexpress_ca9x4where we do test in CI via QEMU but do not need to modify a device tree that is passed on to us, we already control the source of truth DTB in this case.
But that board:
- uses OF_EMBED, which it should not
- does not use SPL, which I need
Quoted 2 lines
And also yes, I'm behind on reviewing things I need to review.
Aren't we all...I can't even keep up with these threads.
Regards,
Simon
Re: [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64
Quoted 58 lines · Simon Glass
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 24 lines · Simon Glass
Hi François,
Quoted 21 lines · François Ozog
Hi Simon
Quoted 17 lines · Simon Glass
Hi Peter,
Quoted 12 lines · Peter Maydell
Quoted 5 lines · Simon Glass
Add this file, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Signed-off-by Simon Glass <[email protected]>Note that the dtb you get from QEMU is only guaranteed to work if:
1) you run it on the exact same QEMU version you generated it with
2) you pass QEMU the exact same command line arguments you used when you generated itQuoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yes, I certainly understand that. In general this is not safe, but in practice it works well enough for development and CI.
You recognize that you hijack a product directory with development hack facility. There is a test directory to keep things clear. There can be a dev-dts or something similar for Dev time tools. I have only seen push back on those fake dts files in the dts directory: I guess that unless someone strongly favors a continuation of the discussion, you may consider re-shaping the proposal to address concerns.
As stated previously, I would like to have at least a sample DT in-tree for all boards. I cannot see another way to get the
KconfigWhat's the point of having a sample when it's not going to always be correct or may be actively wrong and we can tell interested developers / users how to get the correct DTB/DTS to examine?
Quoted 8 lines
options in line. If we are able to put these files somewhere else in the future and get them out of U-Boot, with perhaps just an overlay for development purposes, I'd be keen to see it. But for now, this is where we are, I believe.
In this particular case, this is not just a dev hack. It is also for CI tests which need to use a devicetree. See for example here:
Quoted 7 lines
Quoted 2 lines
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/This example would probably be better done on
vexpress_ca9x4where we do test in CI via QEMU but do not need to modify a device tree that is passed on to us, we already control the source of truth DTB in this case.
Quoted 4 lines
But that board:
- uses
OF_EMBED, which it should not
- does not use SPL, which I need
Check out the other hardware then that we emulate today, and or maybe something off of
https://qemu.readthedocs.io/en/latest/system/target-arm.html that we could add. My point is that by picking the QEMU targets for where to test this feature you've gone with "I've introduced this feature so now I need to introduce this other change I've been arguing for too" in an artificial manner as it would only be used like that for testing.
Signature · 1 line
Tom
PATCH v5 7/26 riscv: qemu: Add devicetree files for qemu_riscv32/64
In reply to Simon GlassAdd these files, generated from qemu, so there is a reference devicetree in the U-Boot tree.
Split the existing qemu-virt into two, since we need a different devicetree for 32- and 64-bit machines.
---
(no changes since v1)
arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++++++++++++++++++++++++++ arch/riscv/dts/qemu-virt64.dts | 217 +++++++++++++++++++++++++++ configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 2 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 2 +- 10 files changed, 441 insertions(+), 11 deletions(-) delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts
arch/riscv/dts/Makefile +1 -1
@@ -2,7 +2,7 @@ dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb -dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt.dtb +dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt32.dtb qemu-virt64.dtb dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb
arch/riscv/dts/qemu-virt.dts deleted +0 -8
@@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2021, Bin Meng <[email protected]> - */ - -/dts-v1/; - -#include "binman.dtsi"
arch/riscv/dts/qemu-virt32.dts new file +217 -0
217 lines not on this page · raw message
arch/riscv/dts/qemu-virt64.dts new file +217 -0
217 lines not on this page · raw message
configs/qemu-riscv32_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 CONFIG_SYS_MALLOC_LEN=0x800000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32" CONFIG_TARGET_QEMU_VIRT=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x80200000
configs/qemu-riscv32_smode_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 CONFIG_SYS_MALLOC_LEN=0x800000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32" CONFIG_TARGET_QEMU_VIRT=y CONFIG_RISCV_SMODE=y CONFIG_DISTRO_DEFAULTS=y
configs/qemu-riscv32_spl_defconfig +1 -1
@@ -2,7 +2,7 @@ CONFIG_RISCV=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_DEFAULT_DEVICE_TREE="qemu-virt" +CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32" CONFIG_SPL=y CONFIG_TARGET_QEMU_VIRT=y CONFIG_RISCV_SMODE=y
configs/qemu-riscv64_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 CONFIG_SYS_MALLOC_LEN=0x800000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64" CONFIG_TARGET_QEMU_VIRT=y CONFIG_ARCH_RV64I=y CONFIG_DISTRO_DEFAULTS=y
configs/qemu-riscv64_smode_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 CONFIG_SYS_MALLOC_LEN=0x800000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64" CONFIG_TARGET_QEMU_VIRT=y CONFIG_ARCH_RV64I=y CONFIG_RISCV_SMODE=y
configs/qemu-riscv64_spl_defconfig +1 -1
@@ -2,7 +2,7 @@ CONFIG_RISCV=y CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x20000 CONFIG_SYS_MALLOC_LEN=0x800000 -CONFIG_DEFAULT_DEVICE_TREE="qemu-virt" +CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64" CONFIG_SPL=y CONFIG_TARGET_QEMU_VIRT=y CONFIG_ARCH_RV64I=y
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 8/26 arm: rpi: Add a devicetree file for rpi_4
In reply to Simon GlassAdd this file, obtained from the Raspbian boot disk, so there is a reference devicetree in the U-Boot tree. The same one is used for 32- and 64-bit variants.
Note that U-Boot does not normally need this at runtime, since CONFIG_OF_BOARD is enabled. The previous firmware stage provides a devicetree at runtime.
---
(no changes since v1)
arch/arm/dts/Makefile | 3 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++++++++++++++++++++++++++++++ configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + 5 files changed, 1963 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
arch/arm/dts/Makefile +2 -1
@@ -1068,7 +1068,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \ bcm2837-rpi-3-b-plus.dtb \ - bcm2837-rpi-cm3-io3.dtb + bcm2837-rpi-cm3-io3.dtb \ + bcm2711-rpi-4-b.dtb dtb-$(CONFIG_ARCH_BCM63158) += \ bcm963158.dtb
arch/arm/dts/bcm2711-rpi-4-b.dts new file +1958 -0
1,958 lines not on this page · raw message
configs/rpi_4_32b_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000 CONFIG_TARGET_RPI_4_32B=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 +CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b" CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_OF_BOARD_SETUP=y
configs/rpi_4_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00080000 CONFIG_TARGET_RPI_4=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 +CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b" CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x1000000 CONFIG_OF_BOARD_SETUP=y
configs/rpi_arm64_defconfig +1 -0
@@ -6,6 +6,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x1000000 +CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b" CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="pci enum; usb start;"
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 9/26 arm: vexpress: Add a devicetree file for juno
In reply to Simon GlassAdd this file, obtained from the Linaro website[1], so there is a reference file in the U-Boot tree.
Note that U-Boot does not normally need this at runtime, since CONFIG_OF_BOARD is enabled. The previous firmware stage provides a devicetree at runtime.
[1] https://releases.linaro.org/android/reference-lcr/juno/7.1-17.05/
---
(no changes since v1)
arch/arm/dts/Makefile | 3 + arch/arm/dts/juno-r2.dts | 1038 ++++++++++++++++++++++++ configs/vexpress_aemv8a_juno_defconfig | 1 + 3 files changed, 1042 insertions(+) create mode 100644 arch/arm/dts/juno-r2.dts
arch/arm/dts/Makefile +3 -0
@@ -1140,7 +1140,10 @@ dtb-$(CONFIG_TARGET_GE_BX50V3) += \ dtb-$(CONFIG_TARGET_GE_B1X5V2) += imx6dl-b1x5v2.dtb dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb +# TODO(Linus Walleij <[email protected]>): Should us a single vexpress +# Kconfig option to build all of these. See examples above. dtb-$(CONFIG_TARGET_VEXPRESS_CA9X4) += vexpress-v2p-ca9.dtb +dtb-$(CONFIG_TARGET_VEXPRESS64_JUNO) += juno-r2.dtb dtb-$(CONFIG_TARGET_TOTAL_COMPUTE) += total_compute.dtb
arch/arm/dts/juno-r2.dts new file +1038 -0
1,038 lines not on this page · raw message
configs/vexpress_aemv8a_juno_defconfig +1 -0
@@ -52,3 +52,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y +CONFIG_DEFAULT_DEVICE_TREE="juno-r2"
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 10/26 arm: xenguest_arm64: Add a fake devicetree file
In reply to Simon GlassAdd an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.
The build instructions in U-Boot do not provide enough detail to build a useful devicetree, unfortunately.
---
(no changes since v1)
arch/arm/dts/Makefile | 2 ++ arch/arm/dts/xenguest-arm64.dts | 15 +++++++++++++++ configs/xenguest_arm64_defconfig | 1 + 3 files changed, 18 insertions(+) create mode 100644 arch/arm/dts/xenguest-arm64.dts
arch/arm/dts/Makefile +2 -0
@@ -1131,6 +1131,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt8516-pumpkin.dtb \ mt8518-ap1-emmc.dtb +dtb-$(CONFIG_XEN) += xenguest-arm64.dtb + dtb-$(CONFIG_TARGET_GE_BX50V3) += \ imx6q-bx50v3.dtb \ imx6q-b850v3.dtb \
arch/arm/dts/xenguest-arm64.dts new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Dummy devicetre file for xenguest_arm64 + * + * This is required to make the board build with CONFIG OF_SEPARATE + * Build instructions at xenguest_arm64.rst are inadequate for obtaining a real + * devicetree. + * + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
configs/xenguest_arm64_defconfig +1 -0
@@ -4,6 +4,7 @@ CONFIG_TARGET_XENGUEST_ARM64=y CONFIG_SYS_TEXT_BASE=0x40080000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_SYS_MALLOC_LEN=0x2000000 +CONFIG_DEFAULT_DEVICE_TREE="xenguest-arm64" CONFIG_IDENT_STRING=" xenguest" CONFIG_SYS_LOAD_ADDR=0x40000000 CONFIG_BOOTDELAY=10
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 11/26 arm: octeontx: Add a fake devicetree file
In reply to Simon GlassAdd an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.
Unfortunately there are no build instructions in the U-Boot tree to enable a real file to be created.
---
(no changes since v1)
arch/arm/dts/Makefile | 3 +++ arch/arm/dts/octeontx.dts | 14 ++++++++++++++ configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + 6 files changed, 21 insertions(+) create mode 100644 arch/arm/dts/octeontx.dts
arch/arm/dts/Makefile +3 -0
@@ -1133,6 +1133,9 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ dtb-$(CONFIG_XEN) += xenguest-arm64.dtb +dtb-$(CONFIG_ARCH_OCTEONTX) += octeontx.dtb +dtb-$(CONFIG_ARCH_OCTEONTX2) += octeontx.dtb + dtb-$(CONFIG_TARGET_GE_BX50V3) += \ imx6q-bx50v3.dtb \ imx6q-b850v3.dtb \
arch/arm/dts/octeontx.dts new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Dummy devicetre file for octeontx2 boards + * + * This is required to make the board build with CONFIG OF_SEPARATE + * I could not find any in-tree documentation at all so this is a dummy file. + * + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
configs/octeontx2_95xx_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX2_95XX=y CONFIG_SYS_MALLOC_LEN=0x4008000 CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="octeontx" CONFIG_DEBUG_UART_BASE=0x87e028000000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART=y
configs/octeontx2_96xx_defconfig +1 -0
@@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX2_96XX=y CONFIG_SYS_MALLOC_LEN=0x4008000 CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="octeontx" CONFIG_DEBUG_UART_BASE=0x87e028000000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART=y
configs/octeontx_81xx_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX_81XX=y CONFIG_SYS_MALLOC_LEN=0x4008000 CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="octeontx" CONFIG_DEBUG_UART_BASE=0x87e028000000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART=y
configs/octeontx_83xx_defconfig +1 -0
@@ -10,6 +10,7 @@ CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_TARGET_OCTEONTX_83XX=y CONFIG_SYS_MALLOC_LEN=0x4008000 CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="octeontx" CONFIG_DEBUG_UART_BASE=0x87e028000000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_DEBUG_UART=y
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 12/26 arm: xilinx_versal_virt: Add a devicetree file
In reply to Simon GlassAdd a devicetree file obtained from qemu for this board. This was obtained with:
qemu-system-aarch64 -M xlnx-versal-virt -machine dumpdtb=dtb.dtb
---
(no changes since v1)
arch/arm/dts/Makefile | 3 +- arch/arm/dts/xilinx-versal-virt.dts | 307 +++++++++++++++++++++++++++ configs/xilinx_versal_virt_defconfig | 1 + 3 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/xilinx-versal-virt.dts
arch/arm/dts/Makefile +2 -1
@@ -352,7 +352,8 @@ dtb-$(CONFIG_ARCH_ZYNQMP) += \ dtb-$(CONFIG_ARCH_VERSAL) += \ versal-mini.dtb \ versal-mini-emmc0.dtb \ - versal-mini-emmc1.dtb + versal-mini-emmc1.dtb \ + xilinx-versal-virt.dtb dtb-$(CONFIG_ARCH_ZYNQMP_R5) += \ zynqmp-r5.dtb dtb-$(CONFIG_AM33XX) += \
arch/arm/dts/xilinx-versal-virt.dts new file +307 -0
307 lines not on this page · raw message
configs/xilinx_versal_virt_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x100000 CONFIG_SYS_MEMTEST_START=0x00000000 CONFIG_SYS_MEMTEST_END=0x00001000 CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt" CONFIG_CMD_FRU=y CONFIG_DEFINE_TCM_OCM_MMAP=y CONFIG_COUNTER_FREQUENCY=100000000
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 13/26 arm: bcm7xxx: Add a devicetree file
In reply to Simon GlassAdd a dummy devicetree file for these boards. It seems to be possible to obtain a real one from another bootloader called 'bolt' but I will leave this to the maintainer.
---
(no changes since v1)
arch/arm/dts/Makefile | 2 ++ arch/arm/dts/bcm7xxx.dts | 15 +++++++++++++++ configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + 4 files changed, 19 insertions(+) create mode 100644 arch/arm/dts/bcm7xxx.dts
arch/arm/dts/Makefile +2 -0
@@ -1083,6 +1083,8 @@ dtb-$(CONFIG_ARCH_BCM6858) += \ dtb-$(CONFIG_TARGET_BCMNS3) += ns3-board.dtb +dtb-$(CONFIG_ARCH_BCMSTB) += bcm7xxx.dtb + dtb-$(CONFIG_ASPEED_AST2500) += ast2500-evb.dtb dtb-$(CONFIG_ASPEED_AST2600) += ast2600-evb.dtb
arch/arm/dts/bcm7xxx.dts new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Dummy devicetre file for bcm7260 board + * + * This is required to make the board build with CONFIG OF_SEPARATE + * In-tree document explains how to obtain a real devicetree using 'bolt' but + * I did not attempt this. + * + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
configs/bcm7260_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x814800 CONFIG_SYS_MALLOC_LEN=0x2800000 +CONFIG_DEFAULT_DEVICE_TREE="bcm7xxx" CONFIG_ENV_OFFSET_REDUND=0x824800 CONFIG_SYS_LOAD_ADDR=0x02000000 CONFIG_FIT=y
configs/bcm7445_defconfig +1 -0
@@ -8,6 +8,7 @@ CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x1E0000 CONFIG_ENV_SECT_SIZE=0x10000 CONFIG_SYS_MALLOC_LEN=0xa00000 +CONFIG_DEFAULT_DEVICE_TREE="bcm7xxx" CONFIG_ENV_OFFSET_REDUND=0x1F0000 CONFIG_SYS_LOAD_ADDR=0x02000000 CONFIG_FIT=y
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 14/26 arm: qemu-ppce500: Add a devicetree file
In reply to Simon GlassAdd a devicetree file obtained from qemu for this board. This was obtained with:
qemu-system-ppc64 -machine ppce500 -cpu e6500 -M dumpdtb=dtb.dtb
---
(no changes since v1)
arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 ++++++++++++++++++++++++++++++ configs/qemu-ppce500_defconfig | 1 + 3 files changed, 266 insertions(+) create mode 100644 arch/powerpc/dts/qemu-ppce500.dts
arch/powerpc/dts/Makefile +1 -0
@@ -18,6 +18,7 @@ dtb-$(CONFIG_TARGET_P2041RDB) += p2041rdb.dtb dtb-$(CONFIG_TARGET_P3041DS) += p3041ds.dtb dtb-$(CONFIG_TARGET_P4080DS) += p4080ds.dtb dtb-$(CONFIG_TARGET_P5040DS) += p5040ds.dtb +dtb-$(CONFIG_TARGET_QEMU_PPCE500) += qemu-ppce500.dtb dtb-$(CONFIG_TARGET_SOCRATES) += socrates.dtb dtb-$(CONFIG_TARGET_T1024RDB) += t1024rdb.dtb dtb-$(CONFIG_TARGET_T1042D4RDB) += t1042d4rdb.dtb
arch/powerpc/dts/qemu-ppce500.dts new file +264 -0
264 lines not on this page · raw message
configs/qemu-ppce500_defconfig +1 -0
@@ -1,6 +1,7 @@ CONFIG_PPC=y CONFIG_SYS_TEXT_BASE=0xf01000 CONFIG_ENV_SIZE=0x2000 +CONFIG_DEFAULT_DEVICE_TREE="qemu-ppce500" CONFIG_MPC85xx=y # CONFIG_CMD_ERRATA is not set CONFIG_TARGET_QEMU_PPCE500=y
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 15/26 arm: highbank: Add a fake devicetree file
In reply to Simon GlassAdd an empty file to prevent build errors when building with CONFIG_OF_SEPARATE enabled.
Unfortunately there are no build instructions in the U-Boot tree to enable a real file to be created.
---
(no changes since v1)
arch/arm/dts/Makefile | 2 ++ arch/arm/dts/highbank.dts | 14 ++++++++++++++ configs/highbank_defconfig | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/highbank.dts
arch/arm/dts/Makefile +2 -0
@@ -862,6 +862,8 @@ dtb-$(CONFIG_MX7) += imx7d-sdb.dtb \ dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-com.dtb \ imx7ulp-evk.dtb +dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb + dtb-$(CONFIG_ARCH_IMX8) += \ fsl-imx8qm-apalis.dtb \ fsl-imx8qm-mek.dtb \
arch/arm/dts/highbank.dts new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Dummy devicetre file for highbank board + * + * This is required to make the board build with CONFIG OF_SEPARATE + * There appears to be no in-tree documentation about this board at all. + * + * Copyright 2021 Google LLC + */ + +/dts-v1/; + +/ { +};
configs/highbank_defconfig +1 -1
@@ -7,6 +7,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000 CONFIG_NR_DRAM_BANKS=2 CONFIG_ENV_SIZE=0x2000 CONFIG_SYS_MALLOC_LEN=0x80000 +CONFIG_DEFAULT_DEVICE_TREE="highbank" CONFIG_SYS_BOOTCOUNT_ADDR=0xfff3cf0c CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y CONFIG_DISTRO_DEFAULTS=y
@@ -21,7 +22,6 @@ CONFIG_AUTOBOOT_KEYED_CTRLC=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y # CONFIG_CMD_SETEXPR is not set -CONFIG_OF_BOARD=y CONFIG_ENV_IS_IN_NVRAM=y CONFIG_ENV_ADDR=0xFFF88000 CONFIG_SCSI_AHCI=y
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 16/26 fdt: Make OF_BOARD a bool option
In reply to Simon GlassThis should not be a separate option from OF_SEPARATE. It is a run-time option to override the devicetree, even if present.
Move the option out of the choice.
Disable BINMAN_FDT for a few boards which don't actually use it.
---
(no changes since v1)
configs/qemu-ppce500_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 2 ++ configs/qemu-riscv64_spl_defconfig | 1 + dts/Kconfig | 9 +++++---- 4 files changed, 9 insertions(+), 4 deletions(-)
configs/qemu-ppce500_defconfig +1 -0
@@ -54,4 +54,5 @@ CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_BLK=y CONFIG_ADDR_MAP=y +# CONFIG_BINMAN_FDT is not set CONFIG_PANIC_HANG=y
configs/qemu-riscv32_spl_defconfig +2 -0
@@ -6,6 +6,7 @@ CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32" CONFIG_SPL=y CONFIG_TARGET_QEMU_VIRT=y CONFIG_RISCV_SMODE=y +# CONFIG_OF_BOARD_FIXUP is not set CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x80200000 CONFIG_FIT=y
@@ -18,3 +19,4 @@ CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_SYSRESET_SBI=y +# CONFIG_BINMAN_FDT is not set
configs/qemu-riscv64_spl_defconfig +1 -0
@@ -19,3 +19,4 @@ CONFIG_OF_BOARD=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y CONFIG_SYSRESET_SBI=y +# CONFIG_BINMAN_FDT is not set
dts/Kconfig +5 -4
@@ -100,7 +100,6 @@ choice config OF_SEPARATE bool "Separate DTB for DT control" - depends on !SANDBOX help If this option is enabled, the device tree will be built and placed as a separate u-boot.dtb file alongside the U-Boot image.
@@ -113,14 +112,16 @@ config OF_EMBED and development only and is not recommended for production devices. Boards in the mainline U-Boot tree should not use it. +endchoice + config OF_BOARD bool "Provided by the board (e.g a previous loader) at runtime" help If this option is enabled, the device tree will be provided by - the board at runtime if the board supports it, instead of being - bundled with the image. + the board at runtime if the board supports it. The device tree bundled + with the image (if any) will be overridden / ignored. -endchoice + A device tree file must be provided in the tree. config DEFAULT_DEVICE_TREE string "Default Device Tree for DT control"
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 17/26 Drop CONFIG_BINMAN_STANDALONE_FDT
In reply to Simon GlassThis was added as a hack to work around not having an in-tree devicetree. Now that this is fixed it is not needed.
Drop it.
---
(no changes since v1)
Makefile | 3 +-- dts/Kconfig | 18 ------------------ tools/binman/binman.rst | 20 -------------------- 3 files changed, 1 insertion(+), 40 deletions(-)
Makefile +1 -2
@@ -943,7 +943,6 @@ endif endif INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb -INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif
@@ -1407,7 +1406,7 @@ u-boot-lzma.img: u-boot.bin.lzma FORCE u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \ ,$(UBOOT_BIN)) FORCE $(call if_changed,mkimage) $(BOARD_SIZE_CHECK)
dts/Kconfig +0 -18
@@ -16,24 +16,6 @@ config BINMAN bool select DTOC -config BINMAN_STANDALONE_FDT - bool - depends on BINMAN - default y if OF_BOARD - help - This option tells U-Boot build system that a standalone device tree - source is explicitly required when using binman to package U-Boot. - - This is not necessary in a common scenario where a device tree source - that contains the binman node is provided in the arch/<arch>/dts - directory for a specific board. Such device tree sources are built for - OF_SEPARATE or OF_EMBED. However for a scenario like the board device - tree blob is not provided in the U-Boot build tree, but fed to U-Boot - in the runtime, e.g.: in the OF_BOARD case that it is passed by - a prior stage bootloader. For such scenario, a standalone device tree - blob containing binman node to describe how to package U-Boot should - be provided explicitly. - menu "Device Tree Control" depends on SUPPORT_OF_CONTROL
tools/binman/binman.rst +0 -20
@@ -232,26 +232,6 @@ You can use other, more specific CONFIG options - see 'Automatic .dtsi inclusion' below. -Using binman with OF_BOARD --------------------------------------------- - -Normally binman is used with a board configured with OF_SEPARATE or OF_EMBED. -This is a typical scenario where a device tree source that contains the binman -node is provided in the arch/<arch>/dts directory for a specific board. - -However for a board configured with OF_BOARD, no device tree blob is provided -in the U-Boot build phase hence the binman node information is not available. -In order to support such use case, a new Kconfig option BINMAN_STANDALONE_FDT -is introduced, to tell the build system that a standalone device tree blob -containing binman node is explicitly required. - -Note there is a Kconfig option BINMAN_FDT which enables U-Boot run time to -access information about binman entries, stored in the device tree in a binman -node. Generally speaking, this option makes sense for OF_SEPARATE or OF_EMBED. -For the other OF_CONTROL methods, it's quite possible binman node is not -available as binman is invoked during the build phase, thus this option is not -turned on by default for these OF_CONTROL methods. - Access to binman entry offsets at run time (symbols) ----------------------------------------------------
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 18/26 doc: Update info on devicetree update
In reply to Simon GlassSince OF_BOARD has been corrected to be a run-time option, we can drop the historical info from this documentation.
---
(no changes since v1)
doc/develop/devicetree/dt_update.rst | 74 +++------------------------- 1 file changed, 8 insertions(+), 66 deletions(-)
doc/develop/devicetree/dt_update.rst +8 -66
@@ -32,66 +32,6 @@ that board on suitable hardware (or emulation). This is specified using the `CONFIG DEFAULT_DEVICE_TREE` option. -Current situation (October 2021) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -As an aside, at present U-Boot allows `CONFIG_DEFAULT_DEVICE_TREE` to be empty, -e.g. if `CONFIG_OF_BOARD` is used. This has unfortunately created an enormous -amount of confusion and some wasted effort. This was not intended. Support for -an empty `CONFIG_DEFAULT_DEVICE_TREE` will be dropped soon. - -Some of the problems created are: - -- It is not obvious that the devicetree is coming from another project - -- There is no way to see even a sample devicetree for these platform in U-Boot, - so it is hard to know what is going on, e.g. which devices are typically - present - -- The other project may not provide a way to support U-Boot's requirements for - devicetree, such as the /config node. Note: On the U-Boot mailing linst, this - was only discovered after weeks of discussion and confusion - -- For QEMU specifically, consulting two QEMU source files is required, for which - there are no references in U-Boot documentation. The code is generating a - devicetree, but it is not clear what controls affect this generation. - -Specifically on the changes in U-Bootm `CONFIG_OF_BOARD` was added in -rpi_patch_ for Raspberry Pi, which does have an in-tree devicetree, but this -feature has since been used for boards that don't - -Once this bug is fixed, CONFIG_OF_BOARD will override (at runtime) the -evicetree suppled with U-Boot, but will otherwise use CONFIG_OF_SEPARATE for the -in-tree build. So these two will become options, moving out of the 'choice' in -`dts/Kconfig`. - -This means that there is a basic devicetree build in the U-Boot tree, for -build-testing, consistency and documentation purposes, but at runtime U-Boot can -accept its devicetree from another source. The in-tree devicetree may contain -U-Boot-specific features (in u-boot*.dtsi files) and this may prove useful for -the other project, so it can ensure that U-Boot functions correctly and supports -all its expected features. - -To be clear, while U-Boot has its own copy of the devicetree source for each -board, this must match the Linux source, perhaps with some u-boot.dtsi -additions. The intent here is not to create a separate binding, just to provide -a representative devicetree in U-Boot. - -Offending boards are: - -- rpi_4 and rpi_4_32b (other rpi boards do have an in-tree devicetree) -- qemu_arm64 -- qemu_arm -- qemu-ppce500 -- qemu-riscv32 -- qemu-riscv32_smode -- qemu-riscv64 -- qemu-riscv64_smode - -All of these need to have a devicetree added in-tree. This is targeted to be -fixed in the 2022.01 release. - - Building the devicetree -----------------------
@@ -205,15 +145,18 @@ Operating System. Also, while Linux has a (sometimes extremely long) command line, U-Boot does not support this. The devicetree provides a more structured approach in any case. +Note: Dicussions on adding a binding for this to the Linux devicetree bindings +are ongoing as of October 2021. + Devicetree in another project ----------------------------- -In some cases U-Boot receive its devicetree at runtime from a program that calls -it. For example ARM's Trusted Firmware A (`TF-A`_) may have a devicetree that it -passes to U-Boot. This overrides any devicetree build by U-Boot. When packaging -the firmware, the U-Boot devicetree may in fact be left out if it can be -guaranteed that it will receive one from another project. +In some cases U-Boot receives its devicetree at runtime from a program that +calls it. For example ARM's Trusted Firmware A (`TF-A`_) may have a devicetree +that it passes to U-Boot. This overrides any devicetree build by U-Boot. When +packaging the firmware, the U-Boot devicetree may in fact be left out if it can +be guaranteed that it will receive one from another project. In this case, the devicetree in the other project must track U-Boot's use of device tree, for the following reasons:
@@ -547,7 +490,6 @@ Overall, adding a second devicetree would create enormous confusion and complexity. It seems a lot cheaper to solve this by a change of attitude. -.. _rpi_patch: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/ .. _`TF-A`: https://www.trustedfirmware.org/projects/tf-a .. _`QEMU ARM`: https://github.com/qemu/qemu/blob/master/hw/arm/virt.c .. _`QEMU RISC-V`: https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 19/26 fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()
In reply to Simon GlassThis logic is a bit convoluted for one function. Move the mulit-FIT part into its own function.
---
(no changes since v1)
lib/fdtdec.c | 62 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 24 deletions(-)
lib/fdtdec.c +38 -24
@@ -1591,13 +1591,46 @@ __weak int fdtdec_board_setup(const void *fdt_blob)return 0 ; } +/** +* setup_multi_dtb_fit() - locate the correct dtb from a FIT +* +* This supports the CONFIG_MULTI_DTB_FIT feature, looking for the dtb in a +* supplied FIT +* +* It accepts the current value of gd->fdt_blob, which points to the FIT, then +* updates that gd->fdt_blob, to point to the chosen dtb so that U-Boot uses the +* correct one +*/ +static void setup_multi_dtb_fit (void ) +{ +# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) +void *blob; + +/* +* Try and uncompress the blob. +* Unfortunately there is no way to know how big the input blob really +* is. So let us set the maximum input size arbitrarily high. 16MB +* ought to be more than enough for packed DTBs. +*/ +if (uncompress_blob (gd->fdt_blob,0x1000000 , &blob) ==0 ) + gd->fdt_blob = blob; + +/* +* Check if blob is a FIT images containings DTBs. +* If so, pick the most relevant +*/ + blob =locate_dtb_in_fit (gd->fdt_blob); +if (blob) { + gd->multi_dtb_fit = gd->fdt_blob; + gd->fdt_blob = blob; + } +#endif /* # MULTI_DTB_FIT */ +} +int fdtdec_setup (void ) {int ret;#if CONFIG_IS_ENABLED (OF_CONTROL ) -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) -void *fdt_blob; -# endif # ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ # ifdef CONFIG_SPL_BUILD
@@ -1616,27 +1649,8 @@ int fdtdec_setup(void) (unsigned long)map_to_sysmem(gd->fdt_blob)), 0);# endif -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) -/* -* Try and uncompress the blob. -* Unfortunately there is no way to know how big the input blob really -* is. So let us set the maximum input size arbitrarily high. 16MB -* ought to be more than enough for packed DTBs. -*/ -if (uncompress_blob (gd->fdt_blob,0x1000000 , &fdt_blob) ==0 ) - gd->fdt_blob = fdt_blob; - -/* -* Check if blob is a FIT images containings DTBs. -* If so, pick the most relevant -*/ - fdt_blob =locate_dtb_in_fit (gd->fdt_blob); -if (fdt_blob) { - gd->multi_dtb_fit = gd->fdt_blob; - gd->fdt_blob = fdt_blob; - } - -# endif +if (CONFIG_IS_ENABLED (MULTI_DTB_FIT )) +setup_multi_dtb_fit ();#endif ret =fdtdec_prepare_fdt ();
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Re: [PATCH v5 19/26] fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup()
Hi Simon,
Since those patch series are too long and borderline unreviewable, I'd much rather split them on different patchsets (i.e one with cleanups and one with the actual proposal).
Quoted 98 lines · Simon Glass
This logic is a bit convoluted for one function. Move the mulit-FIT part into its own function.
Signed-off-by Simon Glass <[email protected]>---
(no changes since v1)
lib/fdtdec.c | 62 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 24 deletions(-)lib/fdtdec.c +38
-24@@ -1591,13 +1591,46 @@ __weak int fdtdec_board_setup(const void *fdt_blob)return 0 ; } +/** +* setup_multi_dtb_fit() - locate the correct dtb from a FIT +* +* This supports the CONFIG_MULTI_DTB_FIT feature, looking for the dtb in a +* supplied FIT +* +* It accepts the current value of gd->fdt_blob, which points to the FIT, then +* updates that gd->fdt_blob, to point to the chosen dtb so that U-Boot uses the +* correct one +*/ +static void setup_multi_dtb_fit (void ) +{ +# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) +void *blob; + +/* +* Try and uncompress the blob. +* Unfortunately there is no way to know how big the input blob really +* is. So let us set the maximum input size arbitrarily high. 16MB +* ought to be more than enough for packed DTBs. +*/ +if (uncompress_blob (gd->fdt_blob,0x1000000 , &blob) ==0 ) + gd->fdt_blob = blob; + +/* +* Check if blob is a FIT images containings DTBs. +* If so, pick the most relevant +*/ + blob =locate_dtb_in_fit (gd->fdt_blob); +if (blob) { + gd->multi_dtb_fit = gd->fdt_blob; + gd->fdt_blob = blob; + } +#endif /* # MULTI_DTB_FIT */ +} +int fdtdec_setup (void ) {int ret;#if CONFIG_IS_ENABLED (OF_CONTROL ) -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) -void *fdt_blob; -# endif # ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ # ifdef CONFIG_SPL_BUILD @@ -1616,27 +1649,8 @@ int fdtdec_setup(void) (unsigned long)map_to_sysmem(gd->fdt_blob)), 0);# endif -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) -/* -* Try and uncompress the blob. -* Unfortunately there is no way to know how big the input blob really -* is. So let us set the maximum input size arbitrarily high. 16MB -* ought to be more than enough for packed DTBs. -*/ -if (uncompress_blob (gd->fdt_blob,0x1000000 , &fdt_blob) ==0 ) - gd->fdt_blob = fdt_blob; - -/* -* Check if blob is a FIT images containings DTBs. -* If so, pick the most relevant -*/ - fdt_blob =locate_dtb_in_fit (gd->fdt_blob); -if (fdt_blob) { - gd->multi_dtb_fit = gd->fdt_blob; - gd->fdt_blob = fdt_blob; - } - -# endif +if (CONFIG_IS_ENABLED (MULTI_DTB_FIT )) +setup_multi_dtb_fit ();#endif ret =fdtdec_prepare_fdt ();Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 20/26 fdt: Drop #ifdefs with MULTI_DTB_FIT
In reply to Simon GlassRefactor the code to drop the #ifdefs for this feature.
---
(no changes since v1)
dts/Kconfig | 1 - include/asm-generic/global_data.h | 8 ++++++++ lib/fdtdec.c | 31 +++++++++++-------------------- 3 files changed, 19 insertions(+), 21 deletions(-)
dts/Kconfig +0 -1
@@ -176,7 +176,6 @@ endchoice config MULTI_DTB_FIT_UNCOMPRESS_SZ hex "Size of memory reserved to uncompress the DTBs" - depends on (MULTI_DTB_FIT_GZIP || MULTI_DTB_FIT_LZO) default 0x8000 help This is the size of this area where the DTBs are uncompressed.
include/asm-generic/global_data.h +8 -0
@@ -512,6 +512,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE);#define gd_acpi_ctx () NULL#endif +#if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) +#define gd_multi_dtb_fit () gd->multi_dtb_fit +#define gd_set_multi_dtb_fit (_dtb) gd->multi_dtb_fit = _dtb +#else +#define gd_multi_dtb_fit () NULL +#define gd_set_multi_dtb_fit (_dtb) +#endif +/** * enum gd_flags - global data flags *
lib/fdtdec.c +11 -20
@@ -1146,11 +1146,10 @@ int fdtdec_setup_mem_size_base_lowest(void)return 0 ; } -#if CONFIG_IS_ENABLED(MULTI_DTB_FIT) -# if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\ - CONFIG_IS_ENABLED(MULTI_DTB_FIT_LZO)static int uncompress_blob (const void *src,ulong sz_src,void **dstp) { +#if CONFIG_IS_ENABLED (MULTI_DTB_FIT_GZIP ) ||\ +CONFIG_IS_ENABLED (MULTI_DTB_FIT_LZO )size_t sz_out =CONFIG_VAL (MULTI_DTB_FIT_UNCOMPRESS_SZ );bool gzip =0 , lzo =0 ;ulong sz_in = sz_src;
@@ -1175,11 +1174,11 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return -ENOMEM ; } }else { -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT_USER_DEFINED_AREA ) +# if CONFIG_IS_ENABLED (MULTI_DTB_FIT_USER_DEFINED_AREA ) dst = (void *)CONFIG_VAL (MULTI_DTB_FIT_USER_DEF_ADDR ); -# else +# else return -ENOTSUPP ; -# endif +# endif }if (CONFIG_IS_ENABLED (GZIP ) && gzip)
@@ -1197,16 +1196,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp) return -EBADMSG; } *dstp = dst; -return 0 ; -} -# else -static int uncompress_blob (const void *src,ulong sz_src,void **dstp) -{ +#else + *dstp = (void *)src; *dstp = (void *)src; +#endif return 0 ; } -# endif -#endif #if defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/*
@@ -1603,7 +1598,6 @@ __weak int fdtdec_board_setup(const void *fdt_blob)*/ static void setup_multi_dtb_fit (void ) { -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT )void *blob;/*
@@ -1621,10 +1615,9 @@ static void setup_multi_dtb_fit(void)*/ blob =locate_dtb_in_fit (gd->fdt_blob);if (blob) { - gd->multi_dtb_fit = gd->fdt_blob; +gd_set_multi_dtb_fit (gd->fdt_blob); gd->fdt_blob = blob; } -#endif /* # MULTI_DTB_FIT */ }int fdtdec_setup (void )
@@ -1659,7 +1652,6 @@ int fdtdec_setup(void)return ret; } -#if CONFIG_IS_ENABLED (MULTI_DTB_FIT )int fdtdec_resetup (int *rescan) {void *fdt_blob;
@@ -1670,8 +1662,8 @@ int fdtdec_resetup(int *rescan)* FIT image stillpresent there. Save the time and space * required to uncompress it again. */ -if (gd->multi_dtb_fit) { - fdt_blob =locate_dtb_in_fit (gd->multi_dtb_fit); +if (gd_multi_dtb_fit ()) { + fdt_blob =locate_dtb_in_fit (gd_multi_dtb_fit ());if (fdt_blob == gd->fdt_blob) {/*
@@ -1695,7 +1687,6 @@ int fdtdec_resetup(int *rescan) *rescan =0 ;return 0 ; } -#endif int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, phys_addr_t *basep, phys_size_t *sizep,
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Re: [PATCH v5 20/26] fdt: Drop #ifdefs with MULTI_DTB_FIT
Hi Simon,
likewise, since this is a pretty big patchset split it of in refactoring/new code patchsets so we can actually review it.
Thanks
/Ilias
Quoted 146 lines · Simon Glass
Refactor the code to drop the #ifdefs for this feature.
Signed-off-by Simon Glass <[email protected]>---
(no changes since v1)
dts/Kconfig | 1 - include/asm-generic/global_data.h | 8 ++++++++ lib/fdtdec.c | 31 +++++++++++-------------------- 3 files changed, 19 insertions(+), 21 deletions(-)dts/Kconfig +0
-1@@ -176,7 +176,6 @@ endchoice config MULTI_DTB_FIT_UNCOMPRESS_SZ hex "Size of memory reserved to uncompress the DTBs" - depends on (MULTI_DTB_FIT_GZIP || MULTI_DTB_FIT_LZO) default 0x8000 help This is the size of this area where the DTBs are uncompressed.include/asm-generic/global_data.h +8
-0@@ -512,6 +512,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE);#define gd_acpi_ctx () NULL#endif +#if CONFIG_IS_ENABLED (MULTI_DTB_FIT ) +#define gd_multi_dtb_fit () gd->multi_dtb_fit +#define gd_set_multi_dtb_fit (_dtb) gd->multi_dtb_fit = _dtb +#else +#define gd_multi_dtb_fit () NULL +#define gd_set_multi_dtb_fit (_dtb) +#endif +/** * enum gd_flags - global data flags * lib/fdtdec.c +11
-20@@ -1146,11 +1146,10 @@ int fdtdec_setup_mem_size_base_lowest(void)return 0 ; } -#if CONFIG_IS_ENABLED(MULTI_DTB_FIT) -# if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\ - CONFIG_IS_ENABLED(MULTI_DTB_FIT_LZO)static int uncompress_blob (const void *src,ulong sz_src,void **dstp) { +#if CONFIG_IS_ENABLED (MULTI_DTB_FIT_GZIP ) ||\ +CONFIG_IS_ENABLED (MULTI_DTB_FIT_LZO )size_t sz_out =CONFIG_VAL (MULTI_DTB_FIT_UNCOMPRESS_SZ );bool gzip =0 , lzo =0 ;ulong sz_in = sz_src;@@ -1175,11 +1174,11 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return -ENOMEM ; } }else { -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT_USER_DEFINED_AREA ) +# if CONFIG_IS_ENABLED (MULTI_DTB_FIT_USER_DEFINED_AREA ) dst = (void *)CONFIG_VAL (MULTI_DTB_FIT_USER_DEF_ADDR ); -# else +# else return -ENOTSUPP ; -# endif +# endif }if (CONFIG_IS_ENABLED (GZIP ) && gzip)@@ -1197,16 +1196,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp) return -EBADMSG; } *dstp = dst; -return 0 ; -} -# else -static int uncompress_blob (const void *src,ulong sz_src,void **dstp) -{ +#else + *dstp = (void *)src; *dstp = (void *)src; +#endif return 0 ; } -# endif -#endif #if defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* @@ -1603,7 +1598,6 @@ __weak int fdtdec_board_setup(const void *fdt_blob)*/ static void setup_multi_dtb_fit (void ) { -# if CONFIG_IS_ENABLED (MULTI_DTB_FIT )void *blob;/* @@ -1621,10 +1615,9 @@ static void setup_multi_dtb_fit(void)*/ blob =locate_dtb_in_fit (gd->fdt_blob);if (blob) { - gd->multi_dtb_fit = gd->fdt_blob; +gd_set_multi_dtb_fit (gd->fdt_blob); gd->fdt_blob = blob; } -#endif /* # MULTI_DTB_FIT */ }int fdtdec_setup (void )@@ -1659,7 +1652,6 @@ int fdtdec_setup(void)return ret; } -#if CONFIG_IS_ENABLED (MULTI_DTB_FIT )int fdtdec_resetup (int *rescan) {void *fdt_blob;@@ -1670,8 +1662,8 @@ int fdtdec_resetup(int *rescan)* FIT image stillpresent there. Save the time and space * required to uncompress it again. */ -if (gd->multi_dtb_fit) { - fdt_blob =locate_dtb_in_fit (gd->multi_dtb_fit); +if (gd_multi_dtb_fit ()) { + fdt_blob =locate_dtb_in_fit (gd_multi_dtb_fit ());if (fdt_blob == gd->fdt_blob) {/* @@ -1695,7 +1687,6 @@ int fdtdec_resetup(int *rescan) *rescan =0 ;return 0 ; } -#endif int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, phys_addr_t *basep, phys_size_t *sizep,Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 21/26 fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()
In reply to Simon GlassMove this to the header file to clean up the C code.
---
(no changes since v1)
include/fdtdec.h | 14 ++++++++++++++ lib/fdtdec.c | 6 +----- 2 files changed, 15 insertions(+), 5 deletions(-)
include/fdtdec.h +14 -0
@@ -111,6 +111,20 @@ struct fdt_pci_addr {extern u8 __dtb_dt_begin[];/* embedded device tree blob */ extern u8 __dtb_dt_spl_begin[];/* embedded device tree blob for SPL/TPL */ +/* Get a pointer to the embedded devicetree, if there is one, else NULL */ +static inline u8 *dtb_dt_embedded (void ) +{ +#ifdef CONFIG_OF_EMBED +# ifdef CONFIG_SPL_BUILD +return __dtb_dt_spl_begin; +# else +return __dtb_dt_begin; +# endif +#else +return NULL ; +#endif +} +/** * Compute the size of a resource. *
lib/fdtdec.c +1 -5
@@ -1626,11 +1626,7 @@ int fdtdec_setup(void)#if CONFIG_IS_ENABLED (OF_CONTROL )# ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ -# ifdef CONFIG_SPL_BUILD - gd->fdt_blob = __dtb_dt_spl_begin; -# else - gd->fdt_blob = __dtb_dt_begin; -# endif + gd->fdt_blob =dtb_dt_embedded ();# elif defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* Allow the board to override the fdt address. */ gd->fdt_blob =board_fdt_blob_setup ();
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 22/26 fdt: Drop #ifdef around board_fdt_blob_setup()
In reply to Simon GlassThis serves no purpose. Drop it.
---
(no changes since v1)
lib/fdtdec.c | 2 -- 1 file changed, 2 deletions(-)
lib/fdtdec.c +0 -2
@@ -1203,7 +1203,6 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -#if defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE )/* * For CONFIG_OF_SEPARATE, the board may optionally implement this to * provide and/or fixup the fdt.
@@ -1223,7 +1222,6 @@ __weak void *board_fdt_blob_setup(void)#endif return fdt_blob; } -#endif int fdtdec_set_ethernet_mac_address (void *fdt,const u8 *mac,size_t size) {
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 25/26 fdt: Drop remaining preprocessor macros in fdtdec_setup()
In reply to Simon GlassWe only have two choices for obtaining the devicetree. Simplify the code to make that clear.
---
(no changes since v1)
lib/fdtdec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
lib/fdtdec.c +7 -7
@@ -1621,13 +1621,13 @@ static void setup_multi_dtb_fit(void)int fdtdec_setup (void ) {int ret; -#ifdef CONFIG_OF_EMBED -/* Get a pointer to the FDT */ - gd->fdt_blob =dtb_dt_embedded (); -#elif defined(CONFIG_OF_BOARD ) || defined(CONFIG_OF_SEPARATE ) -/* Allow the board to override the fdt address. */ - gd->fdt_blob =board_fdt_blob_setup (); -#endif + +/* The devicetree is typically appended to U-Boot */ +if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) + gd->fdt_blob =board_fdt_blob_setup (); +else /* embed dtb in ELF file for testing / development */ + gd->fdt_blob =dtb_dt_embedded (); +if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
PATCH v5 26/26 fdt: Don't call board_fdt_blob_setup() without OF_BOARD
In reply to Simon GlassAt present this override function is called even when OF_BOARD Is not enabled. This makes it impossible to disable this feature and in fact makes the OF_BOARD option useless.
Reinstate its intended purpose, so that it is possible to switch between the appended devicetree and one provided by the board's custom function.
---
Changes in v5:
- Add new patches to clean up fdtdec_setup() and surrounds
include/fdtdec.h | 7 +++++-- lib/fdtdec.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-)
include/fdtdec.h +5 -2
@@ -1170,8 +1170,11 @@ int fdtdec_resetup(int *rescan);/** * Board-specific FDT initialization. Returns the address to a device tree blob. -* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined -* and the board implements it. +* Called when CONFIG_OF_BOARD is defined. +* +* The existing devicetree is available at gd->fdt_blob +* +* @returns new devicetree blob pointer */ void *board_fdt_blob_setup (void );
lib/fdtdec.c +11 -6
@@ -1203,11 +1203,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -/* -* For CONFIG_OF_SEPARATE, the board may optionally implement this to -* provide and/or fixup the fdt. +/** +* fdt_find_separate() - Find a devicetree at the end of the image +* +* @return pointer to FDT blob */ -__weak void *board_fdt_blob_setup (void ) +static void *fdt_find_separate (void ) {void *fdt_blob =NULL ;#ifdef CONFIG_SPL_BUILD
@@ -1623,11 +1624,15 @@ int fdtdec_setup(void)int ret;/* The devicetree is typically appended to U-Boot */ -if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) - gd->fdt_blob =board_fdt_blob_setup (); +if (IS_ENABLED (CONFIG_OF_SEPARATE )) + gd->fdt_blob =fdt_find_separate ();else /* embed dtb in ELF file for testing / development */ gd->fdt_blob =dtb_dt_embedded (); +/* Allow the board to override the fdt address. */ +if (IS_ENABLED (CONFIG_OF_BOARD )) + gd->fdt_blob =board_fdt_blob_setup (); +if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Hi Simon,
As I said here [1], this is moving on an entirely different direction I had in mind. I'd much prefer starting the discussions for a solution that allows us to scale.
FWIW I think the current code is still not clean for my taste. Commit 3b595da441cf ("fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE") allowed this function to be used regardless of the config options. IMHO we should have 2 clear options:
- U-Boot provides the DTB
- It's somehow passed over to U-Boot
Quoted 77 lines · Simon Glass
At present this override function is called even when
OF_BOARDIs not enabled. This makes it impossible to disable this feature and in fact makes theOF_BOARDoption useless.Reinstate its intended purpose, so that it is possible to switch between the appended devicetree and one provided by the board's custom function.
Signed-off-by Simon Glass <[email protected]>---
Changes in v5:
- Add new patches to clean upfdtdec_setup()and surroundsinclude/fdtdec.h | 7 +++++-- lib/fdtdec.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-)include/fdtdec.h +5
-2@@ -1170,8 +1170,11 @@ int fdtdec_resetup(int *rescan);/** * Board-specific FDT initialization. Returns the address to a device tree blob. -* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined -* and the board implements it. +* Called when CONFIG_OF_BOARD is defined. +* +* The existing devicetree is available at gd->fdt_blob +* +* @returns new devicetree blob pointer */ void *board_fdt_blob_setup (void );lib/fdtdec.c +11
-6@@ -1203,11 +1203,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -/* -* For CONFIG_OF_SEPARATE, the board may optionally implement this to -* provide and/or fixup the fdt. +/** +* fdt_find_separate() - Find a devicetree at the end of the image +* +* @return pointer to FDT blob */ -__weak void *board_fdt_blob_setup (void ) +static void *fdt_find_separate (void ) {void *fdt_blob =NULL ;#ifdef CONFIG_SPL_BUILD @@ -1623,11 +1624,15 @@ int fdtdec_setup(void)int ret;/* The devicetree is typically appended to U-Boot */ -if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) - gd->fdt_blob =board_fdt_blob_setup (); +if (IS_ENABLED (CONFIG_OF_SEPARATE )) + gd->fdt_blob =fdt_find_separate ();else /* embed dtb in ELF file for testing / development */ gd->fdt_blob =dtb_dt_embedded (); +/* Allow the board to override the fdt address. */ +if (IS_ENABLED (CONFIG_OF_BOARD )) + gd->fdt_blob =board_fdt_blob_setup (); +if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
[1] https://lore.kernel.org/u-boot/[email protected]/
Regards
/Ilias
Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Hi Ilias,
Quoted 6 lines · Ilias Apalodimas
Hi Simon,
As I said here [1], this is moving on an entirely different direction I had in mind. I'd much prefer starting the discussions for a solution that allows us to scale.
I am missing the point here. Is there something in the plans that I don't know about?
Quoted 5 lines
FWIW I think the current code is still not clean for my taste. Commit
3b595da441cf("fdtdec: allow board to provide fdt forCONFIG_OF_SEPARATE") allowed this function to be used regardless of the config options. IMHO we should have 2 clear options:
- U-Boot provides the DTB
Supported with: OF_SEPARATE
Quoted 1 line
- It's somehow passed over to U-Boot
Supported with: OF_SEPARATE + OF_BOARD
I actually hit this problem with my qemu testing, in that it is actually not possible to use U-Boot's devicetree without hacking the code. We need to be able to select this feature explicitly, or turn it off, at least for development.
Regards,
Simon
Quoted 84 lines · Simon Glass
Quoted 75 lines
At present this override function is called even when
OF_BOARDIs not enabled. This makes it impossible to disable this feature and in fact makes theOF_BOARDoption useless.Reinstate its intended purpose, so that it is possible to switch between the appended devicetree and one provided by the board's custom function.
Signed-off-by Simon Glass <[email protected]>---
Changes in v5:
- Add new patches to clean upfdtdec_setup()and surroundsinclude/fdtdec.h | 7 +++++-- lib/fdtdec.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-)include/fdtdec.h +5
-2@@ -1170,8 +1170,11 @@ int fdtdec_resetup(int *rescan);/** * Board-specific FDT initialization. Returns the address to a device tree blob. -* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined -* and the board implements it. +* Called when CONFIG_OF_BOARD is defined. +* +* The existing devicetree is available at gd->fdt_blob +* +* @returns new devicetree blob pointer */ void *board_fdt_blob_setup (void );lib/fdtdec.c +11
-7@@ -1203,11 +1203,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -/* -* For CONFIG_OF_SEPARATE, the board may optionally implement this to -* provide and/or fixup the fdt. +/** +* fdt_find_separate() - Find a devicetree at the end of the image +* +* @return pointer to FDT blob */ -__weak void *board_fdt_blob_setup (void ) +static void *fdt_find_separate (void ) {void *fdt_blob =NULL ;#ifdef CONFIG_SPL_BUILD @@ -1623,11 +1624,15 @@ int fdtdec_setup(void)int ret;/* The devicetree is typically appended to U-Boot */ -if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) - gd->fdt_blob =board_fdt_blob_setup (); +if (IS_ENABLED (CONFIG_OF_SEPARATE )) + gd->fdt_blob =fdt_find_separate ();else /* embed dtb in ELF file for testing / development */ gd->fdt_blob =dtb_dt_embedded (); +/* Allow the board to override the fdt address. */ +if (IS_ENABLED (CONFIG_OF_BOARD )) + gd->fdt_blob =board_fdt_blob_setup (); +if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16, --Quoted 2 lines
2.33.0.1079.g6e70778dc9-goog
[1] https://lore.kernel.org/u-boot/[email protected]/
Regards
/Ilias
Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Hi Simon,
Quoted 6 lines · Simon Glass
Hi Ilias,
Quoted 1 line · Ilias Apalodimas
Quoted 8 lines
Quoted 5 lines
Hi Simon,
As I said here [1], this is moving on an entirely different direction I had in mind. I'd much prefer starting the discussions for a solution that allows us to scale.
I am missing the point here. Is there something in the plans that I don't know about?
I have some ideas, but haven't found time to code it and send patches yet.
Quoted 7 lines
Quoted 6 lines
FWIW I think the current code is still not clean for my taste. Commit
3b595da441cf("fdtdec: allow board to provide fdt forCONFIG_OF_SEPARATE") allowed this function to be used regardless of the config options. IMHO we should have 2 clear options:
- U-Boot provides the DTB
Quoted 5 lines
Supported with:
OF_SEPARATEQuoted 1 line
- It's somehow passed over to U-Boot
Supported with:
OF_SEPARATE+OF_BOARD
That's exactly what I don't personally like. In your example OF_BOARD means "U-Boot has a DTB and here's a way to override it". In my head that options means "U-Boot was handed over a DTB on a register and it must be able to deal with it". The latter is obviously less restrictive to previous bootloaders.
Quoted 5 lines
I actually hit this problem with my qemu testing, in that it is actually not possible to use U-Boot's devicetree without hacking the code. We need to be able to select this feature explicitly, or turn it off, at least for development.
Alternatively we can just keep U-Boot config node in a .dtbo and apply it on the fly after QEMU has handed us over the DTB it created.
Regards
/Ilias
Quoted 89 lines
Regards,
SimonQuoted 84 lines · Simon Glass
Quoted 75 lines
At present this override function is called even when
OF_BOARDIs not enabled. This makes it impossible to disable this feature and in fact makes theOF_BOARDoption useless.Reinstate its intended purpose, so that it is possible to switch between the appended devicetree and one provided by the board's custom function.
Signed-off-by Simon Glass <[email protected]>---
Changes in v5:
- Add new patches to clean upfdtdec_setup()and surroundsinclude/fdtdec.h | 7 +++++-- lib/fdtdec.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-)include/fdtdec.h +5
-2@@ -1170,8 +1170,11 @@ int fdtdec_resetup(int *rescan);/** * Board-specific FDT initialization. Returns the address to a device tree blob. -* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined -* and the board implements it. +* Called when CONFIG_OF_BOARD is defined. +* +* The existing devicetree is available at gd->fdt_blob +* +* @returns new devicetree blob pointer */ void *board_fdt_blob_setup (void );lib/fdtdec.c +11
-7@@ -1203,11 +1203,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)return 0 ; } -/* -* For CONFIG_OF_SEPARATE, the board may optionally implement this to -* provide and/or fixup the fdt. +/** +* fdt_find_separate() - Find a devicetree at the end of the image +* +* @return pointer to FDT blob */ -__weak void *board_fdt_blob_setup (void ) +static void *fdt_find_separate (void ) {void *fdt_blob =NULL ;#ifdef CONFIG_SPL_BUILD @@ -1623,11 +1624,15 @@ int fdtdec_setup(void)int ret;/* The devicetree is typically appended to U-Boot */ -if (IS_ENABLED (CONFIG_OF_SEPARATE ) ||IS_ENABLED (CONFIG_OF_BOARD )) - gd->fdt_blob =board_fdt_blob_setup (); +if (IS_ENABLED (CONFIG_OF_SEPARATE )) + gd->fdt_blob =fdt_find_separate ();else /* embed dtb in ELF file for testing / development */ gd->fdt_blob =dtb_dt_embedded (); +/* Allow the board to override the fdt address. */ +if (IS_ENABLED (CONFIG_OF_BOARD )) + gd->fdt_blob =board_fdt_blob_setup (); +if (!IS_ENABLED (CONFIG_SPL_BUILD )) {/* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16, --Quoted 2 lines
2.33.0.1079.g6e70778dc9-goog
[1] https://lore.kernel.org/u-boot/[email protected]/
Regards
/Ilias
Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Quoted 27 lines · Ilias Apalodimas
Hi Simon,
Quoted 6 lines · Simon Glass
Hi Ilias,
Quoted 1 line · Ilias Apalodimas
Quoted 8 lines
Quoted 5 lines
Hi Simon,
As I said here [1], this is moving on an entirely different direction I had in mind. I'd much prefer starting the discussions for a solution that allows us to scale.
I am missing the point here. Is there something in the plans that I don't know about?
I have some ideas, but haven't found time to code it and send patches yet.
Quoted 7 lines
Quoted 6 lines
FWIW I think the current code is still not clean for my taste. Commit
3b595da441cf("fdtdec: allow board to provide fdt forCONFIG_OF_SEPARATE") allowed this function to be used regardless of the config options. IMHO we should have 2 clear options:
- U-Boot provides the DTB
Quoted 8 lines
Quoted 5 lines
Supported with:
OF_SEPARATEQuoted 1 line
- It's somehow passed over to U-Boot
Supported with:
OF_SEPARATE+OF_BOARDThat's exactly what I don't personally like. In your example
OF_BOARDmeans "U-Boot has a DTB and here's a way to override it". In my head
In some ways this is just highlighting a long standing problem of working with DTB. There's certainly been some places where splitting the data from the driver has helped. But in some other places, my goodness has it made the development cycle worse. Doing this on QEMU probably is on one of the most annoying cases too since yes, you start by dumping the dtb you would get, then iterating the dts outside of the rest of the scope of your build. In the kernel you can "make dtbs" at least and get things spit out. I'm just repeating over here that the development cycle of working on device trees is at times not great.
Signature · 1 line
Tom
Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Hi Tom
Quoted 42 lines · Tom Rini
Quoted 12 lines · Ilias Apalodimas
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Ilias,
Quoted 4 lines · Ilias Apalodimas
Hi Simon,
As I said here [1], this is moving on an entirely different
direction I had
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
in mind. I'd much prefer starting the discussions for a solution that allows us to scale.
I am missing the point here. Is there something in the plans that I don't know about?
I have some ideas, but haven't found time to code it and send patches
yet.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
FWIW I think the current code is still not clean for my taste.
Commit
Quoted 1 line
Quoted 1 line
Quoted 1 line
3b595da441cf("fdtdec: allow board to provide fdt for
CONFIG_OF_SEPARATE")Quoted 1 line
Quoted 1 line
Quoted 1 line
allowed this function to be used regardless of the config options.
IMHO we
Quoted 11 lines
Quoted 8 lines
Quoted 2 lines
should have 2 clear options:
- U-Boot provides the DTBSupported with:
OF_SEPARATEQuoted 1 line
- It's somehow passed over to U-Boot
Supported with:
OF_SEPARATE+OF_BOARDThat's exactly what I don't personally like. In your example
OF_BOARDmeans "U-Boot has a DTB and here's a way to override it". In my head
Quoted 9 lines
In some ways this is just highlighting a long standing problem of working with DTB. There's certainly been some places where splitting the data from the driver has helped. But in some other places, my goodness has it made the development cycle worse. Doing this on QEMU probably is on one of the most annoying cases too since yes, you start by dumping the dtb you would get, then iterating the dts outside of the rest of the scope of your build. In the kernel you can "make dtbs" at least and get things spit out. I'm just repeating over here that the development cycle of working on device trees is at times not great.
In general you do this only once, unless you use the virt machine and in that case there is no documentation about DT generated for each device added on the command line.
I had lots of difficulties getting all UART possibilities: virtio <1.0, 1.0,1.1; mmio or pci.
But once you get the command line, the dTB is fixed.
Of course it would be better to get Qemu document DT generation of its devices.
Quoted 5 lines
--
Tom
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Quoted 56 lines · François Ozog
Hi Tom
Quoted 42 lines · Tom Rini
Quoted 12 lines · Ilias Apalodimas
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Ilias,
Quoted 4 lines · Ilias Apalodimas
Hi Simon,
As I said here [1], this is moving on an entirely different
direction I had
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
in mind. I'd much prefer starting the discussions for a solution that allows us to scale.
I am missing the point here. Is there something in the plans that I don't know about?
I have some ideas, but haven't found time to code it and send patches
yet.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
FWIW I think the current code is still not clean for my taste.
Commit
Quoted 1 line
Quoted 1 line
Quoted 1 line
3b595da441cf("fdtdec: allow board to provide fdt for
CONFIG_OF_SEPARATE")Quoted 1 line
Quoted 1 line
Quoted 1 line
allowed this function to be used regardless of the config options.
IMHO we
Quoted 11 lines
Quoted 8 lines
Quoted 2 lines
should have 2 clear options:
- U-Boot provides the DTBSupported with:
OF_SEPARATEQuoted 1 line
- It's somehow passed over to U-Boot
Supported with:
OF_SEPARATE+OF_BOARDThat's exactly what I don't personally like. In your example
OF_BOARDmeans "U-Boot has a DTB and here's a way to override it". In my headQuoted 9 lines
In some ways this is just highlighting a long standing problem of working with DTB. There's certainly been some places where splitting the data from the driver has helped. But in some other places, my goodness has it made the development cycle worse. Doing this on QEMU probably is on one of the most annoying cases too since yes, you start by dumping the dtb you would get, then iterating the dts outside of the rest of the scope of your build. In the kernel you can "make dtbs" at least and get things spit out. I'm just repeating over here that the development cycle of working on device trees is at times not great.
Quoted 8 lines
In general you do this only once, unless you use the virt machine and in that case there is no documentation about DT generated for each device added on the command line.
I had lots of difficulties getting all UART possibilities: virtio <1.0, 1.0,1.1; mmio or pci.
But once you get the command line, the dTB is fixed.
Of course it would be better to get Qemu document DT generation of its devices.
In a lot of ways QEMU isn't even the real problem, unless it's applying rand() to some parts of where devices end up, etc. The cycle there isn't any worse than where the device tree resides in hardware. The device tree development cycle is a pain. QEMU is actually not so bad in this regard really since it's just dumpdtb and pass back the modified one, it takes care of then ensuring it's in the correct spot. The part where every blob must be in the right place is another part of that horror show that binman and fconf both try and address.
Signature · 1 line
Tom
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
Cheers
FF
Quoted 177 lines · Simon Glass
With Ilias' efforts we have dropped
OF_PRIOR_STAGEandOF_HOSTFILEso there are only three ways to obtain a devicetree:-
OF_SEPARATE- the normal way, where the devicetree is built and appended to U-Boot
-OF_EMBED- for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in this
series: "doc: Add documentation about devicetree usage"In practice,
OF_BOARDis not really distinct fromOF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.So it makes no sense to have
OF_BOARDas a 'choice'. It should be an option, available with eitherOF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now thatOF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDMakefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 +++++++++++++++++++++ arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rst
Quoted 4 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | *Director Business Development*
T: +33.67221.6485
[email protected] | Skype: ffozog
Hi François,
Quoted 4 lines · François Ozog
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
But trying to do any driver / core work for a board where you don't have the devicetree is currently not possible. The devicetree is a core component and being unable to modify it is simply not practical. We are talking here about an option that can be enabled or disabled. In my case I am able to disable it locally and do my development work.
BTW I've got the bloblist handoff working with a devicetree inside it, for qemu_arm. I need to try it on a real board to figure out what the difference is.
Regards,
Simon
Quoted 191 lines
Cheers
FF
Quoted 176 lines · Simon Glass
With Ilias' efforts we have dropped
OF_PRIOR_STAGEandOF_HOSTFILEso there are only three ways to obtain a devicetree:-
OF_SEPARATE- the normal way, where the devicetree is built and appended to U-Boot
-OF_EMBED- for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in this
series: "doc: Add documentation about devicetree usage"In practice,
OF_BOARDis not really distinct fromOF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.So it makes no sense to have
OF_BOARDas a 'choice'. It should be an option, available with eitherOF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now thatOF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDMakefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 +++++++++++++++++++++ arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rstQuoted 3 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Quoted 7 lines · Simon Glass
Hi François,
Quoted 3 lines · François Ozog
Hi Simon
Quoted 9 lines
Quoted 1 line
Position unchanged on this series: adding fake dts for boards that
generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention. But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms.
For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.
Quoted 8 lines
But trying to do any driver / core work for a board where you don't have the devicetree is currently not possible. The devicetree is a core component and being unable to modify it is simply not practical. We are talking here about an option that can be enabled or disabled. In my case I am able to disable it locally and do my development work.
Quoted 5 lines
BTW I've got the bloblist handoff working with a devicetree inside it, for
qemu_arm. I need to try it on a real board to figure out what the difference is.That's great news and much needed for stabilizing the inbound ABI from
prior loader to U-Boot. Let's create another thread to discuss this important topic.
Quoted 204 lines
Regards,
SimonQuoted 27 lines
Cheers
FF
Quoted 20 lines · Simon Glass
With Ilias' efforts we have dropped
OF_PRIOR_STAGEandOF_HOSTFILEso there are only three ways to obtain a devicetree:-
OF_SEPARATE- the normal way, where the devicetree is built and appended to U-Boot
-OF_EMBED- for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in this
series: "doc: Add documentation about devicetree usage"In practice,
OF_BOARDis not really distinct fromOF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader andits
Quoted 1 line
Quoted 1 line
caller may have a better idea about the hardware available in the
machine.
Quoted 11 lines
Quoted 11 lines
This is the case with a few QEMU boards, for example.
So it makes no sense to have
OF_BOARDas a 'choice'. It should be an option, available with eitherOF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
Quoted 6 lines
Quoted 6 lines
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 9 lines
Quoted 9 lines
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsQuoted 3 lines
Quoted 3 lines
Changes in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specificthings
Quoted 10 lines
Quoted 10 lines
- Move to doc/develop/devicetree now that
OF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the samedevicetree
Quoted 124 lines
Quoted 116 lines
in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDMakefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 +++++++++++++++++++++ arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rstQuoted 3 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
Quoted 9 lines
Quoted 9 lines
But trying to do any driver / core work for a board where you don't have the devicetree is currently not possible. The devicetree is a core component and being unable to modify it is simply not practical. We are talking here about an option that can be enabled or disabled. In my case I am able to disable it locally and do my development work.
Quoted 6 lines
Quoted 4 lines
BTW I've got the bloblist handoff working with a devicetree inside it, for
qemu_arm. I need to try it on a real board to figure out what the difference is.That's great news and much needed for stabilizing the inbound ABI from prior loader to U-Boot. Let's create another thread to discuss this important topic.
Quoted 1 line
My scenario is not all that advanced and I am using qemu_arm to test the bloblist handoff stuff and include it in CI, with a suitable devicetree and a binman node.
Regards,
Simon
Quoted 198 lines
Quoted 182 lines
Quoted 182 lines
Cheers
FF
Quoted 176 lines · Simon Glass
With Ilias' efforts we have dropped
OF_PRIOR_STAGEandOF_HOSTFILEso there are only three ways to obtain a devicetree:-
OF_SEPARATE- the normal way, where the devicetree is built and appended to U-Boot
-OF_EMBED- for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in this
series: "doc: Add documentation about devicetree usage"In practice,
OF_BOARDis not really distinct fromOF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.So it makes no sense to have
OF_BOARDas a 'choice'. It should be an option, available with eitherOF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now thatOF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDMakefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 +++++++++++++++++++++ arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rstQuoted 8 lines
Quoted 8 lines
Quoted 3 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Quoted 26 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.
Quoted 4 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.
That we have to have so many separate rpi build targets, and can't just use rpm_arm64 and add rpi_arm32 is not a good feature. The various rpi configs that use CONFIG_OF_EMBED are on your list of things that need to be cleaned up, yes?
Quoted 15 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
What I don't understand here is why or how U-Boot is supposed to become the source of truth for device trees. The general goal is that the device tree be something that actually comes along on the hardware, because it's stable enough and correct enough that it's not going to be changed from one OS kernel release to the next. That should be where the correct and true tree comes from, the device itself.
Signature · 1 line
Tom
Hi Tom,
Quoted 33 lines · Tom Rini
Quoted 26 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.Quoted 4 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.
Quoted 4 lines
That we have to have so many separate rpi build targets, and can't just use
rpm_arm64and addrpi_arm32is not a good feature. The various rpi configs that useCONFIG_OF_EMBEDare on your list of things that need to be cleaned up, yes?
Yes, it should use CONFIG_OF_SEPARATE. It think it didn't for historical reasons, but not sure why.
Quoted 17 lines
Quoted 4 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
Quoted 12 lines
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
Quoted 6 lines
What I don't understand here is why or how U-Boot is supposed to become the source of truth for device trees. The general goal is that the device tree be something that actually comes along on the hardware, because it's stable enough and correct enough that it's not going to be changed from one OS kernel release to the next. That should be where the correct and true tree comes from, the device itself.
Is that the confusion here? I am not saying that U-Boot becomes the 'source of truth' (horrible term). Where did that idea come from?
By hardware you mean firmware, I think. If you are developing firmware, you need control of the devicetree. It is part of the firmware.
Regards,
Simon
Quoted 36 lines · Simon Glass
Hi Tom,
Quoted 33 lines · Tom Rini
Quoted 30 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.
Quoted 7 lines
Quoted 4 lines
That we have to have so many separate rpi build targets, and can't just use
rpm_arm64and addrpi_arm32is not a good feature. The various rpi configs that useCONFIG_OF_EMBEDare on your list of things that need to be cleaned up, yes?Yes, it should use
CONFIG_OF_SEPARATE. It think it didn't for historical reasons, but not sure why.
I think because it wasn't clear enough at the time how to say "just use the dtb given to us as-is".
Quoted 23 lines
Quoted 16 lines
Quoted 15 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
Quoted 6 lines
What I don't understand here is why or how U-Boot is supposed to become the source of truth for device trees. The general goal is that the device tree be something that actually comes along on the hardware, because it's stable enough and correct enough that it's not going to be changed from one OS kernel release to the next. That should be where the correct and true tree comes from, the device itself.
Quoted 6 lines
Is that the confusion here? I am not saying that U-Boot becomes the 'source of truth' (horrible term). Where did that idea come from?
By hardware you mean firmware, I think. If you are developing firmware, you need control of the devicetree. It is part of the firmware.
I mean the case where U-Boot is provided the device tree to use, by whatever external and non-U-Boot means. I keep saying "source of truth" as a way to clarify that the correct and only required device tree is given to us at run time. If U-Boot needs to know something, it's already provided there. If it's not there, we don't need to know it. This is also why there's not a reason to normally build a device tree in U-Boot since it will not be used. And if we aren't building it, we don't need it in the source tree either since it's going to introduce confusion. Quoted in part or referenced under doc/ ? OK, that can make sense in some cases.
Signature · 1 line
Tom
Hi Simon
Quoted 43 lines · Simon Glass
Hi François,
Quoted 8 lines · François Ozog
Quoted 4 lines · Simon Glass
Hi François,
On Tue, 26 Oct 2021 at 00:07, François Ozog <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that
generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
Quoted 7 lines
Quoted 5 lines
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
I am not the only one in disagreement... You just saw Alex Bénée from
Qemu saying the same thing.
Quoted 2 lines
I understand the advanced debug/development scenario you mention. But locating the DT files in the dts directory is mis-leading the
contributors to think that they need to compile the DT for the targeted platforms.
Quoted 1 line
For your advanced scenario, you can still have the dts in the
documentation area, or whatever directory (except dts). compile it and supply to U-Boot.
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
Quoted 8 lines
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is?
there are situations where U-Boot must have a dtb. Then those dTB sources are logically found in the dts directory.
There are situations where U-Boot should not have a dtb. In that case there should be no element in the dts directory. Otherwise it creates confusion. Now as you point out, we need “playgrounds” to deal with some situation. So having examples in an ad-hoc directory, different from dts is fine. I proposed documentation but you may find a better place.
In other words, dts shall host only dt source when U-Boot cannot do but make a dTB for a platform.
As you have seen in different mail thread (firmware sustainability and OCP checklist) freedom is important to Linaro and there are no hidden Trojan horse for licensing.
If a board is
Quoted 4 lines
in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
You can if you keep two dts directories separate:
dts for boards for which U-Boot must have one
debug-dts for boards for which U-Boot get the DT at runtime but for which you want a playground for debug/easier development.
Quoted 240 lines
Quoted 10 lines
Quoted 10 lines
But trying to do any driver / core work for a board where you don't have the devicetree is currently not possible. The devicetree is a core component and being unable to modify it is simply not practical. We are talking here about an option that can be enabled or disabled. In my case I am able to disable it locally and do my development work.
Quoted 5 lines
Quoted 4 lines
BTW I've got the bloblist handoff working with a devicetree inside it, for
qemu_arm. I need to try it on a real board to figure out what the difference is.That's great news and much needed for stabilizing the inbound ABI from
prior loader to U-Boot. Let's create another thread to discuss this important topic.
Quoted 1 line
Quoted 1 line
My scenario is not all that advanced and I am using
qemu_armto test the bloblist handoff stuff and include it in CI, with a suitable devicetree and a binman node.Regards,
SimonQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Cheers
FF
Le mar. 26 oct. 2021 à 02:24, Simon Glass <[email protected]> a écrit
:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
With Ilias' efforts we have dropped
OF_PRIOR_STAGEandOF_HOSTFILEso there are only three ways to obtain a devicetree:-
OF_SEPARATE- the normal way, where the devicetree is built and appended to U-Boot
-OF_EMBED- for development purposes, the devicetree is embeddedin
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed at
all
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in
this
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
series: "doc: Add documentation about devicetree usage"
In practice,
OF_BOARDis not really distinct fromOF_SEPARATE. Anyboard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
can obtain its devicetree at runtime, even it is has a devicetree
built
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
in U-Boot. This is because U-Boot may be a second-stage bootloader
and its
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
caller may have a better idea about the hardware available in the
machine.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
This is the case with a few QEMU boards, for example.
So it makes no sense to have
OF_BOARDas a 'choice'. It should be an option, available with eitherOF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree
files
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
(and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Changes in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explainU-Boot-specific things
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
- Move to doc/develop/devicetree now that
OF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernelcmdline
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
- Explain that
OF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the samedevicetree
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' tocover
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Makefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958+++++++++++++++++++++
Quoted 89 lines
Quoted 73 lines
Quoted 73 lines
Quoted 73 lines
arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rstQuoted 8 lines
Quoted 8 lines
Quoted 3 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Hi François,
Quoted 48 lines · François Ozog
Hi Simon
Quoted 35 lines · Simon Glass
Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
Quoted 8 lines
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is?
Quoted 5 lines
there are situations where U-Boot must have a dtb. Then those dTB sources are logically found in the dts directory.
There are situations where U-Boot should not have a dtb. In that case there should be no element in the dts directory. Otherwise it creates confusion.
Now as you point out, we need “playgrounds” to deal with some situation. So having examples in an ad-hoc directory, different from dts is fine. I proposed documentation but you may find a better place. In other words, dts shall host only dt source when U-Boot cannot do but make a dTB for a platform.
As you have seen in different mail thread (firmware sustainability and OCP checklist) freedom is important to Linaro and there are no hidden Trojan horse for licensing.
I don't understand what you are getting at with the Trojan horse. But you have no objection to requiring boards to supply a DT (whether in documentation or arch/arm/dts) to be in U-Boot?
Quoted 240 lines
Quoted 7 lines
If a board is
in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.You can if you keep two dts directories separate:
dts for boards for which U-Boot must have one
debug-dts for boards for which U-Boot get the DT at runtime but for which you want a playground for debug/easier development.Quoted 18 lines
Quoted 11 lines
Quoted 11 lines
But trying to do any driver / core work for a board where you don't have the devicetree is currently not possible. The devicetree is a core component and being unable to modify it is simply not practical. We are talking here about an option that can be enabled or disabled. In my case I am able to disable it locally and do my development work.
Quoted 6 lines
Quoted 4 lines
BTW I've got the bloblist handoff working with a devicetree inside it, for
qemu_arm. I need to try it on a real board to figure out what the difference is.That's great news and much needed for stabilizing the inbound ABI from prior loader to U-Boot. Let's create another thread to discuss this important topic.
Quoted 1 line
Quoted 205 lines
My scenario is not all that advanced and I am using
qemu_armto test the bloblist handoff stuff and include it in CI, with a suitable devicetree and a binman node.Regards,
SimonQuoted 198 lines
Quoted 182 lines
Quoted 182 lines
Cheers
FF
Quoted 176 lines · Simon Glass
With Ilias' efforts we have dropped
OF_PRIOR_STAGEandOF_HOSTFILEso there are only three ways to obtain a devicetree:-
OF_SEPARATE- the normal way, where the devicetree is built and appended to U-Boot
-OF_EMBED- for development purposes, the devicetree is embedded in the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed at all in the U-Boot tree. Most boards do provide one, but some don't. Some don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch in this
series: "doc: Add documentation about devicetree usage"In practice,
OF_BOARDis not really distinct fromOF_SEPARATE. Any board can obtain its devicetree at runtime, even it is has a devicetree built in U-Boot. This is because U-Boot may be a second-stage bootloader and its caller may have a better idea about the hardware available in the machine. This is the case with a few QEMU boards, for example.So it makes no sense to have
OF_BOARDas a 'choice'. It should be an option, available with eitherOF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree files (and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add the files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, since removed
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explain U-Boot-specific things
- Move to doc/develop/devicetree now thatOF_CONTROLis in the docsChanges in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernel cmdline
- Explain thatOF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the same devicetree in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source in U-Boot'
- Rewrite 'Devicetree generated on-the-fly in another project' to cover points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDMakefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 +++++++++++++++++++++ arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rstQuoted 8 lines
Quoted 8 lines
Quoted 3 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Hi Simon
Quoted 70 lines · Simon Glass
Hi François,
Quoted 8 lines · François Ozog
Hi Simon
Quoted 4 lines · Simon Glass
Hi François,
On Wed, 27 Oct 2021 at 09:14, François Ozog <[email protected]>
Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 8 lines · Simon Glass
Quoted 4 lines
Hi François,
On Tue, 26 Oct 2021 at 00:07, François Ozog <
Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that
generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
I am not the only one in disagreement... You just saw Alex Bénée from
Qemu saying the same thing.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I understand the advanced debug/development scenario you mention. But locating the DT files in the dts directory is mis-leading the
contributors to think that they need to compile the DT for the targeted platforms.
Quoted 1 line
Quoted 1 line
Quoted 1 line
For your advanced scenario, you can still have the dts in the
documentation area, or whatever directory (except dts). compile it and supply to U-Boot.
Quoted 18 lines
Quoted 9 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
Quoted 8 lines
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is?
Quoted 1 line
there are situations where U-Boot must have a dtb. Then those dTB
sources are logically found in the dts directory.
Quoted 1 line
There are situations where U-Boot should not have a dtb. In that case
there should be no element in the dts directory. Otherwise it creates confusion.
Quoted 1 line
Now as you point out, we need “playgrounds” to deal with some situation.
So having examples in an ad-hoc directory, different from dts is fine. I proposed documentation but you may find a better place.
Quoted 7 lines
Quoted 1 line
In other words, dts shall host only dt source when U-Boot cannot do but
make a dTB for a platform.
Quoted 1 line
As you have seen in different mail thread (firmware sustainability and
OCP checklist) freedom is important to Linaro and there are no hidden Trojan horse for licensing.
I don't understand what you are getting at with the Trojan horse.
I was referring to your statement that “TFA was created for licensing “ reasons. That’s not the case. It was created to address fragmentation in the secure firmware for which there was no open source at all. SPL is definitely not architected to be the basis of Arm secure firmware { TFA/BL31 (secure monitor), TFA/BL32 (OP-TEE), TFA/SEL2(Hafnium), TFA/SCMI server, SCP…}. That said SPL and TFA/BL2 have similar roles from a 10,000ft perspective.
I felt your comment was alluding to TFA was created to promote binary components integration, which is also not the case. Hence my reference to Trojan Horse.
Quoted 3 lines
But
you have no objection to requiring boards to supply a DT (whether in documentation orarch/arm/dts) to be in U-Boot?
I agree that boards need to properly document their DT. For (a) boards that have defined their standard boot flow to assume U-Boot will only do fix ups and overlays, the DT shall be in the U-Boot documentation part (either in full or pointing to their project documentation), in all other cases (b) it shall be in dts. Boards in the (a) case (may not be exhaustive): Qemu, SystemReady, RPI (it actually assumes it boot a Linux kernel but U-Boot smartly interposes). There may be RISCV boards that comply to EBBR too but I let Heinrich/Atish comment.
Quoted 271 lines
Quoted 10 lines
Quoted 9 lines
If a board is
in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.Quoted 3 lines
You can if you keep two dts directories separate:
dts for boards for which U-Boot must have one
debug-dts for boards for which U-Boot get the DT at runtime but forwhich you want a playground for debug/easier development.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
But trying to do any driver / core work for a board where you don't have the devicetree is currently not possible. The devicetree is a core component and being unable to modify it is simply not practical. We are talking here about an option that can be enabled or disabled. In my case I am able to disable it locally and do my development
work.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
BTW I've got the bloblist handoff working with a devicetree inside
it,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
for
qemu_arm. I need to try it on a real board to figure out what the difference is.That's great news and much needed for stabilizing the inbound ABI
from prior loader to U-Boot. Let's create another thread to discuss this important topic.
Quoted 10 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
My scenario is not all that advanced and I am using
qemu_armto test the bloblist handoff stuff and include it in CI, with a suitable devicetree and a binman node.Regards,
SimonQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Cheers
FF
Le mar. 26 oct. 2021 à 02:24, Simon Glass <[email protected]> a
écrit :
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
With Ilias' efforts we have dropped
OF_PRIOR_STAGEand
OF_HOSTFILEsoQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
there are only three ways to obtain a devicetree:
-
OF_SEPARATE- the normal way, where the devicetree is builtand
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
appended to U-Boot
-OF_EMBED- for development purposes, the devicetree isembedded in
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the ELF file (also used for EFI)
-OF_BOARD- the board figures it out on its ownThe last one is currently set up so that no devicetree is needed
at all
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
in the U-Boot tree. Most boards do provide one, but some don't.
Some
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
don't even provide instructions on how to boot on the board.
The problems with this approach are documented in another patch
in this
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
series: "doc: Add documentation about devicetree usage"
In practice,
OF_BOARDis not really distinct fromOF_SEPARATE.Any board
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
can obtain its devicetree at runtime, even it is has a devicetree
built
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
in U-Boot. This is because U-Boot may be a second-stage
bootloader and its
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
caller may have a better idea about the hardware available in the
machine.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This is the case with a few QEMU boards, for example.
So it makes no sense to have
OF_BOARDas a 'choice'. It should bean
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
option, available with either
OF_SEPARATEorOF_EMBED.This series makes this change, adding various missing devicetree
files
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(and placeholders) to make the build work.
Note: If board maintainers are able to add their own patch to add
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
files, some patches in this series can be dropped.
It also provides a few qemu clean-ups discovered along the way.
Note: This breaks the qemu-riscv64_spl test, which still needs investigation.
[1]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Changes in v5:
- Bring into theOF_BOARDseries
- Rebase to master and drop mention ofOF_PRIOR_STAGE, sinceremoved
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
- Refer to the 'control' DTB in the first paragraph
- Use QEMU instead of qemu
- Merge RISC-V and ARM patches since they are similar
- Add new patches to clean upfdtdec_setup()and surroundsChanges in v3:
- Clarify the 'bug' refered to at the top
- Reword 'This means that there' paragraph to explainU-Boot-specific things
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
- Move to doc/develop/devicetree now that
OF_CONTROLis in thedocs
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Changes in v2:
- Fix typos per Sean (thank you!) and a few others
- Add a 'Use of U-Boot /config node' section
- Drop mention of dm-verity since that actually uses the kernelcmdline
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
- Explain that
OF_BOARDwill still work after these changes (in 'Once this bug is fixed...' paragraph)
- Expand a bit on the reason why the 'Current situation' is bad
- Clarify in a second place that Linux and U-Boot use the samedevicetree
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
in 'To be clear, while U-Boot...'
- Expand on why we should have rules for other projects in 'Devicetree in another project'
- Add a comment as to why devicetree in U-Boot is not 'bad design'
- Reword 'in-tree U-Boot devicetree' to 'devicetree source inU-Boot'
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
- Rewrite 'Devicetree generated on-the-fly in another project' to
cover
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
points raised on v1
- Add 'Why does U-Boot have its nodes and properties?'
- Add 'Why not have two devicetrees?'Ilias Apalodimas (1):
sandbox: RemoveOF_HOSTFILESimon Glass (25):
doc: Add documentation about devicetree usage
arm: qemu: Mention -nographic in the docs
arm: riscv: qemu: Explain how to extract the generated dt
arm: qemu: Add a devicetree file forqemu_arm
arm: qemu: Add a devicetree file forqemu_arm64
riscv: qemu: Add devicetree files for qemu_riscv32/64
arm: rpi: Add a devicetree file forrpi_4
arm: vexpress: Add a devicetree file for juno
arm:xenguest_arm64: Add a fake devicetree file
arm: octeontx: Add a fake devicetree file
arm:xilinx_versal_virt: Add a devicetree file
arm: bcm7xxx: Add a devicetree file
arm: qemu-ppce500: Add a devicetree file
arm: highbank: Add a fake devicetree file
fdt: MakeOF_BOARDa bool option
DropCONFIG_BINMAN_STANDALONE_FDT
doc: Update info on devicetree update
fdt: MoveMULTI_DTB_FIThandling out offdtdec_setup()
fdt: Drop #ifdefs withMULTI_DTB_FIT
fdt: DropCONFIG_SPL_BUILDcheck infdtdec_setup()
fdt: Drop #ifdef aroundboard_fdt_blob_setup()
fdt: Useif()for fdtcontroladdr check
fdt: DropOF_CONTROLcheck infdtdec_setup()
fdt: Drop remaining preprocessor macros infdtdec_setup()
fdt: Don't callboard_fdt_blob_setup()withoutOF_BOARDQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Makefile | 7 +- arch/arm/dts/Makefile | 20 +- arch/arm/dts/bcm2711-rpi-4-b.dts | 1958+++++++++++++++++++++
Quoted 95 lines
Quoted 84 lines
Quoted 84 lines
Quoted 81 lines
Quoted 81 lines
Quoted 73 lines
arch/arm/dts/bcm7xxx.dts | 15 + arch/arm/dts/highbank.dts | 14 + arch/arm/dts/juno-r2.dts | 1038 +++++++++++ arch/arm/dts/octeontx.dts | 14 + arch/arm/dts/qemu-arm.dts | 402 +++++ arch/arm/dts/qemu-arm64.dts | 381 ++++ arch/arm/dts/xenguest-arm64.dts | 15 + arch/arm/dts/xilinx-versal-virt.dts | 307 ++++ arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/qemu-ppce500.dts | 264 +++ arch/riscv/dts/Makefile | 2 +- arch/riscv/dts/qemu-virt.dts | 8 - arch/riscv/dts/qemu-virt32.dts | 217 +++ arch/riscv/dts/qemu-virt64.dts | 217 +++ arch/sandbox/cpu/cpu.c | 21 +- arch/sandbox/include/asm/u-boot-sandbox.h | 8 - configs/bcm7260_defconfig | 1 + configs/bcm7445_defconfig | 1 + configs/highbank_defconfig | 2 +- configs/octeontx2_95xx_defconfig | 1 + configs/octeontx2_96xx_defconfig | 1 + configs/octeontx_81xx_defconfig | 1 + configs/octeontx_83xx_defconfig | 1 + configs/qemu-ppce500_defconfig | 2 + configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv32_smode_defconfig | 1 + configs/qemu-riscv32_spl_defconfig | 4 +- configs/qemu-riscv64_defconfig | 1 + configs/qemu-riscv64_smode_defconfig | 1 + configs/qemu-riscv64_spl_defconfig | 3 +- configs/qemu_arm64_defconfig | 1 + configs/qemu_arm_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_noinst_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/vexpress_aemv8a_juno_defconfig | 1 + configs/xenguest_arm64_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + doc/board/emulation/qemu-arm.rst | 10 +- doc/board/emulation/qemu-riscv.rst | 3 + doc/develop/devicetree/control.rst | 7 +- doc/develop/devicetree/dt_qemu.rst | 48 + doc/develop/devicetree/dt_update.rst | 498 ++++++ doc/develop/devicetree/index.rst | 2 + dts/Kconfig | 37 +- include/asm-generic/global_data.h | 8 + include/fdtdec.h | 21 +- lib/fdtdec.c | 116 +- scripts/Makefile.spl | 4 +- tools/binman/binman.rst | 20 - 59 files changed, 5560 insertions(+), 164 deletions(-) create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts create mode 100644 arch/arm/dts/bcm7xxx.dts create mode 100644 arch/arm/dts/highbank.dts create mode 100644 arch/arm/dts/juno-r2.dts create mode 100644 arch/arm/dts/octeontx.dts create mode 100644 arch/arm/dts/qemu-arm.dts create mode 100644 arch/arm/dts/qemu-arm64.dts create mode 100644 arch/arm/dts/xenguest-arm64.dts create mode 100644 arch/arm/dts/xilinx-versal-virt.dts create mode 100644 arch/powerpc/dts/qemu-ppce500.dts delete mode 100644 arch/riscv/dts/qemu-virt.dts create mode 100644 arch/riscv/dts/qemu-virt32.dts create mode 100644 arch/riscv/dts/qemu-virt64.dts create mode 100644 doc/develop/devicetree/dt_qemu.rst create mode 100644 doc/develop/devicetree/dt_update.rstQuoted 3 lines
--
2.33.0.1079.g6e70778dc9-goog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozogQuoted 5 lines
Quoted 5 lines
--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog--
François-Frédéric Ozog | Director Business Development
T: +33.67221.6485
[email protected] | Skype: ffozog
Signature · 3 lines
François-Frédéric Ozog | *Director Business Development* T: +33.67221.6485 [email protected] | Skype: ffozog
Quoted 29 lines
From: Simon Glass <[email protected]>
Date: Wed, 27 Oct 2021 12:23:21 -0600Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.
Quoted 4 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.
Until. The Raspberry Pi foundation releases a new firmware that configures the hardware differently such that the addresses in the U-Boot devicetree are wrong and nothing works anymore. Can't speak for the rpi 1, but this has happened in the past for the rpi 2 and 3 as well as more recently on the rpi 4.
Quoted 15 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
How many people are there out there that work on U-Boot that don't have a Linux source tree checked out? Even I have several of those lying around on my development systems and I am an OpenBSD developer ;).
Hi Mark,
Quoted 35 lines · Mark Kettenis
Quoted 30 lines
From: Simon Glass <[email protected]>
Date: Wed, 27 Oct 2021 12:23:21 -0600Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.Quoted 4 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.
Quoted 5 lines
Until. The Raspberry Pi foundation releases a new firmware that configures the hardware differently such that the addresses in the U-Boot devicetree are wrong and nothing works anymore. Can't speak for the rpi 1, but this has happened in the past for the rpi 2 and 3 as well as more recently on the rpi 4.
So I update my SD card with a new private-binary bootloader and things stop working? I think I can narrow that one down :-)
Quoted 17 lines
Quoted 4 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
Quoted 12 lines
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
Quoted 3 lines
How many people are there out there that work on U-Boot that don't have a Linux source tree checked out? Even I have several of those lying around on my development systems and I am an OpenBSD developer ;).
So it is OK to have the DT in Linux but not in U-Boot? I don't even know what to say that. How does that square with your point above?
I am not talking about disabling OF_BOARD, just making it *possible* to do so.
Regards,
Simon
Quoted 66 lines
From: Simon Glass <[email protected]>
Date: Tue, 2 Nov 2021 19:20:51 -0600Hi Mark,
Quoted 35 lines · Mark Kettenis
Quoted 30 lines
From: Simon Glass <[email protected]>
Date: Wed, 27 Oct 2021 12:23:21 -0600Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.Quoted 4 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.Quoted 5 lines
Until. The Raspberry Pi foundation releases a new firmware that configures the hardware differently such that the addresses in the U-Boot devicetree are wrong and nothing works anymore. Can't speak for the rpi 1, but this has happened in the past for the rpi 2 and 3 as well as more recently on the rpi 4.
So I update my SD card with a new private-binary bootloader and things stop working? I think I can narrow that one down :-)
Quoted 16 lines
Quoted 15 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
Quoted 6 lines
Quoted 3 lines
How many people are there out there that work on U-Boot that don't have a Linux source tree checked out? Even I have several of those lying around on my development systems and I am an OpenBSD developer ;).
So it is OK to have the DT in Linux but not in U-Boot? I don't even know what to say that. How does that square with your point above?
Ideally the DT's and DT binding would move out of the Linux tree and into a repository of their own. But until that is the case, the Linux tree is the source of truth.
Quoted 2 lines
I am not talking about disabling
OF_BOARD, just making it *possible* to do so.
And I don't think it makes sense to do so on most boards that have OF_BOARD in their config.
Quoted 70 lines · Mark Kettenis
Quoted 70 lines
From: Simon Glass <[email protected]>
Date: Tue, 2 Nov 2021 19:20:51 -0600Hi Mark,
Quoted 35 lines · Mark Kettenis
Quoted 30 lines
From: Simon Glass <[email protected]>
Date: Wed, 27 Oct 2021 12:23:21 -0600Hi François,
Quoted 18 lines · François Ozog
Quoted 5 lines · Simon Glass
Hi François,
Quoted 1 line · François Ozog
Quoted 8 lines
Quoted 3 lines
Hi Simon
Position unchanged on this series: adding fake dts for boards that generate their device tree in the dts directory is not good. If you have them in documentation the it is acceptable.
I think we are going to have to disagree on this one. I actually used the qemu one in testing/development recently. We have to have a way to develop in-tree with U-Boot. It does not impinge on any of your use cases, so far as I know.
Quoted 4 lines
I am not the only one in disagreement... You just saw Alex Bénée from Qemu saying the same thing.
I understand the advanced debug/development scenario you mention.
But locating the DT files in the dts directory is mis-leading the contributors to think that they need to compile the DT for the targeted platforms. For your advanced scenario, you can still have the dts in the documentation area, or whatever directory (except dts). compile it and supply to U-Boot.Quoted 4 lines
We have this situation with rpi 1, 2 and 3 and I don't believe anyone has noticed. U-Boot handles the build automatically. If you turn off
OF_BOARD, it will use the U-Boot devicetree always so you know what is going on.Quoted 5 lines
Until. The Raspberry Pi foundation releases a new firmware that configures the hardware differently such that the addresses in the U-Boot devicetree are wrong and nothing works anymore. Can't speak for the rpi 1, but this has happened in the past for the rpi 2 and 3 as well as more recently on the rpi 4.
So I update my SD card with a new private-binary bootloader and things stop working? I think I can narrow that one down :-)
Quoted 19 lines
Quoted 15 lines
We can add a message to U-Boot indicating where the devicetree came from, perhaps? That might be useful given everything that is going on.
As in this case, quite often in these discussions I struggle to understand what is behind the objection. Is it that your customers are demanding that devicetrees become private, secret data, not included in open-source projects? Or is it just the strange case of QEMU that is informing your thinking? I know of at least one project where the first-stage bootloader produces a devicetree and no one has the source for it. I believe TF-A was created for licensing reasons...so can you be a bit clearer about what the problem actually is? If a board is in-tree in U-Boot I would like it to have a devicetree there, at least until we have a better option. At the very least, it MUST be discoverable and it must be possible to undertake U-Boot development easily without a lot of messing around.
How many people are there out there that work on U-Boot that don't have a Linux source tree checked out? Even I have several of those lying around on my development systems and I am an OpenBSD developer ;).
Quoted 6 lines
Quoted 2 lines
So it is OK to have the DT in Linux but not in U-Boot? I don't even know what to say that. How does that square with your point above?
Ideally the DT's and DT binding would move out of the Linux tree and into a repository of their own. But until that is the case, the Linux tree is the source of truth.
Yes, and this is a long known and slowly in progress kinda-sorta thing. A few more people helping to review things, etc, are always appreciated by upstream.
Quoted 5 lines
Quoted 2 lines
I am not talking about disabling
OF_BOARD, just making it *possible* to do so.And I don't think it makes sense to do so on most boards that have
OF_BOARDin their config.
It should probably close to never be done, unless it's some case where it's crazy-hard to update the device tree correctly for the platform. So it's not a problem on Pi as it's just on the FAT32 partition right there, it's not a problem on Apple M1 as ..however you do it.., and so on.
I can almost hear the argument from here about "but I'm doing some work for U-Boot and need to add..." and that's where we need to figure out what to do next. Yes, we likely need to have some bindings of our own, and developing those AND pushing them upstream will require iterating here. So the developer point of view of how do I whack things to supply my own is valid. But it's not the default use case. The default use case is building the firmware that users rarely see, because their system boots to the OS and they get down to using their system.
Signature · 1 line
Tom