From 3180336943999674abe12b5fb4cc4bace6e29edb Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 16:52:35 +0200 Subject: fix(build): move FIRME_SUPPORT flags to Makefile For platforms not including bl31.mk, especially Armv7/aarch32 platforms, The flags FIRME_SUPPORT and FIRME_SUPPORT_IDE_KM will not be defined (to 0), which causes a build warning, as FIRME_SUPPORT_IDE_KM is used in a common file (include/plat/common/platform.h). The behavior does not change as the default values for those flags are 0 (in default.mk). Change-Id: Ibce324db896943e249220246bb41d4fb34af8d02 Signed-off-by: Yann Gautier --- Makefile | 4 ++++ bl31/bl31.mk | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0e6209618..d8fdad14f 100644 --- a/Makefile +++ b/Makefile @@ -668,6 +668,8 @@ $(call assert_booleans,\ TEST_IO_SHORT_READ_FI \ SDEI_SUPPORT \ SMC_PCI_SUPPORT \ + FIRME_SUPPORT \ + FIRME_SUPPORT_IDE_KM \ )) # Numeric_Flags @@ -960,6 +962,8 @@ $(call add_defines,\ SDEI_SUPPORT \ USE_GIC_DRIVER \ SMC_PCI_SUPPORT \ + FIRME_SUPPORT \ + FIRME_SUPPORT_IDE_KM \ )) ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1) diff --git a/bl31/bl31.mk b/bl31/bl31.mk index 781f3025e..f8dded08d 100644 --- a/bl31/bl31.mk +++ b/bl31/bl31.mk @@ -250,8 +250,6 @@ $(call assert_booleans,\ CRASH_REPORTING \ DSU_PDL2_SUPPORT \ EL3_EXCEPTION_HANDLING \ - FIRME_SUPPORT \ - FIRME_SUPPORT_IDE_KM \ USE_DSU_DRIVER \ )) @@ -267,6 +265,4 @@ $(call add_defines,\ DSU_PDL2_SUPPORT \ EL3_EXCEPTION_HANDLING \ USE_DSU_DRIVER \ - FIRME_SUPPORT \ - FIRME_SUPPORT_IDE_KM \ )) -- cgit v1.2.3 From a6d10d2c521fb0614869866f2f6782fb5c3bb5a0 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 18:01:08 +0200 Subject: fix(libc): define __BSD_VISIBLE to 0 This is defined (under conditions) in sys/cdefs.h, but the file is never used, we have a cdefs.h in include/lib/libc instead. As the flag is not used, and can cause compilation warning when including endian.h, define it to 0 in the cdefs.h file we use. Change-Id: I049f6ed9d584c33082882f5937a8a858cae93466 Signed-off-by: Yann Gautier --- include/lib/libc/cdefs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/lib/libc/cdefs.h b/include/lib/libc/cdefs.h index ecedb264c..1c708b3cf 100644 --- a/include/lib/libc/cdefs.h +++ b/include/lib/libc/cdefs.h @@ -55,4 +55,6 @@ #define __predict_true(exp) (exp) #define __predict_false(exp) (exp) +#define __BSD_VISIBLE 0 + #endif /* CDEFS_H */ -- cgit v1.2.3 From 01255a389631d75202efdbbf6867056b866dc8df Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 18:51:14 +0200 Subject: fix(io): correct SIZE_MAX management Checking if the size or offset is above SIZE_MAX in the different io files makes sense only for aarch32 platforms where SIZE_MAX is an u32. On aarch64 system, this cannot happen as SIZE_MAX is the max of an u64. And it triggers a warning, for example with clang: drivers/io/io_block.c:199:16: error: result of comparison 'unsigned long long' > 18446744073709551615 is always false [-Werror,-Wtautological-type-limit-compare] 199 | if (cur->size > (unsigned long long)SIZE_MAX) { | ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ However, the check on offset + size should be changed to an overflow check with check_u64_overflow() for aarch64 platforms. That was already the goal of `(offset + size < offset)` so replace it. Change-Id: I76391ac86ddb2ab359b5401e6c776c3995c55ce3 Signed-off-by: Yann Gautier --- drivers/io/io_block.c | 3 +++ drivers/io/io_fip.c | 8 ++++++-- drivers/io/io_mtd.c | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/io/io_block.c b/drivers/io/io_block.c index ea7512272..db8eaba9a 100644 --- a/drivers/io/io_block.c +++ b/drivers/io/io_block.c @@ -196,9 +196,12 @@ static int block_len(io_entity_t *entity, size_t *length) assert(length != NULL); cur = (block_dev_state_t *)entity->info; + +#ifndef __aarch64__ if (cur->size > (unsigned long long)SIZE_MAX) { return -EINVAL; } +#endif *length = (size_t)cur->size; return 0; diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c index f06e98a2f..c70d435c1 100644 --- a/drivers/io/io_fip.c +++ b/drivers/io/io_fip.c @@ -405,11 +405,15 @@ static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec, if ((size == 0U) || (offset >= fip_size64) || (size > fip_size64) || - (offset + size < offset) || (offset + size > fip_size64) || +#ifdef __aarch64__ + check_u64_overflow(offset, size) +#else (offset > (uint64_t)SIZE_MAX) || (size > (uint64_t)SIZE_MAX) || - (offset + size > (uint64_t)SIZE_MAX)) { + (offset + size > (uint64_t)SIZE_MAX) +#endif + ) { ERROR("FIP entry bounds invalid\n"); result = -EINVAL; goto fip_file_open_close; diff --git a/drivers/io/io_mtd.c b/drivers/io/io_mtd.c index abf0d3498..73418fe92 100644 --- a/drivers/io/io_mtd.c +++ b/drivers/io/io_mtd.c @@ -211,9 +211,12 @@ static int mtd_len(io_entity_t *entity, size_t *length) assert(length != NULL); cur = (mtd_dev_state_t *)entity->info; + +#ifndef __aarch64__ if (cur->size > (unsigned long long)SIZE_MAX) { return -EINVAL; } +#endif *length = (size_t)cur->size; return 0; -- cgit v1.2.3 From f7ec061461e41a58c9abf60d4acc70ffa5b95f1e Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 1 Sep 2026 16:11:41 +0200 Subject: fix(scmi): remove scmi_msg_get_voltage_handler The function is not handled in scmi_process_message(), and there is no ID for this protocol. Remove it. This was seen when compiling with -Werror=missing-prototypes, there was an error: drivers/scmi-msg/entry.c:35:20: error: no previous prototype for 'scmi_msg_get_voltage_handler' [-Werror=missing-prototypes] 35 | scmi_msg_handler_t scmi_msg_get_voltage_handler(struct scmi_msg *msg __unused) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I4091c8a76a9a19968ffde230567c1ac5f1ad409e Signed-off-by: Yann Gautier --- drivers/scmi-msg/entry.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/scmi-msg/entry.c b/drivers/scmi-msg/entry.c index 5ac68e1e6..14db61c54 100644 --- a/drivers/scmi-msg/entry.c +++ b/drivers/scmi-msg/entry.c @@ -14,7 +14,6 @@ #pragma weak scmi_msg_get_clock_handler #pragma weak scmi_msg_get_rstd_handler #pragma weak scmi_msg_get_pd_handler -#pragma weak scmi_msg_get_voltage_handler #pragma weak scmi_msg_get_sensor_handler scmi_msg_handler_t scmi_msg_get_clock_handler(struct scmi_msg *msg __unused) @@ -32,11 +31,6 @@ scmi_msg_handler_t scmi_msg_get_pd_handler(struct scmi_msg *msg __unused) return NULL; } -scmi_msg_handler_t scmi_msg_get_voltage_handler(struct scmi_msg *msg __unused) -{ - return NULL; -} - scmi_msg_handler_t scmi_msg_get_sensor_handler(struct scmi_msg *msg __unused) { return NULL; -- cgit v1.2.3 From 04af9c91b343f0e4ff747b1aac6af1095a3c8a9c Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 1 Sep 2026 16:26:05 +0200 Subject: fix(el3-runtime): add some missing prototypes When compiling with -Werror=missing-prototypes, 2 functions are missing their prototypes in header file: handler_interrupt_exception() and handler_sync_exception(). Add them in runtime_svc.h. The stdint.h include is also added to context_el1.h, or else there are compilation errors for uint64_t being undefined. And it is moved before ENABLE_FEAT_D128 flag in sysreg128.h, as uint64_t is also used in the #else part. Change-Id: I88177af229430b19715557c39da64ae0780d43d4 Signed-off-by: Yann Gautier --- include/common/runtime_svc.h | 3 +++ include/lib/el3_runtime/context_el1.h | 2 ++ include/lib/extensions/sysreg128.h | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/common/runtime_svc.h b/include/common/runtime_svc.h index 26e8d6f28..0547adf2c 100644 --- a/include/common/runtime_svc.h +++ b/include/common/runtime_svc.h @@ -7,6 +7,7 @@ #ifndef RUNTIME_SVC_H #define RUNTIME_SVC_H +#include #include /* to include exception types */ #include #include @@ -125,6 +126,8 @@ static inline uint32_t get_unique_oen_from_smc_fid(uint32_t fid) /******************************************************************************* * Function & variable prototypes ******************************************************************************/ +void handler_interrupt_exception(cpu_context_t *ctx); +void handler_sync_exception(cpu_context_t *ctx); void runtime_svc_init(void); uintptr_t handle_runtime_svc(uint32_t smc_fid, void *cookie, void *handle, unsigned int flags); diff --git a/include/lib/el3_runtime/context_el1.h b/include/lib/el3_runtime/context_el1.h index f320d2c5f..3011f0c10 100644 --- a/include/lib/el3_runtime/context_el1.h +++ b/include/lib/el3_runtime/context_el1.h @@ -11,6 +11,8 @@ #ifndef __ASSEMBLER__ +#include + /******************************************************************************* * EL1 Registers: * AArch64 EL1 system register context structure for preserving the diff --git a/include/lib/extensions/sysreg128.h b/include/lib/extensions/sysreg128.h index 8854856b6..433633323 100644 --- a/include/lib/extensions/sysreg128.h +++ b/include/lib/extensions/sysreg128.h @@ -9,9 +9,9 @@ #ifndef __ASSEMBLER__ -#if ENABLE_FEAT_D128 #include +#if ENABLE_FEAT_D128 typedef uint128_t sysreg_t; #define PAR_EL1_D128 (((sysreg_t)(1ULL)) << (64)) -- cgit v1.2.3 From 172467a75e8b259e8493b51291cc92fd2c93e0dc Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 1 Sep 2026 17:32:55 +0200 Subject: fix(xlat): check definition of PLAT_XLAT_TABLES_DYNAMIC flag When enabling -Wundef, we can see this warning: include/lib/xlat_tables/xlat_tables_v2_helpers.h:81:5: error: 'PLAT_XLAT_TABLES_DYNAMIC' is not defined, evaluates to '0' [-Werror=undef] 81 | #if PLAT_XLAT_TABLES_DYNAMIC | ^~~~~~~~~~~~~~~~~~~~~~~~ As the flag can be defined either with `call add_defines`, or directly added to BL*_CFLAGS, the easier way to correct those warning is to first check the flag is defined and then that it is set, with: `#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC` Change-Id: Ifbd20161d90e3eab46352393760fb0c01d24785c Signed-off-by: Yann Gautier --- include/lib/xlat_tables/xlat_tables_v2.h | 2 +- include/lib/xlat_tables/xlat_tables_v2_helpers.h | 4 ++-- lib/xlat_tables_v2/xlat_tables_context.c | 4 ++-- lib/xlat_tables_v2/xlat_tables_core.c | 12 ++++++------ lib/xlat_tables_v2/xlat_tables_private.h | 2 +- lib/xlat_tables_v2/xlat_tables_utils.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h index 88c23e15b..d2c3a8c95 100644 --- a/include/lib/xlat_tables/xlat_tables_v2.h +++ b/include/lib/xlat_tables/xlat_tables_v2.h @@ -298,7 +298,7 @@ void mmap_add_region_alloc_va_ctx(xlat_ctx_t *ctx, mmap_region_t *mm); */ void mmap_add_alloc_va(mmap_region_t *mm); -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC /* * Add a dynamic region with defined base PA and base VA. This type of region * can be added and removed even after the translation tables are initialized. diff --git a/include/lib/xlat_tables/xlat_tables_v2_helpers.h b/include/lib/xlat_tables/xlat_tables_v2_helpers.h index 77277615f..8af1f9f70 100644 --- a/include/lib/xlat_tables/xlat_tables_v2_helpers.h +++ b/include/lib/xlat_tables/xlat_tables_v2_helpers.h @@ -78,7 +78,7 @@ struct xlat_ctx { * Keep track of how many regions are mapped in each table. The base * table can't be unmapped so it isn't needed to keep track of it. */ -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC int *tables_mapped_regions; #endif /* PLAT_XLAT_TABLES_DYNAMIC */ @@ -112,7 +112,7 @@ struct xlat_ctx { int xlat_regime; }; -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC #define XLAT_ALLOC_DYNMAP_STRUCT(_ctx_name, _xlat_tables_count) \ static int _ctx_name##_mapped_regions[_xlat_tables_count]; diff --git a/lib/xlat_tables_v2/xlat_tables_context.c b/lib/xlat_tables_v2/xlat_tables_context.c index a648dd97a..56166988b 100644 --- a/lib/xlat_tables_v2/xlat_tables_context.c +++ b/lib/xlat_tables_v2/xlat_tables_context.c @@ -60,7 +60,7 @@ void mmap_add_alloc_va(mmap_region_t *mm) } } -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va, size_t size, unsigned int attr) @@ -207,7 +207,7 @@ int xlat_make_tables_readonly(void) * region. Therefore, in this case we have to assume that the whole address * space size might be mapped. */ -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC #define MAX_PHYS_ADDR tf_xlat_ctx.pa_max_address #else #define MAX_PHYS_ADDR tf_xlat_ctx.max_pa diff --git a/lib/xlat_tables_v2/xlat_tables_core.c b/lib/xlat_tables_v2/xlat_tables_core.c index 023b7c890..c36bfbdd2 100644 --- a/lib/xlat_tables_v2/xlat_tables_core.c +++ b/lib/xlat_tables_v2/xlat_tables_core.c @@ -30,7 +30,7 @@ static inline __attribute__((unused)) void xlat_clean_dcache_range(uintptr_t add } } -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC /* * The following functions assume that they will be called using subtables only. @@ -290,7 +290,7 @@ static inline unsigned int xlat_tables_va_to_index(const uintptr_t table_base_v return (unsigned int)((va - table_base_va) >> XLAT_ADDR_SHIFT(level)); } -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC /* * From the given arguments, it decides which action to take when unmapping the @@ -608,7 +608,7 @@ static uintptr_t xlat_tables_map_region(xlat_ctx_t *ctx, mmap_region_t *mm, table_idx_va = xlat_tables_find_start_va(mm, table_base_va, level); table_idx = xlat_tables_va_to_index(table_base_va, table_idx_va, level); -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC if (level > ctx->base_level) xlat_table_inc_regions_count(ctx, table_base); #endif @@ -768,7 +768,7 @@ static int mmap_add_region_check(const xlat_ctx_t *ctx, const mmap_region_t *mm) */ if (fully_overlapped_va) { -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC if (((mm->attr & MT_DYNAMIC) != 0U) || ((mm_cursor->attr & MT_DYNAMIC) != 0U)) { return -EPERM; @@ -989,7 +989,7 @@ void mmap_add_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm) } } -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC int mmap_add_dynamic_region_ctx(xlat_ctx_t *ctx, mmap_region_t *mm) { @@ -1248,7 +1248,7 @@ void __init init_xlat_tables_ctx(xlat_ctx_t *ctx) /* All tables must be zeroed before mapping any region. */ zeromem(ctx->base_table, ctx->base_table_entries * sizeof(uint64_t)); -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC zeromem(ctx->tables_mapped_regions, ctx->tables_num * sizeof(uint32_t)); #endif for (int i = 0; i < ctx->tables_num; i++) { diff --git a/lib/xlat_tables_v2/xlat_tables_private.h b/lib/xlat_tables_v2/xlat_tables_private.h index 4bfe73b29..920e263b6 100644 --- a/lib/xlat_tables_v2/xlat_tables_private.h +++ b/lib/xlat_tables_v2/xlat_tables_private.h @@ -13,7 +13,7 @@ #include -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC /* * Private shifts and masks to access fields of an mmap attribute */ diff --git a/lib/xlat_tables_v2/xlat_tables_utils.c b/lib/xlat_tables_v2/xlat_tables_utils.c index 582019071..8153297b5 100644 --- a/lib/xlat_tables_v2/xlat_tables_utils.c +++ b/lib/xlat_tables_v2/xlat_tables_utils.c @@ -270,7 +270,7 @@ void xlat_tables_print(xlat_ctx_t *ctx) VERBOSE(" Entries @initial lookup level: %u\n", ctx->base_table_entries); -#if PLAT_XLAT_TABLES_DYNAMIC +#if defined(PLAT_XLAT_TABLES_DYNAMIC) && PLAT_XLAT_TABLES_DYNAMIC used_page_tables = 0; for (int i = 0; i < ctx->tables_num; ++i) { if (ctx->tables_mapped_regions[i] != 0) -- cgit v1.2.3 From d93e24fe519db1337438687cf3c4b1451b10b90d Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 15:07:15 +0200 Subject: refactor(st-clock): remove STM32MP_M33_TDCID flag The feature is not yet upstream'ed and causes build warnings when we enable -Wundef flag. Remove the flag from the clock file. It will be re-introduced when the M33_TDCID feature is sent upstream. Change-Id: Ifdff16d8b783c72e24fe4c7e56ffa811185d0161 Signed-off-by: Yann Gautier --- drivers/st/clk/clk-stm32mp2.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/st/clk/clk-stm32mp2.c b/drivers/st/clk/clk-stm32mp2.c index f34739ae9..a91389b21 100644 --- a/drivers/st/clk/clk-stm32mp2.c +++ b/drivers/st/clk/clk-stm32mp2.c @@ -711,7 +711,6 @@ static const char *clk_stm32_get_oscillator_name(enum stm32_osc id) return NULL; } -#if !STM32MP_M33_TDCID static void clk_oscillator_set_bypass(struct stm32_clk_priv *priv, int id, bool digbyp, bool bypass) { @@ -801,7 +800,6 @@ static int clk_oscillator_wait_ready_on(struct stm32_clk_priv *priv, int id) { return clk_oscillator_wait_ready(priv, id, true); } -#endif /* !STM32MP_M33_TDCID */ #endif /* IMAGE_BL2 */ static unsigned long clk_stm32_osc_recalc_rate(struct stm32_clk_priv *priv, @@ -910,10 +908,8 @@ static void clk_stm32_osc_init(struct stm32_clk_priv *priv, int id) static struct stm32_clk_ops clk_stm32_osc_ops = { .recalc_rate = clk_stm32_osc_recalc_rate, .is_enabled = clk_stm32_osc_gate_is_enabled, -#if !STM32MP_M33_TDCID .enable = clk_stm32_osc_gate_enable, .disable = clk_stm32_osc_gate_disable, -#endif .init = clk_stm32_osc_init, }; -- cgit v1.2.3 From 0a1039ed324018164166360b05da6274fbe4e0a6 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 18:33:38 +0200 Subject: fix(stm32mp1): manage all flags for PKA algos PKA_USE_BRAINPOOL_P256R1 and PKA_USE_NIST_P521 were not defined in platform.mk, leading to compilation warnings with -Wundef. Add them in add_defines macro, but disabled. Change-Id: I43622b3b72f1a9b6348f9f04863a7ca55edd7d82 Signed-off-by: Yann Gautier --- plat/st/stm32mp1/platform.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk index 1f2318738..2e13aabf1 100644 --- a/plat/st/stm32mp1/platform.mk +++ b/plat/st/stm32mp1/platform.mk @@ -88,6 +88,8 @@ endif endif PKA_USE_NIST_P256 ?= 0 +PKA_USE_NIST_P521 ?= 0 +PKA_USE_BRAINPOOL_P256R1 ?= 0 PKA_USE_BRAINPOOL_P256T1 ?= 0 # Disable Neon support: runtime may conflict with non-secure world @@ -159,8 +161,10 @@ endif # Enable flags for C files $(call assert_booleans,\ $(sort \ + PKA_USE_BRAINPOOL_P256R1 \ PKA_USE_BRAINPOOL_P256T1 \ PKA_USE_NIST_P256 \ + PKA_USE_NIST_P521 \ STM32MP_CRYPTO_ROM_LIB \ STM32MP_DDR_32BIT_INTERFACE \ STM32MP_DDR_DUAL_AXI_PORT \ @@ -189,8 +193,10 @@ $(call assert_numerics,\ $(call add_defines,\ $(sort \ DWL_BUFFER_BASE \ + PKA_USE_BRAINPOOL_P256R1 \ PKA_USE_BRAINPOOL_P256T1 \ PKA_USE_NIST_P256 \ + PKA_USE_NIST_P521 \ PLAT_PARTITION_MAX_ENTRIES \ PLAT_TBBR_IMG_DEF \ STM32_HASH_VER \ -- cgit v1.2.3 From 981664bcfa7de642c94870774fb394eb08706829 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Wed, 2 Sep 2026 09:28:24 +0200 Subject: fix(st): staticize verify_signature The verify_signature() used for STM32MP15 was not set as static, which was triggering a warning with -Wmissing-prototypes. Make it static, like the function used for STM32MP13 and STM32MP2x family. Change-Id: I4c73debda817f0888ae196ebf3ef3d699ce83f63 Signed-off-by: Yann Gautier --- plat/st/common/stm32mp_crypto_lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plat/st/common/stm32mp_crypto_lib.c b/plat/st/common/stm32mp_crypto_lib.c index 6c70b50f9..36945727a 100644 --- a/plat/st/common/stm32mp_crypto_lib.c +++ b/plat/st/common/stm32mp_crypto_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024, STMicroelectronics - All Rights Reserved + * Copyright (c) 2022-2026, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause */ @@ -141,8 +141,8 @@ static int get_plain_pk_from_asn1(void *pk_ptr, unsigned int pk_len, void **plai } #if STM32MP_CRYPTO_ROM_LIB -uint32_t verify_signature(uint8_t *hash_in, uint8_t *pubkey_in, - uint8_t *signature, uint32_t ecc_algo) +static uint32_t verify_signature(uint8_t *hash_in, uint8_t *pubkey_in, + uint8_t *signature, uint32_t ecc_algo) { int ret; -- cgit v1.2.3 From 7d46d400c74f7a1844cd0ee8cc1f4a30be0b9f86 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Wed, 2 Sep 2026 09:33:43 +0200 Subject: fix(st-usb): staticize dwc3_dev_init The function dwc3_dev_init() is only used in usb_dwc3.c file, and it triggers a warning with -Wmissing-prototypes. Make it static. Change-Id: Iaa2152a5b39e70cc69b2cecfa94a86010162454a Signed-off-by: Yann Gautier --- drivers/st/usb_dwc3/usb_dwc3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/st/usb_dwc3/usb_dwc3.c b/drivers/st/usb_dwc3/usb_dwc3.c index d6f2bbcac..110e34bfa 100644 --- a/drivers/st/usb_dwc3/usb_dwc3.c +++ b/drivers/st/usb_dwc3/usb_dwc3.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2025, STMicroelectronics - All Rights Reserved + * Copyright (c) 2015-2026, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause */ @@ -2173,7 +2173,7 @@ static enum usb_status dwc3_set_dev_speed(dwc3_handle_t *dwc3_handle, uint8_t sp * the configuration information for the specified USBx peripheral. * @retval HAL status */ -enum usb_status dwc3_dev_init(dwc3_handle_t *dwc3_handle, uint8_t speed, uint8_t intr_dev) +static enum usb_status dwc3_dev_init(dwc3_handle_t *dwc3_handle, uint8_t speed, uint8_t intr_dev) { uint32_t reg; uint8_t i; -- cgit v1.2.3 From c2086457307204726be11ab4cbe55cb5013ea569 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 14:27:12 +0200 Subject: feat(build): introduce BL_FLAGS This flag is only used by MAKE_C macro, and won't be propageted to other targets like MAKE_C_LIB. This allows handling -Wundef flag, that we want to enable but that is known to bring warnings with some libs (zlib or compiler-rt). Change-Id: I44591e4b9bcfe9803253585cc51ab6a3f5d0e036 Signed-off-by: Yann Gautier --- make_helpers/build_macros.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index f52427ddd..033e7242e 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -407,7 +407,7 @@ $(eval BL_CFLAGS := $($(4)_CFLAGS)) $(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | $$$$(@D)/ $(BL_INCLUDE_DIRS:%=%/) $$(s)echo " CC $$<" - $$(q)$($(ARCH)-cc) $$(LTO_CFLAGS) $$(TF_CFLAGS) $(BL_CPPFLAGS) $(BL_CFLAGS) $(call MAKE_DEP,$(DEP),$(OBJ)) -c $$< -o $$@ + $$(q)$($(ARCH)-cc) $$(LTO_CFLAGS) $$(TF_CFLAGS) $(BL_CPPFLAGS) $(BL_CFLAGS) $$(BL_FLAGS) $(call MAKE_DEP,$(DEP),$(OBJ)) -c $$< -o $$@ -include $(DEP) -- cgit v1.2.3 From 77f2dfc38a9d26809c0656e726d2e7511a5de559 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Wed, 24 Jun 2026 19:54:14 +0200 Subject: refactor(compiler-rt): move compiler_rt to a lib This allows a dedicated build, and avoid BL_FLAGS compilation flags. The code size does not increase, it has been checked on ST platforms: STM32MP13 and STM32MP25. Change-Id: I5ff3c40222770400a97dd4d451aeebc26fef4f2a Signed-off-by: Yann Gautier --- Makefile | 11 +++++++---- lib/compiler-rt/compiler-rt.mk | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d8fdad14f..67defe4d1 100644 --- a/Makefile +++ b/Makefile @@ -169,8 +169,6 @@ endif ################################################################################ # Common sources and include directories ################################################################################ -include lib/compiler-rt/compiler-rt.mk - # Allow overriding the timestamp, for example for reproducible builds, or to # synchronize timestamps across multiple projects. # This must be set to a C string (including quotes where applicable). @@ -191,8 +189,7 @@ BL_COMMON_SOURCES += common/bl_common.c \ plat/common/plat_bl_common.c \ plat/common/plat_log_common.c \ plat/common/${ARCH}/plat_common.c \ - plat/common/${ARCH}/platform_helpers.S \ - ${COMPILER_RT_SRCS} + plat/common/${ARCH}/platform_helpers.S ifeq ($($(ARCH)-cc-id),arm-clang) BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S @@ -1016,6 +1013,12 @@ endif #(SPD) ################################################################################ include ${MAKE_HELPERS_DIRECTORY}cflags.mk +################################################################################ +# Include compiler-rt. It is built with MAKE_LIB so it must be included after +# some macros are defined, especially BUILD_PLAT +################################################################################ +include lib/compiler-rt/compiler-rt.mk + ################################################################################ # Build targets ################################################################################ diff --git a/lib/compiler-rt/compiler-rt.mk b/lib/compiler-rt/compiler-rt.mk index 2b16504bf..0f9abde53 100644 --- a/lib/compiler-rt/compiler-rt.mk +++ b/lib/compiler-rt/compiler-rt.mk @@ -28,11 +28,11 @@ # POSSIBILITY OF SUCH DAMAGE. # -COMPILER_RT_SRCS := lib/compiler-rt/builtins/popcountdi2.c \ +LIBCOMPILER_RT_SRCS := lib/compiler-rt/builtins/popcountdi2.c \ lib/compiler-rt/builtins/popcountsi2.c ifeq (${ARCH},aarch32) -COMPILER_RT_SRCS += lib/compiler-rt/builtins/arm/aeabi_ldivmod.S \ +LIBCOMPILER_RT_SRCS += lib/compiler-rt/builtins/arm/aeabi_ldivmod.S \ lib/compiler-rt/builtins/arm/aeabi_uldivmod.S \ lib/compiler-rt/builtins/arm/aeabi_memcpy.S \ lib/compiler-rt/builtins/arm/aeabi_memset.S \ @@ -42,3 +42,5 @@ COMPILER_RT_SRCS += lib/compiler-rt/builtins/arm/aeabi_ldivmod.S \ lib/compiler-rt/builtins/lshrdi3.c \ lib/compiler-rt/builtins/udivmoddi4.c endif + +$(eval $(call MAKE_LIB,compiler_rt)) -- cgit v1.2.3 From dd82fce0866b0a0ebc5129b5f23ff39a7e2121a9 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Wed, 24 Jun 2026 20:06:10 +0200 Subject: refactor(zlib): move zlib to a lib This allows a dedicated build, and adding compilation flags. The code size does not increase, it has been checked on ST platforms: STM32MP13 and STM32MP25. And the flags -DZ_SOLO -DDEF_WBITS=31 are now dedicated to zlib. Change-Id: I38509b94c0dbcdf46d4b2fb8a4f7ff0e839bc482 Signed-off-by: Yann Gautier --- lib/zlib/zlib.mk | 8 ++++---- plat/altera/soc/agilex3/platform.mk | 1 - plat/hisilicon/hikey/platform.mk | 1 - plat/hisilicon/hikey960/platform.mk | 1 - plat/intel/soc/agilex/platform.mk | 1 - plat/intel/soc/agilex5/platform.mk | 1 - plat/intel/soc/stratix10/platform.mk | 1 - plat/renesas/rcar/platform.mk | 3 +-- plat/rockchip/rv1126b/platform.mk | 1 - plat/socionext/uniphier/platform.mk | 3 +-- plat/st/common/common.mk | 1 - 11 files changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/zlib/zlib.mk b/lib/zlib/zlib.mk index a8937a776..9c0458fad 100644 --- a/lib/zlib/zlib.mk +++ b/lib/zlib/zlib.mk @@ -7,7 +7,7 @@ ZLIB_PATH := lib/zlib # Imported from zlib 1.2.11 (do not modify them) -ZLIB_SOURCES := $(addprefix $(ZLIB_PATH)/, \ +LIBZLIB_SRCS := $(addprefix $(ZLIB_PATH)/, \ adler32.c \ crc32.c \ inffast.c \ @@ -16,10 +16,10 @@ ZLIB_SOURCES := $(addprefix $(ZLIB_PATH)/, \ zutil.c) # Implemented for TF -ZLIB_SOURCES += $(addprefix $(ZLIB_PATH)/, \ +LIBZLIB_SRCS += $(addprefix $(ZLIB_PATH)/, \ tf_gunzip.c) INCLUDES += -Iinclude/lib/zlib -# REVISIT: the following flags need not be given globally -TF_CFLAGS += -DZ_SOLO -DDEF_WBITS=31 +LIBZLIB_CFLAGS := -DZ_SOLO -DDEF_WBITS=31 +$(eval $(call MAKE_LIB,zlib)) diff --git a/plat/altera/soc/agilex3/platform.mk b/plat/altera/soc/agilex3/platform.mk index a4b3c175e..2c977cee3 100644 --- a/plat/altera/soc/agilex3/platform.mk +++ b/plat/altera/soc/agilex3/platform.mk @@ -83,7 +83,6 @@ BL2_SOURCES += \ include lib/zlib/zlib.mk PLAT_INCLUDES += -Ilib/zlib -BL2_SOURCES += $(ZLIB_SOURCES) BL31_SOURCES += \ drivers/arm/cci/cci.c \ diff --git a/plat/hisilicon/hikey/platform.mk b/plat/hisilicon/hikey/platform.mk index 0b919e566..8d1ed2793 100644 --- a/plat/hisilicon/hikey/platform.mk +++ b/plat/hisilicon/hikey/platform.mk @@ -97,7 +97,6 @@ endif include lib/zlib/zlib.mk PLAT_INCLUDES += -Ilib/zlib -BL2_SOURCES += $(ZLIB_SOURCES) HIKEY_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ drivers/arm/gic/v2/gicv2_main.c \ diff --git a/plat/hisilicon/hikey960/platform.mk b/plat/hisilicon/hikey960/platform.mk index 286a01d55..dcdade389 100644 --- a/plat/hisilicon/hikey960/platform.mk +++ b/plat/hisilicon/hikey960/platform.mk @@ -97,7 +97,6 @@ endif include lib/zlib/zlib.mk PLAT_INCLUDES += -Ilib/zlib -BL2_SOURCES += $(ZLIB_SOURCES) BL31_SOURCES += drivers/arm/cci/cci.c \ drivers/arm/pl061/pl061_gpio.c \ diff --git a/plat/intel/soc/agilex/platform.mk b/plat/intel/soc/agilex/platform.mk index ff3f382cb..136be4a82 100644 --- a/plat/intel/soc/agilex/platform.mk +++ b/plat/intel/soc/agilex/platform.mk @@ -65,7 +65,6 @@ BL2_SOURCES += \ include lib/zlib/zlib.mk PLAT_INCLUDES += -Ilib/zlib -BL2_SOURCES += $(ZLIB_SOURCES) BL31_SOURCES += \ drivers/arm/cci/cci.c \ diff --git a/plat/intel/soc/agilex5/platform.mk b/plat/intel/soc/agilex5/platform.mk index 3a3f2167f..94d68ea09 100644 --- a/plat/intel/soc/agilex5/platform.mk +++ b/plat/intel/soc/agilex5/platform.mk @@ -83,7 +83,6 @@ BL2_SOURCES += \ include lib/zlib/zlib.mk PLAT_INCLUDES += -Ilib/zlib -BL2_SOURCES += $(ZLIB_SOURCES) BL31_SOURCES += \ drivers/arm/cci/cci.c \ diff --git a/plat/intel/soc/stratix10/platform.mk b/plat/intel/soc/stratix10/platform.mk index 6f459b1fb..d1bf35e98 100644 --- a/plat/intel/soc/stratix10/platform.mk +++ b/plat/intel/soc/stratix10/platform.mk @@ -61,7 +61,6 @@ BL2_SOURCES += \ include lib/zlib/zlib.mk PLAT_INCLUDES += -Ilib/zlib -BL2_SOURCES += $(ZLIB_SOURCES) BL31_SOURCES += \ drivers/arm/cci/cci.c \ diff --git a/plat/renesas/rcar/platform.mk b/plat/renesas/rcar/platform.mk index cbee73b3d..f068ea54d 100644 --- a/plat/renesas/rcar/platform.mk +++ b/plat/renesas/rcar/platform.mk @@ -366,8 +366,7 @@ BL2_SOURCES += plat/renesas/rcar/bl2_plat_setup.c \ ifeq (${RCAR_GEN3_BL33_GZIP},1) include lib/zlib/zlib.mk -BL2_SOURCES += common/image_decompress.c \ - $(ZLIB_SOURCES) +BL2_SOURCES += common/image_decompress.c endif ifneq (${ENABLE_STACK_PROTECTOR},0) diff --git a/plat/rockchip/rv1126b/platform.mk b/plat/rockchip/rv1126b/platform.mk index 46bb5e6b2..41efa2422 100644 --- a/plat/rockchip/rv1126b/platform.mk +++ b/plat/rockchip/rv1126b/platform.mk @@ -70,7 +70,6 @@ BL31_SOURCES += ${RK_GIC_SOURCES} \ drivers/scmi-msg/smt.c \ lib/cpus/aarch64/cortex_a53.S \ $(LIBFDT_SRCS) \ - $(ZLIB_SOURCES) \ ${RK_PLAT_COMMON}/aarch64/plat_helpers.S \ ${RK_PLAT_COMMON}/aarch64/platform_common.c \ ${RK_PLAT_COMMON}/bl31_plat_setup.c \ diff --git a/plat/socionext/uniphier/platform.mk b/plat/socionext/uniphier/platform.mk index 4c12f725d..bac768542 100644 --- a/plat/socionext/uniphier/platform.mk +++ b/plat/socionext/uniphier/platform.mk @@ -121,8 +121,7 @@ ifeq (${FIP_GZIP},1) include lib/zlib/zlib.mk -BL2_SOURCES += common/image_decompress.c \ - $(ZLIB_SOURCES) +BL2_SOURCES += common/image_decompress.c $(eval $(call add_define,UNIPHIER_DECOMPRESS_GZIP)) diff --git a/plat/st/common/common.mk b/plat/st/common/common.mk index 454f35b10..7d6333364 100644 --- a/plat/st/common/common.mk +++ b/plat/st/common/common.mk @@ -198,7 +198,6 @@ PLAT_BL_COMMON_SOURCES += drivers/clk/clk.c \ plat/st/common/stm32mp_dt.c BL2_SOURCES += ${FCONF_SOURCES} ${FCONF_DYN_SOURCES} -BL2_SOURCES += $(ZLIB_SOURCES) BL2_SOURCES += drivers/io/io_fip.c \ plat/st/common/bl2_io_storage.c \ -- cgit v1.2.3 From ccb3eb9aefd8b2f6d762366c4c7ba0a2e81b720e Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Fri, 28 Aug 2026 14:33:03 +0200 Subject: feat(build): enable -Wundef for C files if W >= 1 Add -Wundef to BL_FLAGS. This will then be enabled for all TF-A C files through MAKE_C macro, but not for libs. This flag is enabled only when W is defined in the build command line and greater or equal to 1. Change-Id: I6c327584b1e1bb0e1eb59c774a6c6a6788139b99 Signed-off-by: Yann Gautier --- make_helpers/cflags.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/make_helpers/cflags.mk b/make_helpers/cflags.mk index 3aacd4659..d00c8e17d 100644 --- a/make_helpers/cflags.mk +++ b/make_helpers/cflags.mk @@ -52,8 +52,6 @@ WARNING2 := $(WARNING1) WARNING2 += -Wold-style-definition WARNING2 += -Wmissing-prototypes WARNING2 += -Wmissing-format-attribute -# TF-A aims to comply with this eventually. Effort too large at present -WARNING2 += -Wundef # currently very involved and many platforms set this off WARNING2 += -Wunused-const-variable=2 @@ -69,6 +67,15 @@ WARNING3 += -Wpacked WARNING3 += -Wpointer-arith WARNING3 += -Wswitch-default +# The -Wundef cannot be easily handled through warning flags. +# This would bring warning for libs (compiler-rt, zlib). +# Instead add it to BL_FLAGS that is only used by MAKE_C macro. +# TODO: remove the W=1 check for -Wundef when all the related warnings +# are corrected. +ifeq ($(shell test $(W) -ge 1 && echo true),true) +BL_FLAGS += -Wundef +endif + cflags-common += $(WARNING$(W)) ifneq (${E},0) cflags-common += -Werror -- cgit v1.2.3 From d7135a7214e49c6364ba518cdac343aa595a8db8 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Tue, 1 Sep 2026 18:55:25 +0200 Subject: feat(st): enable some warning flags Enable -Wundef, -Wold-style-definition and -Wmissing-prototypes. They should be enabled globally, but there is too much work for the time being. At least having them enabled for a platform should avoid having new instances of those warnings. Change-Id: I716e05392972d2297d86aa3383678af7a9edeb45 Signed-off-by: Yann Gautier --- plat/st/common/common.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plat/st/common/common.mk b/plat/st/common/common.mk index 7d6333364..9c4976d93 100644 --- a/plat/st/common/common.mk +++ b/plat/st/common/common.mk @@ -32,6 +32,11 @@ ifeq ($(findstring clang,$(notdir $(CC))),) TF_CFLAGS += -Wformat-signedness endif +# TODO: those flags should be removed from here when they are enabled in cflags.mk +BL_FLAGS += -Wundef +BL_FLAGS += -Wold-style-definition +BL_FLAGS += -Wmissing-prototypes + # Boot devices STM32MP_EMMC ?= 0 STM32MP_SDMMC ?= 0 -- cgit v1.2.3