[RFC PATCH 02/12] lib: utils: fdt_helper: parse RISC-V Worlds DT properties

Yu-Chien Peter Lin peter.lin at sifive.com
Mon Aug 3 00:19:55 PDT 2026


Hi Anup,

Regarding to the suggestion in your patch:
"[4/5] lib: sbi: Extend hart protection abstraction to allow ID configuration"
 
 https://patchwork.ozlabs.org/comment/3725105/ 

> The RISC-V world DT property parsing can be done at the
> time of parsing domains from FDT (like already done in this
> series). The hart platform abstraction will be only for configuring
> the RISC-V world CSRs.

I considered moving per-hart pmwid DT properties parsing into
generic_domains_init()->fdt_domains_populate(), but I think
generic_extensions_init()->fdt_parse_worlds_all_harts() is
still the right place for two reasons:
1. riscv,pmwid, riscv,pmwidlist, and riscv,pmlwidlist are
   per-hart properties stored in sbi_hart_features — not
   per-domain. They describe the hart's platform-defined WID
   configuration, independent of which domain the hart is
   assigned to.
2. pmwid parsing should also work on root-domain-only systems
   (no /chosen/opensbi-domains in DT). Since
   fdt_iterate_each_domain() returns early when the domain
   config node is absent, __fdt_parse_domain() is never
   called — so placing pmwid parsing there would miss those
   hart feature information.

So the flow is:

 init_coldboot()
 │
 ├─ sbi_hart_init()
 │    └─ hart_detect_features()
 │       └─ generic_extensions_init()
 │            ├─ fdt_parse_isa_extensions_all_harts()  ← /cpus: hf->extensions
 │            └─ fdt_parse_worlds_all_harts()          ← /cpus: hf->pmwid/pmwidlist/pmlwidlist
 │
 ├─ sbi_domain_finalize()
 │    └─ generic_domains_init()
           └─ fdt_domains_populate()
                ├─ traverse /cpus for coldboot hart domain
                └─ __fdt_parse_domain() × N
                     ├─ parse wid, wid_deleg     ← per-domain S-mode WID
                     └─ traverse /cpus for hart assignment

Does this reasoning make sense to you? Or did I miss something?

Thanks,
Peter Lin



More information about the opensbi mailing list