^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * viking.S: High speed Viking cache/mmu operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1997,1998,1999 Jakub Jelinek (jj@ultra.linux.cz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 1999 Pavel Semerad (semerad@ss1000.ms.mff.cuni.cz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/psr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/asi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/mxcc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/pgtable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/pgtsrmmu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/viking.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) sun4dsmp_flush_tlb_spin:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) .word 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .globl viking_flush_cache_all, viking_flush_cache_mm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .globl viking_flush_cache_range, viking_flush_cache_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .globl viking_flush_page, viking_mxcc_flush_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .globl viking_flush_page_for_dma, viking_flush_page_to_ram
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .globl viking_flush_sig_insns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .globl viking_flush_tlb_all, viking_flush_tlb_mm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) .globl viking_flush_tlb_range, viking_flush_tlb_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) viking_flush_page:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) sethi %hi(PAGE_OFFSET), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) sub %o0, %g2, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) srl %g3, 12, %g1 ! ppage >> 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) clr %o1 ! set counter, 0 - 127
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) sethi %hi(PAGE_OFFSET + PAGE_SIZE - 0x80000000), %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) sethi %hi(0x80000000), %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) sethi %hi(VIKING_PTAG_VALID), %o5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) sethi %hi(2*PAGE_SIZE), %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) sethi %hi(PAGE_SIZE), %g7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) clr %o2 ! block counter, 0 - 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 5:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) sll %o1, 5, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) or %g4, %o4, %g4 ! 0x80000000 | (set << 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) sll %o2, 26, %g5 ! block << 26
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 6:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) or %g5, %g4, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ldda [%g5] ASI_M_DATAC_TAG, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) cmp %g3, %g1 ! ptag == ppage?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) bne 7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) inc %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) andcc %g2, %o5, %g0 ! ptag VALID?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) be 7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) add %g4, %o3, %g2 ! (PAGE_OFFSET + PAGE_SIZE) | (set << 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ld [%g2], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ld [%g2 + %g7], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) add %g2, %o0, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ld [%g2], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ld [%g2 + %g7], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) add %g2, %o0, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ld [%g2], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ld [%g2 + %g7], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) add %g2, %o0, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) ld [%g2], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) b 8f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) ld [%g2 + %g7], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 7:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) cmp %o2, 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ble 6b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) sll %o2, 26, %g5 ! block << 26
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 8: inc %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) cmp %o1, 0x7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) ble 5b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) clr %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 9: retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) viking_mxcc_flush_page:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) sethi %hi(PAGE_OFFSET), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) sub %o0, %g2, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) sub %g3, -PAGE_SIZE, %g3 ! ppage + PAGE_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) sethi %hi(MXCC_SRCSTREAM), %o3 ! assume %hi(MXCC_SRCSTREAM) == %hi(MXCC_DESTSTREAM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) mov 0x10, %g2 ! set cacheable bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) or %o3, %lo(MXCC_SRCSTREAM), %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) or %o3, %lo(MXCC_DESSTREAM), %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) sub %g3, MXCC_STREAM_SIZE, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 6:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) stda %g2, [%o2] ASI_M_MXCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) stda %g2, [%o3] ASI_M_MXCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) andncc %g3, PAGE_MASK, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) bne 6b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) sub %g3, MXCC_STREAM_SIZE, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 9: retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) viking_flush_cache_page:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) viking_flush_cache_range:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) ld [%o0 + VMA_VM_MM], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) viking_flush_cache_mm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ld [%o0 + AOFF_mm_context], %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) cmp %g1, -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) bne viking_flush_cache_all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) b,a viking_flush_cache_out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) viking_flush_cache_all:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) WINDOW_FLUSH(%g4, %g5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) viking_flush_cache_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) viking_flush_tlb_all:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) mov 0x400, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) sta %g0, [%g1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) viking_flush_tlb_mm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) mov SRMMU_CTX_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) ld [%o0 + AOFF_mm_context], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) lda [%g1] ASI_M_MMUREGS, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) cmp %o1, -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) be 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) mov 0x300, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) sta %o1, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) sta %g0, [%g2] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) sta %g5, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 1: retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) viking_flush_tlb_range:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) ld [%o0 + VMA_VM_MM], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) mov SRMMU_CTX_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) ld [%o0 + AOFF_mm_context], %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) lda [%g1] ASI_M_MMUREGS, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) cmp %o3, -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) be 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) sethi %hi(~((1 << PGDIR_SHIFT) - 1)), %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) sta %o3, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) and %o1, %o4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) add %o1, 0x200, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) sta %g0, [%o1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 1: sub %o1, %o4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) cmp %o1, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) blu,a 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) sta %g0, [%o1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) sta %g5, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 2: retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) viking_flush_tlb_page:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) ld [%o0 + VMA_VM_MM], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) mov SRMMU_CTX_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) ld [%o0 + AOFF_mm_context], %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) lda [%g1] ASI_M_MMUREGS, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) cmp %o3, -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) be 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) and %o1, PAGE_MASK, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) sta %o3, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) sta %g0, [%o1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) sta %g5, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 1: retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) viking_flush_page_to_ram:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) viking_flush_page_for_dma:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) viking_flush_sig_insns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) .globl sun4dsmp_flush_tlb_all, sun4dsmp_flush_tlb_mm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) .globl sun4dsmp_flush_tlb_range, sun4dsmp_flush_tlb_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) sun4dsmp_flush_tlb_all:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) sethi %hi(sun4dsmp_flush_tlb_spin), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 1: ldstub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) bne 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) mov 0x400, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) sta %g0, [%g1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) stb %g0, [%g3 + %lo(sun4dsmp_flush_tlb_spin)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 2: tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) bne,a 2b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ldub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) b,a 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) sun4dsmp_flush_tlb_mm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) sethi %hi(sun4dsmp_flush_tlb_spin), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 1: ldstub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) bne 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) mov SRMMU_CTX_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ld [%o0 + AOFF_mm_context], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) lda [%g1] ASI_M_MMUREGS, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) mov 0x300, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) sta %o1, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) sta %g0, [%g2] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) sta %g5, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) stb %g0, [%g3 + %lo(sun4dsmp_flush_tlb_spin)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 2: tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) bne,a 2b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) ldub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) b,a 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) sun4dsmp_flush_tlb_range:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) sethi %hi(sun4dsmp_flush_tlb_spin), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 1: ldstub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) bne 3f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) mov SRMMU_CTX_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) ld [%o0 + VMA_VM_MM], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ld [%o0 + AOFF_mm_context], %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) lda [%g1] ASI_M_MMUREGS, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) sethi %hi(~((1 << PGDIR_SHIFT) - 1)), %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) sta %o3, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) and %o1, %o4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) add %o1, 0x200, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) sta %g0, [%o1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 2: sub %o1, %o4, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) cmp %o1, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) blu,a 2b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) sta %g0, [%o1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) sta %g5, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) stb %g0, [%g3 + %lo(sun4dsmp_flush_tlb_spin)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 3: tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) bne,a 3b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) ldub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) b,a 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) sun4dsmp_flush_tlb_page:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) sethi %hi(sun4dsmp_flush_tlb_spin), %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 1: ldstub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) bne 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) mov SRMMU_CTX_REG, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) ld [%o0 + VMA_VM_MM], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) ld [%o0 + AOFF_mm_context], %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) lda [%g1] ASI_M_MMUREGS, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) and %o1, PAGE_MASK, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) sta %o3, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) sta %g0, [%o1] ASI_M_FLUSH_PROBE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) sta %g5, [%g1] ASI_M_MMUREGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) stb %g0, [%g3 + %lo(sun4dsmp_flush_tlb_spin)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 2: tst %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) bne,a 2b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) ldub [%g3 + %lo(sun4dsmp_flush_tlb_spin)], %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) b,a 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) #endif