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>
17 * Default "generic" version of __kernel_sync_dicache.
19 * void __kernel_sync_dicache(unsigned long start, unsigned long end)
21 * Flushes the data cache & invalidate the instruction cache for the
22 * provided range [start, end[
24 V_FUNCTION_BEGIN(__kernel_sync_dicache)
28 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
35 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
37 andc r6,r3,r5 /* round low to line bdy */
38 subf r8,r6,r4 /* compute length */
39 add r8,r8,r5 /* ensure we get enough */
40 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
41 srd. r8,r8,r9 /* compute line count */
43 beqlr /* nothing to do? */
50 /* Now invalidate the instruction cache */
52 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
54 andc r6,r3,r5 /* round low to line bdy */
55 subf r8,r6,r4 /* compute length */
57 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
58 srd. r8,r8,r9 /* compute line count */
60 beqlr /* nothing to do? */
75 V_FUNCTION_END(__kernel_sync_dicache)