cacheflush_64.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _SPARC64_CACHEFLUSH_H
  3. #define _SPARC64_CACHEFLUSH_H
  4. #include <asm/page.h>
  5. #ifndef __ASSEMBLY__
  6. #include <linux/mm.h>
  7. /* Cache flush operations. */
  8. #define flushw_all() __asm__ __volatile__("flushw")
  9. void __flushw_user(void);
  10. #define flushw_user() __flushw_user()
  11. #define flush_user_windows flushw_user
  12. #define flush_register_windows flushw_all
  13. /* These are the same regardless of whether this is an SMP kernel or not. */
  14. #define flush_cache_mm(__mm) \
  15. do { if ((__mm) == current->mm) flushw_user(); } while(0)
  16. #define flush_cache_dup_mm(mm) flush_cache_mm(mm)
  17. #define flush_cache_range(vma, start, end) \
  18. flush_cache_mm((vma)->vm_mm)
  19. #define flush_cache_page(vma, page, pfn) \
  20. flush_cache_mm((vma)->vm_mm)
  21. /*
  22. * On spitfire, the icache doesn't snoop local stores and we don't
  23. * use block commit stores (which invalidate icache lines) during
  24. * module load, so we need this.
  25. */
  26. void flush_icache_range(unsigned long start, unsigned long end);
  27. void __flush_icache_page(unsigned long);
  28. void __flush_dcache_page(void *addr, int flush_icache);
  29. void flush_dcache_page_impl(struct page *page);
  30. #ifdef CONFIG_SMP
  31. void smp_flush_dcache_page_impl(struct page *page, int cpu);
  32. void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
  33. #else
  34. #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
  35. #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
  36. #endif
  37. void __flush_dcache_range(unsigned long start, unsigned long end);
  38. #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
  39. void flush_dcache_page(struct page *page);
  40. #define flush_icache_page(vma, pg) do { } while(0)
  41. void flush_ptrace_access(struct vm_area_struct *, struct page *,
  42. unsigned long uaddr, void *kaddr,
  43. unsigned long len, int write);
  44. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  45. do { \
  46. flush_cache_page(vma, vaddr, page_to_pfn(page)); \
  47. memcpy(dst, src, len); \
  48. flush_ptrace_access(vma, page, vaddr, src, len, 0); \
  49. } while (0)
  50. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  51. do { \
  52. flush_cache_page(vma, vaddr, page_to_pfn(page)); \
  53. memcpy(dst, src, len); \
  54. flush_ptrace_access(vma, page, vaddr, dst, len, 1); \
  55. } while (0)
  56. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  57. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  58. #define flush_cache_vmap(start, end) do { } while (0)
  59. #define flush_cache_vunmap(start, end) do { } while (0)
  60. #endif /* !__ASSEMBLY__ */
  61. #endif /* _SPARC64_CACHEFLUSH_H */