162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _SPARC_CACHEFLUSH_H 362306a36Sopenharmony_ci#define _SPARC_CACHEFLUSH_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/page-flags.h> 662306a36Sopenharmony_ci#include <asm/cachetlb_32.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#define flush_cache_all() \ 962306a36Sopenharmony_ci sparc32_cachetlb_ops->cache_all() 1062306a36Sopenharmony_ci#define flush_cache_mm(mm) \ 1162306a36Sopenharmony_ci sparc32_cachetlb_ops->cache_mm(mm) 1262306a36Sopenharmony_ci#define flush_cache_dup_mm(mm) \ 1362306a36Sopenharmony_ci sparc32_cachetlb_ops->cache_mm(mm) 1462306a36Sopenharmony_ci#define flush_cache_range(vma,start,end) \ 1562306a36Sopenharmony_ci sparc32_cachetlb_ops->cache_range(vma, start, end) 1662306a36Sopenharmony_ci#define flush_cache_page(vma,addr,pfn) \ 1762306a36Sopenharmony_ci sparc32_cachetlb_ops->cache_page(vma, addr) 1862306a36Sopenharmony_ci#define flush_icache_range(start, end) do { } while (0) 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 2162306a36Sopenharmony_ci do { \ 2262306a36Sopenharmony_ci flush_cache_page(vma, vaddr, page_to_pfn(page));\ 2362306a36Sopenharmony_ci memcpy(dst, src, len); \ 2462306a36Sopenharmony_ci } while (0) 2562306a36Sopenharmony_ci#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 2662306a36Sopenharmony_ci do { \ 2762306a36Sopenharmony_ci flush_cache_page(vma, vaddr, page_to_pfn(page));\ 2862306a36Sopenharmony_ci memcpy(dst, src, len); \ 2962306a36Sopenharmony_ci } while (0) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#define __flush_page_to_ram(addr) \ 3262306a36Sopenharmony_ci sparc32_cachetlb_ops->page_to_ram(addr) 3362306a36Sopenharmony_ci#define flush_sig_insns(mm,insn_addr) \ 3462306a36Sopenharmony_ci sparc32_cachetlb_ops->sig_insns(mm, insn_addr) 3562306a36Sopenharmony_ci#define flush_page_for_dma(addr) \ 3662306a36Sopenharmony_ci sparc32_cachetlb_ops->page_for_dma(addr) 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_civoid sparc_flush_page_to_ram(struct page *page); 3962306a36Sopenharmony_civoid sparc_flush_folio_to_ram(struct folio *folio); 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 4262306a36Sopenharmony_ci#define flush_dcache_folio(folio) sparc_flush_folio_to_ram(folio) 4362306a36Sopenharmony_cistatic inline void flush_dcache_page(struct page *page) 4462306a36Sopenharmony_ci{ 4562306a36Sopenharmony_ci flush_dcache_folio(page_folio(page)); 4662306a36Sopenharmony_ci} 4762306a36Sopenharmony_ci#define flush_dcache_mmap_lock(mapping) do { } while (0) 4862306a36Sopenharmony_ci#define flush_dcache_mmap_unlock(mapping) do { } while (0) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define flush_cache_vmap(start, end) flush_cache_all() 5162306a36Sopenharmony_ci#define flush_cache_vmap_early(start, end) do { } while (0) 5262306a36Sopenharmony_ci#define flush_cache_vunmap(start, end) flush_cache_all() 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* When a context switch happens we must flush all user windows so that 5562306a36Sopenharmony_ci * the windows of the current process are flushed onto its stack. This 5662306a36Sopenharmony_ci * way the windows are all clean for the next process and the stack 5762306a36Sopenharmony_ci * frames are up to date. 5862306a36Sopenharmony_ci */ 5962306a36Sopenharmony_civoid flush_user_windows(void); 6062306a36Sopenharmony_civoid kill_user_windows(void); 6162306a36Sopenharmony_civoid flushw_all(void); 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci#endif /* _SPARC_CACHEFLUSH_H */ 64