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] replace mailbox.h with a IPC abstraction #9697

Open
kv2019i opened this issue Nov 29, 2024 · 0 comments
Open

[FEATURE][Zephyr] replace mailbox.h with a IPC abstraction #9697

kv2019i opened this issue Nov 29, 2024 · 0 comments
Labels
enhancement New feature or request Zephyr Issues only observed with Zephyr integrated

Comments

@kv2019i
Copy link
Collaborator

kv2019i commented Nov 29, 2024

Is your feature request related to a problem? Please describe.
Replace the SOF mailbox.h interface with a higher-level abstraction to send/receive IPCs from host, or some other higher level interface that can be moved to Zephyr.
Part of #5794

Currently each SOF platform needs to implement mailbox.h and memory.h. Mailbox.h implements following functions:

  • mailbox_sw_reg_write() and mailbox_sw_reg_write64()
  • mailbox_sw_reg_read() and mailbox_sw_reg_read64()
  • mailbox_sw_regs_write()

The common sof/lib/mailbox.h uses platform memory.h to additionally define:

  • mailbox_dspbox_*()
  • mailbox_hostbox_*()
  • mailbox_stream_*()

This is a hardware specific interface that needs to be implemented on SOF side. I.e. something we really want to move over to Zephyr, just like all other driver code.

Possible solutions / IPC driver abstraction
The mailbox.h interfaces are primarily used in SOF IPC code to send and receive messages to the host. Main users:

  • src/platform - platform files typically use this mailbox interfacea to send the initial FW_READY on boot
  • src/ipc3/handler.c - IPC3 implementation
  • src/ipc4/handler.c - IPC4 implementation
  • src/ipc/ipc-zephyr.c common IPC code
  • src/audio/copier - one specialized use (IPC4) to write position/delay data directly to a memory mapped register window
  • src/include/sof/debug/debug.h - one example (there are some more similar) of non-functional debug use (writing debug info to shared memory)
  • and a few other minor users

The primary user is still for IPC. So one option to remove this layer from SOF src/platform/ is to move everybody over to a common IPC driver interface. For Intel platforms, Zephyr now provides zephyr/soc/intel/intel_adsp/common/include/intel_adsp_ipc.h that essentially moves most of the platform functionality over to Zephyr. To make this more generally applicable, this interface would have to be extended to other vendors, and we'd need a solution how to tackle the extra memory-mapped I/O ops that are part of IPC4 (copier, telemetry, coredumps).

Early on Zephyr IPM (ipm.h) was considered for SOF IPC, but limitations were hit and IPM not used. Another look at the available interfaces is in order.

Possible solutions / Move mailbox abstraction to Zephyr

Details are open, but given simplicity of the interface, using available Zephyr tools (DT, sys_read/write() and perhaps device_mmio.h) to implement a c generic mailbox handler code should be doable.

@kv2019i kv2019i added enhancement New feature or request Zephyr Issues only observed with Zephyr integrated labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Zephyr Issues only observed with Zephyr integrated
Projects
None yet
Development

No branches or pull requests

1 participant