Browse Source

platform: generic: starfive: Issue fence instruction out of the loop

This patch shifts the fence instruction outside of the loop in
sbi_dubhe_L2_inv_range and sbi_dubhe_L2_flush_range. Fence should
only be called once at the beginning and once at the end of the flush
or invalidate operation

Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
Genevieve Chan 1 year ago
parent
commit
ff985349fd
1 changed files with 5 additions and 4 deletions
  1. 5 4
      platform/generic/starfive/dubhe_cache.S

+ 5 - 4
platform/generic/starfive/dubhe_cache.S

@@ -27,14 +27,15 @@ __sbi_dubhe_L2_inv_range:
 	add	a1, a1, a0	/* Compute end address */
 	add	a1, a1, a0	/* Compute end address */
 	not	t2, t1
 	not	t2, t1
 	and	a0, a0, t2
 	and	a0, a0, t2
+	fence	rw, rw
 1:
 1:
 	/* CDISCARD.L2 rs1 = a0 */
 	/* CDISCARD.L2 rs1 = a0 */
-	fence	rw, rw
 	.insn i 0x73, 0, x0, a0, -0x3A
 	.insn i 0x73, 0, x0, a0, -0x3A
-	fence	rw, rw
+
 	add	a0, a0, t0
 	add	a0, a0, t0
 	blt	a0, a1, 1b
 	blt	a0, a1, 1b
 2:
 2:
+	fence	rw, rw
 	ret
 	ret
 
 
 	/*
 	/*
@@ -55,12 +56,12 @@ __sbi_dubhe_L2_flush_range:
 	add	a1, a1, a0	/* Compute end address */
 	add	a1, a1, a0	/* Compute end address */
 	not	t2, t1
 	not	t2, t1
 	and	a0, a0, t2
 	and	a0, a0, t2
+	fence	rw, rw
 1:
 1:
 	/* CFLUSH.L2 rs1 = a0 */
 	/* CFLUSH.L2 rs1 = a0 */
-	fence	rw, rw
 	.insn i 0x73, 0, x0, a0, -0x3C
 	.insn i 0x73, 0, x0, a0, -0x3C
-	fence	rw, rw
 	add	a0, a0, t0
 	add	a0, a0, t0
 	blt	a0, a1, 1b
 	blt	a0, a1, 1b
 2:
 2:
+	fence	rw, rw
 	ret
 	ret