-
Notifications
You must be signed in to change notification settings - Fork 349
zephyr: userspace_helper: add test_mailbox.c (plus a test) #10477
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
base: main
Are you sure you want to change the base?
Conversation
Add helper function to make memory regions needed for sof/mailbox.h available to a user thread. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add a user-space test for sof/mailbox.h interface usage. The test covers current usage of mailbox by SOF audio pipeline code. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
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 adds support for accessing the SOF mailbox interface from Zephyr user-space threads by introducing a helper function and comprehensive test coverage.
Changes:
- Added
user_access_to_mailbox()helper function to grant user threads access to mailbox memory regions - Created test suite
test_mailbox.cto verify mailbox operations from both kernel and user contexts - Updated build configuration to include the new test when userspace is enabled
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| zephyr/test/userspace/test_mailbox.c | New test file implementing mailbox access tests from user-space threads |
| zephyr/test/userspace/README.md | Documentation update describing the new mailbox test |
| zephyr/test/CMakeLists.txt | Build configuration to compile test_mailbox.c when conditions are met |
| zephyr/lib/userspace_helper.c | Implementation of user_access_to_mailbox() for memory domain setup |
| zephyr/include/rtos/userspace_helper.h | Header declaration for the new helper function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| struct sof_ipc_stream_posn posn; | ||
| size_t offset = 0; /* first stream position slot */ | ||
|
|
||
| LOG_INF("Write to IPC4 stream#0 position info offset %u size %u.", |
Copilot
AI
Jan 9, 2026
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.
The log message incorrectly states 'IPC4' when this code path is for non-IPC4 configurations (inside #else block for CONFIG_IPC_MAJOR_4). Should reference the appropriate IPC version or use generic terminology.
| LOG_INF("Write to IPC4 stream#0 position info offset %u size %u.", | |
| LOG_INF("Write to stream#0 position info offset %u size %zu.", |
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.
LGTM.
| void module_driver_heap_remove(struct k_heap *mod_drv_heap) | ||
| { } | ||
|
|
||
| int user_access_to_mailbox(struct k_mem_domain *domain, k_tid_t thread_id) |
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.
nitpick: we can make this static inline in the header and it would save a little TEXT.
Add helper function to make memory regions needed for sof/mailbox.h
available to a user thread.