arch: arm: API to configure Secure exception boost

This commit defines and implements an internal ARMv8-M TrustZone
API to allow the user to select whether Secure exceptions will
have priority boosting over Non-Secure exceptions.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2018-03-26 13:07:04 +02:00 committed by Anas Nashif
parent 179b8d15f1
commit 5bb3d01580
2 changed files with 29 additions and 0 deletions

View file

@ -77,6 +77,19 @@ void tz_nbanked_exception_target_state_set(int secure_state)
| aircr_payload;
}
void tz_nonsecure_exception_prio_config(int secure_boost)
{
u32_t aircr_payload = SCB->AIRCR & (~(SCB_AIRCR_VECTKEY_Msk));
if (secure_boost) {
aircr_payload |= SCB_AIRCR_PRIS_Msk;
} else {
aircr_payload &= ~(SCB_AIRCR_PRIS_Msk);
}
SCB->AIRCR = ((AIRCR_VECT_KEY_PERMIT_WRITE << SCB_AIRCR_VECTKEY_Pos)
& SCB_AIRCR_VECTKEY_Msk)
| aircr_payload;
}
void tz_sau_configure(int enable, int allns)
{
if (enable) {

View file

@ -104,6 +104,22 @@ void tz_nonsecure_psplim_set(u32_t val);
#endif /* CONFIG_ARMV8_M_MAINLINE */
/**
* @brief Prioritize Secure exceptions
*
* Function allows the user to prioritize Secure exceptions over Non-Secure,
* enabling Secure exception priority boosting.
*
* @param secure_boost Flag indicating whether Secure priority boosting
* is desired; select 1 for priority boosting, otherwise 0.
*
* Note:
*
* This function shall only be called from Secure state.
*
* @return N/A
*/
void tz_nonsecure_exception_prio_config(int secure_boost);
/**
* @brief Set target state for exceptions not banked between security states