On Tue, Jun 5, 2012 at 11:52 PM, Alexander Graf <ag...@suse.de> wrote: > Today we have two separate places where we keep information which device > is where: > > - hw/ppce500_mpc8544ds.c to instantiate all devices > - pc-bios/mpc8544ds.dtb as device tree to tell the guest about devices > > Every time we split crucial information, things can go terribly wrong. If > you update one file, but not the other, you can screw things up without > realizing it quickly. > > The redundancy is also unnecessary, because QEMU already knows all the > information at which addresses its devices live. So we can generate the > device tree from the same variables - and even have the device tree adjust > if something changes in there. > > The one functionality we lose with this approach is the ability to manually > patch the device tree to contain additional devices. To still be able to do > so easily, we introduce a new option -machine dumpdtb=<file> that creates a > dtb output file which can be used with -machine dtb=<file> later. In between > these 2 executions of QEMU, the dtb can be modified however much you like. > > A lot of bits in this patch set are still hardcoded. We also don't accomodate > for dynamic creation of device tree nodes when -device is used. This requires > a bit more QOM'ification for us to be able to loop through all devices, so we > can dynamically create the device tree nodes for them. The basic concept > should > still hold as is though. > > > Alex
Please use snprintf() instead of sprintf(). > > v1 -> v2: > > - rename cell64 -> u64 > - don't treat memory as single u64 > - remove commit id from patch description > - NEW: PPC: e500: Use new MPIC dt format > PPC: e500: Use new SOC dt format > PPC: e500: Define addresses as always 64bit > PPC: e500: Extend address/size of / to 64bit > dt: Add global option to set phandle start offset > PPC: e500: Refactor serial dt generation > > Alexander Graf (31): > dt: allow add_subnode to create root subnodes > dt: add helpers for 2, 3 and 4 cell adds > dt: add helper for phandle references > dt: temporarily disable subtree creation failure check > dt: add helper for phandle enumeration > dt: add helper for empty dt creation > dt: add helper for phandle allocation > dt: add helper for 64bit cell adds > PPC: e500: require libfdt > PPC: e500: dt: create memory node dynamically > PPC: e500: dt: create /cpus node dynamically > PPC: e500: dt: create /hypervisor node dynamically > PPC: e500: dt: create / node dynamically > PPC: e500: dt: create /chosen node dynamically > PPC: e500: dt: create /soc8544 node dynamically > PPC: e500: dt: create serial nodes dynamically > PPC: e500: dt: create mpic node dynamically > PPC: e500: dt: create global-utils node dynamically > PPC: e500: dt: create pci node dynamically > PPC: e500: dt: start with empty device tree > dt: Add -machine dumpdtb option to dump the current dtb > PPC: e500: dt: use 64bit cell helper > PPC: e500: dt: use target_phys_addr_t for ramsize > PPC: e500: enable manual loading of dtb blob > Revert "dt: temporarily disable subtree creation failure check" > PPC: e500: Use new MPIC dt format > PPC: e500: Use new SOC dt format > PPC: e500: Define addresses as always 64bit > PPC: e500: Extend address/size of / to 64bit > dt: Add global option to set phandle start offset > PPC: e500: Refactor serial dt generation > > Makefile | 1 - > Makefile.target | 2 +- > device_tree.c | 134 +++++++++++++++++++++++++++- > device_tree.h | 16 +++ > hw/ppce500_mpc8544ds.c | 237 +++++++++++++++++++++++++++++++++++++++++------ > pc-bios/mpc8544ds.dtb | Bin 2028 -> 0 bytes > pc-bios/mpc8544ds.dts | 119 ------------------------ > qemu-config.c | 8 ++ > roms/openbios | 2 +- > 9 files changed, 365 insertions(+), 154 deletions(-) > delete mode 100644 pc-bios/mpc8544ds.dtb > delete mode 100644 pc-bios/mpc8544ds.dts > >