-
Notifications
You must be signed in to change notification settings - Fork 321
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
[FEATURE] Make SOF with Zephyr run on i.MX93's A55 core with Jailhouse #7192
Comments
@LaurentiuM1234 what is jailhouse ? any links ? |
@lgirdwood Sure, for a more detailed overview please see 1 and 2. For a more general overview please see 3. Also, please see 4 for github repo. TL; DR: Jailhouse is a hypervisor used to partition the system's resources. In our case, we'll be using Jailhouse to split the A55 cores between Linux and Zephyr, meaning they will run independently on different cores. |
@LaurentiuM1234 thanks, had a read through of the jailhouse docs. Looks like a great feature. Re questions above.
|
@LaurentiuM1234 Ack, no need to use smex/rimage. Zephyr dictionary support can be used and we have tested it to work. Only reason why we still don't have dictionary enabled by default for Intel targets is that we have many platforms stuck to old compiler versions and Zephyr dictionary require a somewhat modern compiler. We just switched one Intel platform to clang toolchain and that will allow us to us dictionaries. With that, no need for smex anymore. |
Regarding linker behavior: that gets pretty hairy internal to zephyr, but for the most part apps don't need to care. SOF has a few special sections (e.g. rimage manifest data) that you'll need to implement in the Zephyr SOC layer (probably just clone from the intel_adsp linker scripts, though it's possible your requirements are mild if you aren't using rimage itself). Definitely ping me if you have trouble. |
It should soon be part of |
For smex, you could easily add some new EDIT: C re-implementation of elfutils submitted in |
You don't need to disable If you need neither rimage nor smex you probably don't want to use Everything is possible :-) |
Thank you very much for all the useful comments!
Hm, for now I've used
and maybe An alternative to this would be to have something like PROGRESS UPDATE On Zephyr and SOF sides of things everything seems to be working fine, managed to get some logs on the console. Currently, I'm working on the Linux side of things. Hopefully, will soon have something decent enough to submit a draft PR. |
Cloning is just two Don't get me wrong: Just for fun, look at one-line commit 9a23191 and see how many layers Current
I think Less is more! Also like this one: "A little copying (= your own, tiny and simple west script) is better than a little dependency (using only 10% of the much bigger xtensa-build-zephyr.py script)" |
STATUS UPDATE ARCHITECTURE OVERVIEW Note: all the hardware resources in the picture are either managed by the root or the inmate (also applies to the cores). For more information regarding Jailhouse and how it operates please see 1, 2, 3. Github repo can be found at 4. HOW DOES IT WORK? Step 1 Note: when the hypervisor is enabled, the root cell is also created. At this point all the hardware is still managed by Linux. Step 2 Note: technically speaking, Linux doesn't actually lose control over the EDMA2, SAI3 and MUA since their nodes are disabled in the DTS but since the hypervisor will restrict its access to their registers we'll consider that Linux loses control over them. Step 3 ISSUES
STATUS TODO
@lgirdwood What do you think about adding the Jailhouse configurations for inmate/root in the SOF repository? They are kinda SOF specific so I doubt they'll be accepted in the main Jailhouse repository. Also, they might help people interested in running SOF on an arm core alongside Linux. EDIT:
|
@mmaka1 @kv2019i @plbossart fyi - good technical description here. |
Latest dictionary news from @kv2019i:
This is now done and the corresponding Zephyr documentation updates have just been merged:
This makes it much easier to skip I'm curious whether you're still using
I just saw that the A55 has a ILP32 mode, I'm curious why you didn't try that first?4GB looks like a lot of RAM for an audio DSP :-) Lack of hybrid 32/64 support in Jailhouse? Or because of the way you implemented IPC? I'm aware 64 bits support is now old news in Zephyr but I doubt anyone else has been running SOF in LP64 mode yet... thanks for charting this new territory for the rest of us! :-)
Actually, that was probably a bad idea because I guess some users may want SMEX and other users not for the same |
Currently, I'm using a modified version of
Frankly, I wasn't aware of the existence of this ABI. Thanks for pointing it out ! Might be worth investigating it a bit for the sake of curiosity at least. |
Thanks for letting us know.
Understood; the perfect is the enemy of the good.
So you're indirectly confirming that the SOF code base is mostly 64bits-clean besides the few warnings you mentioned above? That sounds really good! Can you share a very rough description of the kind of tests that are passing? So there is some recipe that compiles in LP64 mode with the Zephyr SDK? If it does not require too many changes then we should definitely fix these warnings and add a Github Action for it to make sure the codebase stays 64bits clean. |
Hm, I guess so. It seems to work fine apart from the build warnings.
Nothing too fancy. In fact, there's no formal testing atm as the support is still not fully upstream (the linux patches are still in review). So far, all I've done is build it and test some aplay/arecords + pause/resume during aplay.
Yup, seems like the case. Took a look at
I was planning to eventually have a look at the warnings and find a way to fix them. Also, I'm all up for adding a github action. It shouldn't require too much effort (hopefully!). |
I tried these but quickly realized there's a LOT missing in SOF for them:
What Zephyr |
This shouldn't work as i.MX8MM with ARM64 is not supported in SOF.
The name of the board to use is Btw, were these command issued from Zephyr? If so, the reason the build fails is because the sof module is not updated, hence it doesn't contain the i.MX93 support. If the command was issued from SOF side, then please make sure to update If any of the above doesn't work would it be possible to share the build errors? |
I wonder how do we conditionally pull in a HAL for a specific platform family? (e.g IMX) Currently, this works in SOF source tree root:
But there must be another way - to avoid unnecessary pulling |
A ton of (valid!) warnings but this will make sure the code at least compiles. For more context see thesofproject#7192 Signed-off-by: Marc Herbert <[email protected]>
Done:
I assumed you meant: "when using the sof/west.yml manifest".
Thanks, that recipe finally worked out of the box! I tried a number of other configurations (from both manifest "sides") but none had worked so far.
Looks like warnings sometimes point at real, hard problems! At least one in this LP64 case: the old sof-logger is still hardcoded to four 32bits parameters. I don't see how to solve this.
It's very complicated actually and has been changing in west very recently:
In #7772 I kept it simple and I just added Once the |
There's really no reason to fall back on a default "platform" and pick up a bunch of other, totally random settings. Now the following command fails immediately with a useful `platform not defined` error message instead of stopping with a cryptic `platform/trace/trace.h: No such file or directory` after successfully compiling half the .c files in a Frankenstein CONFIG_uration. ``` west build -p --board mimx8mm_evk_a53 modules/audio/sof/app ``` More context in thesofproject#7192. Signed-off-by: Marc Herbert <[email protected]>
There's really no reason to fall back on a default "platform" and pick up a bunch of other, totally random settings. Now the following command fails immediately with a useful `platform not defined` error message instead of stopping with a cryptic `platform/trace/trace.h: No such file or directory` after successfully compiling half the .c files in a Frankenstein CONFIG_uration. ``` west build -p --board mimx8mm_evk_a53 modules/audio/sof/app ``` More context in #7192. Signed-off-by: Marc Herbert <[email protected]>
A ton of (valid!) warnings but this will make sure the code at least compiles. For more context see #7192 Signed-off-by: Marc Herbert <[email protected]>
@LaurentiuM1234 looks like most / all PRs merged now ? if so we close ? |
PURPOSE
I've decided to open this issue in order to track the current progress and interact with the community. Our plan is to make SOF with Zephyr run on i.MX93's cortex-A55 core with the help of Jailhouse. Jailhouse will be used to split the hardware resources between Linux and Zephyr which will be running independently on different cores.
Feedback and suggestions would be very much appreciated.
ISSUES
scripts/xtensa-build-zephyr
, I have managed to obtain thezephyr.elf
. The script fails when trying to runsmex
in order to build the.ldc
file. My current understanding is thatsmex
isn't able to properly parse thezephyr.elf
file because of the fact that there's currently no support for parsingELF-64
files. My question regarding this would be: would it be a good idea to add support insmex
for parsing such files? Also, would it be necessary since, for now, my plan for now is to use Zephyr's logging system (no trace, the logs will be printed via the UART)?zephyr.elf
's sections: are there any restrictions imposed by SOF (e.g: alignment, order)? For now, I was able to get away by simply adding the.static_uuids
,.static_log
and.trace_ctx
to the already present sections added for ARM64 platforms on Zephyr.smex
and the signing process still be required if the plan is to load the firmware image through Jailhouse? Please correct me if I'm wrong but my current understanding is that the .ri file resulting from the SOF build process contains some sort of header which is "stripped" during the load process in the linux kernel. Because of this, since Jailhouse loads the firmware image as-is, the A55 core would probably not be able to work properly. Would it be acceptable to bypass the .ri file creation process and simply utilize the generatedzephyr.bin
? (which can be generated by enablingCONFIG_BUILD_OUTPUT_BIN
)RELATED PRs
TODO
CC: @dbaluta @iuliana-prodan @paulstelian97 @lgirdwood
The text was updated successfully, but these errors were encountered: