Skip to content

Commit f0598c8

Browse files
authored
Elaborate on mailbox mechanism
1 parent b1b2157 commit f0598c8

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

docs/porting/psa/spm.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SPM (Secure Partition Manager) is a part of the PSA Firmware Framework that is r
44

55
**This page gives guidelines for silicon partners wishing to have Secure Partition Manager capabilities**
66

7+
78
## Linker Scripts
89

910
Silicon partners must edit the secure and non-secure linker scripts to define sections for RAM, FLASH and SHARED_RAM.
@@ -82,16 +83,48 @@ MEMORY
8283
...
8384
```
8485

86+
87+
## Mailbox
88+
89+
Mailbox is the SPM mechanism in charge of Inter Processor Communication.
90+
Therefore, it is relevant for multi-core systems only.
91+
92+
#### Concepts
93+
The mailbox mechanism is based on message queues and dispatcher threads.
94+
Each core has a single dispatcher thread, and a single message queue.
95+
The dispatcher thread waits on a mailbox event. Once this event occurs, the dispatcher thread reads and runs "tasks" accumulated on its local message queue.
96+
97+
#### Requirements
98+
The SPM mailbox mechanism requires that the platform should have the following capabilities:
99+
* Inter Processor Communication capabilities - The ability to notify the peer processor about an event (usually implemented with interrupts)
100+
* Ability to set a RAM section which is shared between the cores
101+
102+
#### Porting
103+
These are the guidelines which should be followed by silicon partners with multi-core systems:
104+
- For each core, initialize, configure and enable the a mailbox event (usually an interrupt) at SystemInit()
105+
- For each core, implement the mailbox event handler (usually interrupt handler):
106+
- This handler must call an ARM callback function. This is explained in more details in the [HAL Functions section](#hal-functions)
107+
- It is the silicon partner's responsibility to clear the mailbox event. This can be done in the event handler.
108+
- For each core, implement the HAL function which notifies the peer processor about a mailbox event occurrence. This is a part of the HAL, and explained in more details in the [HAL Functions section](#hal-functions)
109+
110+
85111
## HAL Functions
86112

87113
Target specific code of silicon partners who wish to have SPM capabilities must:
88114
- Implement a list of functions which are being called by SPM code
89115
- Call other functions supplied by ARM
90116

91117
The HAL can be logically divided into 3 different fields:
92-
- **Addresses:** This part of HAL allows the silicon partner to share the addresses set in the linker scripts with the SPM code. The SPM uses these addresses mostly to enforce access permissions.
93-
- **Mailbox:** The mailbox is the mechanism for Inter Processor Communication. This part of HAL allows the silicon partner to implement specific parts of the mailbox mechanism according to the specification of the their specific platform.
94-
- **Secure Partition Environment:** This part of HAL allows the silicon partner to apply their specific memory protection scheme.
118+
119+
#### Addresses
120+
This part of HAL allows the silicon partner to share the addresses set in the linker scripts with the SPM code. The SPM uses these addresses mostly to enforce access permissions.
121+
122+
#### Mailbox
123+
This part of HAL allows the silicon partner to implement a thin layer of the mailbox mechanism which is specific to their platform.
124+
It must be implemented only by silicon partners with multi-core systems.
125+
126+
#### Secure Processing Environment
127+
This part of HAL allows the silicon partner to apply their specific memory protection scheme.
95128

96129
A list of these functions can be found here [TODO: WHEN READY, ADD LINK TO DOXYGEN FILES OF HAL FUNCTIONS]
97130

0 commit comments

Comments
 (0)