Skip to content

Conversation

@laurenmurphyx64
Copy link
Contributor

NOTE: THIS SHOULD NOT BE MERGED BEFORE #101226 IS FIXED!

Fixes build and runtime errors for Intel ADSP platforms with the LLEXT tests.

  • Adds RAM tags to Intel ADSP so tests run with Twister
  • Adds board overlays to use RELOCATABLE instead of SHAREDLIB as xt-clang cannot link shared libs for Xtensa
  • Exports symbols used by Intel ADSP (z_timeout_remaining, z_timeout_expires)
  • Adds Xtensa MPU / MMU Kconfigs to "no memory protection" config file
  • Adds a test-specific Kconfig option to put extensions in .text instead of .data*

*The linker puts .data like the LLEXT test extensions in the uncached memory of the Intel ADSP, which can't be executed. But why am I adding a test-specific Kconfig for only one platform? Well, the only alternative I could think of was adding Intel ADSP specific LLEXT heap (placing it in .rodata instead of .data) and INSTR_FETCHABLE definitions** so text would be copied into the heap. But per a comment in llext_link.c's llext_link_plt(), Xtensa llext's PLT linking is not valid when not performed inline in the ELF buffer. This is because it uses offsets from the text in the ELF buffer and assumes the text section's position relative to the other sections has not changed during loading. If one or more sections, such as .text, are loaded onto the heap, the relocation addresses calculated by the linker will not land in the correct memory region. Xtensa seems to not only require WRITABLE storage, but that extensions be properly aligned and placed in executable memory, so that no sections are copied into the heap.

**also only for one platform, and more invasively inserted into the LLEXT subsystem itself instead of just a test

Fixes #100767

...or it would, but there is a bug (?), #101226, where the board overlays this PR adds are ignored by Twister because the testcase.yaml uses extra_conf_files.

Adds board overlays for Intel ADSP platforms to use
CONFIG_LLEXT_TYPE_ELF_RELOCATABLE instead of SHAREDLIB
as xt-clang cannot link shared libs for Xtensa, exports
symbols used by Intel ADSP with Xtensa toolchain, and
adds XTENSA MPU / MMU to "no memory protection" config file.

Signed-off-by: Lauren Murphy <[email protected]>
Add a Kconfig option for the test to put extensions in .text.
This is useful for platforms for which the linker places .data
in memory unsuitable for instruction execution, such as
Intel ADSP's uncached memory.

The theoretical alternative to support Intel ADSP is to add a
platform-specific INSTR_FETCHABLE macro and platform-specific
heap definition (placing the heap into .rodata) into llext so
that the llext loader can copy text into an executable heap, but
per a comment at llext_link's llext_link_plt, Xtensa llext's PLT
linking is not valid when not performed inline in the ELF buffer.
This is because it uses offsets from the text in the ELF buffer
and assumes the text section's position relative to the other
sections has not changed during loading. If one or more sections,
particularly text, are loaded onto the heap, the relocation
addresses calculated by the linker will not land in the correct
memory region.

Signed-off-by: Lauren Murphy <[email protected]>
Adds RAM tags to select Intel ADSP platforms with the
primary goal of getting LLEXT subsys tests to run.

Signed-off-by: Lauren Murphy <[email protected]>
@sonarqubecloud
Copy link

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

Labels

area: Boards/SoCs area: Kernel area: llext Linkable Loadable Extensions area: Tests Issues related to a particular existing or missing test platform: Intel ADSP Intel Audio platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

llext: test failing for Intel ADSP (PLT idx not found, etc.)

3 participants