Skip to content

Commit 683bb21

Browse files
kv2019ilgirdwood
authored andcommitted
zephyr: userspace_helper: add function to add common partition to domain
Userspace_helper.h provides infrastructure to mark SOF objects that should be accessible to all user threads (the "common_partition"). Add function user_memory_attach_common_partition() that allows to attach this partition to a specific domain. This is intended to use e.g. when moving LL tasks to user-space, where a single domain will be created at boot, and should have access to the common partition. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent d31370b commit 683bb21

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

zephyr/include/rtos/userspace_helper.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ struct k_heap *module_driver_heap_init(void);
5252
*/
5353
int user_memory_init_shared(k_tid_t thread_id, struct processing_module *mod);
5454

55+
/**
56+
* Attach common userspace memory partition to a module memory domain.
57+
* @param dom - memory domain to attach the common partition to.
58+
*
59+
* @return 0 for success, error otherwise.
60+
*
61+
* @note
62+
* Function used only when CONFIG_USERSPACE is set.
63+
* The common partition contains shared objects required by user-space modules.
64+
*/
65+
int user_memory_attach_common_partition(struct k_mem_domain *dom);
66+
5567
#endif
5668

5769
/**

zephyr/lib/userspace_helper.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ int user_memory_init_shared(k_tid_t thread_id, struct processing_module *mod)
8383
return k_mem_domain_add_thread(comp_dom, thread_id);
8484
}
8585

86+
int user_memory_attach_common_partition(struct k_mem_domain *dom)
87+
{
88+
return k_mem_domain_add_partition(dom, &common_partition);
89+
}
90+
8691
int user_access_to_mailbox(struct k_mem_domain *domain, k_tid_t thread_id)
8792
{
8893
struct k_mem_partition mem_partition;

0 commit comments

Comments
 (0)