forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/powerpc/kernel/vdso32/cacheflush.S
....@@ -1,18 +1,16 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * vDSO provided cache flush routines
34 *
45 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
56 * IBM Corp.
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version
10
- * 2 of the License, or (at your option) any later version.
117 */
128 #include <asm/processor.h>
139 #include <asm/ppc_asm.h>
1410 #include <asm/vdso.h>
11
+#include <asm/vdso_datapage.h>
1512 #include <asm/asm-offsets.h>
13
+#include <asm/cache.h>
1614
1715 .text
1816
....@@ -26,42 +24,62 @@
2624 */
2725 V_FUNCTION_BEGIN(__kernel_sync_dicache)
2826 .cfi_startproc
27
+#ifdef CONFIG_PPC64
2928 mflr r12
3029 .cfi_register lr,r12
31
- mr r11,r3
32
- bl __get_datapage@local
30
+ get_datapage r10, r0
3331 mtlr r12
34
- mr r10,r3
32
+#endif
3533
34
+#ifdef CONFIG_PPC64
3635 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
3736 addi r5,r7,-1
38
- andc r6,r11,r5 /* round low to line bdy */
37
+#else
38
+ li r5, L1_CACHE_BYTES - 1
39
+#endif
40
+ andc r6,r3,r5 /* round low to line bdy */
3941 subf r8,r6,r4 /* compute length */
4042 add r8,r8,r5 /* ensure we get enough */
43
+#ifdef CONFIG_PPC64
4144 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
4245 srw. r8,r8,r9 /* compute line count */
46
+#else
47
+ srwi. r8, r8, L1_CACHE_SHIFT
48
+ mr r7, r6
49
+#endif
4350 crclr cr0*4+so
4451 beqlr /* nothing to do? */
4552 mtctr r8
4653 1: dcbst 0,r6
54
+#ifdef CONFIG_PPC64
4755 add r6,r6,r7
56
+#else
57
+ addi r6, r6, L1_CACHE_BYTES
58
+#endif
4859 bdnz 1b
4960 sync
5061
5162 /* Now invalidate the instruction cache */
5263
64
+#ifdef CONFIG_PPC64
5365 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
5466 addi r5,r7,-1
55
- andc r6,r11,r5 /* round low to line bdy */
67
+ andc r6,r3,r5 /* round low to line bdy */
5668 subf r8,r6,r4 /* compute length */
5769 add r8,r8,r5
5870 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
5971 srw. r8,r8,r9 /* compute line count */
6072 crclr cr0*4+so
6173 beqlr /* nothing to do? */
74
+#endif
6275 mtctr r8
76
+#ifdef CONFIG_PPC64
6377 2: icbi 0,r6
6478 add r6,r6,r7
79
+#else
80
+2: icbi 0, r7
81
+ addi r7, r7, L1_CACHE_BYTES
82
+#endif
6583 bdnz 2b
6684 isync
6785 li r3,0