[PATCH v4 1/3] lib: sbi: domain: add domain registration notifier infrastructure
Rahul Pathak
rahul.pathak at oss.qualcomm.com
Wed Sep 16 19:55:09 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(+)
>
> +void sbi_domain_notify_all(const struct sbi_domain *dom)
> +{
> + struct sbi_domain_notifier_entry *entry;
> +
> + sbi_list_for_each_entry(entry, &domain_notifier_list, node) {
> + if (entry->fn)
> + entry->fn(dom, entry->priv);
> + }
> +}
>
> struct sbi_domain *sbi_hartindex_to_domain(u32 hartindex)
> {
> @@ -650,6 +708,7 @@ int sbi_domain_register(struct sbi_domain *dom)
> return SBI_EALREADY;
> }
>
> + sbi_domain_notify_all(dom);
Both sanitize_domain and the sbi_domain_setup_state functions
can fail. If the intention of notification is for successful domain
registration then the sbi_domain_notify_all should be called in the end.
> /* Sanitize discovered domain */
> rc = sanitize_domain(dom);
> if (rc) {
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list