arm: mach-k3: Enable WA for R5F deadlock
authorLokesh Vutla <lokeshvutla@ti.com>
Tue, 31 Dec 2019 10:19:55 +0000 (15:49 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 3 Jan 2020 14:47:11 +0000 (09:47 -0500)
On K3 devices there are 2 conditions where R5F can deadlock:
1.When software is performing series of store operations to
  cacheable write back/write allocate memory region and later
  on software execute barrier operation (DSB or DMB). R5F may
  hang at the barrier instruction.
2.When software is performing a mix of load and store operations
  within a tight loop and store operations are all writing to
  cacheable write back/write allocates memory regions, R5F may
  hang at one of the load instruction.

To avoid the above two conditions disable linefill optimization
inside Cortex R5F which will make R5F to only issue up to 2 cache
line fills at any point of time.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-k3/am6_init.c
arch/arm/mach-k3/common.c
arch/arm/mach-k3/common.h
arch/arm/mach-k3/j721e_init.c

index 99edcd9..a78ffbb 100644 (file)
@@ -82,6 +82,7 @@ void board_init_f(ulong dummy)
        ctrl_mmr_unlock();
 
 #ifdef CONFIG_CPU_V7R
+       disable_linefill_optimization();
        setup_k3_mpu_regions();
 #endif
 
index bf631b7..50f5b81 100644 (file)
@@ -244,3 +244,28 @@ void board_prep_linux(bootm_headers_t *images)
                                       CONFIG_SYS_CACHELINE_SIZE));
 }
 #endif
+
+#ifdef CONFIG_CPU_V7R
+void disable_linefill_optimization(void)
+{
+       u32 actlr;
+
+       /*
+        * On K3 devices there are 2 conditions where R5F can deadlock:
+        * 1.When software is performing series of store operations to
+        *   cacheable write back/write allocate memory region and later
+        *   on software execute barrier operation (DSB or DMB). R5F may
+        *   hang at the barrier instruction.
+        * 2.When software is performing a mix of load and store operations
+        *   within a tight loop and store operations are all writing to
+        *   cacheable write back/write allocates memory regions, R5F may
+        *   hang at one of the load instruction.
+        *
+        * To avoid the above two conditions disable linefill optimization
+        * inside Cortex R5F.
+        */
+       asm("mrc p15, 0, %0, c1, c0, 1" : "=r" (actlr));
+       actlr |= (1 << 13); /* Set DLFO bit  */
+       asm("mcr p15, 0, %0, c1, c0, 1" : : "r" (actlr));
+}
+#endif
index 8f9a023..35d1609 100644 (file)
@@ -16,3 +16,4 @@
 
 void setup_k3_mpu_regions(void);
 int early_console_init(void);
+void disable_linefill_optimization(void);
index d0bf86a..4758739 100644 (file)
@@ -87,6 +87,7 @@ void board_init_f(ulong dummy)
        ctrl_mmr_unlock();
 
 #ifdef CONFIG_CPU_V7R
+       disable_linefill_optimization();
        setup_k3_mpu_regions();
 #endif