1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * vDSO provided cache flush routines
5 * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
8 #include <asm/processor.h>
9 #include <asm/ppc_asm.h>
11 #include <asm/vdso_datapage.h>
12 #include <asm/asm-offsets.h>
13 #include <asm/cache.h>
18 * Default "generic" version of __kernel_sync_dicache.
20 * void __kernel_sync_dicache(unsigned long start, unsigned long end)
22 * Flushes the data cache & invalidate the instruction cache for the
23 * provided range [start, end[
25 V_FUNCTION_BEGIN(__kernel_sync_dicache)
29 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
39 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
42 li r5, L1_CACHE_BYTES - 1
44 andc r6,r3,r5 /* round low to line bdy */
45 subf r8,r6,r4 /* compute length */
46 add r8,r8,r5 /* ensure we get enough */
48 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
49 srw. r8,r8,r9 /* compute line count */
51 srwi. r8, r8, L1_CACHE_SHIFT
55 beqlr /* nothing to do? */
61 addi r6, r6, L1_CACHE_BYTES
66 /* Now invalidate the instruction cache */
69 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
71 andc r6,r3,r5 /* round low to line bdy */
72 subf r8,r6,r4 /* compute length */
74 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
75 srw. r8,r8,r9 /* compute line count */
77 beqlr /* nothing to do? */
85 addi r7, r7, L1_CACHE_BYTES
98 V_FUNCTION_END(__kernel_sync_dicache)