lib: sbi_domain: Add domain notifier infrastructure

Introduce a notifier callback mechanism that allows subsystems to
register interest in domain events (such as registration). Whenever
such events happen for a domain, all registered notifiers are invoked.

The following public interfaces are added to sbi_domain.h:

  - sbi_domain_register_notifier(): registers a notifier callback.
    Duplicate (fn, event, priv) pairs are silently ignored.

  - sbi_domain_unregister_notifier(): removes a previously registered
    notifier callback.

Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com>
Signed-off-by: Oza Pawandeep <pawandeep.oza@oss.qualcomm.com>
Reviewed-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Tested-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260923032359.4041876-11-anup.patel@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Oza Pawandeep authored and Anup Patel committed 2026-10-25 14:30:46 +05:30
1 parent f909590830
commit f4ed5aa8b7
2 files changed
+118

No files matched your search

+40
View File
@@ -387,4 +387,44 @@ int sbi_domain_finalize(struct sbi_scratch *scratch);
/** Initialize domains */
int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid);
/** Possible domain notify events */
enum sbi_domain_notify_event {
SBI_DOMAIN_NOTIFY_EVENT_REGISTER = 0,
SBI_DOMAIN_NOTIFY_EVENT_MAX,
};
/**
* Domain notify callback.
* @param dom pointer to domain
* @param event domain notify event
* @param priv private data of the callback
* @return 0 on success (informs framework to continue notifications)
* @return negative error code on failure (informs framework to not continue notifications)
*/
typedef int (*sbi_domain_notify_fn)(struct sbi_domain *dom,
enum sbi_domain_notify_event event,
void *priv);
/**
* Register domain notifier
* @param fn domain notify callback
* @param event domain notify event
* @param priv private data of the callback
* @return 0 on success
* @return negative error code on failure
*/
int sbi_domain_register_notifier(sbi_domain_notify_fn fn,
enum sbi_domain_notify_event event, void *priv);
/**
* Unregister domain notifier
* @param fn domain notify callback
* @param event domain notify event
* @param priv private data of the callback
* @return 0 on success
* @return negative error code on failure
*/
int sbi_domain_unregister_notifier(sbi_domain_notify_fn fn,
enum sbi_domain_notify_event event, void *priv);
#endif