[RFC PATCH 05/12] include: sbi_domain: add Worlds WID fields

Yu-Chien Peter Lin peter.lin at sifive.com
Mon Jul 20 00:55:36 PDT 2026


On Mon, Jul 13, 2026 at 02:52:27PM -0700, Pawandeep Oza wrote:
> On Fri, Jun 26, 2026 at 3:16 AM Yu-Chien Peter Lin <peter.lin at sifive.com> wrote:
> >
> > Adds next_wid (u32 WID for next boot stage), has_next_wid (distinguishes
> > explicit zero from unset for pmwid fallback), and next_widlist (u64 bitmask
> > specifying which WIDs can be delegated to this domain) to sbi_domain
> > structure. Enables per-domain World ID configuration.
> >
> > Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
> > ---
> >  include/sbi/sbi_domain.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h
> > index 16edd4ce..7d523493 100644
> > --- a/include/sbi/sbi_domain.h
> > +++ b/include/sbi/sbi_domain.h
> > @@ -211,6 +211,12 @@ struct sbi_domain {
> >         unsigned long next_addr;
> >         /** Privilege mode of next booting stage for this domain */
> >         unsigned long next_mode;
> > +       /** Next booting stage World ID for this domain */
> > +       u32 next_wid;
> oza: The next_ convention works well for one-time boot handoff fields
> like next_addr and next_mode
> But next_wid and next_widlist are not one-time boot fields — they are:
> Written on every domain entry via sbi_domain_worlds_enter()
> Active throughout the domain's lifetime
> Runtime isolation policy, not a boot handoff value
> So the next_ naming is semantically misleading here
> 
> why not just have this naming
> 
> widThe
> WID assigned to this domain.
> has_wid
> lwid_deleg
> The delegation budget to lower levels.

Good catch! That's indeed better naming. I prefer wid_deleg
over lwid_deleg to mirror the MWIDDELEG CSR name. Hope that
works for you

Thanks,
Peter Lin

> 
> > +       /** Whether next_wid was explicitly set */
> > +       bool has_next_wid;
> > +       /** Next booting stage World ID delegation bitmask for this domain */
> > +       u64 next_widlist;
> >         /** Is domain allowed to reset the system */
> >         bool system_reset_allowed;
> >         /** Is domain allowed to suspend the system */
> > --
> > 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