lib: sbi_domain: Allow adding memrange to a particular domain from drivers

Currently, memregions of non-root domain only populated at domain creation
time which not flexible for drivers which create domain specific resources
(such as MPXY channels). Add new sbi_domain_add_memrange() function which
allows adding memrange to any domain at boot time.

Signed-off-by: Anup Patel <anup.patel@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-9-anup.patel@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Anup Patel authored and Anup Patel committed 2026-10-25 14:30:46 +05:30
1 parent 145bd4ccc0
commit c4f098bfa3
2 files changed
+39 -19

No files matched your search

+21 -2
View File
@@ -345,6 +345,22 @@ void sbi_domain_dump_all(const char *suffix);
*/
int sbi_domain_register(struct sbi_domain *dom);
/**
* Add a memory range with its flags to a domain
* @param dom pointer to domain
* @param addr start physical address of memory range
* @param size physical size of memory range
* @param align alignment of memory region
* @param region_flags memory range flags
*
* @return 0 on success
* @return SBI_EALREADY if memory region conflicts with the existing one
* @return SBI_EINVAL otherwise
*/
int sbi_domain_add_memrange(struct sbi_domain *dom,
unsigned long addr, unsigned long size,
unsigned long align, unsigned long region_flags);
/**
* Add a memory range with its flags to the root domain
* @param addr start physical address of memory range
@@ -356,8 +372,11 @@ int sbi_domain_register(struct sbi_domain *dom);
* @return SBI_EALREADY if memory region conflicts with the existing one
* @return SBI_EINVAL otherwise
*/
int sbi_domain_root_add_memrange(unsigned long addr, unsigned long size,
unsigned long align, unsigned long region_flags);
static inline int sbi_domain_root_add_memrange(unsigned long addr, unsigned long size,
unsigned long align, unsigned long region_flags)
{
return sbi_domain_add_memrange(&root, addr, size, align, region_flags);
}
/** Startup non-root domains */
int sbi_domain_startup(struct sbi_scratch *scratch, u32 cold_hartid);