[rtems commit] bsps/arm: Workaround for Errata 845369

Sebastian Huber sebh at rtems.org
Fri Oct 16 04:48:22 UTC 2020


Module:    rtems
Branch:    5
Commit:    3d7da43562d83faf93f9a3827408d2a13a3658d3
Changeset: http://git.rtems.org/rtems/commit/?id=3d7da43562d83faf93f9a3827408d2a13a3658d3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Oct  2 11:36:20 2020 +0200

bsps/arm: Workaround for Errata 845369

Add a workaround for Cortex-A9 Errata 845369: Under Very Rare Timing
Circumstances Transition into Streaming Mode Might Create Data Corruption.

Update #4114.

---

 bsps/arm/include/bsp/arm-a9mpcore-start.h      | 15 ++++++++++++
 cpukit/score/cpu/arm/include/libcpu/arm-cp15.h | 32 ++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/bsps/arm/include/bsp/arm-a9mpcore-start.h b/bsps/arm/include/bsp/arm-a9mpcore-start.h
index 8423e64..83c84f1 100644
--- a/bsps/arm/include/bsp/arm-a9mpcore-start.h
+++ b/bsps/arm/include/bsp/arm-a9mpcore-start.h
@@ -123,6 +123,20 @@ arm_a9mpcore_start_enable_smp_in_auxiliary_control(void)
   actlr |= ARM_CORTEX_A9_ACTL_SMP | ARM_CORTEX_A9_ACTL_FW;
   arm_cp15_set_auxiliary_control(actlr);
 }
+
+BSP_START_TEXT_SECTION static inline void
+arm_a9mpcore_start_errata_845369_handler(void)
+{
+  uint32_t diag;
+
+  /*
+   * Workaround for Errata 845369: Under Very Rare Timing Circumstances
+   * Transition into Streaming Mode Might Create Data Corruption.
+   */
+  diag = arm_cp15_get_diagnostic_control();
+  diag |= 1U << 22;
+  arm_cp15_set_diagnostic_control(diag);
+}
 #endif
 
 BSP_START_TEXT_SECTION static inline void arm_a9mpcore_start_hook_0(void)
@@ -138,6 +152,7 @@ BSP_START_TEXT_SECTION static inline void arm_a9mpcore_start_hook_0(void)
   }
 
 #ifdef RTEMS_SMP
+  arm_a9mpcore_start_errata_845369_handler();
   arm_a9mpcore_start_enable_smp_in_auxiliary_control();
 #endif
 
diff --git a/cpukit/score/cpu/arm/include/libcpu/arm-cp15.h b/cpukit/score/cpu/arm/include/libcpu/arm-cp15.h
index 8d43ca0..ffe32e4 100644
--- a/cpukit/score/cpu/arm/include/libcpu/arm-cp15.h
+++ b/cpukit/score/cpu/arm/include/libcpu/arm-cp15.h
@@ -2292,6 +2292,38 @@ arm_cp15_set_counter_virtual_offset(uint64_t val)
   );
 }
 
+/* Diagnostic Control Register */
+ARM_CP15_TEXT_SECTION static inline uint32_t
+arm_cp15_get_diagnostic_control(void)
+{
+  ARM_SWITCH_REGISTERS;
+  uint32_t val;
+
+  __asm__ volatile (
+    ARM_SWITCH_TO_ARM
+    "mrc p15, 0, %[val], c15, c0, 1\n"
+    ARM_SWITCH_BACK
+    : [val] "=&r" (val) ARM_SWITCH_ADDITIONAL_OUTPUT
+  );
+
+  return val;
+}
+
+/* Diagnostic Control Register */
+ARM_CP15_TEXT_SECTION static inline void
+arm_cp15_set_diagnostic_control(uint32_t val)
+{
+  ARM_SWITCH_REGISTERS;
+
+  __asm__ volatile (
+    ARM_SWITCH_TO_ARM
+    "mcr p15, 0, %[val], c15, c0, 1\n"
+    ARM_SWITCH_BACK
+    : ARM_SWITCH_OUTPUT
+    : [val] "r" (val)
+  );
+}
+
 /**
  * @brief Sets the @a section_flags for the address range [@a begin, @a end).
  *



More information about the vc mailing list