18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#ifndef __ABI_CSKY_CACHEFLUSH_H
48c2ecf20Sopenharmony_ci#define __ABI_CSKY_CACHEFLUSH_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci/* Keep includes the same across arches.  */
78c2ecf20Sopenharmony_ci#include <linux/mm.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/*
108c2ecf20Sopenharmony_ci * The cache doesn't need to be flushed when TLB entries change when
118c2ecf20Sopenharmony_ci * the cache is mapped to physical memory, not virtual memory
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#define flush_cache_all()			do { } while (0)
148c2ecf20Sopenharmony_ci#define flush_cache_mm(mm)			do { } while (0)
158c2ecf20Sopenharmony_ci#define flush_cache_dup_mm(mm)			do { } while (0)
168c2ecf20Sopenharmony_ci#define flush_cache_range(vma, start, end)	do { } while (0)
178c2ecf20Sopenharmony_ci#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define PG_dcache_clean		PG_arch_1
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
228c2ecf20Sopenharmony_cistatic inline void flush_dcache_page(struct page *page)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	if (test_bit(PG_dcache_clean, &page->flags))
258c2ecf20Sopenharmony_ci		clear_bit(PG_dcache_clean, &page->flags);
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define flush_dcache_mmap_lock(mapping)		do { } while (0)
298c2ecf20Sopenharmony_ci#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
308c2ecf20Sopenharmony_ci#define flush_icache_page(vma, page)		do { } while (0)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define flush_icache_range(start, end)		cache_wbinv_range(start, end)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_civoid flush_icache_mm_range(struct mm_struct *mm,
358c2ecf20Sopenharmony_ci			unsigned long start, unsigned long end);
368c2ecf20Sopenharmony_civoid flush_icache_deferred(struct mm_struct *mm);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define flush_cache_vmap(start, end)		do { } while (0)
398c2ecf20Sopenharmony_ci#define flush_cache_vunmap(start, end)		do { } while (0)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
428c2ecf20Sopenharmony_cido { \
438c2ecf20Sopenharmony_ci	memcpy(dst, src, len); \
448c2ecf20Sopenharmony_ci	if (vma->vm_flags & VM_EXEC) { \
458c2ecf20Sopenharmony_ci		dcache_wb_range((unsigned long)dst, \
468c2ecf20Sopenharmony_ci				(unsigned long)dst + len); \
478c2ecf20Sopenharmony_ci		flush_icache_mm_range(current->mm, \
488c2ecf20Sopenharmony_ci				(unsigned long)dst, \
498c2ecf20Sopenharmony_ci				(unsigned long)dst + len); \
508c2ecf20Sopenharmony_ci		} \
518c2ecf20Sopenharmony_ci} while (0)
528c2ecf20Sopenharmony_ci#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
538c2ecf20Sopenharmony_ci	memcpy(dst, src, len)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#endif /* __ABI_CSKY_CACHEFLUSH_H */
56