diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-17 21:01:02 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:13:34 -0500 |
commit | 8b234274418d6d79527c4ac3a72da446ca4cb35f (patch) | |
tree | ab4ab14fa7f1cab7889ecc2339f0261253a5d0e1 /arch/sparc64/kernel/sun4v_tlb_miss.S | |
parent | 7adb37fe80d06cbd40de9b225b12a3a9ec40b6bb (diff) |
[SPARC64]: More TLB/TSB handling fixes.
The SUN4V convention with non-shared TSBs is that the context
bit of the TAG is clear. So we have to choose an "invalid"
bit and initialize new TSBs appropriately. Otherwise a zero
TAG looks "valid".
Make sure, for the window fixup cases, that we use the right
global registers and that we don't potentially trample on
the live global registers in etrap/rtrap handling (%g2 and
%g6) and that we put the missing virtual address properly
in %g5.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/sun4v_tlb_miss.S')
-rw-r--r-- | arch/sparc64/kernel/sun4v_tlb_miss.S | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc64/kernel/sun4v_tlb_miss.S index 244d50de8499..57ccdaec7ccb 100644 --- a/arch/sparc64/kernel/sun4v_tlb_miss.S +++ b/arch/sparc64/kernel/sun4v_tlb_miss.S | |||
@@ -16,15 +16,14 @@ | |||
16 | ldx [BASE + HV_FAULT_D_ADDR_OFFSET], VADDR; \ | 16 | ldx [BASE + HV_FAULT_D_ADDR_OFFSET], VADDR; \ |
17 | ldx [BASE + HV_FAULT_D_CTX_OFFSET], CTX; | 17 | ldx [BASE + HV_FAULT_D_CTX_OFFSET], CTX; |
18 | 18 | ||
19 | /* DEST = (CTX << 48) | (VADDR >> 22) | 19 | /* DEST = (VADDR >> 22) |
20 | * | 20 | * |
21 | * Branch to ZERO_CTX_LABEL is context is zero. | 21 | * Branch to ZERO_CTX_LABEL is context is zero. |
22 | */ | 22 | */ |
23 | #define COMPUTE_TAG_TARGET(DEST, VADDR, CTX, TMP, ZERO_CTX_LABEL) \ | 23 | #define COMPUTE_TAG_TARGET(DEST, VADDR, CTX, ZERO_CTX_LABEL) \ |
24 | srlx VADDR, 22, TMP; \ | 24 | srlx VADDR, 22, DEST; \ |
25 | sllx CTX, 48, DEST; \ | ||
26 | brz,pn CTX, ZERO_CTX_LABEL; \ | 25 | brz,pn CTX, ZERO_CTX_LABEL; \ |
27 | or DEST, TMP, DEST; | 26 | nop; |
28 | 27 | ||
29 | /* Create TSB pointer. This is something like: | 28 | /* Create TSB pointer. This is something like: |
30 | * | 29 | * |
@@ -53,7 +52,7 @@ sun4v_itlb_miss: | |||
53 | ldxa [%g1] ASI_SCRATCHPAD, %g1 | 52 | ldxa [%g1] ASI_SCRATCHPAD, %g1 |
54 | 53 | ||
55 | LOAD_ITLB_INFO(%g2, %g4, %g5) | 54 | LOAD_ITLB_INFO(%g2, %g4, %g5) |
56 | COMPUTE_TAG_TARGET(%g6, %g4, %g5, %g3, kvmap_itlb_4v) | 55 | COMPUTE_TAG_TARGET(%g6, %g4, %g5, kvmap_itlb_4v) |
57 | COMPUTE_TSB_PTR(%g1, %g4, %g3, %g7) | 56 | COMPUTE_TSB_PTR(%g1, %g4, %g3, %g7) |
58 | 57 | ||
59 | /* Load TSB tag/pte into %g2/%g3 and compare the tag. */ | 58 | /* Load TSB tag/pte into %g2/%g3 and compare the tag. */ |
@@ -72,15 +71,15 @@ sun4v_itlb_miss: | |||
72 | * | 71 | * |
73 | * %g3: PTE | 72 | * %g3: PTE |
74 | * %g4: vaddr | 73 | * %g4: vaddr |
75 | * %g6: TAG TARGET (only "CTX << 48" part matters) | ||
76 | */ | 74 | */ |
77 | sun4v_itlb_load: | 75 | sun4v_itlb_load: |
76 | ldxa [%g0] ASI_SCRATCHPAD, %g6 | ||
78 | mov %o0, %g1 ! save %o0 | 77 | mov %o0, %g1 ! save %o0 |
79 | mov %o1, %g2 ! save %o1 | 78 | mov %o1, %g2 ! save %o1 |
80 | mov %o2, %g5 ! save %o2 | 79 | mov %o2, %g5 ! save %o2 |
81 | mov %o3, %g7 ! save %o3 | 80 | mov %o3, %g7 ! save %o3 |
82 | mov %g4, %o0 ! vaddr | 81 | mov %g4, %o0 ! vaddr |
83 | srlx %g6, 48, %o1 ! ctx | 82 | ldx [%g6 + HV_FAULT_I_CTX_OFFSET], %o1 ! ctx |
84 | mov %g3, %o2 ! PTE | 83 | mov %g3, %o2 ! PTE |
85 | mov HV_MMU_IMMU, %o3 ! flags | 84 | mov HV_MMU_IMMU, %o3 ! flags |
86 | ta HV_MMU_MAP_ADDR_TRAP | 85 | ta HV_MMU_MAP_ADDR_TRAP |
@@ -101,7 +100,7 @@ sun4v_dtlb_miss: | |||
101 | ldxa [%g1] ASI_SCRATCHPAD, %g1 | 100 | ldxa [%g1] ASI_SCRATCHPAD, %g1 |
102 | 101 | ||
103 | LOAD_DTLB_INFO(%g2, %g4, %g5) | 102 | LOAD_DTLB_INFO(%g2, %g4, %g5) |
104 | COMPUTE_TAG_TARGET(%g6, %g4, %g5, %g3, kvmap_dtlb_4v) | 103 | COMPUTE_TAG_TARGET(%g6, %g4, %g5, kvmap_dtlb_4v) |
105 | COMPUTE_TSB_PTR(%g1, %g4, %g3, %g7) | 104 | COMPUTE_TSB_PTR(%g1, %g4, %g3, %g7) |
106 | 105 | ||
107 | /* Load TSB tag/pte into %g2/%g3 and compare the tag. */ | 106 | /* Load TSB tag/pte into %g2/%g3 and compare the tag. */ |
@@ -115,15 +114,15 @@ sun4v_dtlb_miss: | |||
115 | * | 114 | * |
116 | * %g3: PTE | 115 | * %g3: PTE |
117 | * %g4: vaddr | 116 | * %g4: vaddr |
118 | * %g6: TAG TARGET (only "CTX << 48" part matters) | ||
119 | */ | 117 | */ |
120 | sun4v_dtlb_load: | 118 | sun4v_dtlb_load: |
119 | ldxa [%g0] ASI_SCRATCHPAD, %g6 | ||
121 | mov %o0, %g1 ! save %o0 | 120 | mov %o0, %g1 ! save %o0 |
122 | mov %o1, %g2 ! save %o1 | 121 | mov %o1, %g2 ! save %o1 |
123 | mov %o2, %g5 ! save %o2 | 122 | mov %o2, %g5 ! save %o2 |
124 | mov %o3, %g7 ! save %o3 | 123 | mov %o3, %g7 ! save %o3 |
125 | mov %g4, %o0 ! vaddr | 124 | mov %g4, %o0 ! vaddr |
126 | srlx %g6, 48, %o1 ! ctx | 125 | ldx [%g6 + HV_FAULT_D_CTX_OFFSET], %o1 ! ctx |
127 | mov %g3, %o2 ! PTE | 126 | mov %g3, %o2 ! PTE |
128 | mov HV_MMU_DMMU, %o3 ! flags | 127 | mov HV_MMU_DMMU, %o3 ! flags |
129 | ta HV_MMU_MAP_ADDR_TRAP | 128 | ta HV_MMU_MAP_ADDR_TRAP |
@@ -136,16 +135,18 @@ sun4v_dtlb_load: | |||
136 | retry | 135 | retry |
137 | 136 | ||
138 | sun4v_dtlb_prot: | 137 | sun4v_dtlb_prot: |
138 | SET_GL(1) | ||
139 | |||
139 | /* Load MMU Miss base into %g2. */ | 140 | /* Load MMU Miss base into %g2. */ |
140 | ldxa [%g0] ASI_SCRATCHPAD, %g2 | 141 | ldxa [%g0] ASI_SCRATCHPAD, %g5 |
141 | 142 | ||
142 | ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g5 | 143 | ldx [%g5 + HV_FAULT_D_ADDR_OFFSET], %g5 |
143 | rdpr %tl, %g1 | 144 | rdpr %tl, %g1 |
144 | cmp %g1, 1 | 145 | cmp %g1, 1 |
145 | bgu,pn %xcc, winfix_trampoline | 146 | bgu,pn %xcc, winfix_trampoline |
146 | nop | 147 | nop |
147 | ba,pt %xcc, sparc64_realfault_common | 148 | ba,pt %xcc, sparc64_realfault_common |
148 | mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4 | 149 | mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4 |
149 | 150 | ||
150 | /* Called from trap table with TAG TARGET placed into | 151 | /* Called from trap table with TAG TARGET placed into |
151 | * %g6, SCRATCHPAD_UTSBREG1 contents in %g1, and | 152 | * %g6, SCRATCHPAD_UTSBREG1 contents in %g1, and |
@@ -189,7 +190,8 @@ sun4v_itlb_error: | |||
189 | sethi %hi(sun4v_err_itlb_vaddr), %g1 | 190 | sethi %hi(sun4v_err_itlb_vaddr), %g1 |
190 | stx %g4, [%g1 + %lo(sun4v_err_itlb_vaddr)] | 191 | stx %g4, [%g1 + %lo(sun4v_err_itlb_vaddr)] |
191 | sethi %hi(sun4v_err_itlb_ctx), %g1 | 192 | sethi %hi(sun4v_err_itlb_ctx), %g1 |
192 | srlx %g6, 48, %o1 ! ctx | 193 | ldxa [%g0] ASI_SCRATCHPAD, %g6 |
194 | ldx [%g6 + HV_FAULT_I_CTX_OFFSET], %o1 | ||
193 | stx %o1, [%g1 + %lo(sun4v_err_itlb_ctx)] | 195 | stx %o1, [%g1 + %lo(sun4v_err_itlb_ctx)] |
194 | sethi %hi(sun4v_err_itlb_pte), %g1 | 196 | sethi %hi(sun4v_err_itlb_pte), %g1 |
195 | stx %g3, [%g1 + %lo(sun4v_err_itlb_pte)] | 197 | stx %g3, [%g1 + %lo(sun4v_err_itlb_pte)] |
@@ -214,7 +216,8 @@ sun4v_dtlb_error: | |||
214 | sethi %hi(sun4v_err_dtlb_vaddr), %g1 | 216 | sethi %hi(sun4v_err_dtlb_vaddr), %g1 |
215 | stx %g4, [%g1 + %lo(sun4v_err_dtlb_vaddr)] | 217 | stx %g4, [%g1 + %lo(sun4v_err_dtlb_vaddr)] |
216 | sethi %hi(sun4v_err_dtlb_ctx), %g1 | 218 | sethi %hi(sun4v_err_dtlb_ctx), %g1 |
217 | srlx %g6, 48, %o1 ! ctx | 219 | ldxa [%g0] ASI_SCRATCHPAD, %g6 |
220 | ldx [%g6 + HV_FAULT_D_CTX_OFFSET], %o1 | ||
218 | stx %o1, [%g1 + %lo(sun4v_err_dtlb_ctx)] | 221 | stx %o1, [%g1 + %lo(sun4v_err_dtlb_ctx)] |
219 | sethi %hi(sun4v_err_dtlb_pte), %g1 | 222 | sethi %hi(sun4v_err_dtlb_pte), %g1 |
220 | stx %g3, [%g1 + %lo(sun4v_err_dtlb_pte)] | 223 | stx %g3, [%g1 + %lo(sun4v_err_dtlb_pte)] |