Hi Jon,
SystemReady IR owner here at ATG. May I ask, what would be the purpose of DTB 
provided by the OS? The primary function (not only one) of DTB from a 
SystemReady perspective is for the Platform (fw) advertise to the OS what's in 
there, there are other secondary functions and some vendors use DTB to store 
FW-only information or proprietary data structures that do not break the 
interoperability to OSes.
Is such OS DTB containing platform information, or is this DTB containing data 
useful for the OS or meaningful to be originated from the OS ? can you please 
elaborate a bit?

Thanks in advance,
Pere


-----Original Message-----
From: Humphreys, Jonathan <j-humphr...@ti.com>
Sent: Wednesday, May 1, 2024 10:18 PM
To: boot-architecture@lists.linaro.org; Vincent Stehle <vincent.ste...@arm.com>
Subject: OS provided DT proposal



Hi all.  Several EBBR meetings ago, I introduced the need for allowing OS 
provided device trees [1].  Please find below the proposal I am delinquent on 
sending.


Hopefully, we can discuss this in the next meeting.


Thanks

Jon


[1] https://github.com/ARM-software/ebbr/wiki/EBBR-Notes-2024.02.12



Problem statement:
==================

Device trees are in theory a pure description of the hardware, and since the 
hardware doesn't change, the device tree describing the hardware likewise never 
changes.
With this, a device tree could then be burned into the hardware's ROM to be 
queried by software for hardware discovery. In practice, though, device trees 
evolve over time. They evolve for many reasons, including
- support for previously unsupported hardware
- device driver improvements that require additional hardware information
- bug fixes

Linux's device tree source is maintained with the kernel source, and kernel 
builds include building the device trees too. This ensures that the device tree 
matching the kernel's usage is always kept in sync. Often, embedded distros 
will include the matching device tree blobs.

The EBBR mandates that the device tree blob is provided by the firmware.

Thus it is likely that the device tree provided by the firmware and given to 
the operating system is not the matching device tree blob for that kernel. This 
can cause hardware to be missing, buggy, or non-functional.

Proposal:
=========

A key goal of the EBBR is to define the contract between the firmware and the 
OS so that the OS doesn't need to be built specifically for the hardware, and 
the firmware can boot any compliant OS. Thus, any solution that requires the OS 
to know specifics about the hardware beyond the EBBR contract would violate the 
EBBR goals. This precludes any solution where the OS, having the matching DTBs, 
would pick the DTB, because this requires the OS to know what hardware it is 
being run on. Likewise, any solution where the firmware is aware of the OS 
matching DTBs would require the firmware to be aware of the particular OS it is 
booting.

What can be known:
- The firmware knows what board it is running on, and thus knows what device
  tree to use. But it doesn't know what version of the device tree to use,
  because it doesn't know what OS is being booted.
- The OS knows what version of DTBs matches it's kernel, but does not know which
  specific device tree to use.

This proposal then has the firmware choose the device tree by name, or some 
other identifier that can be used to match the device tree for the board [1]. 
It has the OS-provided OS loader select the location of the matching versions 
of DTBs for it.

The firmware would pass the device tree filename/id to the OS loader, instead 
of the DTB itself. The OS loader would determine the location of the matching 
DTBs based on the chosen OS to boot, load the matching DTB from that location, 
and pass to the kernel.

Considerations:
- often a DTB requires fixups. The EFI_DT_FIXUP_PROTOCOL could be utilized.
- device tree overlays could be indicated with a scheme using the device tree ID
  passed to the OS loader
- authenticating the DTB would be the responsibility of the OS distribution and
  handled in the same way as the kernel itself is authenticated. The OS is the
  entity responsible for signing the DTB, as it should be.

This proposal should be in addition to supporting the standard way of passing 
in a firmware-provided DT, in cases where the OS doesn't provide or have a need 
to provide a matching DT.

[1] Rather than using the device tree source filename, to have more 
flexibility, one can conceive an ID or compatible string that the OS could then 
scan the DTBs to find a match.


_______________________________________________
boot-architecture mailing list -- boot-architecture@lists.linaro.org
To unsubscribe send an email to boot-architecture-le...@lists.linaro.org
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
boot-architecture mailing list -- boot-architecture@lists.linaro.org
To unsubscribe send an email to boot-architecture-le...@lists.linaro.org

Reply via email to