On 29 October 2014 13:28, Christopher Covington <c...@codeaurora.org> wrote: > I've sometimes thought it might be cool if QEMU could consume a DTB and > emulate whatever is described, assuming the devices and configurations are > supported. I've yet to come up with a real problem to motivate this > "solution", though.
This has been suggested before, but unfortunately it's not really feasible except in certain constrained scenarios (for instance the Xilinx work Andreas mentioned, where as I understand it they have one tool that generates the DTB and the FPGA they're trying to model and so it's easy to be sure the DTB has all the necessary information). The fundamental issue is that a DTB is basically a data structure controlled by the kernel -- it contains all the information the kernel needs to know about how the hardware is configured and wired up together, where the kernel can't dynamically probe for it. The information QEMU needs to know to be able to model a board is related but not the same (and why would the kernel people modify their device tree files to add information that only QEMU cares about?) So it sounds nice but in practice it gets very quickly into a morass of problems I think. [To take one example, boards with CPUs that support TrustZone may have devices that appear only in the Secure world, but there's no way in a device tree to indicate this. The kernel doesn't care because it only executes in one world and only needs to know about the devices that exist there.] -- PMM