Skip to content

Zephyr policy updates 20260727 - #795

Merged
zeddii merged 19 commits into
devicetree-org:masterfrom
bentheredonethat:zephyr-policy-updates-20260727-ben
Aug 6, 2026
Merged

Zephyr policy updates 20260727 #795
zeddii merged 19 commits into
devicetree-org:masterfrom
bentheredonethat:zephyr-policy-updates-20260727-ben

Conversation

@bentheredonethat

Copy link
Copy Markdown
Collaborator

Hi @zeddii -- there are spec updates so user can specify Domain YAML linker and MPU characteristics for Zephyr

Importantly, gen_domain_dts does not generate MPU permissions or linker scripts. It preserves the results produced by the dedicated assists.

Hi @sivadur @kedareswararao there are the gen-domain changes for:

  • /scratch/blevinsk/lopper/lopper/assists/gen_domain_dts.py
  • /scratch/blevinsk/lopper/lopper/assists/zephyr_supported_comp.yaml

It does the following:

  • Preserves nodes explicitly marked with:

    compatible = "zephyr,memory-region";

  • Preserves nodes referenced from /chosen, including:

    zephyr,sram = "...";
    zephyr,ipc_shm = "...";

  • Prevents the generic Zephyr domain transformation from overwriting an already selected zephyr,sram.

  • Renames R5/R52 memory nodes to match their processor-local reg addresses and updates /chosen references after the rename.

  • Preserves these generated properties during pruning:

    zephyr,memory-region
    zephyr,memory-attr
    zephyr,sram

  • Normalizes ZynqMP IPI mailbox properties for Zephyr:

    xlnx,ipi-id → local-ipi-id
    xlnx,ipi-id → remote-ipi-id
    reg-names = "host_ipi_reg"
    status = "okay"

  • Removes incompatible properties from destination mailbox children where required.

  • Extends the supported-compatible policy for:

    • zephyr,memory-region
    • mmio-sram
    • zephyr,mbox-ipm
    • vnd,mbox-consumer
    • xlnx,zynqmp-ipi-mailbox
    • xlnx,zynqmp-ipi-dest-mailbox

Intended execution order

Domain YAML

YAML expansion

zephyr-mpu
├── emits zephyr,memory-region
├── emits zephyr,memory-attr
└── selects /chosen/zephyr,sram

zephyr-linker
├── writes the linker script
└── writes the layout report

gen_domain_dts
├── prunes the domain
├── preserves generated Zephyr metadata
├── fixes local RPU memory names
└── produces the final Zephyr DTS

@bentheredonethat bentheredonethat changed the title Zephyr policy updates 20260727 ben Zephyr policy updates 20260727 Aug 3, 2026
@bentheredonethat
bentheredonethat force-pushed the zephyr-policy-updates-20260727-ben branch 2 times, most recently from fca4a43 to 7db3ac0 Compare August 4, 2026 00:11
@zeddii

zeddii commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

I'm out of the office, back on Wednesday and will review these then.

@bentheredonethat

Copy link
Copy Markdown
Collaborator Author

@zeddii ok thank you!

@zeddii

zeddii commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks @bentheredonethat — this is well-structured and the split is right (linker/MPU in dedicated assists, gen_domain_dts only preserving the generated metadata). CI is green and the new tests target the tricky bits (sram-override guard, ipc_shm refs, RPU local-TCM range, linker expand +/-). A few items before it can be merged:

1. Rebase needed. #790 just merged, and it touches gen_domain_dts.py in the same areas this PR does — please rebase on latest master.

2. Rename may leave stale references to the renamed node. It looks to me like xlnx_zephyr_fixup_rpu_memory_names() only fixes /chosen refs for the hardcoded ("zephyr,sram",). A reference to a renamed node could be left pointing at the old path via:

  • other /chosen entries (e.g. zephyr,ipc_shm) — _zephyr_node_must_be_preserved() scans all /chosen props;

  • a &label/phandle reference from another node — the rename does delete → mutate abs_path/nameadd, and add/delete don't re-register __symbols__/phandles on their own.

    To refresh after the rename: call sdt.tree.resolve() (re-resolves phandles/refs — the same call assemble_sdt.py uses after structural edits), and update the renamed node's /__symbols__ entry to the new path — there's already a precedent for exactly this in this file (the domain /__symbols__ fix-up, ~L655–668), followed by sdt.tree.sync(). A test that renames a node referenced by both zephyr,ipc_shm and a &label elsewhere, asserting both still resolve, would confirm it.

3. Guard the IPI id access. In xlnx_remove_unsupported_nodes(), node["xlnx,ipi-id"].value is read after matching xlnx,zynqmp-ipi-mailbox / -dest-mailbox — if a matching node lacks xlnx,ipi-id this throws KeyError. A cheap if node.props("xlnx,ipi-id") guard would harden it.

Minor (non-blocking): the rename uses reg[1] as the new unit-address, which assumes the high address cell is 0 (local TCM view) — fine for the intended case, worth a one-line comment.

With the rebase + items 2 and 3 addressed, this is good to go.

Support current ZynqMP direct-IPM and Versal mailbox signaling, combine
contiguous RPMsg carveouts into zephyr,ipc_shm, and improve relation-target
diagnostics and Lopper logging.

Keep Zephyr memory permissions and linker placement outside the shared
OpenAMP transform.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Normalize ZynqMP IPI bindings and local-view RPU memory node names while
preserving explicit zephyr,sram, zephyr,memory-region, and
zephyr,memory-attr properties during generic domain pruning.

Leave MPU permission and linker placement generation to their dedicated
assists.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add ZynqMP Libmetal and domain-access fixtures for Linux UIO and R5
bare-metal endpoints. Verify timer, IPI, interrupt, bus, and shared-memory
output through the complete Libmetal workflow.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add a common Cortex-R memory model for Zephyr linker and MPU generation.
Resolve domain-owned memories, normalize permissions and processor-local TCM
addresses, infer R5/R52 boot profiles, and validate section placement without
requiring an OpenAMP relation or compatible.

Keep resource-table section registration in a separate optional OpenAMP
extension while allowing the shared model to validate that placement.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add the standalone zephyr-mpu assist for Cortex-R execution domains. Emit
standard zephyr,memory-region and zephyr,memory-attr properties, select the
validated boot memory through zephyr,sram, and remove transformation-only
policy metadata.

Expand R5 DDR ranges to a representable power-of-two MPU aperture while
leaving R52 base-limit ranges exact. Retain openamp-zephyr-mpu as a
backward-compatible command alias.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add the standalone zephyr-linker assist and package the Zephyr 4.3
Cortex-R linker ABI. Generate a complete primary script with independent
vector, text, rodata, data, BSS, no-init, heap, stack, and constrained custom
section placement without requiring a Zephyr source checkout.

Emit a resolved layout report and delegate optional resource-table rendering
to the OpenAMP extension. Retain openamp-zephyr-linker as a
backward-compatible command alias.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Cover R5 TCM boot, R52 TCM and DDR boot, representable R5 DDR MPU
apertures, independent and custom linker placement, and Zephyr ABI conflict
rejection.

Run MPU and linker generation before IMUX and final Zephyr domain transforms
to verify conventional metadata and placement survive the complete OpenAMP
pipeline.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Document shared OpenAMP processing, dedicated Zephyr MPU and
complete-linker generation, generic domain pruning, Libmetal output,
responsibility boundaries, and validation in the final workflow.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Flatten readable domain-local linker and section nodes into properties
before domain-access pruning. Resolve memory references to phandles and
remove temporary metadata.

Add direct validation for resolved memories, offsets, unsupported
sections, and hierarchy removal.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add standalone Cortex-R5 linker and MPU coverage using a plain Zephyr
domain without an OpenAMP compatible, relation, reserved-memory, or
resource table. Verify memory-name disambiguation and the public
zephyr_linker and zephyr_mpu command paths.

Add ZynqMP and Versal OpenAMP demo policies with MPU and linker placement
metadata. Place the 4 KiB RAM console at the end of the existing firmware
carveout and split the YAML-side RPROC0 region so trace policy remains
distinct without requiring a Linux devicetree change.

Test the complete transforms and resource-table output against the final
firmware and trace carveout layout.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Allow a Zephyr memory policy to mark a region as static when the SoC MPU
table already provides its mapping. Keep the region available to linker
placement while suppressing a duplicate zephyr,memory-attr entry, so narrower
dynamic policies can retain MPU priority over broad static mappings.

Document the static flag in the generated workflow and cover R52 TCM and DDR
layouts, overlap checks, and linker-managed memory behavior in sanity tests.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Extend the Versal2 OpenAMP reference overlay with Zephyr Cortex-R52 MPU
permissions and linker placement metadata. Cover both TCM and DDR boot memory
while retaining the existing IPC and resource-table carveout layout.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add a read-only assist mode that lists IPI controllers owned by a
selected processor, existing RPMsg and Libmetal mappings, and usable
bidirectional mailbox pairs.

Share the platform-neutral discovery and reporting helpers
through openamp_xlnx_common while keeping command-line dispatch in the
Xilinx OpenAMP assist.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Define the domain-YAML contract used to generate Zephyr Cortex-R linker
scripts and conventional MPU memory metadata. Document supported permissions,
the static mapping flag, linker section placement, boot profiles, generated
properties, and standalone assist commands.

Clarify that this policy is independent of OpenAMP relations and identify
resource-table placement as an optional OpenAMP-specific extension.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
@bentheredonethat
bentheredonethat force-pushed the zephyr-policy-updates-20260727-ben branch from 7db3ac0 to c1677ff Compare August 6, 2026 05:40
@bentheredonethat

Copy link
Copy Markdown
Collaborator Author

@zeddii rebased , updated , pushed!

Handle Libmetal relations independently from RPMsg relations during Xilinx
OpenAMP processing. Resolve each relation mailbox and expose its
destination bitmask on the parent UIO IPI controller for Linux consumers.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Use idiomatic truth, identity, membership, and generator checks
throughout the Xilinx OpenAMP assists. Tighten relation and mailbox
validation, handle missing domains safely, and correct timer and
chosen-node references while preserving the existing processing flow.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Update all matching chosen and symbol paths when RPU TCM nodes adopt
their processor-local unit addresses. Resolve and sync the tree
after structural edits so phandle consumers continue to target
the renamed node, and cover chosen, symbol, and phandle references
with a regression test.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Only convert ZynqMP mailbox IPI identifiers when the source
property exists, avoiding KeyError for otherwise valid
mailbox nodes. Retain the existing local and remote identifier
conversions when the property is present and cover both
paths with focused tests.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
@bentheredonethat
bentheredonethat force-pushed the zephyr-policy-updates-20260727-ben branch from c1677ff to fd4be07 Compare August 6, 2026 05:54
Zephyr's ZynqMP and Versal R5 timer configuration refers to the ttc0
nodelabel, while an SDT domain can retain a differently labeled TTC or
more than one TTC. Normalize the domain-local result instead of making
Zephyr select an arbitrary compatible instance.

Preserve an explicitly mapped ttc0 and otherwise promote the first TTC
retained by domain access. Accept both cdns,ttc and xlnx,ttcps inputs,
update the symbols node, and cover single, multiple, compatible, and
non-R5 cases.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
@zeddii
zeddii merged commit 6dd5ad3 into devicetree-org:master Aug 6, 2026
3 checks passed
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.

2 participants