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/asm-offsets.h>
16 * Default "generic" version of __kernel_sync_dicache.
18 * void __kernel_sync_dicache(unsigned long start, unsigned long end)
20 * Flushes the data cache & invalidate the instruction cache for the
21 * provided range [start, end[
23 V_FUNCTION_BEGIN(__kernel_sync_dicache)
28 bl V_LOCAL_FUNC(__get_datapage)
32 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
34 andc r6,r11,r5 /* round low to line bdy */
35 subf r8,r6,r4 /* compute length */
36 add r8,r8,r5 /* ensure we get enough */
37 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
38 srd. r8,r8,r9 /* compute line count */
40 beqlr /* nothing to do? */
47 /* Now invalidate the instruction cache */
49 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
51 andc r6,r11,r5 /* round low to line bdy */
52 subf r8,r6,r4 /* compute length */
54 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
55 srd. r8,r8,r9 /* compute line count */
57 beqlr /* nothing to do? */
66 V_FUNCTION_END(__kernel_sync_dicache)
70 * POWER5 version of __kernel_sync_dicache
72 V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
80 V_FUNCTION_END(__kernel_sync_dicache_p5)