On Thu, 2015-05-14 at 14:02 +0300, Pantelis Antoniou wrote: > Hi Ben, > > > On May 14, 2015, at 10:47 , Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> wrote: > > > > [snip] > > So I spend some time thinking about your use case and I think it boils down > to this: > > I have a live tree in the firmware, I have made changes and I need to reflect > those changes to the live tree in the kernel. > > Sounds like ‘how do I generate a patch for getting those two in sync'. No? More or less. > I can see where this might be useful for others as all. > > I think we really need to create a liblivedt like we have libfdt since > we have a number of projects going about using/manipulating DT at runtime. > > 1. The linux kernel, with it’s own live tree implementation. > 2. The device tree compiler (it has a live tree) custom implemented. > 3. Your weird and wonderful (or wacky) firmware. > 4. u-boot does use DT now, but it does with libfdt. I believe this is suboptimal. > 5. barebox does DT as well. > > Most of what we want to do with DT can be abstracted in a library I think that > all of those projects can use. > > What are your thoughts? Well, we have at least two implementations, the kernel one and the one in our OPAL firmware: https://github.com/open-power/skiboot/blob/master/include/device.h https://github.com/open-power/skiboot/blob/master/core/device.c The latter uses some nice Rusty tricks (tm) for multiple argument functions. It would make sense to do a library somewhere yes. However, I need to cut my firmware API pretty much today so I think for now I'll stick to something Ad-Hoc for the PCI hotplug code that just passes the bit of FDT with the new devices and leave the "grand project" of live sync of the tree for later. There are other implementations of live DT in various Open Firmware variants out there, most are in Forth which I suggest you don't bother with unless you enjoy pain, but I think at least one of these is actually in C. Cheers, Ben. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html