[PATCH v4 1/3] lib: sbi: domain: add domain registration notifier infrastructure

Rahul Pathak rahul.pathak at oss.qualcomm.com
Thu Sep 17 08:38:14 PDT 2026


On Fri, Sep 11, 2026 at 2:39 AM Pawandeep Oza
<pawandeep.oza at oss.qualcomm.com> wrote:
>
> From: Oza Pawandeep <pawandeep.oza at oss.qualcomm.com>
>
> Introduce a notifier callback mechanism that allows subsystems to
> register interest in domain registration events. When a new domain
> is registered via sbi_domain_register(), all registered notifiers
> are invoked before domain sanitization.
>
> The following public interfaces are added to sbi_domain.h:
>
>   - sbi_domain_register_notifier(): registers a notifier callback.
>     Duplicate (fn, priv) pairs are silently ignored.
>
>   - sbi_domain_unregister_notifier(): removes a previously registered
>     notifier callback.
>
> Signed-off-by: Oza Pawandeep <pawandeep.oza at oss.qualcomm.com>
> ---
>  include/sbi/sbi_domain.h | 10 +++++++
>  lib/sbi/sbi_domain.c     | 59 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+)
>
> diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h
> index b35ea99f..2471df48 100644
> --- a/include/sbi/sbi_domain.h
> +++ b/include/sbi/sbi_domain.h
> @@ -358,4 +358,14 @@ int sbi_domain_finalize(struct sbi_scratch *scratch);
>  /** Initialize domains */
>  int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid);
>
> +/** Notifier callback */
> +typedef void (*sbi_domain_notifier_fn)(const struct sbi_domain *dom,
> +                                      void *priv);
> +
> +/** Regitser domain notifier */

Typo  Regitser -> Register

> +int sbi_domain_register_notifier(sbi_domain_notifier_fn notifier, void *priv);
> +
> +/** Unregitser domain notifier */

Typo Unregitser -> Unregister

> +int sbi_domain_unregister_notifier(sbi_domain_notifier_fn notifier, void *priv);
> +
>  #endif
> diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
> index 747c346c..99f201cf 100644
> --- a/lib/sbi/sbi_domain.c
> +++ b/lib/sbi/sbi_domain.c
> @@ -36,7 +36,65 @@ struct sbi_domain root = {
>         .fw_region_inited = false,
>  };
>
> +struct sbi_domain_notifier_entry {
> +       struct sbi_dlist        node;
> +       sbi_domain_notifier_fn  fn;
> +       void                   *priv;
> +};

In my editor, it shows the above structure's fields indentation are
using spaces.

> +
> +
>  static unsigned long domain_hart_ptr_offset;
> +static SBI_LIST_HEAD(domain_notifier_list);
> +



More information about the opensbi mailing list