This article gives information about the Linux® mailbox framework. The mailbox framework is involved in interprocessor communication in heterogeneous multicore systems.
1. Framework purpose[edit | edit source]
The mailbox is used in interprocessor communication to exchange messages or signals between the host and the coprocessor cores. The mailbox framework is based on:
- A mailbox controller that is platform dependent:
- It is in charge of configuring and handling IRQ from the IPCC peripheral.
- It provides a generic API to the mailbox client.
- A mailbox client that is in charge of the message to send or receive.
A general presentation of the mailbox framework is available in the Linux mailbox documentation [1].
2. System overview[edit | edit source]
2.1. Component description[edit | edit source]
- Mailbox controller
- The mailbox controller is the stm32_ipcc. It configures and controls the IPCC peripheral
- Mailbox client
- The user can define his own mailbox client.
- For example, the RPMsg framework uses mailbox for the interprocessor communication.
- In this case the mailbox client is the remoteproc driver that forwards services from/to the RPMsg framework.
2.2. API description[edit | edit source]
The APIs are described in the Linux documentation:
3. Configuration[edit | edit source]
Activate stm32 IPCC mailbox in kernel configuration using the Linux Menuconfig tool: Menuconfig or how to configure kernel
Device drivers --->
-*- Mailbox Hardware Support --->
<*> STM32 IPCC Mailbox
4. Device tree configuration[edit | edit source]
The mailbox device node must be declared and enabled in the Linux kernel device tree. Here is an extract of the STM32MP1 evaluation board device tree:
ipcc: mailbox@4c001000 { compatible = "st,stm32mp1-ipcc"; #mbox-cells = <1>; reg = <0x4c001000 0x400>; st,proc-id = <0>; interrupts-extended = <&exti 61 1>; <&intc GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "rx", "tx"; clocks = <&rcc_clk IPCC>; wakeup-source; power-domains = <&pd_core>; status = "disabled"; };
Then client has to reserve channels. Here is an example of channel allocation for the remoteproc node:
&m4_rproc { memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>, <&vdev0vring1>, <&vdev0buffer>, <&mcu_rsc_table>; mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>; mbox-names = "vq0", "vq1", "shutdown"; interrupt-parent = <&exti>; interrupts = <68 1>; wakeup-source; status = "okay"; };
5. How to trace and debug the framework[edit | edit source]
5.1. How to trace[edit | edit source]
Dynamic debug traces can be added using the following commands:
echo -n 'file stm32-ipcc.c +p' > /sys/kernel/debug/dynamic_debug/control echo -n 'file mailbox.c +p' > /sys/kernel/debug/dynamic_debug/control
6. References[edit | edit source]