Skip to content

PPC: mpc8544ds: Create device tree dynamically

Alexander Graf qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest31 patches 6 repliesIn review

v1 -> v2 from the cover letter

- 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

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/31dt: allow add_subnode to create root subnodesdevice_tree.c+6 -10 replies
2/31dt: add helpers for multi-cell addsdevice_tree.h+12 -01 reply
3/31dt: add helper for phandle referencesdevice_tree.c device_tree.h+11 -01 reply
4/31dt: temporarily disable subtree creation failure checkdevice_tree.c+2 -00 replies
5/31dt: add helper for phandle enumerationdevice_tree.c device_tree.h+16 -11 reply
6/31dt: add helper for empty dt creationdevice_tree.c device_tree.h+38 -00 replies
7/31dt: add helper for phandle allocationdevice_tree.c device_tree.h+8 -00 replies
8/31dt: add helper for 64bit cell addsdevice_tree.c device_tree.h+9 -00 replies
9/31PPC: e500: require libfdthw/ppc/Makefile.objs hw/ppce500_mpc8544ds.c+1 -60 replies
10/31PPC: e500: dt: create memory node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dtb pc-bios/mpc8544ds.dts+4 -90 replies
11/31PPC: e500: dt: create /cpus node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dtb pc-bios/mpc8544ds.dts+5 -50 replies
12/31PPC: e500: dt: create /hypervisor node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dtb pc-bios/mpc8544ds.dts+1 -30 replies
13/31PPC: e500: dt: create / node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dtb pc-bios/mpc8544ds.dts+8 -50 replies
14/31PPC: e500: dt: create /chosen node dynamicallyhw/ppce500_mpc8544ds.c+1 -00 replies
15/31PPC: e500: dt: create /soc8544 node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dts+17 -90 replies
16/31PPC: e500: dt: create serial nodes dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dts+35 -260 replies
17/31PPC: e500: dt: create mpic node dynamicallyhw/ppce500_mpc8544ds.c+16 -00 replies
18/31PPC: e500: dt: create global-utils node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dts+9 -60 replies
19/31PPC: e500: dt: create pci node dynamicallyhw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dtb pc-bios/mpc8544ds.dts+50 -460 replies
20/31PPC: e500: dt: start with empty device treeMakefile hw/ppce500_mpc8544ds.c pc-bios/mpc8544ds.dtb +1 more+1 -220 replies
21/31dt: Add -machine dumpdtb option to dump the current dtbhw/ppce500_mpc8544ds.c qemu-config.c+22 -02 replies
22/31PPC: e500: dt: use 64bit cell helperhw/ppce500_mpc8544ds.c+3 -30 replies
23/31PPC: e500: dt: use target_phys_addr_t for ramsizehw/ppce500_mpc8544ds.c+1 -10 replies
24/31PPC: e500: enable manual loading of dtb blobhw/ppce500_mpc8544ds.c+22 -40 replies
25/31Revert "dt: temporarily disable subtree creation failure check"device_tree.c+0 -20 replies
26/31PPC: e500: Use new MPIC dt formathw/ppce500_mpc8544ds.c+18 -150 replies
27/31PPC: e500: Use new SOC dt formathw/ppce500_mpc8544ds.c+4 -50 replies
28/31PPC: e500: Define addresses as always 64bithw/ppce500_mpc8544ds.c+17 -170 replies
29/31PPC: e500: Extend address/size of / to 64bithw/ppce500_mpc8544ds.c+18 -100 replies
30/31dt: Add global option to set phandle start offsetdevice_tree.c qemu-config.c+31 -10 replies
31/31PPC: e500: Refactor serial dt generationhw/ppce500_mpc8544ds.c+26 -280 replies

Reviews trailers per patch

6 of 31 patches have a Reviewed-by or Acked-by.

PatchPeter CrosthwaiteScott Wood
1/31R-b
2/31R-b
3/31R-b
4/31
5/31R-b
6/31R-b
7/31
8/31R-b
9/31
10/31
11/31
12/31
13/31
14/31
15/31
16/31
17/31
18/31
19/31
20/31
21/31
22/31
23/31
24/31
25/31
26/31Requested-by
27/31Requested-by
28/31
29/31
30/31
31/31

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 00/31] PPC: mpc8544ds: Create device tree dynamically

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

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

v2 -> v3:

- [phandle helper] rename "string" to target_node_path
- [phandle helper] add correct header includes
- use snprintf
- create and use new multi-cell setting api

Alexander Graf (31):
dt: allow add_subnode to create root subnodes
dt: add helpers for multi-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 -
 device_tree.c          |  106 +++++++++++++++++++++-
 device_tree.h          |   20 ++++
 hw/ppc/Makefile.objs   |    2 +-
 hw/ppce500_mpc8544ds.c |  237 +++++++++++++++++++++++++++++++++++++++++------
 pc-bios/mpc8544ds.dtb  |  Bin 2028 -> 0 bytes
 pc-bios/mpc8544ds.dts  |  119 ------------------------
 qemu-config.c          |    8 ++
 8 files changed, 340 insertions(+), 153 deletions(-)
 delete mode 100644 pc-bios/mpc8544ds.dtb
 delete mode 100644 pc-bios/mpc8544ds.dts