1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/arm/mm/cache-v4.S
5 * Copyright (C) 1997-2002 Russell king
7 #include <linux/linkage.h>
8 #include <linux/init.h>
9 #include <linux/cfi_types.h>
10 #include <asm/assembler.h>
12 #include "proc-macros.S"
17 * Unconditionally clean and invalidate the entire icache.
19 SYM_TYPED_FUNC_START(v4_flush_icache_all)
21 SYM_FUNC_END(v4_flush_icache_all)
24 * flush_user_cache_all()
26 * Invalidate all cache entries in a particular address
29 * - mm - mm_struct describing address space
31 SYM_FUNC_ALIAS(v4_flush_user_cache_all, v4_flush_kern_cache_all)
34 * flush_kern_cache_all()
36 * Clean and invalidate the entire cache.
38 SYM_TYPED_FUNC_START(v4_flush_kern_cache_all)
39 #ifdef CONFIG_CPU_CP15
41 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
46 SYM_FUNC_END(v4_flush_kern_cache_all)
49 * flush_user_cache_range(start, end, flags)
51 * Invalidate a range of cache entries in the specified
54 * - start - start address (may not be aligned)
55 * - end - end address (exclusive, may not be aligned)
56 * - flags - vma_area_struct flags describing address space
58 SYM_TYPED_FUNC_START(v4_flush_user_cache_range)
59 #ifdef CONFIG_CPU_CP15
61 mcr p15, 0, ip, c7, c7, 0 @ flush ID cache
66 SYM_FUNC_END(v4_flush_user_cache_range)
69 * coherent_kern_range(start, end)
71 * Ensure coherency between the Icache and the Dcache in the
72 * region described by start. If you have non-snooping
73 * Harvard caches, you need to implement this function.
75 * - start - virtual start address
76 * - end - virtual end address
78 SYM_TYPED_FUNC_START(v4_coherent_kern_range)
80 SYM_FUNC_END(v4_coherent_kern_range)
83 * coherent_user_range(start, end)
85 * Ensure coherency between the Icache and the Dcache in the
86 * region described by start. If you have non-snooping
87 * Harvard caches, you need to implement this function.
89 * - start - virtual start address
90 * - end - virtual end address
92 SYM_TYPED_FUNC_START(v4_coherent_user_range)
95 SYM_FUNC_END(v4_coherent_user_range)
98 * flush_kern_dcache_area(void *addr, size_t size)
100 * Ensure no D cache aliasing occurs, either with itself or
103 * - addr - kernel address
104 * - size - region size
106 SYM_TYPED_FUNC_START(v4_flush_kern_dcache_area)
107 #ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
110 SYM_FUNC_END(v4_flush_kern_dcache_area)
113 * dma_flush_range(start, end)
115 * Clean and invalidate the specified virtual address range.
117 * - start - virtual start address
118 * - end - virtual end address
120 SYM_TYPED_FUNC_START(v4_dma_flush_range)
121 #ifdef CONFIG_CPU_CP15
123 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
126 SYM_FUNC_END(v4_dma_flush_range)
129 * dma_unmap_area(start, size, dir)
130 * - start - kernel virtual start address
131 * - size - size of region
132 * - dir - DMA direction
134 SYM_TYPED_FUNC_START(v4_dma_unmap_area)
135 teq r2, #DMA_TO_DEVICE
136 bne v4_dma_flush_range
138 SYM_FUNC_END(v4_dma_unmap_area)
141 * dma_map_area(start, size, dir)
142 * - start - kernel virtual start address
143 * - size - size of region
144 * - dir - DMA direction
146 SYM_TYPED_FUNC_START(v4_dma_map_area)
148 SYM_FUNC_END(v4_dma_map_area)