-
Notifications
You must be signed in to change notification settings - Fork 349
userspace: Preparation for userspace loadable modules support #10103
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d581d36
alloc: userspace: Introduce MMU shared memory heap
jxstelter 44705a8
ptl: mmu: Introduce module driver heap for non-privileged modules
softwarecki 2f924bd
module_adapter: Allocate data buffers from MMU shared heap
jxstelter 1a19ba9
audio: buffers: ring_buffer: Allocate memory from shared heap for use…
softwarecki bd6abf0
module_adapter: Separate generic_module_is_ready_to_process function
softwarecki 754ebd6
lib_manager: Public lib_manager_get_instance_bss_address function
softwarecki d3adf65
zephyr: userspace: Fix compilation options
jxstelter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright(c) 2025 Intel Corporation. All rights reserved. | ||
| * | ||
| * Author: Jaroslaw Stelter <jaroslaw.stelter@intel.com> | ||
| * Adrian Warecki <adrian.warecki@intel.com> | ||
| */ | ||
|
|
||
| /** | ||
| * \brief Userspace support functions. | ||
| */ | ||
| #ifndef __RTOS_USERSPACE_HELPER_H__ | ||
| #define __RTOS_USERSPACE_HELPER_H__ | ||
|
|
||
| #include <stdint.h> | ||
| #include <stddef.h> | ||
|
|
||
| #include <rtos/alloc.h> | ||
|
|
||
| struct sys_heap; | ||
|
|
||
| #ifdef CONFIG_USERSPACE | ||
| /** | ||
| * Initialize private processing module heap. | ||
| * @param N/A. | ||
| * @return pointer to the sys_heap structure. | ||
| * | ||
| * @note | ||
| * Function used only when CONFIG_USERSPACE is set. | ||
| * The private heap is used only for non-privileged modules for all processing module allocations | ||
| * that should be isolated. The heap helps to accumulate all dynamic allocations in single memory | ||
| * region which is then added to modules memory domain. | ||
| */ | ||
| static inline struct sys_heap *module_driver_heap_init(void) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| #endif | ||
|
|
||
| /** | ||
| * Allocates memory block from private module sys_heap if exists, otherwise call rballoc_align(). | ||
| * @param sys_heap - pointer to the sys_heap structure | ||
| * @param flags - Flags, see SOF_MEM_FLAG_... | ||
| * @param bytes - Size in bytes. | ||
| * @param alignment - Alignment in bytes. | ||
| * @return Pointer to the allocated memory or NULL if failed. | ||
| * | ||
| * @note When CONFIG_USERSPACE not set function calls rballoc_align() | ||
| */ | ||
| static inline void *module_driver_heap_aligned_alloc(struct sys_heap *mod_drv_heap, uint32_t flags, | ||
| size_t bytes, uint32_t align) | ||
| { | ||
| return rballoc_align(flags, bytes, align); | ||
| } | ||
|
|
||
| /** | ||
| * Allocates memory block from private module sys_heap if exists, otherwise call rmalloc. | ||
| * @param sys_heap - pointer to the sys_heap structure | ||
| * @param flags - Flags, see SOF_MEM_FLAG_... | ||
| * @param bytes - Size in bytes. | ||
| * @return - Pointer to the allocated memory or NULL if failed. | ||
| * | ||
| * * @note When CONFIG_USERSPACE not set function calls rmalloc() | ||
| */ | ||
| static inline void *module_driver_heap_rmalloc(struct sys_heap *mod_drv_heap, uint32_t flags, | ||
| size_t bytes) | ||
| { | ||
| return rmalloc(flags, bytes); | ||
| } | ||
|
|
||
| /** | ||
| * Similar to user_rmalloc(), guarantees that returned block is zeroed. | ||
| * | ||
| * @note When CONFIG_USERSPACE not set function calls rzalloc() | ||
| */ | ||
| static inline void *module_driver_heap_rzalloc(struct sys_heap *mod_drv_heap, uint32_t flags, | ||
| size_t bytes) | ||
| { | ||
| return rzalloc(flags, bytes); | ||
| } | ||
|
|
||
| /** | ||
| * Frees the memory block from private module sys_heap if exists. Otherwise call rfree. | ||
| * @param ptr Pointer to the memory block. | ||
| * | ||
| * @note User should take care to not free memory allocated from sys_heap | ||
| * with module_driver_heap set to NULL. It will cause exception. | ||
| * | ||
| * When CONFIG_USERSPACE not set function calls rfree() | ||
| */ | ||
| static inline void module_driver_heap_free(struct sys_heap *mod_drv_heap, void *mem) | ||
| { | ||
| rfree(mem); | ||
| } | ||
|
|
||
| /** | ||
| * Free private processing module heap. | ||
| * @param sys_heap pointer to the sys_heap structure. | ||
| * | ||
| * @note | ||
| * Function used only when CONFIG_USERSPACE is set. | ||
| * Frees private module heap. | ||
| */ | ||
| static inline void module_driver_heap_remove(struct sys_heap *mod_drv_heap) | ||
| { } | ||
|
|
||
| #endif /* __RTOS_USERSPACE_HELPER_H__ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.