[PATCH 4/4] ARM: stm32mp: Check secure state first

Patrick DELAUNAY patrick.delaunay at foss.st.com
Tue Feb 24 11:33:38 CET 2026


Hi,

On 2/10/26 11:26, Patrice Chotard wrote:
> From: Gatien Chevallier <gatien.chevallier at foss.st.com>
>
> Secure state must be checked before handling semaphores,
> otherwise it can cause an IAC.
>
> Signed-off-by: Gatien Chevallier <gatien.chevallier at foss.st.com>
> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
> ---
>   arch/arm/mach-stm32mp/stm32mp2/rifsc.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/stm32mp2/rifsc.c b/arch/arm/mach-stm32mp/stm32mp2/rifsc.c
> index 0ef086bb956..9db8b9efc64 100644
> --- a/arch/arm/mach-stm32mp/stm32mp2/rifsc.c
> +++ b/arch/arm/mach-stm32mp/stm32mp2/rifsc.c
> @@ -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;
>   }
>   
>


Reviewed-by: Patrick Delaunay <patrick.delaunay at foss.st.com>

Thanks
Patrick



More information about the U-Boot mailing list