-
Notifications
You must be signed in to change notification settings - Fork 349
userspace: dp: Add support for userspace DP thread #10142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
de5eec1 to
027a490
Compare
027a490 to
453cbaf
Compare
New overlay config created to build SOF with userspace mode enabled. Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com> Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Allocate task structures from the module's driver heap to enable userspace access. This change allows the DP task to operate in userspace context. Also update LL task allocation to use the same heap for consistency, as the memory release logic is shared and does not differentiate between heaps. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
453cbaf to
a65241d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces initial support for running SOF modules in userspace, enabling selected modules to execute in non-privileged mode. The changes focus on adapting the DP scheduler for userspace compatibility and establishing the necessary memory management infrastructure.
- Modifies DP scheduler to use semaphores instead of IRQ locks for userspace threads
- Introduces userspace-specific memory domains and allocation strategies
- Adds configuration options and overlay support for userspace mode
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/lib/userspace_helper.c | Implements userspace stack allocation and memory domain management functions |
| zephyr/include/rtos/userspace_helper.h | Defines userspace helper APIs and memory partition macros |
| zephyr/Kconfig | Adds USERSPACE dependencies to heap configuration options |
| src/schedule/zephyr_dp_schedule.c | Major refactoring to support both kernel and userspace thread scheduling |
| src/include/sof/schedule/dp_schedule.h | Updates scheduler API to include thread options parameter |
| src/include/sof/audio/module_adapter/library/userspace_proxy.h | Defines userspace context structure |
| src/include/module/module/base.h | Adds userspace context field to processing module |
| src/include/sof/audio/component_ext.h | Updates component cleanup to use module heap |
| src/idc/idc.c | Converts IDC task allocation to use module heap |
| src/audio/pipeline/pipeline-schedule.c | Updates DP task creation with userspace support |
| src/audio/buffers/comp_buffer.c | Adds memory partition annotations to buffer operations |
| app/overlays/ptl/userspace_overlay.conf | Provides userspace-specific configuration overlay |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
softwarecki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved incorrect review comments generated by the AI copilot.
kv2019i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No showstoppers -- minor comments inline
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good 1st step we can build on.
a65241d to
c4d573d
Compare
|
@softwarecki do I understand it correctly that with this PR it's possible to run a DP module in user space? We really need a CI test for this... |
kv2019i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonus if you add the one ifdef USERSPACE but not a blocker.
Introduce the userspace_context structure to store data required by modules operating in userspace. Add the common_partition memory domain to share SOF components that need to be accessible from userspace. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
c4d573d to
612ab6c
Compare
K_USER option flag is ignored until CONFIG_USERSPACE is not set. When set, it creates thread in non_priviledged mode. Without proper support such thread will fail. This change is required to run DP scheduler with CONFIG_USERSPACE flag set. When DP scheduler supports non-privileged modules use of irq_lock is not allowed. Therefore for this configuration it uses static semaphores one per core. These could be accesses from user space thread. New created thread with K_USER option (non-privileged) must be added to module memory domain to get access to its private memory space. Additionally allocate scheduler data and task_memory from shared pool. Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com> Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
612ab6c to
73abfd8
Compare
This pull request introduces initial support for running SOF modules in userspace. Key changes include:
DP Scheduler Adaptation: Modify the DP scheduler to operate with
CONFIG_USERSPACEenabled. Replaceirq_lockwith per-core static semaphores for non-privileged threads.Userspace Context: Add
userspace_contextstructure to manage userspace-specific data.Memory Domain: Introduce
common_partitionmemory domain to expose selected SOF components to userspace.Task Allocation: Allocate DP and LL task structures from the module driver heap to ensure compatibility with userspace access.
Overlay Configuration: Add userspace-specific overlay config to enable building SOF in userspace mode.
Manifest Update: Synchronize
man_module_typewith reference FW to support new fields likeuser_mode,domain_rtos, andcore_type.These changes lay the groundwork for executing selected SOF modules in non-privileged mode.