[RFC PATCH 09/12] platform: generic: parse root domain WID config from DT

Anup Patel anup at brainfault.org
Mon Jul 20 03:39:06 PDT 2026


On Mon, Jul 20, 2026 at 2:24 PM Yu-Chien Peter Lin <peter.lin at sifive.com> wrote:
>
> On Wed, Jul 08, 2026 at 05:39:34PM -0700, Pawandeep Oza wrote:
> > On Fri, Jun 26, 2026 at 3:17 AM Yu-Chien Peter Lin <peter.lin at sifive.com> wrote:
> > >
> > > Parse root-domain-next-wid (32-bit) and root-domain-next-widlist
> > > (64-bit) properties from /chosen/opensbi,config node during
> > > generic_domains_init(). Sets root.next_wid/has_next_wid and
> > > root.next_widlist.
> > >
> > > Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
> > > ---
> > >  platform/generic/platform.c | 20 +++++++++++++++++++-
> > >  1 file changed, 19 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> > > index 51e9f342..de12deb5 100644
> > > --- a/platform/generic/platform.c
> > > +++ b/platform/generic/platform.c
> > > @@ -11,6 +11,7 @@
> > >  #include <platform_override.h>
> > >  #include <sbi/riscv_asm.h>
> > >  #include <sbi/sbi_bitops.h>
> > > +#include <sbi/sbi_domain.h>
> > >  #include <sbi/sbi_hartmask.h>
> > >  #include <sbi/sbi_heap.h>
> > >  #include <sbi/sbi_platform.h>
> > > @@ -276,7 +277,9 @@ int generic_extensions_init(bool cold_boot)
> > >  int generic_domains_init(void)
> > >  {
> > >         const void *fdt = fdt_get_address();
> > > -       int offset, ret;
> > > +       const fdt32_t *val;
> > > +       int len, offset, ret;
> > > +       u64 val64;
> > >
> > >         ret = fdt_domains_populate(fdt);
> > >         if (ret < 0)
> > > @@ -290,6 +293,21 @@ int generic_domains_init(void)
> > >                 if (offset >= 0 &&
> > >                     fdt_get_property(fdt, offset, "system-suspend-test", NULL))
> > >                         sbi_system_suspend_test_enable();
> > > +
> > > +               if (offset >= 0) {
> > > +                       val = fdt_getprop(fdt, offset, "root-domain-next-wid", &len);
> > > +                       if (val && len == sizeof(fdt32_t)) {
> > > +                               root.next_wid = fdt32_to_cpu(val[0]);
> > > +                               root.has_next_wid = true;
> > > +                       }
> > > +
> > > +                       val = fdt_getprop(fdt, offset, "root-domain-next-widlist", &len);
> > Oza: Root domain WID config is semantically identical to per-domain
> > WID config but lives in a completely different DT location
> > root can be another default domain under chosen { opensbi-domains {
>
> Sure, it would be better to have root domain wid configuration
> specified under the opensbi-domain parent node alongside other
> domains. I also am planning to introduce "opensbi,domain,instance,root"
> compatible string.

Another approach is to treat DT node named "root" under path
"/chosen/opensbi-domains" for RISC-V worlds related DT property.
In the future, same "root" DT node can be used other root domain
DT properties.

Regards,
Anup

>
> Thanks,
> Peter Lin
>
> > > +                       if (val && (len == (2 * sizeof(fdt32_t)))) {
> > > +                               val64 = fdt32_to_cpu(val[0]);
> > > +                               val64 = (val64 << 32) | fdt32_to_cpu(val[1]);
> > > +                               root.next_widlist = val64;
> > > +                       }
> > > +               }
> > >         }
> > >
> > >         return 0;
> > > --
> > > 2.43.7
> > >
> > >
> > > --
> > > opensbi mailing list
> > > opensbi at lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list