ipc: eliminate multiple memcpy() calls - #11059
Open
lyakh wants to merge 1 commit into
Open
Conversation
lyakh
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1 and
plbossart
as code owners
August 5, 2026 08:05
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces IPC4 message handling overhead by removing local stack copies and memcpy_s() calls for several IPC4 request headers, instead interpreting the inbound message via pointer casting and tightening some APIs with const correctness.
Changes:
- Replaces multiple
memcpy_s()-to-stack patterns with direct pointer casts for IPC4 request header access in the user IPC4 handler. - Updates
comp_new_ipc4(),ipc4_chain_manager_create(), andipc4_chain_dma_state()to takeconstIPC4 request structures. - Propagates the updated function signatures through relevant public headers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/ipc/ipc4/helper.c | Makes IPC4 helper entry points accept const request structures (no behavioral change intended). |
| src/ipc/ipc4/handler-user.c | Removes stack copies / memcpy_s() and switches to direct request-structure pointer access. |
| src/include/sof/ipc/topology.h | Updates IPC4 chain DMA helper prototypes to match new const signatures. |
| src/include/sof/audio/component_ext.h | Updates comp_new_ipc4() prototype to accept a const init-instance request. |
Suppressed comments (1)
src/ipc/ipc4/handler-user.c:1436
- In CONFIG_LIBRARY builds,
configis a pointer here too, sosizeof(config)is the pointer size, not the size ofstruct ipc4_module_large_config. The payload pointer will be off by 4/8 bytes.
#if CONFIG_LIBRARY
struct ipc *ipc = ipc_get();
const char *data = (const char *)ipc->comp_data + sizeof(config);
#else
const char *data = (const char *)MAILBOX_HOSTBOX_BASE;
Eliminate multiple instances of IPC4 data copying, use simple type- casts instead. This removes stack objects and replaces run-time copying with compile-time pointer substitution. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
tmleman
approved these changes
Aug 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Eliminate multiple instances of IPC4 data copying, use simple type- casts instead. This removes stack objects and replaces run-time copying with compile-time pointer substitution.