Skip to content

lopper: assists: Split Zephyr DTS generation into zephyr_domain_dts assist#779

Open
dbingi-amd wants to merge 2 commits into
devicetree-org:masterfrom
dbingi-amd:zephyr-lopper
Open

lopper: assists: Split Zephyr DTS generation into zephyr_domain_dts assist#779
dbingi-amd wants to merge 2 commits into
devicetree-org:masterfrom
dbingi-amd:zephyr-lopper

Conversation

@dbingi-amd

Copy link
Copy Markdown
Contributor

• 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.

@dbingi-amd

Copy link
Copy Markdown
Contributor Author

Hi @kedareswararao,
Please review.

@kedareswararao

Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lopper/assists/gen_domain_dts.py Outdated
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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be one change per commit if you are doing cleanup means it should be in a separate commit

Comment thread lopper/assists/gen_domain_dts.py Outdated
if node.propval('xlnx,ip-name', list) == ['axi_intc']:
node + LopperProp("interrupts-extended = <&cpu0_intc 9>")
break
for node in sdt.tree['/'].subnodes():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here unrelated change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread lopper/assists/zephyr_domain_dts.py Outdated
@@ -0,0 +1,1740 @@
#/*
# * Copyright (C) 2023-2026 Advanced Micro Devices, Inc. All Rights Reserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026 is sufficient since it's a new file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the copyright year

Comment thread lopper/assists/zephyr_domain_dts.py Outdated
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cross check this comment and fix properly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the doc string

@dbingi-amd dbingi-amd force-pushed the zephyr-lopper branch 2 times, most recently from 513452a to e1b60d6 Compare July 10, 2026 04:54
Zephyr-specific device-tree logic is currently handled inside gen_domain_dts
alongside Linux and baremetal domain pruning. Move Zephyr handling into a
dedicated assist to improve modularity, readability, and maintainability.
- Moved Zephyr device-tree generation from gen_domain_dts into zephyr_domain_dts.py.
- Removed zephyr_dt handling from gen_domain_dts while keeping linux_dt, baremetal,
  and zynqmp_fsbl behaviour unchanged.
- Added zephyr_domain_dts assist to accept SDT input, invoke gen_domain_dts
  in-process and apply Zephyr transforms.
- Registered zephyr_domain_dts in lop-load.dts.

Signed-off-by: Bingi Dinesh kumar <dineshkumar.bingi@amd.com>
Zephyr device-tree generation now uses the zephyr_domain_dts assist instead of
gen_domain_dts with a zephyr_dt option. Update documentation so users follow the
new entry point and Lopper command flow.
- Updated developer-guide.md to describe zephyr_domain_dts as the Zephyr assist.
- Updated Cortex-A78 and Cortex-R52 platform guides with the new Lopper usage.
- Updated MicroBlaze RISC-V platform guide with the new Lopper usage.
- Updated Linux device-tree generation chapter to note gen_domain_dts remains for
  Linux domain trees.

Signed-off-by: Bingi Dinesh kumar <dineshkumar.bingi@amd.com>
@dbingi-amd

Copy link
Copy Markdown
Contributor Author

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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

timer_node.name = "timer"
timer_node.label = "int_timer"
timer_node ["compatible"] = "riscv,timer"
timer_node["compatible"] = "riscv,timer"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here unrelated change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants