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

[FEATURE][Zephyr] Clarify expectations of platform.h for Zephyr SOF builds #7248

Open
kv2019i opened this issue Mar 10, 2023 · 6 comments
Open
Labels
enhancement New feature or request

Comments

@kv2019i
Copy link
Collaborator

kv2019i commented Mar 10, 2023

Levelling up from #5602

Is your feature request related to a problem? Please describe.
The platform.h has three interfaces:

int platform_boot_complete(uint32_t boot_message);
int platform_init(struct sof *sof);
int platform_context_save(struct sof *sof);

Plus a set of capability definitions used by application code (like PLATFORM_MAX_CHANNELS). These need to be defined by each platform via platform.h.

Documented here: https://github.com/thesofproject/sof/blob/main/src/include/sof/platform.h

Now we have three types of platforms implemented in SOF main (2023/March situation):

  • native Zephyr, can only be built with Zephyr (e.g. platform/intel/ace)
  • native XTOS, can be only built with XTOS (e.g. platform/mtk8186)
  • hybrid that can be built with either Zephyr or XTOS (e.g. platform/intel/cavs and platform/imx8)

Describe the solution you'd like
Clear definition of semantics of platform.h expected for native Zephyr platforms. Based on experience with intel/ace , there is still need for a thin platform layer.

As XTOS does not have its own platform layer, SOF platform.h will need to continue to serve as the platform layer as long as SOF main supports XTOS builds.

Describe alternatives you've considered

  • removal of platform layer completely and make it XTOS only interface
    - this is still a possibility but hard to do unless all platforms move to native Zephyr
    - a new solution would be needed for e.g. intel/ace/platform.c
  • split out "platfrom-capability.h" that only exports platform.h interfaces needed by src/audio/
    - on Zephyr this can be a thin mapping to DTS information (and possibly shared across platforms)
    - this would allow to clean up code for hybrid platforms that continue to support both Zephyr and XTOS builds (versus the current ifdef ZEPHYR mess we have now in some of the platform files)

Additional context

@kv2019i kv2019i added the enhancement New feature or request label Mar 10, 2023
@kv2019i
Copy link
Collaborator Author

kv2019i commented Mar 10, 2023

@dbaluta
Copy link
Collaborator

dbaluta commented Mar 10, 2023

int platform_boot_complete(uint32_t boot_message);
int platform_boot_complete(uint32_t boot_message);

Do you mean int platform_init(struct sof *sof) instead of one of platform_boot_complete?

@lgirdwood lgirdwood added this to the v2.6 milestone Mar 13, 2023
@lgirdwood lgirdwood modified the milestones: v2.6, v2.7 May 10, 2023
kv2019i added a commit to kv2019i/sof that referenced this issue Aug 16, 2023
Complete migration of Intel TigerLake platform to Zephyr RTOS by
removing remaining platform definitions for XTOS for this platform.

Link: thesofproject#7248
Signed-off-by: Kai Vehmanen <[email protected]>
kv2019i added a commit to kv2019i/sof that referenced this issue Aug 16, 2023
Complete migration of Intel TigerLake platform to Zephyr RTOS by
removing remaining platform definitions for XTOS for this platform.

Link: thesofproject#7248
Signed-off-by: Kai Vehmanen <[email protected]>
@kv2019i kv2019i removed this from the v2.7 milestone Aug 17, 2023
@kv2019i
Copy link
Collaborator Author

kv2019i commented Aug 17, 2023

Cleared the v2.7 milestone. Let's use this meta-item to track the transition of platfrom from XTOS to hybrid and to native Zephyr. This is likely to require multiple releases to complete.

kv2019i added a commit to kv2019i/sof that referenced this issue Aug 17, 2023
Complete migration of Intel TigerLake platform to Zephyr RTOS by
removing remaining platform definitions for XTOS for this platform.

Link: thesofproject#7248
Signed-off-by: Kai Vehmanen <[email protected]>
kv2019i added a commit to kv2019i/sof that referenced this issue Aug 18, 2023
Complete migration of Intel TigerLake platform to Zephyr RTOS by
removing remaining platform definitions for XTOS for this platform.

Link: thesofproject#7248
Signed-off-by: Kai Vehmanen <[email protected]>
kv2019i added a commit that referenced this issue Aug 21, 2023
Complete migration of Intel TigerLake platform to Zephyr RTOS by
removing remaining platform definitions for XTOS for this platform.

Link: #7248
Signed-off-by: Kai Vehmanen <[email protected]>
@marc-hb
Copy link
Collaborator

marc-hb commented Sep 25, 2023

hybrid that can be built with either Zephyr or XTOS (e.g. platform/intel/cavs and platform/imx8)

I believe it's only imx8 left now in the main branch, correct?

this would allow to clean up code for hybrid platforms that continue to support both Zephyr and XTOS builds (versus the current ifdef ZEPHYR mess we have now in some of the platform files)

Is this hybrid mode still necessary? It was useful to quickly and conveniently compare XTOS and Zephyr when Zephyr was taking off and had no SOF track record or validation yet. Now that Zephyr is routinely validated on some platforms, any future platform trying to switch to Zephyr too has the confidence of a common codebase that is well tested by other platforms. So maybe SOF does not need such an hybrid mode any more?

In other words and pardon me if I'm over-simplifying because I'm not familiar with this topic:

  • ./src/platform/imx8m-XTOS/platform.c
  • ./src/platform/imx8m-zephyr/platform.c

... with a fair amount of copy/paste between the two: who cares it's only a temporary transition!

My 2 cents, hope its helps.

@lgirdwood
Copy link
Member

@kv2019i we should not need a platform.c for Zephyr builds as all IP code should now be in Zephyr. If there is application init code around in platform.c then we can move it to a more generic init file.

@kv2019i
Copy link
Collaborator Author

kv2019i commented Apr 10, 2024

Linking here as well. To manage custom vendor code to add IPC4 tuples, SOF platform concept seems like a good fit, my arguments for this at #9012 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants