-
Notifications
You must be signed in to change notification settings - Fork 349
Fixes for SOF with Zephyr on i.MX #4524
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
Fixes for SOF with Zephyr on i.MX #4524
Conversation
Building imx is critical to test changes like thesofproject#4524 Note not signing imx means sof-imx.ldc is staged for deployment but no imx firmware is, example: $ scripts/xtensa-build-zephyr.sh imx apl build-sof-staging ├── sof │ ├── community │ │ └── sof-apl.ri │ ├── sof-apl.ldc │ └── sof-imx.ldc └── tools └── sof-logger Signed-off-by: Marc Herbert <marc.herbert@intel.com>
marc-hb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "unwrapped message" checkpatch warnings seems easy to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still not easy to test this without knowing which --board argument to pass to west (see #4525 ) but at least I now see exactly what you're doing and I can simulate it, thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've explained how I tested it with both xtensa-build-zephyr.sh and west commands: see here
The only problem is that the pull request from Zephyr's repo is not yet merged, so you'll need to use a specific branch: https://github.com/iuliana-prodan/zephyr/commits/imx_sof_with_zephy
marc-hb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I fix it? How can I wrap it? |
That does not seem to be true, try: It would make the line exceed the limit most of the time. |
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iuliana-prodan probably best if we put all the wrapping in the zephyr directory as this will help a lot when it comes to transferring APIs to native Zephyr. This will also help if will help if we need to wrap other RTOS code since we can have a wrapper dir for each (and mean less conditional code in core places).
8161c74 to
4dc506b
Compare
Fix it! |
4dc506b to
aba724d
Compare
|
Please add this to PR. As long as you don't update SUPPORTED_PLATFORMS yet it won't have any CI effect yet hence it won't break anything but it will help local testing and cherry-picks. @@ -110,6 +111,9 @@ build()
icl)
PLAT_CONFIG='intel_adsp_cavs20'
;;
+ imx8)
+ PLAT_CONFIG='nxp_adsp_imx8'
+ ;;
tgl-h)
PLAT_CONFIG='intel_adsp_cavs25' |
src/drivers/interrupt.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have to re-spin this PR to address @marc-hb 's comment, could you also add to this comment, that because of this currently i.MX with Zephyr has to use both wrapper.c and this file which causes name collisions. That's why you need these defines. And below where you #undef for the first time, please add a comment saying, that that will now call the version from wrapper.c
@lgirdwood in fact this seems like a good candidate for an early native Zephyr API conversion: if we could switch over to native z_soc_irq_*() everywhere in the code with wrappers for XTOS builds, we wouldn't need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. @lyakh @iuliana-prodan what's the effort in switching over the APIs for Intel and NXP code ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marc-hb the irq wrapping as discussed on call
zephyr/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you respin this PR, please merge this with the previous commit to avoid breaking bisection, even though these platforms don't actually work with Zephyr...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
aba724d to
2cdbaf2
Compare
Added. |
|
LGTM. Thanks Iulia. We should also get at least 1 approval from Intel folks :) |
|
@iuliana-prodan can you check CI qemu for imx - look like this breaks boot. |
Remove zephyr_ll.c from mandatory files for building SOF with Zephyr and include it where necessary: in CAVS 1.5, CAVS 1.8, CAVS 2.0 and CAVS 2.5. While here, add ll_schedule for BROADWELL and BAYTRAIL when building SOF with Zephyr. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
For now, zephyr_ll is limited to timer_domain. For i.MX we use dma_domain, so keep the ll_schedule from SOF, until we extend the zephyr_ll for DMA_IRQ. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
On i.MX the DMA interrupts are routed via IRQ_STEER. In order for this to work we need to: - make any second level interrupts handling go through interrupt-irqsteer.c; - use first level interrupt handling from wrapper.c. TODO: Implement a driver for the IRQ_STEER in Zephyr, to replace the legacy code (interrupt-irqsteer.c). Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
…CHEDULE_LL_DMA In XTOS SOF, ipc_send_queued_msg() is run by task_main_primary_core(). In Zephyr we need to schedule ipc_send_queued_msg() using a notifier triggered by the periodic ll_scheduler. This is similar to commit c194125 ("zephyr: add notifier_register(ipc_send_queued_msg) in task_main_start()") For i.MX we need to use this temporary fix for SOF_SCHEDULE_LL_DMA, also. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Add imx8 platform for local testing. TODO: Update xtensa-build-zephyr.sh when Zephyr repo is updated with imx8 support. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2cdbaf2 to
111a1e5
Compare
I've rebased to latest main branch (commit 57ee04f) also to restart CI. |
All green with one exception: "On-device Test Failed:APL_UP2_NOCODEC_ZEPHYR: kernel boot fail!". |
BTW you don't need to rebase to restart CI if you don't want to create Most (all?) CI engines test the constantly moving pull/4524/merge (e.g. https://github.com/thesofproject/sof/commits/ebfd72540fda right now), they do NOT test the static pull/4524/head so this is another wrong reason to rebase. "You need to rebase" is probably the most common CI misconception. The only time rebasing is required is (of course) when there is a git conflict to resolve, as shown by Github. |
|
Looks like we are good now. |
This pull request fixes some issues we have on i.MX.
Please check each commit, but here's a summary of these fixes:
With this pull request we can now run successfully, on i.MX, playback and record scenarios with Zephyr.