Registered User mNo edit summary Tag: 2017 source edit |
Registered User m (remove "Cortex-A35 master boot" chapter, useless for v6 and wording to review) Tag: 2017 source edit |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | |||
|MPUs list=STM32MP25x | |MPUs list=STM32MP21x, STM32MP23x, STM32MP25x | ||
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP25x | |MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
}} | }} | ||
==Article purpose== | ==Article purpose== | ||
The purpose of this article is to: | The purpose of this article is to: | ||
Line 27: | Line 26: | ||
This chapter is applicable in the scope of the '''OpenSTLinux BSP''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-A processor, and the '''STM32CubeMPU Package''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-M processor. | This chapter is applicable in the scope of the '''OpenSTLinux BSP''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-A processor, and the '''STM32CubeMPU Package''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-M processor. | ||
On {{MicroprocessorDevice | device=25}}, there are six RISAB instances. The following table shows RISAB - internal SRAM mapping and provides information regarding RISAB programming owner and default hardware configuration. </br> | On {{MicroprocessorDevice | device=25}} and {{MicroprocessorDevice | device=23}}, there are six RISAB instances. On {{MicroprocessorDevice | device=21}}, there are only four (RISAB4 and RISAB6 are removed). The following table shows RISAB - internal SRAM mapping and provides information regarding RISAB programming owner and default hardware configuration. </br> | ||
RISAB registers are accessible in read by all execution context to check memory can be accessed or not. | RISAB registers are accessible in read by all execution context to check memory can be accessed or not. | ||
Line 48: | Line 47: | ||
| Nonsecure, unprivileged, any CID | | Nonsecure, unprivileged, any CID | ||
|- | |- | ||
| RISAB4 | | RISAB4<ref group="Note" name=mp21_removed>Not present on {{MicroprocessorDevice | device=21}}</ref> | ||
| SRAM2 (upper 128 KB) | | SRAM2 (upper 128 KB) | ||
| TDCID secure | | TDCID secure | ||
Line 58: | Line 57: | ||
| Secure, unprivileged, any CID | | Secure, unprivileged, any CID | ||
|- | |- | ||
| RISAB6 | | RISAB6<ref group="Note" name=mp21_removed/> | ||
| VDERAM | | VDERAM | ||
| TDCID secure | | TDCID secure | ||
| Nonsecure, unprivileged, any CID | | Nonsecure, unprivileged, any CID | ||
|} | |} | ||
<references group="Note"/> | |||
RISAB configurations are done during bootflow according to memory usage. The ROM code | RISAB configurations are done during bootflow according to memory usage. The ROM code and the FSBL perform an initial RISAB configuration to allow and secure their execution. The RISAB configuration for runtime execution is applied afterwards by the TDCID secure OS. | ||
===Boot time assignment=== | ===Boot time assignment=== | ||
====On {{MicroprocessorDevice | device=21}}==== | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp2_a35_boottime}} | |||
<section begin=stm32mp25_a35_boottime /> | |||
| rowspan="4" | Security | |||
| rowspan="4" | [[RISAB internal peripheral | RISAB]] | |||
| RISAB1 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB2 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB3 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| Used by ROM code only in serial boot for USB buffer management | |||
|- | |||
| RISAB5 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| Used by ROM code only during cold boot | |||
|- | |||
<section end=stm32mp25_a35_boottime /> | |||
|} | |||
====On {{MicroprocessorDevice | device=23}}==== | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp2_a35_boottime}} | |||
<section begin=stm32mp25_a35_boottime /> | |||
| rowspan="6" | Security | |||
| rowspan="6" | [[RISAB internal peripheral | RISAB]] | |||
| RISAB1 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB2 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB3 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| Used by ROM code only in serial boot for USB buffer management | |||
|- | |||
| RISAB4 | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB5 | |||
| <span title="system peripheral" style="font-size:21px">✓</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| Used by ROM code only during cold boot | |||
|- | |||
| RISAB6 | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
<section end=stm32mp25_a35_boottime /> | |||
|} | |||
====On {{MicroprocessorDevice | device=25}}==== | ====On {{MicroprocessorDevice | device=25}}==== | ||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp2_a35_boottime}} | {{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp2_a35_boottime}} | ||
<section begin=stm32mp25_a35_boottime /> | <section begin=stm32mp25_a35_boottime /> | ||
Line 113: | Line 190: | ||
===Runtime assignment=== | ===Runtime assignment=== | ||
====On {{MicroprocessorDevice | device=21}}==== | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp21_runtime}} | |||
<section begin=stm32mp21_a35_runtime /> | |||
| rowspan="4" | Security | |||
| rowspan="4" | [[RISAB internal peripheral | RISAB]] | |||
| RISAB1 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB2 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB3 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB5 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
<section end=stm32mp21_a35_runtime /> | |||
|} | |||
====On {{MicroprocessorDevice | device=23}}==== | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp23_runtime}} | |||
<section begin=stm32mp23_a35_runtime /> | |||
| rowspan="6" | Security | |||
| rowspan="6" | [[RISAB internal peripheral | RISAB]] | |||
| RISAB1 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB2 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB3 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB4 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB5 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| RISAB6 | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
<section end=stm32mp23_a35_runtime /> | |||
|} | |||
====On {{MicroprocessorDevice | device=25}}==== | ====On {{MicroprocessorDevice | device=25}}==== | ||
Line 176: | Line 339: | ||
* '''OP-TEE''': {{CodeSource | OP-TEE_OS | core/drivers/firewall/stm32_risab.c | RISAB driver }} | * '''OP-TEE''': {{CodeSource | OP-TEE_OS | core/drivers/firewall/stm32_risab.c | RISAB driver }} | ||
*'''TF-M''': {{CodeSource | TF-M | platform/ext/target/stm/common/stm32mp2/native_driver/src/rif/stm32_risab.c | RISAB driver }} | *'''TF-M''': {{CodeSource | TF-M | platform/ext/target/stm/common/stm32mp2/native_driver/src/rif/stm32_risab.c | RISAB driver }} | ||
* '''Linux''': {{CodeSource | Linux kernel | drivers/soc/st/stm32_risab.c | RISAB dump driver }} | |||
==How to assign and configure the peripheral== | ==How to assign and configure the peripheral== |
Latest revision as of 16:41, 22 October 2024
1. Article purpose[edit | edit source]
The purpose of this article is to:
- Briefly introduce the RISAB peripheral and its main features.
- Indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts).
- List the software frameworks and drivers managing the peripheral.
- Explain how to configure the peripheral.
2. Peripheral overview[edit | edit source]
The RISAB peripheral is part of the RIF. It is used to protect internal RAMs.
Its main features are:
- Configuration at fixed size memory blocks (512 B) and pages (4 KB)
- Access filtering per:
- secure level
- CID filtering
- privilege level per CID
- read-only, write-only, or read/write per CID
- Possibility to delegate page configuration to a specified execution context defined by delegated configuration CID. Useful to manage memory region access right at software component level instead of requiring changes to TDCID secure OS.
Refer to the STM32 MPU reference manuals for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented.
3. Peripheral usage[edit | edit source]
This chapter is applicable in the scope of the OpenSTLinux BSP running on the Arm® Cortex®-A processor, and the STM32CubeMPU Package running on the Arm® Cortex®-M processor.
On STM32MP25x lines and STM32MP23 unknown microprocessor device, there are six RISAB instances. On STM32MP21 unknown microprocessor device, there are only four (RISAB4 and RISAB6 are removed). The following table shows RISAB - internal SRAM mapping and provides information regarding RISAB programming owner and default hardware configuration.
RISAB registers are accessible in read by all execution context to check memory can be accessed or not.
RISAB instance | Internal SRAM | Owner | Default configuration |
---|---|---|---|
RISAB1 | SYSRAM1 (lower 128 KB) | Cortex-A35 secure | Secure, unprivileged, any CID |
RISAB2 | SYSRAM2 (upper 128 KB) | Cortex-A35 secure | Secure, unprivileged, any CID |
RISAB3 | SRAM1 (lower 128 KB) | TDCID secure | Nonsecure, unprivileged, any CID |
RISAB4[Note 1] | SRAM2 (upper 128 KB) | TDCID secure | Nonsecure, unprivileged, any CID |
RISAB5 | RETRAM | TDCID secure | Secure, unprivileged, any CID |
RISAB6[Note 1] | VDERAM | TDCID secure | Nonsecure, unprivileged, any CID |
- ↑ Jump up to: 1.0 1.1 Not present on STM32MP21 unknown microprocessor device
RISAB configurations are done during bootflow according to memory usage. The ROM code and the FSBL perform an initial RISAB configuration to allow and secure their execution. The RISAB configuration for runtime execution is applied afterwards by the TDCID secure OS.
3.1. Boot time assignment[edit | edit source]
3.1.1. On STM32MP21 unknown microprocessor device[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (ROM code) |
Cortex-A35 secure (TF-A BL2) |
Cortex-A35 non-secure (U-Boot) | |||
Security | RISAB | RISAB1 | ✓ | ✓ | ⬚ | |
RISAB2 | ✓ | ✓ | ⬚ | |||
RISAB3 | ✓ | ⬚ | ⬚ | Used by ROM code only in serial boot for USB buffer management | ||
RISAB5 | ✓ | ⬚ | ⬚ | Used by ROM code only during cold boot |
3.1.2. On STM32MP23 unknown microprocessor device[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (ROM code) |
Cortex-A35 secure (TF-A BL2) |
Cortex-A35 non-secure (U-Boot) | |||
Security | RISAB | RISAB1 | ✓ | ✓ | ⬚ | |
RISAB2 | ✓ | ✓ | ⬚ | |||
RISAB3 | ✓ | ⬚ | ⬚ | Used by ROM code only in serial boot for USB buffer management | ||
RISAB4 | ⬚ | ⬚ | ||||
RISAB5 | ✓ | ⬚ | ⬚ | Used by ROM code only during cold boot | ||
RISAB6 | ⬚ | ⬚ |
3.1.3. On STM32MP25x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (ROM code) |
Cortex-A35 secure (TF-A BL2) |
Cortex-A35 non-secure (U-Boot) | |||
Security | RISAB | RISAB1 | ✓ | ✓ | ⬚ | |
RISAB2 | ✓ | ✓ | ⬚ | |||
RISAB3 | ✓ | ⬚ | ⬚ | Used by ROM code only in serial boot for USB buffer management | ||
RISAB4 | ⬚ | ⬚ | ||||
RISAB5 | ✓ | ⬚ | ⬚ | Used by ROM code only during cold boot | ||
RISAB6 | ⬚ | ⬚ |
3.2. Runtime assignment[edit | edit source]
3.2.1. On STM32MP21 unknown microprocessor device[edit | edit source]
| rowspan="4" | Security | rowspan="4" | RISAB | RISAB1 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB2 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB3 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB5 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |-
|}
3.2.2. On STM32MP23 unknown microprocessor device[edit | edit source]
| rowspan="6" | Security | rowspan="6" | RISAB | RISAB1 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB2 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB3 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB4 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB5 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |- | RISAB6 | ☑OP-TEE | ⬚ | ☐ | ⬚ | |-
|}
3.2.3. On STM32MP25x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | |||||
---|---|---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (OP-TEE / TF-A BL31) |
Cortex-A35 non-secure (Linux) |
Cortex-M33 secure (TF-M) |
Cortex-M33 non-secure (STM32Cube) |
Cortex-M0+![]() (STM32Cube) | |||
Security | RISAB | RISAB1 | ☑OP-TEE | ⬚ | ☐ | ⬚ | ||
RISAB2 | ☑OP-TEE | ⬚ | ☐ | ⬚ | ||||
RISAB3 | ☑OP-TEE | ⬚ | ☐ | ⬚ | ||||
RISAB4 | ☑OP-TEE | ⬚ | ☐ | ⬚ | ||||
RISAB5 | ☑OP-TEE | ⬚ | ☐ | ⬚ | ||||
RISAB6 | ☑OP-TEE | ⬚ | ☐ | ⬚ |
4. Software frameworks and drivers[edit | edit source]
Below are listed the software frameworks and drivers managing the RISAB peripheral for the embedded software components listed in the above tables.
- TF-A: bl2_el3_plat_arch_setup()
- OP-TEE: RISAB driver
- TF-M: RISAB driver
- Linux: RISAB dump driver
5. How to assign and configure the peripheral[edit | edit source]
The STM32CubeMX graphical tool proposes an interface to configure the different RISAB memory regions.
It is possible to select for each region:
- the security level
- the privilege level
- if the region is encrypted or not (depends on RISAF capability)
- the master CID
The STM32CubeMX will generate the associated device tree configuration for the FSBL and secure OS running on the TDCID processor.
6. References[edit | edit source]