]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/powerpc/kernel/vdso64/cacheflush.S
Merge tag 'upstream-4.9-rc1' of git://git.infradead.org/linux-ubifs
[mirror_ubuntu-zesty-kernel.git] / arch / powerpc / kernel / vdso64 / cacheflush.S
CommitLineData
1da177e4
LT
1/*
2 * vDSO provided cache flush routines
3 *
4 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
5 * 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 */
1da177e4
LT
12#include <asm/processor.h>
13#include <asm/ppc_asm.h>
14#include <asm/vdso.h>
0013a854 15#include <asm/asm-offsets.h>
1da177e4
LT
16
17 .text
18
19/*
20 * Default "generic" version of __kernel_sync_dicache.
21 *
22 * void __kernel_sync_dicache(unsigned long start, unsigned long end)
23 *
24 * Flushes the data cache & invalidate the instruction cache for the
25 * provided range [start, end[
1da177e4
LT
26 */
27V_FUNCTION_BEGIN(__kernel_sync_dicache)
28 .cfi_startproc
fbe48175
OJ
29 mflr r12
30 .cfi_register lr,r12
31 mr r11,r3
32 bl V_LOCAL_FUNC(__get_datapage)
33 mtlr r12
34 mr r10,r3
35
36 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
37 addi r5,r7,-1
38 andc r6,r11,r5 /* round low to line bdy */
1da177e4
LT
39 subf r8,r6,r4 /* compute length */
40 add r8,r8,r5 /* ensure we get enough */
fbe48175
OJ
41 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
42 srw. r8,r8,r9 /* compute line count */
5d66da3d 43 crclr cr0*4+so
1da177e4
LT
44 beqlr /* nothing to do? */
45 mtctr r8
fbe48175
OJ
461: dcbst 0,r6
47 add r6,r6,r7
1da177e4
LT
48 bdnz 1b
49 sync
fbe48175
OJ
50
51/* Now invalidate the instruction cache */
52
53 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
54 addi r5,r7,-1
55 andc r6,r11,r5 /* round low to line bdy */
56 subf r8,r6,r4 /* compute length */
57 add r8,r8,r5
58 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
59 srw. r8,r8,r9 /* compute line count */
60 crclr cr0*4+so
61 beqlr /* nothing to do? */
1da177e4 62 mtctr r8
fbe48175
OJ
632: icbi 0,r6
64 add r6,r6,r7
65 bdnz 2b
1da177e4 66 isync
bdceb6a0 67 li r3,0
1da177e4
LT
68 blr
69 .cfi_endproc
70V_FUNCTION_END(__kernel_sync_dicache)
71
72
73/*
74 * POWER5 version of __kernel_sync_dicache
75 */
76V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
77 .cfi_startproc
5d66da3d 78 crclr cr0*4+so
1da177e4
LT
79 sync
80 isync
bdceb6a0 81 li r3,0
1da177e4
LT
82 blr
83 .cfi_endproc
84V_FUNCTION_END(__kernel_sync_dicache_p5)