]> git.openpandora.org Git - pandora-u-boot.git/commitdiff
ARM: stm32mp: Check secure state first
authorGatien Chevallier <gatien.chevallier@foss.st.com>
Tue, 10 Feb 2026 10:26:05 +0000 (11:26 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 24 Feb 2026 16:49:43 +0000 (17:49 +0100)
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>
arch/arm/mach-stm32mp/stm32mp2/rifsc.c

index 0ef086bb956beac4e070806c4735ecc83ea3da00..9db8b9efc641801916f9739c6aef3961ce65a614 100644 (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;
 }