Skip to content
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

ASoC: SOF: ipc4: Add support for split firmware releases #5270

Open
wants to merge 1 commit into
base: topic/sof-dev
Choose a base branch
from

Conversation

ujfalusi
Copy link
Collaborator

@ujfalusi ujfalusi commented Dec 13, 2024

A split SOF release consists of a base firmware and two libraries:
<fw_filename>-openmodules.ri for processing (audio) modules
<fw_filename>-debug.ri for debug and developer modules

To handle this new release model add infrastructure to try to load the two
library after boot optionally.

This approach will allow flexibility on handling platforms in sof-bin with
single or split configuration:
single release: base firmware only
split release: base firmware + openmodules + debug

The files for the split firmware are located at the firmware directory.

The documentation update is: thesofproject/sof-docs#505


kfree(lib_filename);
if (ret)
break;
Copy link

Choose a reason for hiding this comment

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

why break? If any of the libraries fail loading you don't attempt the rest? In this case it kind of makes sense - if there's no "main" module bundle, there's probably no "debug" either, but isn't the general concept - here's a list of optional libraries, we try to load whatever is available?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The sof_ipc4_load_library() will only return error if there were real error for the loading, the bundle not present is not an error, but if the bundle loading fails then that is an error, something is not right and we will abort the probing altogethe.

Copy link
Member

Choose a reason for hiding this comment

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

We should continue if a bundle fails, this way we still get base FW (and it may have some built-in modules) and a registered sound card. Yes we tell the user that we could not load the library and audio may not fully work as expected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We will fail to probe the card as the modules form the failed library are missing and the topology will not probe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, if we continue then the car will not come up, but the debugfs for SOF is going the be there to provide further clues.

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4-modular-sof-01 branch from 36acd21 to 1664690 Compare December 16, 2024 16:41
@ujfalusi
Copy link
Collaborator Author

Changes since v1:

  • follow the sof-docs update [1] and look for the base libraries in the same directory as the firmware

[1] thesofproject/sof-docs#506

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4-modular-sof-01 branch from 1664690 to d09062a Compare December 17, 2024 10:16
@ujfalusi
Copy link
Collaborator Author

Changes since v2:

  • Documentation as inline comment for the sof_ipc4_load_library_bundles() function
  • fix a memory leak (after kasprintf) and added missing NULL check after kzalloc

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4-modular-sof-01 branch from d09062a to 2096214 Compare December 17, 2024 14:02
@ujfalusi
Copy link
Collaborator Author

Changes since v3:

  • Print warning on library loading error. The topology loading will likely fail and no card will be present, but the SOF debugfs is going to be available.

ret = firmware_request_nowarn(&fw_lib->sof_fw.fw, lib_filename,
sdev->dev);
if (ret < 0) {
dev_dbg(sdev->dev, "Library file '%s' is not present\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ujfalusi with the current releases where the openmodule/debug binaries are absent, will we always see this debug message? I think this will too much of a distraction. How about we check the presence of these files before requesting to load the libraries?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or not print here at all if does not exist...

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4-modular-sof-01 branch from 2096214 to 8760089 Compare December 18, 2024 08:04
@ujfalusi
Copy link
Collaborator Author

Changes since v4:

  • Drop the debug print if the optional library is not found in filesystem
  • Change terms to single and split firmware release (two types of the modular firmware).

@ujfalusi ujfalusi changed the title ASoC: SOF: ipc4: Add support for modular firmware releases ASoC: SOF: ipc4: Add support for split firmware releases Dec 18, 2024
* sof_ipc4_load_library_bundles - loads the library parts of a modular firmware
* @sdev: SOF device
*
* With IPC4 the firmware can be monolithic or modular release.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ujfalusi you want to remove the monolithic reference in this PR too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, I wanted to... ;)

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4-modular-sof-01 branch from 8760089 to 8bc8b0c Compare December 19, 2024 09:42
A split SOF release consists of a base firmware and two libraries:
<fw_filename>-openmodules.ri for processing (audio) modules
<fw_filename>-debug.ri for debug and developer modules

To handle this new release model add infrastructure to try to load the two
library after boot optionally.

This approach will allow flexibility on handling platforms in sof-bin with
single or split configuration:
single release: base firmware only
split release: base firmware + openmodules + debug

The files for the split firmware are located at the firmware directory.

Signed-off-by: Peter Ujfalusi <[email protected]>
@ujfalusi
Copy link
Collaborator Author

Changes since v5:

  • replace references to modular to split firmware
  • change sof_ipc4_load_library_bundles() to sof_ipc4_complete_split_release() to better align with the functionality

@bardliao
Copy link
Collaborator

SOFCI TEST

1 similar comment
@bardliao
Copy link
Collaborator

SOFCI TEST

Copy link

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

@ujfalusi ujfalusi requested a review from ranj063 January 9, 2025 09:55
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