.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * vDSO provided cache flush routines |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), |
---|
5 | 6 | * 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. |
---|
11 | 7 | */ |
---|
12 | 8 | #include <asm/processor.h> |
---|
13 | 9 | #include <asm/ppc_asm.h> |
---|
14 | 10 | #include <asm/vdso.h> |
---|
| 11 | +#include <asm/vdso_datapage.h> |
---|
15 | 12 | #include <asm/asm-offsets.h> |
---|
| 13 | +#include <asm/cache.h> |
---|
16 | 14 | |
---|
17 | 15 | .text |
---|
18 | 16 | |
---|
.. | .. |
---|
26 | 24 | */ |
---|
27 | 25 | V_FUNCTION_BEGIN(__kernel_sync_dicache) |
---|
28 | 26 | .cfi_startproc |
---|
| 27 | +#ifdef CONFIG_PPC64 |
---|
29 | 28 | mflr r12 |
---|
30 | 29 | .cfi_register lr,r12 |
---|
31 | | - mr r11,r3 |
---|
32 | | - bl __get_datapage@local |
---|
| 30 | + get_datapage r10, r0 |
---|
33 | 31 | mtlr r12 |
---|
34 | | - mr r10,r3 |
---|
| 32 | +#endif |
---|
35 | 33 | |
---|
| 34 | +#ifdef CONFIG_PPC64 |
---|
36 | 35 | lwz r7,CFG_DCACHE_BLOCKSZ(r10) |
---|
37 | 36 | 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 */ |
---|
39 | 41 | subf r8,r6,r4 /* compute length */ |
---|
40 | 42 | add r8,r8,r5 /* ensure we get enough */ |
---|
| 43 | +#ifdef CONFIG_PPC64 |
---|
41 | 44 | lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) |
---|
42 | 45 | srw. r8,r8,r9 /* compute line count */ |
---|
| 46 | +#else |
---|
| 47 | + srwi. r8, r8, L1_CACHE_SHIFT |
---|
| 48 | + mr r7, r6 |
---|
| 49 | +#endif |
---|
43 | 50 | crclr cr0*4+so |
---|
44 | 51 | beqlr /* nothing to do? */ |
---|
45 | 52 | mtctr r8 |
---|
46 | 53 | 1: dcbst 0,r6 |
---|
| 54 | +#ifdef CONFIG_PPC64 |
---|
47 | 55 | add r6,r6,r7 |
---|
| 56 | +#else |
---|
| 57 | + addi r6, r6, L1_CACHE_BYTES |
---|
| 58 | +#endif |
---|
48 | 59 | bdnz 1b |
---|
49 | 60 | sync |
---|
50 | 61 | |
---|
51 | 62 | /* Now invalidate the instruction cache */ |
---|
52 | 63 | |
---|
| 64 | +#ifdef CONFIG_PPC64 |
---|
53 | 65 | lwz r7,CFG_ICACHE_BLOCKSZ(r10) |
---|
54 | 66 | addi r5,r7,-1 |
---|
55 | | - andc r6,r11,r5 /* round low to line bdy */ |
---|
| 67 | + andc r6,r3,r5 /* round low to line bdy */ |
---|
56 | 68 | subf r8,r6,r4 /* compute length */ |
---|
57 | 69 | add r8,r8,r5 |
---|
58 | 70 | lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10) |
---|
59 | 71 | srw. r8,r8,r9 /* compute line count */ |
---|
60 | 72 | crclr cr0*4+so |
---|
61 | 73 | beqlr /* nothing to do? */ |
---|
| 74 | +#endif |
---|
62 | 75 | mtctr r8 |
---|
| 76 | +#ifdef CONFIG_PPC64 |
---|
63 | 77 | 2: icbi 0,r6 |
---|
64 | 78 | add r6,r6,r7 |
---|
| 79 | +#else |
---|
| 80 | +2: icbi 0, r7 |
---|
| 81 | + addi r7, r7, L1_CACHE_BYTES |
---|
| 82 | +#endif |
---|
65 | 83 | bdnz 2b |
---|
66 | 84 | isync |
---|
67 | 85 | li r3,0 |
---|