1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * Based on arch/arm/include/asm/cacheflush.h 4 * 5 * Copyright (C) 1999-2002 Russell King. 6 * Copyright (C) 2012 ARM Ltd. 7 */ 8 #ifndef __ASM_CACHEFLUSH_H 9 #define __ASM_CACHEFLUSH_H 10 11 #include <linux/kgdb.h> 12 #include <linux/mm.h> 13 14 /* 15 * This flag is used to indicate that the page 16 * and does not require cleaning before return 17 */ 18 #define PG_dcache_clean PG_arch_1 19 20 /* 21 * MM Cache Management 22 * =================== 23 * 24 * The arch/arm64/mm/cache.S implements t 25 * 26 * Start addresses are inclusive and end 27 * addresses should be rounded down, end 28 * 29 * See Documentation/core-api/cachetlb.rs 30 * the implementation assumes non-aliasin 31 * VIPT I-cache. 32 * 33 * All functions below apply to the inter 34 * - start - virtual start addre 35 * - end - virtual end address 36 * 37 * caches_clean_inval_pou(start, end) 38 * 39 * Ensure coherency between the I 40 * the Point of Unification. 41 * 42 * caches_clean_inval_user_pou(start, end 43 * 44 * Ensure coherency between the I 45 * the Point of Unification. 46 * Use only if the region might a 47 * 48 * icache_inval_pou(start, end) 49 * 50 * Invalidate I-cache region to t 51 * 52 * dcache_clean_inval_poc(start, end) 53 * 54 * Clean and invalidate D-cache r 55 * 56 * dcache_inval_poc(start, end) 57 * 58 * Invalidate D-cache region to t 59 * 60 * dcache_clean_poc(start, end) 61 * 62 * Clean D-cache region to the Po 63 * 64 * dcache_clean_pop(start, end) 65 * 66 * Clean D-cache region to the Po 67 * 68 * dcache_clean_pou(start, end) 69 * 70 * Clean D-cache region to the Po 71 */ 72 extern void caches_clean_inval_pou(unsigned lo 73 extern void icache_inval_pou(unsigned long sta 74 extern void dcache_clean_inval_poc(unsigned lo 75 extern void dcache_inval_poc(unsigned long sta 76 extern void dcache_clean_poc(unsigned long sta 77 extern void dcache_clean_pop(unsigned long sta 78 extern void dcache_clean_pou(unsigned long sta 79 extern long caches_clean_inval_user_pou(unsign 80 extern void sync_icache_aliases(unsigned long 81 82 static inline void flush_icache_range(unsigned 83 { 84 caches_clean_inval_pou(start, end); 85 86 /* 87 * IPI all online CPUs so that they un 88 * event and are forced to refetch the 89 */ 90 91 /* 92 * KGDB performs cache maintenance wit 93 * will deadlock trying to IPI the sec 94 * set CACHE_FLUSH_IS_SAFE to 0 to avo 95 * just means that KGDB will elide the 96 * turns out, KGDB uses IPIs to round- 97 * the patching operation, so we don't 98 * In which case, add a KGDB-specific 99 */ 100 if (in_dbg_master()) 101 return; 102 103 kick_all_cpus_sync(); 104 } 105 #define flush_icache_range flush_icache_range 106 107 /* 108 * Copy user data from/to a page which is mapp 109 * processes address space. Really, we want t 110 * space" model to handle this. 111 */ 112 extern void copy_to_user_page(struct vm_area_s 113 unsigned long, void *, const void *, u 114 #define copy_to_user_page copy_to_user_page 115 116 /* 117 * flush_dcache_folio is used when the kernel 118 * cache page at virtual address page->virtual 119 * 120 * If this page isn't mapped (ie, folio_mappin 121 * have userspace mappings, then we _must_ alw 122 * the dcache entries associated with the kern 123 * 124 * Otherwise we can defer the operation, and c 125 * about to change to user space. This is the 126 * See update_mmu_cache for the user space par 127 */ 128 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 129 extern void flush_dcache_page(struct page *); 130 void flush_dcache_folio(struct folio *); 131 #define flush_dcache_folio flush_dcache_folio 132 133 static __always_inline void icache_inval_all_p 134 { 135 if (alternative_has_cap_unlikely(ARM64 136 return; 137 138 asm("ic ialluis"); 139 dsb(ish); 140 } 141 142 #include <asm-generic/cacheflush.h> 143 144 #endif /* __ASM_CACHEFLUSH_H */ 145
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.