Commit a81252d75e14cc2cf0ee45078ef143562a0bc279
1 parent
7f81ea7e28
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
openrisc: fix up vmalloc page table loading
vmalloc'ed pages are faulted into a process' page tables on demand. In order to facilitate this, do_page_fault needs to know whether it was called via a page fault exception or a TLB-miss exception. This patch adds a wrapper around the _x_page_fault_handler entry points that the TLB-miss exceptions can call into in order to have the relevant parameter set to satisfy do_page_fault. This fixes a bug and is "good enough" for now. That said, this whole handling of vmalloc needs to be audited for correctness at some point. Signed-off-by: Jonas Bonn <jonas@southpole.se>
Showing 2 changed files with 14 additions and 6 deletions Side-by-side Diff
arch/openrisc/kernel/entry.S
... | ... | @@ -201,12 +201,17 @@ |
201 | 201 | l.nop |
202 | 202 | |
203 | 203 | /* ---[ 0x300: Data Page Fault exception ]------------------------------- */ |
204 | +EXCEPTION_ENTRY(_dtlb_miss_page_fault_handler) | |
205 | + l.and r5,r5,r0 | |
206 | + l.j 1f | |
207 | + l.nop | |
204 | 208 | |
205 | 209 | EXCEPTION_ENTRY(_data_page_fault_handler) |
206 | 210 | /* set up parameters for do_page_fault */ |
211 | + l.ori r5,r0,0x300 // exception vector | |
212 | +1: | |
207 | 213 | l.addi r3,r1,0 // pt_regs |
208 | 214 | /* r4 set be EXCEPTION_HANDLE */ // effective address of fault |
209 | - l.ori r5,r0,0x300 // exception vector | |
210 | 215 | |
211 | 216 | /* |
212 | 217 | * __PHX__: TODO |
213 | 218 | |
214 | 219 | |
... | ... | @@ -276,12 +281,17 @@ |
276 | 281 | l.nop |
277 | 282 | |
278 | 283 | /* ---[ 0x400: Insn Page Fault exception ]------------------------------- */ |
284 | +EXCEPTION_ENTRY(_itlb_miss_page_fault_handler) | |
285 | + l.and r5,r5,r0 | |
286 | + l.j 1f | |
287 | + l.nop | |
279 | 288 | |
280 | 289 | EXCEPTION_ENTRY(_insn_page_fault_handler) |
281 | 290 | /* set up parameters for do_page_fault */ |
291 | + l.ori r5,r0,0x400 // exception vector | |
292 | +1: | |
282 | 293 | l.addi r3,r1,0 // pt_regs |
283 | 294 | /* r4 set be EXCEPTION_HANDLE */ // effective address of fault |
284 | - l.ori r5,r0,0x400 // exception vector | |
285 | 295 | l.ori r6,r0,0x0 // !write access |
286 | 296 | |
287 | 297 | /* call fault.c handler in or32/mm/fault.c */ |
arch/openrisc/kernel/head.S
... | ... | @@ -1069,8 +1069,7 @@ |
1069 | 1069 | EXCEPTION_LOAD_GPR4 |
1070 | 1070 | EXCEPTION_LOAD_GPR5 |
1071 | 1071 | EXCEPTION_LOAD_GPR6 |
1072 | - l.j _dispatch_do_dpage_fault | |
1073 | - l.nop | |
1072 | + EXCEPTION_HANDLE(_dtlb_miss_page_fault_handler) | |
1074 | 1073 | |
1075 | 1074 | /* ==============================================[ ITLB miss handler ]=== */ |
1076 | 1075 | ENTRY(itlb_miss_handler) |
... | ... | @@ -1192,8 +1191,7 @@ |
1192 | 1191 | EXCEPTION_LOAD_GPR4 |
1193 | 1192 | EXCEPTION_LOAD_GPR5 |
1194 | 1193 | EXCEPTION_LOAD_GPR6 |
1195 | - l.j _dispatch_do_ipage_fault | |
1196 | - l.nop | |
1194 | + EXCEPTION_HANDLE(_itlb_miss_page_fault_handler) | |
1197 | 1195 | |
1198 | 1196 | /* ==============================================[ boot tlb handlers ]=== */ |
1199 | 1197 |