You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/porting/psa/spm.md
+58-60Lines changed: 58 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,14 @@
1
-
<h2id="blockdevice-port">PSA SPM</h2>
1
+
<h2id="spm-port">PSA SPM</h2>
2
2
3
-
SPM (Secure Partition Manager) is a part of the PSA Firmware Framework that is responsible for isolating software in Partitions, managing the execution of software within Partitions, and providing IPC between Partitions.
3
+
Secure Partition Manager (SPM) is a part of the PSA Firmware Framework that is responsible for isolating software in partitions, managing the execution of software within partitions and providing interprocessor communication (IPC) between partitions.
4
4
5
-
For more information about SPM, refer to [TODO: WHEN READY, SPM OVERVIEW PAGE LINK]
5
+
For more information about SPM, please refer to [the SPM overview page](/docs/development/apis/mbed-psa.html).
6
6
7
7
**This page gives guidelines for silicon partners wishing to have Secure Partition Manager capabilities**
8
8
9
+
### Memory layout
9
10
10
-
## Memory layout
11
-
12
-
Typically PSA platforms will share same RAM and flash between secure and non secure cores.
13
-
In order to provide PSA isolation level 1 or higher we need to partition both RAM and flash
14
-
in a way described by following drawing:
11
+
Typically, PSA platforms share the same RAM and flash between secure and nonsecure cores. To provide PSA isolation level 1 or higher, you need to partition both RAM and flash in a way the following image describes:
15
12
16
13
```text
17
14
RAM
@@ -27,11 +24,12 @@ in a way described by following drawing:
In order to achieve RAM and Flash partitioning start and size values must be added to target a configuration in `targets.json`.
31
-
The process of defining can be described in the following steps:
32
-
1. secure target must inherit from `SPE_Target` meta-target
33
-
2. non-secure target must inherit from `NSPE_Target`
34
-
3. both targets must override default configuration by specifying flash RAM and shared RAM regions.
27
+
28
+
To achieve RAM and flash partitioning, you must add start and size values to a target configuration in `targets.json`. You can do this with the following steps:
29
+
30
+
1. Secure target must inherit from `SPE_Target` meta-target.
31
+
2. Nonsecure target must inherit from `NSPE_Target`.
32
+
3. Both targets must override the default configuration by specifying flash RAM and shared RAM regions.
35
33
36
34
```json
37
35
"FUTURE_SEQUANA_M0_PSA": {
@@ -75,15 +73,16 @@ The process of defining can be described in the following steps:
75
73
}
76
74
```
77
75
78
-
> Note: shared memory region is required only for multi core architectures.
76
+
<spanclass="notes">**Note:** Only multicore architectures require a shared memory region.</span>
77
+
78
+
### Linker scripts
79
+
80
+
Linker scripts must include `MBED_ROM_START`, `MBED_ROM_SIZE`, `MBED_RAM_START` and `MBED_RAM_START` macros for defining memory regions. You can define a shared memory region by reserving RAM space for shared memory use. The shared memory location is target specific and depends on the memory protection scheme applied.
79
81
80
-
## Linker Scripts
82
+
Typically, shared memory is located before or after nonsecure RAM, for saving MPU regions. The shared memory region is nonsecure memory that both cores use.
81
83
82
-
Linker scripts mast include `MBED_ROM_START`, `MBED_ROM_SIZE`, `MBED_RAM_START` and `MBED_RAM_START` macros for defining memory regions.
83
-
Shared memory region is defined by reserving RAM space for shared memory usage. Shared memory location is target specific and depends on the memory protection scheme applied.
84
-
Typically shared memory will be located before/after non-secure RAM, for saving MPU regions. Shared memory region is considered non-secure memory used by both cores.
Mailbox is the SPM mechanism in charge of Inter Processor Communication, and is **relevant for multi-core systems only**.
184
+
Mailbox is the SPM mechanism in charge of IPC, and is **relevant for multicore systems only**.
184
185
185
186
#### Concepts
186
-
The mailbox mechanism is based on message queues and dispatcher threads.
187
-
Each core has a single dispatcher thread, and a single message queue.
188
-
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.
187
+
188
+
The mailbox mechanism is based on message queues and dispatcher threads. Each core has a single dispatcher thread and a single message queue. 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.
189
189
190
190
#### Requirements
191
-
The SPM mailbox mechanism requires that the platform should have the following capabilities:
192
-
* Inter Processor Communication capabilities - The ability to notify the peer processor about an event (usually implemented with interrupts)
193
-
* Ability to set a RAM section which is shared between the cores
191
+
192
+
The SPM mailbox mechanism requires the platform to have the following capabilities:
193
+
194
+
- IPC capabilities - The ability to notify the peer processor about an event (usually implemented with interrupts).
195
+
- Ability to set a RAM section shared between the cores.
194
196
195
197
#### Porting
196
-
These are the guidelines which should be followed by silicon partners with multi-core systems:
197
-
- For each core, initialize, configure and enable the a mailbox event (usually an interrupt) at SystemInit()
198
-
- For each core, implement the mailbox event handler (usually interrupt handler):
199
-
- This handler must call an ARM callback function. This is explained in more details in the [HAL Functions section](#hal-functions)
200
-
- It is the silicon partner's responsibility to clear the mailbox event. This can be done in the event handler.
201
-
- 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)
202
198
199
+
These are the guidelines you should follow if you have multicore systems:
200
+
201
+
- For each core, initialize, configure and enable the a mailbox event (usually an interrupt) at `SystemInit()`.
202
+
- For each core, implement the mailbox event handler (usually interrupt handler):
203
+
- This handler must call an Arm callback function. The [HAL functions section](#hal-functions) explains this in more detail.
204
+
- It is your responsibility to clear the mailbox event. You can do this in the event handler.
205
+
- For each core, implement the HAL function that notifies the peer processor about a mailbox event occurrence. This is a part of the HAL, and the section below explains this in more detail.
203
206
204
-
## HAL Functions
207
+
###HAL functions
205
208
206
209
Target specific code of silicon partners who wish to have SPM capabilities must:
207
-
- Implement a list of functions which are being called by SPM code
208
-
- Call other functions supplied by ARM
209
210
210
-
The HAL can be logically divided into 2 different fields:
211
+
- Implement a list of functions which are being called by SPM code.
212
+
- Call other functions supplied by ARM.
211
213
212
-
#### Mailbox
213
-
This part of HAL allows the silicon partner to implement a thin layer of the mailbox mechanism which is specific to their platform.
214
-
It must be implemented only by silicon partners with multi-core systems.
214
+
The HAL can be logically divided into two different fields:
215
215
216
-
#### Secure Processing Environment
217
-
This part of HAL allows the silicon partner to apply their specific memory protection scheme.
216
+
#### Mailbox
218
217
219
-
A list of these functions can be found here [TODO: WHEN READY, ADD LINK TO DOXYGEN FILES OF HAL FUNCTIONS]
218
+
This part of HAL allows you to implement a thin layer of the mailbox mechanism that is specific to your platform. You must only implement it if you have multicore systems.
220
219
220
+
#### Secure Processing Environment
221
221
222
-
## Memory Protection
222
+
This part of HAL allows you to apply your specific memory protection scheme. You can find a list of [these functions]([TODO: WHEN READY, ADD LINK TO DOXYGEN FILES OF HAL FUNCTIONS]).
223
223
224
-
As explained in the [HAL Functions section](#hal-functions), target specific code must implement the function *spm_hal_memory_protection_init()* called on SPM initialization.
225
-
This function should apply memory protection schemes to ensure secure memory can only be accessed from secure-state.
224
+
### Memory protection
226
225
227
-
The implementation of this function, must be aligned with the SPM general guidelines as described in the table below.
226
+
Target-specific code must implement the function*spm_hal_memory_protection_init()* called in SPM initialization. This function should apply memory protection schemes to ensure secure memory can only be accessed from secure-state.
228
227
229
-
This table describes the allowed operations (Read / Write / Execute) on the Secure and Non-Secure RAM and FLASH by each core:
228
+
The implementation of this function must be aligned with the SPM general guidelines, as the table below describes. This table describes the allowed operations (Read, Write and Execute) on the secure and nonsecure RAM and FLASH by each core:
230
229
231
-
- X means No Access
232
-
- V means Must Be Able to Access
233
-
- ? means it is up to the target
234
-
- X? means it is up to the target, preferably No Access
230
+
- X means No access.
231
+
- V means Must be able to access.
232
+
- ? means it is up to the target.
233
+
- X? means it is up to the target, preferably No access.
Arm provides a list of tests to make sure the HAL functions are implemented according to requirements, and the porting is done correctly.
247
247
248
-
ARM provides a list of tests to make sure the HAL functions are implemented according to requirements, and the porting is done correctly.
248
+
After finalizing the porting, execute the following tests:
249
249
250
-
After finalizing the porting, the following tests should be executed:
251
250
-[TODO: WHEN READY, ADD TEST NAME]
252
251
-[TODO: WHEN READY, ADD TEST NAME]
253
252
- ...
254
253
255
-
It is recommended to leave the memory protection part [*spm_hal_memory_protection_init()* implementation] to the end of the porting.
256
-
First implement and test other HAL functions, and after these tests pass, implement *spm_hal_memory_protection_init()* and run the entire test suite again, including the memory protection related tests.
254
+
We recommended you leave the memory protection part (*spm_hal_memory_protection_init()* implementation) to the end of the porting. First, implement and test other HAL functions. After these tests pass, implement *spm_hal_memory_protection_init()*, and run the entire test suite again, including the memory protection related tests.
0 commit comments