cacheflush.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Cache flush operations for the Hexagon architecture
  4. *
  5. * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  6. */
  7. #ifndef _ASM_CACHEFLUSH_H
  8. #define _ASM_CACHEFLUSH_H
  9. #include <linux/mm_types.h>
  10. /* Cache flushing:
  11. *
  12. * - flush_cache_all() flushes entire cache
  13. * - flush_cache_mm(mm) flushes the specified mm context's cache lines
  14. * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
  15. * - flush_cache_range(vma, start, end) flushes a range of pages
  16. * - flush_icache_range(start, end) flush a range of instructions
  17. * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
  18. * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
  19. *
  20. * Need to doublecheck which one is really needed for ptrace stuff to work.
  21. */
  22. #define LINESIZE 32
  23. #define LINEBITS 5
  24. /*
  25. * Flush Dcache range through current map.
  26. */
  27. extern void flush_dcache_range(unsigned long start, unsigned long end);
  28. #define flush_dcache_range flush_dcache_range
  29. /*
  30. * Flush Icache range through current map.
  31. */
  32. extern void flush_icache_range(unsigned long start, unsigned long end);
  33. #define flush_icache_range flush_icache_range
  34. /*
  35. * Memory-management related flushes are there to ensure in non-physically
  36. * indexed cache schemes that stale lines belonging to a given ASID aren't
  37. * in the cache to confuse things. The prototype Hexagon Virtual Machine
  38. * only uses a single ASID for all user-mode maps, which should
  39. * mean that they aren't necessary. A brute-force, flush-everything
  40. * implementation, with the name xxxxx_hexagon() is present in
  41. * arch/hexagon/mm/cache.c, but let's not wire it up until we know
  42. * it is needed.
  43. */
  44. extern void flush_cache_all_hexagon(void);
  45. /*
  46. * This may or may not ever have to be non-null, depending on the
  47. * virtual machine MMU. For a native kernel, it's definitiely a no-op
  48. *
  49. * This is also the place where deferred cache coherency stuff seems
  50. * to happen, classically... but instead we do it like ia64 and
  51. * clean the cache when the PTE is set.
  52. *
  53. */
  54. static inline void update_mmu_cache(struct vm_area_struct *vma,
  55. unsigned long address, pte_t *ptep)
  56. {
  57. /* generic_ptrace_pokedata doesn't wind up here, does it? */
  58. }
  59. void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
  60. unsigned long vaddr, void *dst, void *src, int len);
  61. #define copy_to_user_page copy_to_user_page
  62. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  63. memcpy(dst, src, len)
  64. extern void hexagon_inv_dcache_range(unsigned long start, unsigned long end);
  65. extern void hexagon_clean_dcache_range(unsigned long start, unsigned long end);
  66. #include <asm-generic/cacheflush.h>
  67. #endif