tlb-fa.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/arch/arm/mm/tlb-fa.S
  4. *
  5. * Copyright (C) 2005 Faraday Corp.
  6. * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  7. *
  8. * Based on tlb-v4wbi.S:
  9. * Copyright (C) 1997-2002 Russell King
  10. *
  11. * ARM architecture version 4, Faraday variation.
  12. * This assume an unified TLBs, with a write buffer, and branch target buffer (BTB)
  13. *
  14. * Processors: FA520 FA526 FA626
  15. */
  16. #include <linux/linkage.h>
  17. #include <linux/init.h>
  18. #include <linux/cfi_types.h>
  19. #include <asm/assembler.h>
  20. #include <asm/asm-offsets.h>
  21. #include <asm/tlbflush.h>
  22. #include "proc-macros.S"
  23. /*
  24. * flush_user_tlb_range(start, end, mm)
  25. *
  26. * Invalidate a range of TLB entries in the specified address space.
  27. *
  28. * - start - range start address
  29. * - end - range end address
  30. * - mm - mm_struct describing address space
  31. */
  32. .align 4
  33. SYM_TYPED_FUNC_START(fa_flush_user_tlb_range)
  34. vma_vm_mm ip, r2
  35. act_mm r3 @ get current->active_mm
  36. eors r3, ip, r3 @ == mm ?
  37. retne lr @ no, we dont do anything
  38. mov r3, #0
  39. mcr p15, 0, r3, c7, c10, 4 @ drain WB
  40. bic r0, r0, #0x0ff
  41. bic r0, r0, #0xf00
  42. 1: mcr p15, 0, r0, c8, c7, 1 @ invalidate UTLB entry
  43. add r0, r0, #PAGE_SZ
  44. cmp r0, r1
  45. blo 1b
  46. mcr p15, 0, r3, c7, c10, 4 @ data write barrier
  47. ret lr
  48. SYM_FUNC_END(fa_flush_user_tlb_range)
  49. SYM_TYPED_FUNC_START(fa_flush_kern_tlb_range)
  50. mov r3, #0
  51. mcr p15, 0, r3, c7, c10, 4 @ drain WB
  52. bic r0, r0, #0x0ff
  53. bic r0, r0, #0xf00
  54. 1: mcr p15, 0, r0, c8, c7, 1 @ invalidate UTLB entry
  55. add r0, r0, #PAGE_SZ
  56. cmp r0, r1
  57. blo 1b
  58. mcr p15, 0, r3, c7, c10, 4 @ data write barrier
  59. mcr p15, 0, r3, c7, c5, 4 @ prefetch flush (isb)
  60. ret lr
  61. SYM_FUNC_END(fa_flush_kern_tlb_range)