[PATCH 10/13] bsps/arm: Invalidate TLB in start.S

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Dec 22 13:01:07 UTC 2020


Update #4202.
---
 bsps/arm/raspberrypi/start/bspsmp_init.c     | 2 --
 bsps/arm/raspberrypi/start/bspstarthooks.c   | 3 ---
 bsps/arm/shared/start/start.S                | 9 +++++++++
 bsps/arm/xilinx-zynq/start/bspstarthooks.c   | 4 ----
 bsps/arm/xilinx-zynqmp/start/bspstarthooks.c | 7 +------
 5 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/bsps/arm/raspberrypi/start/bspsmp_init.c b/bsps/arm/raspberrypi/start/bspsmp_init.c
index a4dd470287..eed5b44fa9 100644
--- a/bsps/arm/raspberrypi/start/bspsmp_init.c
+++ b/bsps/arm/raspberrypi/start/bspsmp_init.c
@@ -74,8 +74,6 @@ void rpi_start_rtems_on_secondary_processor(void)
     (uint32_t *) bsp_translation_table_base
   );
 
-  arm_cp15_tlb_invalidate();
-
   ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M;
   ctrl &= ~ARM_CP15_CTRL_V;
   arm_cp15_set_control(ctrl);
diff --git a/bsps/arm/raspberrypi/start/bspstarthooks.c b/bsps/arm/raspberrypi/start/bspstarthooks.c
index 60ff098be7..c6f76f24b8 100644
--- a/bsps/arm/raspberrypi/start/bspstarthooks.c
+++ b/bsps/arm/raspberrypi/start/bspstarthooks.c
@@ -67,9 +67,6 @@ raspberrypi_mmu_config_table[] = {
 
 void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
 {
-  arm_cp15_tlb_invalidate();
-  _ARM_Instruction_synchronization_barrier();
-
   /* Clear Translation Table Base Control Register */
   arm_cp15_set_translation_table_base_control_register(0);
 
diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S
index 0a3d4288cd..3ba8844549 100644
--- a/bsps/arm/shared/start/start.S
+++ b/bsps/arm/shared/start/start.S
@@ -432,6 +432,15 @@ _start:
 	 */
 	mov	r0, #0
 	mcr	p15, 0, r0, c7, c5, 0
+
+#if __ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A'
+	/*
+	 * Invalidate the TLB using ITLBIALL (Instruction TLB Invalidate All).
+	 */
+	mov	r0, #0
+	mcr	p15, 0, r0, c8, c7, 0
+	isb
+#endif
 #endif
 
 	/*
diff --git a/bsps/arm/xilinx-zynq/start/bspstarthooks.c b/bsps/arm/xilinx-zynq/start/bspstarthooks.c
index 25cf96abdb..c67ed4f93e 100644
--- a/bsps/arm/xilinx-zynq/start/bspstarthooks.c
+++ b/bsps/arm/xilinx-zynq/start/bspstarthooks.c
@@ -31,12 +31,8 @@
 #include <bsp/start.h>
 #include <bsp/arm-a9mpcore-start.h>
 
-#include <libcpu/arm-cp15.h>
-
 BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
 {
-  arm_cp15_tlb_invalidate();
-  _ARM_Instruction_synchronization_barrier()
   arm_a9mpcore_start_hook_0();
 }
 
diff --git a/bsps/arm/xilinx-zynqmp/start/bspstarthooks.c b/bsps/arm/xilinx-zynqmp/start/bspstarthooks.c
index 0e844bc105..ef76563a38 100644
--- a/bsps/arm/xilinx-zynqmp/start/bspstarthooks.c
+++ b/bsps/arm/xilinx-zynqmp/start/bspstarthooks.c
@@ -30,17 +30,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION
-
 #include <bsp.h>
 #include <bsp/start.h>
 
-#include <libcpu/arm-cp15.h>
-
 BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
 {
-  arm_cp15_tlb_invalidate();
-  _ARM_Instruction_synchronization_barrier();
+  /* Nothing to do */
 }
 
 BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
-- 
2.26.2



More information about the devel mailing list