-
Notifications
You must be signed in to change notification settings - Fork 369
LL userspace ipc_msg_send() and send_resource_notif() syscalls and related changes #10725
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
3 commits
Select commit
Hold shift + click to select a range
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
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
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
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 |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ | |
| struct dai_config; | ||
| struct dma; | ||
| struct dma_sg_elem_array; | ||
| struct k_heap; | ||
|
|
||
| struct ipc_msg { | ||
| uint32_t header; /* specific to platform */ | ||
|
|
@@ -40,48 +41,45 @@ struct ipc_msg { | |
| }; | ||
|
|
||
| /** | ||
| * \brief Initialize a new IPC message. | ||
| * \brief Initialize a new IPC message using a specific heap. | ||
| * @param heap Heap to allocate from (NULL = default kernel heap) | ||
| * @param header Message header metadata | ||
| * @param extension Message header extension metadata | ||
| * @param size Message data size in bytes. | ||
| * @return New IPC message. | ||
| */ | ||
| static inline struct ipc_msg *ipc_msg_w_ext_init(uint32_t header, uint32_t extension, | ||
| uint32_t size) | ||
| { | ||
| struct ipc_msg *msg; | ||
|
|
||
| msg = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT, sizeof(*msg)); | ||
| if (!msg) | ||
| return NULL; | ||
|
|
||
| if (size) { | ||
| msg->tx_data = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT, size); | ||
| if (!msg->tx_data) { | ||
| rfree(msg); | ||
| return NULL; | ||
| } | ||
| } | ||
|
|
||
| msg->header = header; | ||
| msg->extension = extension; | ||
| msg->tx_size = size; | ||
| list_init(&msg->list); | ||
|
|
||
| return msg; | ||
| } | ||
| struct ipc_msg *ipc_msg_w_ext_init(struct k_heap *heap, uint32_t header, | ||
| uint32_t extension, uint32_t size); | ||
|
|
||
|
jsarha marked this conversation as resolved.
|
||
| /** | ||
| * \brief Initialise a new IPC message. | ||
| * \brief Initialize a new IPC message using a specific heap. | ||
| * @param heap Heap to allocate from (NULL = default kernel heap) | ||
| * @param header Message header metadata | ||
| * @param size Message data size in bytes. | ||
| * @return New IPC message. | ||
| */ | ||
| static inline struct ipc_msg *ipc_msg_init(uint32_t header, uint32_t size) | ||
| static inline struct ipc_msg *ipc_msg_init(struct k_heap *heap, | ||
| uint32_t header, uint32_t size) | ||
| { | ||
| return ipc_msg_w_ext_init(header, 0, size); | ||
| return ipc_msg_w_ext_init(heap, header, 0, size); | ||
| } | ||
|
|
||
| /** | ||
| * \brief Remove an IPC message from the send queue. | ||
| * | ||
| * Acquires the IPC lock and removes the message from its list. | ||
| * Safe to call from userspace. | ||
| * | ||
| * @param msg The IPC message to remove from the queue. | ||
| */ | ||
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) | ||
| __syscall void ipc_msg_list_remove(struct ipc_msg *msg); | ||
| #include <zephyr/syscalls/msg.h> | ||
| #else | ||
| void z_impl_ipc_msg_list_remove(struct ipc_msg *msg); | ||
| #define ipc_msg_list_remove z_impl_ipc_msg_list_remove | ||
| #endif | ||
|
|
||
| /** | ||
| * \brief Frees IPC message header and data. | ||
| * @param msg The IPC message to be freed. | ||
|
|
@@ -91,16 +89,9 @@ static inline void ipc_msg_free(struct ipc_msg *msg) | |
| if (!msg) | ||
| return; | ||
|
|
||
| struct ipc *ipc = ipc_get(); | ||
| k_spinlock_key_t key; | ||
|
|
||
| key = k_spin_lock(&ipc->lock); | ||
|
|
||
| list_item_del(&msg->list); | ||
| ipc_msg_list_remove(msg); | ||
| rfree(msg->tx_data); | ||
| rfree(msg); | ||
|
|
||
| k_spin_unlock(&ipc->lock, key); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -110,11 +101,19 @@ void ipc_send_queued_msg(void); | |
|
|
||
| /** | ||
| * \brief Queues an IPC message for transmission. | ||
| * @param msg The IPC message to be freed. | ||
| * @param msg The IPC message. | ||
| * @param data The message data. | ||
| * @param high_priority True if a high priortity message. | ||
| * @param high_priority True if a high priority message. | ||
| */ | ||
| void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority); | ||
| #if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) | ||
| __syscall void ipc_msg_send(struct ipc_msg *msg, void *data, | ||
| bool high_priority); | ||
| #include <zephyr/syscalls/msg.h> | ||
| #else | ||
| void z_impl_ipc_msg_send(struct ipc_msg *msg, void *data, | ||
| bool high_priority); | ||
| #define ipc_msg_send z_impl_ipc_msg_send | ||
| #endif | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should probably move the syscall declaration in this same place where the function declaration was. |
||
| /** | ||
| * \brief Send an IPC message directly for emergency. | ||
|
|
||
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.