diff options
Diffstat (limited to 'arch/sparc64/kernel/tsb.S')
-rw-r--r-- | arch/sparc64/kernel/tsb.S | 89 |
1 files changed, 76 insertions, 13 deletions
diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc64/kernel/tsb.S index 96e63168d8b2..818bc9e9135a 100644 --- a/arch/sparc64/kernel/tsb.S +++ b/arch/sparc64/kernel/tsb.S | |||
@@ -18,30 +18,33 @@ | |||
18 | * %g4: available temporary | 18 | * %g4: available temporary |
19 | * %g5: available temporary | 19 | * %g5: available temporary |
20 | * %g6: TAG TARGET | 20 | * %g6: TAG TARGET |
21 | * %g7: physical address base of the linux page | 21 | * %g7: available temporary, will be loaded by us with |
22 | * the physical address base of the linux page | ||
22 | * tables for the current address space | 23 | * tables for the current address space |
23 | */ | 24 | */ |
24 | .globl tsb_miss_dtlb | ||
25 | tsb_miss_dtlb: | 25 | tsb_miss_dtlb: |
26 | mov TLB_TAG_ACCESS, %g4 | 26 | mov TLB_TAG_ACCESS, %g4 |
27 | ldxa [%g4] ASI_DMMU, %g4 | 27 | ldxa [%g4] ASI_DMMU, %g4 |
28 | ba,pt %xcc, tsb_miss_page_table_walk | 28 | ba,pt %xcc, tsb_miss_page_table_walk |
29 | nop | 29 | nop |
30 | 30 | ||
31 | .globl tsb_miss_itlb | ||
32 | tsb_miss_itlb: | 31 | tsb_miss_itlb: |
33 | mov TLB_TAG_ACCESS, %g4 | 32 | mov TLB_TAG_ACCESS, %g4 |
34 | ldxa [%g4] ASI_IMMU, %g4 | 33 | ldxa [%g4] ASI_IMMU, %g4 |
35 | ba,pt %xcc, tsb_miss_page_table_walk | 34 | ba,pt %xcc, tsb_miss_page_table_walk |
36 | nop | 35 | nop |
37 | 36 | ||
37 | /* The sun4v TLB miss handlers jump directly here instead | ||
38 | * of tsb_miss_{d,i}tlb with the missing virtual address | ||
39 | * already loaded into %g4. | ||
40 | */ | ||
38 | tsb_miss_page_table_walk: | 41 | tsb_miss_page_table_walk: |
39 | TRAP_LOAD_PGD_PHYS(%g7, %g5) | 42 | TRAP_LOAD_PGD_PHYS(%g7, %g5) |
40 | 43 | ||
41 | USER_PGTABLE_WALK_TL1(%g4, %g7, %g5, %g2, tsb_do_fault) | 44 | USER_PGTABLE_WALK_TL1(%g4, %g7, %g5, %g2, tsb_do_fault) |
42 | 45 | ||
43 | tsb_reload: | 46 | tsb_reload: |
44 | TSB_LOCK_TAG(%g1, %g2, %g4) | 47 | TSB_LOCK_TAG(%g1, %g2, %g7) |
45 | 48 | ||
46 | /* Load and check PTE. */ | 49 | /* Load and check PTE. */ |
47 | ldxa [%g5] ASI_PHYS_USE_EC, %g5 | 50 | ldxa [%g5] ASI_PHYS_USE_EC, %g5 |
@@ -52,9 +55,9 @@ tsb_reload: | |||
52 | * bother putting it into the TSB. | 55 | * bother putting it into the TSB. |
53 | */ | 56 | */ |
54 | srlx %g5, 32, %g2 | 57 | srlx %g5, 32, %g2 |
55 | sethi %hi(_PAGE_ALL_SZ_BITS >> 32), %g4 | 58 | sethi %hi(_PAGE_ALL_SZ_BITS >> 32), %g7 |
59 | and %g2, %g7, %g2 | ||
56 | sethi %hi(_PAGE_SZBITS >> 32), %g7 | 60 | sethi %hi(_PAGE_SZBITS >> 32), %g7 |
57 | and %g2, %g4, %g2 | ||
58 | cmp %g2, %g7 | 61 | cmp %g2, %g7 |
59 | bne,a,pn %xcc, tsb_tlb_reload | 62 | bne,a,pn %xcc, tsb_tlb_reload |
60 | TSB_STORE(%g1, %g0) | 63 | TSB_STORE(%g1, %g0) |
@@ -68,12 +71,54 @@ tsb_tlb_reload: | |||
68 | nop | 71 | nop |
69 | 72 | ||
70 | tsb_dtlb_load: | 73 | tsb_dtlb_load: |
71 | stxa %g5, [%g0] ASI_DTLB_DATA_IN | 74 | |
75 | 661: stxa %g5, [%g0] ASI_DTLB_DATA_IN | ||
72 | retry | 76 | retry |
77 | .section .gl_2insn_patch, "ax" | ||
78 | .word 661b | ||
79 | nop | ||
80 | nop | ||
81 | .previous | ||
82 | |||
83 | /* For sun4v the ASI_DTLB_DATA_IN store and the retry | ||
84 | * instruction get nop'd out and we get here to branch | ||
85 | * to the sun4v tlb load code. The registers are setup | ||
86 | * as follows: | ||
87 | * | ||
88 | * %g4: vaddr | ||
89 | * %g5: PTE | ||
90 | * %g6: TAG | ||
91 | * | ||
92 | * The sun4v TLB load wants the PTE in %g3 so we fix that | ||
93 | * up here. | ||
94 | */ | ||
95 | ba,pt %xcc, sun4v_dtlb_load | ||
96 | mov %g5, %g3 | ||
73 | 97 | ||
74 | tsb_itlb_load: | 98 | tsb_itlb_load: |
75 | stxa %g5, [%g0] ASI_ITLB_DATA_IN | 99 | |
100 | 661: stxa %g5, [%g0] ASI_ITLB_DATA_IN | ||
76 | retry | 101 | retry |
102 | .section .gl_2insn_patch, "ax" | ||
103 | .word 661b | ||
104 | nop | ||
105 | nop | ||
106 | .previous | ||
107 | |||
108 | /* For sun4v the ASI_ITLB_DATA_IN store and the retry | ||
109 | * instruction get nop'd out and we get here to branch | ||
110 | * to the sun4v tlb load code. The registers are setup | ||
111 | * as follows: | ||
112 | * | ||
113 | * %g4: vaddr | ||
114 | * %g5: PTE | ||
115 | * %g6: TAG | ||
116 | * | ||
117 | * The sun4v TLB load wants the PTE in %g3 so we fix that | ||
118 | * up here. | ||
119 | */ | ||
120 | ba,pt %xcc, sun4v_itlb_load | ||
121 | mov %g5, %g3 | ||
77 | 122 | ||
78 | /* No valid entry in the page tables, do full fault | 123 | /* No valid entry in the page tables, do full fault |
79 | * processing. | 124 | * processing. |
@@ -95,10 +140,17 @@ tsb_do_fault: | |||
95 | nop | 140 | nop |
96 | 141 | ||
97 | tsb_do_dtlb_fault: | 142 | tsb_do_dtlb_fault: |
98 | rdpr %tl, %g4 | 143 | rdpr %tl, %g3 |
99 | cmp %g4, 1 | 144 | cmp %g3, 1 |
100 | mov TLB_TAG_ACCESS, %g4 | 145 | |
146 | 661: mov TLB_TAG_ACCESS, %g4 | ||
101 | ldxa [%g4] ASI_DMMU, %g5 | 147 | ldxa [%g4] ASI_DMMU, %g5 |
148 | .section .gl_2insn_patch, "ax" | ||
149 | .word 661b | ||
150 | mov %g4, %g5 | ||
151 | nop | ||
152 | .previous | ||
153 | |||
102 | be,pt %xcc, sparc64_realfault_common | 154 | be,pt %xcc, sparc64_realfault_common |
103 | mov FAULT_CODE_DTLB, %g4 | 155 | mov FAULT_CODE_DTLB, %g4 |
104 | ba,pt %xcc, winfix_trampoline | 156 | ba,pt %xcc, winfix_trampoline |
@@ -196,12 +248,23 @@ __tsb_context_switch: | |||
196 | add %g2, %g1, %g2 | 248 | add %g2, %g1, %g2 |
197 | stx %o0, [%g2 + TRAP_PER_CPU_PGD_PADDR] | 249 | stx %o0, [%g2 + TRAP_PER_CPU_PGD_PADDR] |
198 | 250 | ||
199 | mov TSB_REG, %g1 | 251 | 661: mov TSB_REG, %g1 |
200 | stxa %o1, [%g1] ASI_DMMU | 252 | stxa %o1, [%g1] ASI_DMMU |
253 | .section .gl_2insn_patch, "ax" | ||
254 | .word 661b | ||
255 | mov SCRATCHPAD_UTSBREG1, %g1 | ||
256 | stxa %o1, [%g1] ASI_SCRATCHPAD | ||
257 | .previous | ||
258 | |||
201 | membar #Sync | 259 | membar #Sync |
202 | 260 | ||
203 | stxa %o1, [%g1] ASI_IMMU | 261 | 661: stxa %o1, [%g1] ASI_IMMU |
204 | membar #Sync | 262 | membar #Sync |
263 | .section .gl_2insn_patch, "ax" | ||
264 | .word 661b | ||
265 | nop | ||
266 | nop | ||
267 | .previous | ||
205 | 268 | ||
206 | brz %o2, 9f | 269 | brz %o2, 9f |
207 | nop | 270 | nop |