~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/kernel/vdso/cacheflush.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * vDSO provided cache flush routines
  4  *
  5  * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
  6  *                    IBM Corp.
  7  */
  8 #include <asm/processor.h>
  9 #include <asm/ppc_asm.h>
 10 #include <asm/vdso.h>
 11 #include <asm/vdso_datapage.h>
 12 #include <asm/asm-offsets.h>
 13 #include <asm/cache.h>
 14 
 15         .text
 16 
 17 /*
 18  * Default "generic" version of __kernel_sync_dicache.
 19  *
 20  * void __kernel_sync_dicache(unsigned long start, unsigned long end)
 21  *
 22  * Flushes the data cache & invalidate the instruction cache for the
 23  * provided range [start, end[
 24  */
 25 V_FUNCTION_BEGIN(__kernel_sync_dicache)
 26   .cfi_startproc
 27 BEGIN_FTR_SECTION
 28         b       3f
 29 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
 30 #ifdef CONFIG_PPC64
 31         mflr    r12
 32   .cfi_register lr,r12
 33         get_realdatapage        r10, r11
 34         mtlr    r12
 35   .cfi_restore  lr
 36 #endif
 37 
 38 #ifdef CONFIG_PPC64
 39         lwz     r7,CFG_DCACHE_BLOCKSZ(r10)
 40         addi    r5,r7,-1
 41 #else
 42         li      r5, L1_CACHE_BYTES - 1
 43 #endif
 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 */
 47 #ifdef CONFIG_PPC64
 48         lwz     r9,CFG_DCACHE_LOGBLOCKSZ(r10)
 49         PPC_SRL.        r8,r8,r9                /* compute line count */
 50 #else
 51         srwi.   r8, r8, L1_CACHE_SHIFT
 52         mr      r7, r6
 53 #endif
 54         crclr   cr0*4+so
 55         beqlr                           /* nothing to do? */
 56         mtctr   r8
 57 1:      dcbst   0,r6
 58 #ifdef CONFIG_PPC64
 59         add     r6,r6,r7
 60 #else
 61         addi    r6, r6, L1_CACHE_BYTES
 62 #endif
 63         bdnz    1b
 64         sync
 65 
 66 /* Now invalidate the instruction cache */
 67 
 68 #ifdef CONFIG_PPC64
 69         lwz     r7,CFG_ICACHE_BLOCKSZ(r10)
 70         addi    r5,r7,-1
 71         andc    r6,r3,r5                /* round low to line bdy */
 72         subf    r8,r6,r4                /* compute length */
 73         add     r8,r8,r5
 74         lwz     r9,CFG_ICACHE_LOGBLOCKSZ(r10)
 75         PPC_SRL.        r8,r8,r9                /* compute line count */
 76         crclr   cr0*4+so
 77         beqlr                           /* nothing to do? */
 78 #endif
 79         mtctr   r8
 80 #ifdef CONFIG_PPC64
 81 2:      icbi    0,r6
 82         add     r6,r6,r7
 83 #else
 84 2:      icbi    0, r7
 85         addi    r7, r7, L1_CACHE_BYTES
 86 #endif
 87         bdnz    2b
 88         isync
 89         li      r3,0
 90         blr
 91 3:
 92         crclr   cr0*4+so
 93         sync
 94         icbi    0,r1
 95         isync
 96         li      r3,0
 97         blr
 98   .cfi_endproc
 99 V_FUNCTION_END(__kernel_sync_dicache)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php