ARM: stm32mp: Check secure state first

Secure state must be checked before handling semaphores,
otherwise it can cause an IAC.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
Gatien Chevallier
2026-02-10 11:26:05 +01:00
committed by Patrice Chotard
parent 9d3a9080c9
commit c61d6f67f4

View File

@@ -141,6 +141,12 @@ static int rifsc_check_access(void *base, u32 id)
cid_reg_value = readl(base + RIFSC_RISC_PER0_CIDCFGR(id));
sem_reg_value = readl(base + RIFSC_RISC_PER0_SEMCR(id));
/* Check security configuration */
if (sec_reg_value & BIT(reg_offset)) {
log_debug("Invalid security configuration for peripheral %d\n", id);
return -EACCES;
}
/* Skip cid check if CID filtering isn't enabled */
if (!(cid_reg_value & CIDCFGR_CFEN))
goto skip_cid_check;
@@ -162,12 +168,6 @@ static int rifsc_check_access(void *base, u32 id)
}
skip_cid_check:
/* Check security configuration */
if (sec_reg_value & BIT(reg_offset)) {
log_debug("Invalid security configuration for peripheral %d\n", id);
return -EACCES;
}
return 0;
}