1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _SPARC64_CACHEFLUSH_H
3 #define _SPARC64_CACHEFLUSH_H
11 /* Cache flush operations. */
12 #define flushw_all() __asm__ __volatile__("flushw")
14 void __flushw_user(void);
15 #define flushw_user() __flushw_user()
17 #define flush_user_windows flushw_user
18 #define flush_register_windows flushw_all
20 /* These are the same regardless of whether this is an SMP kernel or not. */
21 #define flush_cache_mm(__mm) \
22 do { if ((__mm) == current->mm) flushw_user(); } while(0)
23 #define flush_cache_dup_mm(mm) flush_cache_mm(mm)
24 #define flush_cache_range(vma, start, end) \
25 flush_cache_mm((vma)->vm_mm)
26 #define flush_cache_page(vma, page, pfn) \
27 flush_cache_mm((vma)->vm_mm)
30 * On spitfire, the icache doesn't snoop local stores and we don't
31 * use block commit stores (which invalidate icache lines) during
32 * module load, so we need this.
34 void flush_icache_range(unsigned long start
, unsigned long end
);
35 void __flush_icache_page(unsigned long);
37 void __flush_dcache_page(void *addr
, int flush_icache
);
38 void flush_dcache_folio_impl(struct folio
*folio
);
40 void smp_flush_dcache_folio_impl(struct folio
*folio
, int cpu
);
41 void flush_dcache_folio_all(struct mm_struct
*mm
, struct folio
*folio
);
43 #define smp_flush_dcache_folio_impl(folio, cpu) flush_dcache_folio_impl(folio)
44 #define flush_dcache_folio_all(mm, folio) flush_dcache_folio_impl(folio)
47 void __flush_dcache_range(unsigned long start
, unsigned long end
);
48 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
49 void flush_dcache_folio(struct folio
*folio
);
50 #define flush_dcache_folio flush_dcache_folio
51 static inline void flush_dcache_page(struct page
*page
)
53 flush_dcache_folio(page_folio(page
));
56 void flush_ptrace_access(struct vm_area_struct
*, struct page
*,
57 unsigned long uaddr
, void *kaddr
,
58 unsigned long len
, int write
);
60 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
62 flush_cache_page(vma, vaddr, page_to_pfn(page)); \
63 memcpy(dst, src, len); \
64 flush_ptrace_access(vma, page, vaddr, src, len, 0); \
67 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
69 flush_cache_page(vma, vaddr, page_to_pfn(page)); \
70 memcpy(dst, src, len); \
71 flush_ptrace_access(vma, page, vaddr, dst, len, 1); \
74 #define flush_dcache_mmap_lock(mapping) do { } while (0)
75 #define flush_dcache_mmap_unlock(mapping) do { } while (0)
77 #define flush_cache_vmap(start, end) do { } while (0)
78 #define flush_cache_vmap_early(start, end) do { } while (0)
79 #define flush_cache_vunmap(start, end) do { } while (0)
81 #endif /* !__ASSEMBLY__ */
83 #endif /* _SPARC64_CACHEFLUSH_H */