Skip to content

Conversation

@jsarha
Copy link

@jsarha jsarha commented Sep 17, 2025

This is my first step towards implementing pipeline specific heaps. There is brand new create message payload definition and implementation. However, the target has already moved so that this payload is not enough anymore.

There is also a problem that it looks like the FW receives some pipeline create messages with payload bit set, but the payload is not there. Firmware receives two messages where linux driver only logs about sending only one. This probably has something to do with forwarding the messages form core 0 to core 2. I have no idea how this can happen, but as I should move to work on kernel heap, I leave the debugging for now.

The FW side code is here: thesofproject/sof#10265

@jsarha
Copy link
Author

jsarha commented Sep 17, 2025

FYI @ranj063 @lyakh @lgirdwood

@jsarha jsarha force-pushed the new_memory_domain_logic branch from 1541ecf to c39e6b2 Compare September 18, 2025 15:38
Jyri Sarha added 2 commits November 10, 2025 23:33
Remove dp-prefix from all module instance's memory attributes and
related data structures. The attributes are not anymore exclusively
for Data Processing module instances, but generic for all module
instances. However, the module init payload is still only for DP
module instances.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
The was inconsistency with SOF_TKN_COMP_STACK_BYTES_REQUIREMENT and
SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT token ids in the Linux driver code
with SOF FW topology code. This commit fixes the Linux side to match
tools/topology/topology2/include/common/tokens.conf

See: https://github.com/thesofproject/sof/blob/788861804ed08485496e979dd9c467c1a21b30c5/tools/topology/topology2/include/common/tokens.conf#L30

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the new_memory_domain_logic branch from cc4773a to c503c3d Compare November 10, 2025 22:35
{SOF_TKN_COMP_STACK_BYTES_REQUIREMENT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct snd_sof_widget, stack_bytes)},
{SOF_TKN_COMP_STATIC_BYTES_REQUIREMENT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct snd_sof_widget, static_bytes)},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to the commit message: is it heap size for initialisation only or for the entire life-time of a single instance (estimated, possibly dependent on configuration or use-case)

@jsarha jsarha force-pushed the new_memory_domain_logic branch from c503c3d to ead2c46 Compare December 3, 2025 19:17
@jsarha
Copy link
Author

jsarha commented Dec 3, 2025

Updated to match and work with thesofproject/sof#10281 . I will address the review comments at later time.

@jsarha jsarha marked this pull request as ready for review December 4, 2025 13:44
@jsarha
Copy link
Author

jsarha commented Dec 4, 2025

I'll mark this ready for review, but before merging it should be checked that thesofproject/sof#10265 is also going to go in without changes to IPC payload.

#define SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT 420
#define SOF_TKN_COMP_STACK_BYTES_REQUIREMENT 421
#define SOF_TKN_COMP_STACK_BYTES_REQUIREMENT 420
#define SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT 421
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this INTERIM_HEAP

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I can. These tokens were already part of 2.14, but then again they were not really used for anything then.

#define SOF_TKN_COMP_DOMAIN_ID 419
#define SOF_TKN_COMP_STACK_BYTES_REQUIREMENT 420
#define SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT 421
#define SOF_TKN_COMP_LIFETIME_BYTES_REQUIREMENT 422
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and SOF_TKN_COMP_LIFETIME_HEAP_BYTES_REQUIREMENT

Jyri Sarha added 4 commits December 11, 2025 11:59
Add token SOF_TKN_COMP_LIFETIME_HEAP_BYTES_REQUIREMENT for the amount
of allocated memory a module instance needs for the whole of its life
time from init to free, and SOF_TKN_COMP_SHARED_BYTES_REQUIREMENT for
the amount of shared memory it needs to allocate.

Also renames the SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT to
SOF_TKN_COMP_INTERIM_HEAP_BYTES_REQUIREMENT to follow FW
implementation terms.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add to lifetime_bytes and shared_bytes snd_sof_widget. They are with
SOF_TKN_COMP_LIFETIME_HEAP_BYTES_REQUIREMENT topology tokens and
SOF_TKN_COMP_SHARED_BYTES_REQUIREMENT topology token's values.

Also renames heap_bytes to interim_bytes to follow the term used in FW
side implementation.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Adds SOF_IPC4_GLB_PIPE_EXT_OBJ_ARRAY macros to set extension bit in
SOF_IPC4_GLB_CREATE_PIPELINE indicating presence of the payload, and
all necessary macros and structs to create the payload.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Start adding payloads to pipeline create messages. The payload
contains information for payload specific memory configuration.

All non DP module instances within the same pipeline share the same
memory attributes and access the same resources. The new logic sums
interim, lifetime, and shared heap memory requirements together and
picks the highest stack requirement of all module instances belonging
to a pipeline. These pipeline specific attributes are sent as struct
sof_ipc4_glb_pipe_payload payload in pipeline's create message.

The idea is to pass common memory configuration for all the Low
Latency modules in the pipeline in pipeline create message payload.

The Data Processing module instances will still have an individual
memory configuration in struct sof_ipc4_mod_init_ext_dp_memory_data
payloads as before. In their payload everything is as it was before,
all attributes are copied directly from their topology attributes.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the new_memory_domain_logic branch from ead2c46 to 91c9b6e Compare December 11, 2025 18:07
@jsarha
Copy link
Author

jsarha commented Dec 11, 2025

The review comments are now addressed, but there is one loose end. The module init payload still uses the old DP memory data in the payload. Its easy change that too, but I need to work on the FW side for it to understand it and to be able to test the code.

…ry_data

Change struct sof_ipc4_mod_init_ext_dp_memory_data to what is required
for the SOF FW userspace DP processing. The earlier version of the
firmware (v2.14) did not use the contents of the struct for anything,
and if it receives a struct that is larger than the original, the
extra words are simply ignored, so there should not be any problem in
changing the struct. The following FW versions will expect larger
struct and ignore anything that is smaller.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha
Copy link
Author

jsarha commented Dec 14, 2025

Change module init IPC payload as requested by @lgirdwood .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants