Skip to content

[FEATURE] Move rimage toml config files to SOF repository #7270

Closed

Description

@kv2019i

Is your feature request related to a problem? Please describe.
The toml files in sof/rimage/config/*.toml have recently started covered properties of SOF modules that are no longer static properties of a platform, but rather are describiting attributes that can change when code is changed in SOF main.

This highly problematic if a code to optimize a module's performance is merged to SOF main, a matching update is needed to rimage toml files (for all affected platforms), plus a separate sof/west.yml update to bring that in to SOF builds (with Zephyr where west is used).

Describe the solution you'd like
Rimage repository should only host the tool, not the actual platform-specific content.

Describe alternatives you've considered
Moving only IPC4 specific data is one option, but due to design of rimage, this seems rather complex and in the end the easier solution would be to move all of toml config files.

Additional context

Activity

  1. added
    enhancementNew feature or request
    IPC4Issues observed with IPC4 (same IPC as Windows)
    on Mar 14, 2023
  2. added this to the v2.6 milestone on Mar 14, 2023
  3. lgirdwood commented on Mar 14, 2023

    @lgirdwood
    Member

    @mwasko @marcinszkudlinski fyi - obvious effort reduction here to keep toml manifest configs alongside FW code.

  4. marc-hb commented on Mar 14, 2023

    @marc-hb
    Collaborator

    The toml files in sof/rimage/config/*.toml have recently started covered properties of SOF modules that are no longer static properties of a platform, but rather are describiting attributes that can change when code is changed in SOF main.

    Wait: the static properties still exist AFAIK. So shouldn't rimage be able to read from more than one .toml file / from both places? Would simply concatenating the files in the order given be enough? This would mean moving fewer files / less content and not breaking backwards compatibility, probably easier git bisect etc.

    PS: I think zephyrproject-rtos/zephyr#54700 should go first. Working on it. EDIT: done.

    EDIT: this seems highly relevant:

  5. kv2019i commented on Mar 14, 2023

    @kv2019i
    CollaboratorAuthor

    @marc-hb wrote:

    Wait: the static properties still exist AFAIK. So shouldn't rimage be able to read from more than one .toml file / from both places? Would simply concatenating the files in the order given be enough? This would mean moving fewer files / less content

    But why should rimage (the tool) repo host even the static details? I agree we could split, but I'm not sure if there is any benefit to hosting in multiple repos. These are essentially the platforms we maintain in SOF repository. I.e. shouldn't rimage repo be more like a repo for gcc/clang in that it provides a tool that takes X in and spews Y out, but the input data X is hosted in other repos.

  6. marc-hb commented on Mar 14, 2023

    @marc-hb
    Collaborator

    After taking a look at thesofproject/sof-docs#451 I wonder why we're even building the extended manifest using C code in 2023?

    https://github.com/thesofproject/rimage/issues?q=crash

    AFAIK the extended manifest is merely concatenated to the "main" .ri rimage file, so they seem fairly independent from each other. So why stick to obsolete and crashing rimage "technology" for the extended manifest?

    EDIT: C re-implementation of elfutils submitted in

  7. pjdobrowolski commented on Mar 15, 2023

    @pjdobrowolski
    Contributor

    I was just about closing my issue with crashing. Last changes in rimage improved significantly stability of that tool. @marc-hb I know that @aborisovich is huge advocate changing language of that tool but currently @softwarecki invest huge amount of work to make that tool a bit more bugfree. Soooo If you want to discuss future of that tool Andrey is right person ;)

  8. aborisovich commented on Mar 15, 2023

    @aborisovich
    Contributor

    @pjdobrowolski not exactly, I'm not a person responsible for such strategical decisions.
    I had started recently a substitute project in C++, but @mmaka1 convinced me that developing such tool in this languages is not the right way to proceed. We also should consider possible development in Python.

    After @softwarecki fixes the tool stopped crashing on Windows and looks much more stable.

  9. lgirdwood commented on Mar 17, 2023

    @lgirdwood
    Member

    After taking a look at thesofproject/sof-docs#451 I wonder why we're even building the extended manifest using C code in 2023?

    @marc-hb lets keep on topic. Verification of hashing/signing is faster in C and hence that's why rimage is in C today.

  10. softwarecki commented on Mar 17, 2023

    @softwarecki
    Collaborator

    @lgirdwood I think @marc-hb was referring to the extended manifest created from toml files. It isn't signed, unlike the module manifest. So it can be generated by another tool and inserted at the beginning of the file.

    For the toml files, I see the following problems with them:

    • No support for file inclusion. We have a separate toml file for each platform. If a module is used by multiple platforms, we have an identical description of the module's capabilities/configuration duplicated in multiple files. A solution could be to separate module descriptions into separate files and include them in platform files.
    • Lack of support for labels. At this moment, some fields of the module's configuration is represented as hexadecimal bit masks that are completely unreadable by humans. Textual value labels should be introduced to make the configuration more readable.
    • Enabling/disabling building of a given module requires correcting toml files.

    My idea to solve these problems is to move the information from the toml files to the source code of the modules. While leaving in them only some basic description of the platform and its address space.
    We can prepare a structure with the information necessary to generate the extended manifest and put it in a separate section of the elf file. It would be read by rimage (or any other tool in the future). In this way, we already provide some informations now. This is the module manifest (struct sof_man_module_manifest) in the ".module" section and the extended manifest (duplicated name, this is different information than in toml files), (struct ext_man_header) section ".fw_metadata". Module manifest for all modules we can easily move to source code, because its reading is already implemented in rimage. The ext_man_header structure was designed to be extensible, so it could be used to pass the module's pin configuration, etc. to rimage. The advantage of this approach is that rimage (or separate tool) would build all manifests using only a compilation artifacts. Adding/removing a module would not involve updating multiple toml files for different platforms.
    When creating a loadable library, we eliminate the risk of taking a toml file that does not match the compiled module. The module metadata would be included in the module file.

  11. marc-hb commented on Mar 17, 2023

    @marc-hb
    Collaborator

    @lgirdwood I think @marc-hb was referring to the extended manifest created from toml files.

    I was a bit vague but yes: the firmware manifest and the extended manifest are two very different problems and they seem to have a very simple and very clear line between them. The former has a limited scope and it is already implemented fully AFAIK whereas the extended manifest seems to be just getting started and currently "exploding" = why this PR was filed.

    I haven't seen signing performance being an issue which means existing libraries in any other, high level and popular language could be re-used to avoid parsing, pushing bits and managing memory "by hand".

    https://alexgaynor.net/2019/aug/12/introduction-to-memory-unsafety-for-vps-of-engineering/

    My idea to solve these problems is to move the information from the toml files to the source code of the modules...

    These longer term ideas should probably be discussed in a new issue to keep this shorter-term PR "on topic". There is a convenient ... -> reference in new issue button in the top-right corner of every comment.

  12. 21 remaining items

  13. marc-hb commented on Sep 7, 2023

    @marc-hb
    Collaborator

    Or much simpler; single repo for rimage and SOF:

  14. kv2019i commented on Sep 25, 2023

    @kv2019i
    CollaboratorAuthor

    Since my comment on August, discussion has spread out even more, so marking this as "unclear" for the moment.

  15. kv2019i commented on Oct 11, 2023

    @kv2019i
    CollaboratorAuthor

    Implemented with #8297 , thanks @marc-hb !

  16. marc-hb commented on Dec 8, 2023

    @marc-hb
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

IPC4Issues observed with IPC4 (same IPC as Windows)enhancementNew feature or requestunclearUnclear enhancement request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions