Skip to content

lib_manager: modules: Set of improvements for loadable module - #10098

Merged
kv2019i merged 6 commits into
thesofproject:mainfrom
softwarecki:lib-uni
Jul 28, 2025
Merged

lib_manager: modules: Set of improvements for loadable module #10098
kv2019i merged 6 commits into
thesofproject:mainfrom
softwarecki:lib-uni

Conversation

@softwarecki

Copy link
Copy Markdown
Collaborator
  • Move module allocation and system agent call from modules_init to lib_manager_module_create to unify the module loading process.

  • Add a bitmask to the LIB_MANAGER_GET_LIB_ID macro to discard the instance identifier placed on the high order bits of the component id.

  • Create a function module_adapter_new_ext that allows to assign a pointer to the private data of the module for which the adapter is being created.

  • Add missing include headers for list and component in lib_manager.

  • Change type of the entry_point parameter in the native_system_agent_start and system_agent_start functions to uintptr_t which allows safe pointer passing.

  • Change signature of the native_system_agent_start function to match with the system_agent_start function. The function returns an error code and a pointer to the module interface is returned via the parameter.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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 refactors how loadable modules are initialized and started in the library manager, adds tighter ID masking, and extends adapter creation to accept private data pointers.

  • Unified module allocation and system agent invocation into lib_manager_module_create
  • Introduced module_adapter_new_ext to pass module-specific private data
  • Changed entry-point parameters to uintptr_t and updated system agent function signatures

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
src/library_manager/lib_manager.cMoved allocation and agent calls into lib_manager_module_create, updated free logic and signatures
src/include/sof/lib_manager.hAdded missing headers and refined LIB_MANAGER_GET_LIB_ID
src/include/sof/audio/module_adapter/module/generic.hDeclared module_adapter_new_ext
src/include/sof/audio/module_adapter/library/native_system_agent.hUpdated native_system_agent_start signature
src/include/sof/audio/module_adapter/iadk/system_agent.hUpdated system_agent_start signature
src/audio/module_adapter/module_adapter.cAdded module_adapter_new_ext implementation
src/audio/module_adapter/module/modules.cRemoved old modules_init allocation logic
src/audio/module_adapter/library/native_system_agent.cUpdated return handling and interface extraction
src/audio/module_adapter/iadk/system_agent.cppChanged entry-point type to uintptr_t
Comments suppressed due to low confidence (2)

src/library_manager/lib_manager.c:333

  • Add a @return description to this doc block explaining the returned base address or error conditions when allocation fails.
 * param[in] ipc_specific_config - ipc4 base configuration

src/include/sof/audio/module_adapter/module/generic.h:212

  • The header lacks a comment for module_adapter_new_ext; please document the mod_priv parameter and its effect on the module adapter.
struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,

Comment threadsrc/library_manager/lib_manager.c Outdated
Comment threadsrc/include/sof/lib_manager.h
Comment threadsrc/library_manager/lib_manager.c Outdated
Comment threadsrc/library_manager/lib_manager.c Outdated
@softwarecki

Copy link
Copy Markdown
CollaboratorAuthor

SOFCI TEST

@wszypelt

Copy link
Copy Markdown

SOFCI TEST

@lgirdwoodlgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one open for me to differentiate the new call from the existing call in the doxygen.

Comment threadsrc/audio/module_adapter/library/native_system_agent.c Outdated
Comment threadsrc/include/sof/audio/module_adapter/library/native_system_agent.h Outdated
Comment threadsrc/audio/module_adapter/module_adapter.c
Comment threadsrc/library_manager/lib_manager.c Outdated
Comment threadsrc/library_manager/lib_manager.c Outdated
@softwarecki
softwareckiforce-pushed the lib-uni branch 2 times, most recently from a512d17 to 03306c5CompareJuly 16, 2025 09:40
@lyakh

Copy link
Copy Markdown
Collaborator

Two CI failures on PTL https://sof-ci.01.org/sofpr/PR10098/build14005/devicetest/index.html - I don't understand how this can be related, but of those two the former I don't remember seeing recently.

@lgirdwood

Copy link
Copy Markdown
Member

Two CI failures on PTL https://sof-ci.01.org/sofpr/PR10098/build14005/devicetest/index.html - I don't understand how this can be related, but of those two the former I don't remember seeing recently.

Will run again, to rule out - cant see how related to this PR.

@lgirdwood

Copy link
Copy Markdown
Member

SOFCI TEST

@lyakhlyakh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should never cast-away const. ("never" is a strong word, in reality I mean "except possibly in very-very few exception cases"). It would be good to have a static code analysis tool to have capture such attempts...

Comment threadsrc/audio/module_adapter/library/native_system_agent.c Outdated
Comment threadsrc/library_manager/lib_manager.c Outdated
Comment threadsrc/library_manager/lib_manager.c Outdated
Change the signature of the native_system_agent_start function to match
with the system_agent_start function. The function returns an error code
and a pointer to the module interface is returned via the parameter.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Change type of the entry_point parameter in the native_system_agent_start
and system_agent_start functions to uintptr_t which allows safe pointer
passing.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Add missing include headers for list and component.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Create a function module_adapter_new_ext that allows to assign a pointer to
the private data of the module for which the adapter is being created.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Add a bitmask to the LIB_MANAGER_GET_LIB_ID macro to discard the instance
identifier placed on the high order bits of the component id.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
…unctions
Move module allocation and system agent call from modules_init to
lib_manager_module_create to unify the module loading process.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
@kv2019i
kv2019i merged commit 037f4d4 into thesofproject:mainJul 28, 2025
37 of 45 checks passed
Sign up for freeto 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.

8 participants

@softwarecki@wszypelt@lyakh@lgirdwood@tmleman@serhiy-katsyuba-intel@kv2019i