Skip to content

Commit

Permalink
plat-stm32mp1: fix warning trace on TZC configuration check
Browse files Browse the repository at this point in the history
Fix build warning reported by recent toolchains when TZDRAM
memory ends at the UINT32_MAX. This happends for example when
building for the stm32mp1-157C_EV1 platform. In such case was GCC
to emit the following warning trace:

core/arch/arm/plat-stm32mp1/plat_tzc400.c: In function ‘init_stm32mp1_tzc’:
core/arch/arm/plat-stm32mp1/plat_tzc400.c:107:61: warning: conversion from ‘uint64_t’ {aka ‘long long unsigned int’} to ‘vaddr_t’ {aka ‘long unsigned int’} changes value from ‘4294967296’ to ‘0’ [-Woverflow]
  107 |                 if (!tzc_region_is_non_secure(region_index, tzdram_end,
      |                                                             ^~~~~~~~~~

Fixes: 59c253f ("plat-stm32mp1: check TZC400 configuration")
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
etienne-lms committed Nov 24, 2023
1 parent c7f9abc commit da2b96e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/arch/arm/plat-stm32mp1/plat_tzc400.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ static struct itr_handler tzc_itr_handler = {
};
DECLARE_KEEP_PAGER(tzc_itr_handler);

static bool tzc_region_is_non_secure(unsigned int i, vaddr_t base, size_t size)
static bool tzc_region_is_non_secure(unsigned int i, uint64_t pa, size_t size)
{
struct tzc_region_config region_cfg = { };
uint32_t ns_cpu_mask = TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_A7_ID);
uint32_t filters_mask = TZC_FILTERS_MASK;
vaddr_t base = pa;

if (tzc_get_region_config(i, &region_cfg))
panic();
Expand Down

0 comments on commit da2b96e

Please sign in to comment.