lopper: assists: Split Zephyr DTS generation into zephyr_domain_dts assist - #779
lopper: assists: Split Zephyr DTS generation into zephyr_domain_dts assist#779dbingi-amd wants to merge 4 commits into
Conversation
|
Hi @kedareswararao, |
|
@zeddii : Please don't merge this until i approve it may break existing use cases need to cross verify properly before approving |
| @@ -11,7 +11,6 @@ | |||
| import sys | |||
| import os | |||
| import glob | |||
There was a problem hiding this comment.
The removal of import argparse from gen_domain_dts.py is a direct consequence of this split. It was solely used by _extra_zephyr_comp_paths() (for --extra-zephyr-comp parsing), which has been moved to zephyr_domain_dts.py along with import argparse. No remaining code in gen_domain_dts.py uses argparse, so keeping it would be a dead import.
| 6. Keeps the status disabled nodes in the final device-tree. | ||
| 7. Delete the nodes that have an xlnx,ip-name property value mentioned in the linux_ignore_ip_list. | ||
|
|
||
| Zephyr device-tree generation uses assist zephyr_domain_dts (run after domain DTS). |
There was a problem hiding this comment.
no need to mention this here need to update the https://github.com/devicetree-org/lopper/tree/master/docs/amd/zephyr/source as per latest assist since it's taken care in the commit 2 no need to add this line here
There was a problem hiding this comment.
Agreed, the line has been removed from the xlnx_generate_domain_dts docstring
| # Add cpu0_intc (riscv,cpu-intc) as a child of the CPU node, | ||
| # and add the riscv,timer node at root wired to cpu0_intc at IRQ 5. | ||
| # Also wire axi_intc to cpu0_intc at IRQ 9 (IRQ_S_EXT). | ||
| if linux_dt and match_cpunode.propval('xlnx,ip-name', list)[0] == 'microblaze_riscv': |
There was a problem hiding this comment.
The explicit linux_dt and was removed because the block was moved inside the existing else: branch (line 529), which already implies linux_dt = 1. The old standalone if linux_dt and microblaze_riscv: and the new else: → if microblaze_riscv: produce identical behavior across all cases — no corner case is affected
There was a problem hiding this comment.
there should be one change per commit if you are doing cleanup means it should be in a separate commit
| if node.propval('xlnx,ip-name', list) == ['axi_intc']: | ||
| node + LopperProp("interrupts-extended = <&cpu0_intc 9>") | ||
| break | ||
| for node in sdt.tree['/'].subnodes(): |
There was a problem hiding this comment.
same here unrelated change
There was a problem hiding this comment.
This block is inside else: (line 529, = linux_dt) and if microblaze_riscv: — the effective guard is still linux_dt AND microblaze_riscv, same as before
| @@ -0,0 +1,1740 @@ | |||
| #/* | |||
| # * Copyright (C) 2023-2026 Advanced Micro Devices, Inc. All Rights Reserved. | |||
There was a problem hiding this comment.
2026 is sufficient since it's a new file
There was a problem hiding this comment.
Updated the copyright year
| Zephyr domain DT assist. Invoked after pruned domain DT is available. | ||
| Args: options['args'][0] = processor instance (same as gen_domain_dts); | ||
| options['args'][1] = optional Zephyr board overlay .dts path. | ||
| Optional flag --extra-zephyr-comp <path> may be repeated to merge |
There was a problem hiding this comment.
cross check this comment and fix properly
There was a problem hiding this comment.
Updated the doc string
e1b60d6 to
e566888
Compare
|
Hi @kedareswararao, Please review the updated change |
| mapped_children_nodes.append(node) | ||
| continue | ||
| elif xlnx_openamp_keep_node(linux_dt, zephyr_dt, node, sdt.tree): | ||
| elif xlnx_openamp_keep_node(linux_dt, False, node, sdt.tree): |
There was a problem hiding this comment.
@bentheredonethat : will this change effect open amp assists?
@dbingi-amd : Please check with Ben and test the open amp dts generation use case as well so that nothing will broke due to this change
There was a problem hiding this comment.
@dbingi-amd @kedareswararao NAK - keep zephyr_dt flag there.
| intc_node['#interrupt-cells'] = 1 | ||
| intc_node + LopperProp("interrupt-controller") | ||
| match_cpunode.add(intc_node) | ||
| match_cpunode.add(intc_node) |
| timer_node.name = "timer" | ||
| timer_node.label = "int_timer" | ||
| timer_node ["compatible"] = "riscv,timer" | ||
| timer_node["compatible"] = "riscv,timer" |
There was a problem hiding this comment.
same here unrelated change
|
Bumping this. A few things are outstanding before this can be considered for merge:
@dbingi-amd — could you rebase against the latest master and respond to the outstanding review comments? Note @kedareswararao has also asked to hold merge until they approve. |
|
This has drifted to CONFLICTING since my last note, so it needs a rebase on Recapping what's still outstanding (unchanged):
@dbingi-amd — a rebase plus resolving the NAK would get this back to a reviewable state. |
e566888 to
f77c5c6
Compare
Remove the zephyr_dt CLI path and Zephyr-specific generation helpers from gen_domain_dts so the assist handles domain pruning and Linux/baremetal output only. linux_dt, baremetal, and zynqmp_fsbl behaviour is unchanged. Rename _zephyr_node_must_be_preserved() to _node_must_be_preserved() and keep it in the domain prune loop. OpenAMP pipelines run gen_domain_dts before zephyr_domain_dts, so nodes already referenced from /chosen must survive generic domain pruning — including ipc shm set by the OpenAMP assist. Signed-off-by: Bingi Dinesh kumar <[email protected]>
Move Zephyr device-tree generation into a dedicated assist that calls gen_domain_dts when the input is a full SDT, then applies Zephyr transforms. Platform lops such as imux remain external -i invocations. Register the assist in lop-load.dts. Reuse _node_must_be_preserved from gen_domain_dts during Zephyr-phase pruning instead of maintaining a separate copy of the preserve logic. Adjust zephyr_board_dt overlay discovery for the zephyr_domain_dts CLI. Carry forward the ZynqMP IPI mailbox child handling, MicroBlaze RISC-V RV32E kconfig generation, and other Zephyr-specific transforms recently present in gen_domain_dts. Signed-off-by: Bingi Dinesh kumar <[email protected]>
Point existing Zephyr unit tests at zephyr_domain_dts instead of gen_domain_dts zephyr_dt. Add IPI mailbox child conversion and promotion coverage for the VCK190 and ZCU102 cases handled by the new assist. Update the OpenAMP Zephyr pipeline sanity step to call zephyr_domain_dts. Signed-off-by: Bingi Dinesh kumar <[email protected]>
Replace gen_domain_dts <proc> zephyr_dt examples with zephyr_domain_dts <proc> [board.dts] in developer-guide.md and the AMD Zephyr platform guides for Cortex-A78, Cortex-R52, and MicroBlaze RISC-V. Note in the Linux device-tree chapter that gen_domain_dts remains the entry point for Linux domain trees. Signed-off-by: Bingi Dinesh kumar <[email protected]>
f77c5c6 to
097a0f2
Compare
|
Hi @kedareswararao @bentheredonethat , Updated the branch per review feedback — please re-review. @bentheredonethat — on your NAK: the zephyr_dt flag removed from gen_domain_dts CLI is intentional (step 5 is now zephyr_domain_dts). The openamp … zephyr_dt assist is unchanged. The xlnx_openamp_keep_node(linux_dt, False, …) change in domain prune is correct — that second arg is not the OpenAMP assist flag; it only affects UIO retention during Linux/baremetal prune. Per your advice: OpenAMP test flow used (VEK385):
Also ran pytest and lopper_sanity.py --openamp. OpenAMP plugin extension for mmio-sram ipc nodes can follow separately if you still want that. @kedareswararao — your feedback addressed: unrelated Linux changes reverted, Zephyr line removed from gen_domain_dts docstring, docs updated under docs/amd/zephyr/source. Thanks, |
• Split Zephyr device-tree generation out of gen_domain_dts into a new zephyr_domain_dts assist.
• gen_domain_dts now handles domain pruning and Linux/baremetal output only; Zephyr logic was removed from it.
• Added zephyr_domain_dts.py for Zephyr-specific transforms, board overlay handling, and related cleanup.
• Registered the new assist in lop-load.dts so Lopper loads it automatically.
• Replaced the old gen_domain_dts {proc} zephyr_dt [board.dts] flow with a separate zephyr_domain_dts {proc} [board.dts] step after domain (and imux) generation.
• Moved optional board overlay input to the second argument of zephyr_domain_dts (previously the third argument on gen_domain_dts).
• Preserved --extra-zephyr-comp support in the Zephyr assist (not in gen_domain_dts).
• Updated Zephyr platform docs, Linux domain-tree docs, and the developer guide to describe the new assist and command examples.
• No intended functional change to generated Zephyr DTS — this is primarily a refactor to separate concerns and simplify maintenance.