]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(gic): wrap cache enabled assert under plat_can_cmo
authorChannagoud kadabi <kadabi@google.com>
Wed, 30 Nov 2022 00:03:47 +0000 (16:03 -0800)
committerkadabi <kadabi@google.com>
Mon, 12 Dec 2022 18:33:40 +0000 (20:33 +0200)
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 <kadabi@google.com>
Change-Id: I80153df493d1ec9e5e354c7c2e6a14322d22c446

drivers/arm/gic/v3/gicv3_main.c
include/plat/common/platform.h

index bc93f9315a2e6c42038d57298f3138c441ac9d97..f6c251df9e9518d1fa0f6a035292f5fede0c286e 100644 (file)
@@ -12,6 +12,7 @@
 #include <common/interrupt_props.h>
 #include <drivers/arm/gicv3.h>
 #include <lib/spinlock.h>
+#include <plat/common/platform.h>
 
 #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;
index 8407bbda820aea9f269d37496061b5ef210c2caf..3351036128ecc4da9ed30a958fe25771f14aa5d9 100644 (file)
@@ -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 */