From 78fbb0ec8372a638b2b2a0276776892141ff43f8 Mon Sep 17 00:00:00 2001 From: Channagoud kadabi Date: Tue, 29 Nov 2022 16:03:47 -0800 Subject: [PATCH] fix(gic): wrap cache enabled assert under plat_can_cmo with reference to feature 04c730 (feat(cpus): make cache ops conditional), booting with caches in debug recovery means SCTLR_C_BIT will be 0. Wrap the assert for the d-cache enabled check in CONDITIONAL_CMO and plat_can_cmo calls to allow booting with d-cache disabled. Signed-off-by: Channagoud kadabi Change-Id: I80153df493d1ec9e5e354c7c2e6a14322d22c446 --- drivers/arm/gic/v3/gicv3_main.c | 7 +++++-- include/plat/common/platform.h | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/arm/gic/v3/gicv3_main.c b/drivers/arm/gic/v3/gicv3_main.c index bc93f9315..f6c251df9 100644 --- a/drivers/arm/gic/v3/gicv3_main.c +++ b/drivers/arm/gic/v3/gicv3_main.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "gicv3_private.h" @@ -1287,12 +1288,14 @@ int gicv3_rdistif_probe(const uintptr_t gicr_frame) assert(gicv3_driver_data->gicr_base == 0U); + if (plat_can_cmo()) { /* Ensure this function is called with Data Cache enabled */ #ifndef __aarch64__ - assert((read_sctlr() & SCTLR_C_BIT) != 0U); + assert((read_sctlr() & SCTLR_C_BIT) != 0U); #else - assert((read_sctlr_el3() & SCTLR_C_BIT) != 0U); + assert((read_sctlr_el3() & SCTLR_C_BIT) != 0U); #endif /* !__aarch64__ */ + } mpidr_self = read_mpidr_el1() & MPIDR_AFFINITY_MASK; rdistif_base = gicr_frame; diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index 8407bbda8..335103612 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -421,4 +421,17 @@ int plat_fwu_set_metadata_image_source(unsigned int image_id, void plat_fwu_set_images_source(const struct fwu_metadata *metadata); uint32_t plat_fwu_get_boot_idx(void); +/* + * Optional function to indicate if cache management operations can be + * performed. + */ +#if CONDITIONAL_CMO +uint64_t plat_can_cmo(void); +#else +static inline uint64_t plat_can_cmo(void) +{ + return 1; +} +#endif /* CONDITIONAL_CMO */ + #endif /* PLATFORM_H */ -- 2.39.5