Skip to content

Commit a81252d

Browse files
author
Jonas Bonn
committed
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>
1 parent 7f81ea7 commit a81252d

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎arch/openrisc/kernel/entry.S‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,17 @@ EXCEPTION_ENTRY(_bus_fault_handler)
201201
l.nop
202202

203203
/* ---[ 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
204208

205209
EXCEPTION_ENTRY(_data_page_fault_handler)
206210
/* set up parameters for do_page_fault */
211+
l.ori r5,r0,0x300 // exception vector
212+
1:
207213
l.addi r3,r1,0 // pt_regs
208214
/* r4 set be EXCEPTION_HANDLE */ // effective address of fault
209-
l.ori r5,r0,0x300 // exception vector
210215

211216
/*
212217
* __PHX__: TODO
@@ -276,12 +281,17 @@ EXCEPTION_ENTRY(_data_page_fault_handler)
276281
l.nop
277282

278283
/* ---[ 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
279288

280289
EXCEPTION_ENTRY(_insn_page_fault_handler)
281290
/* set up parameters for do_page_fault */
291+
l.ori r5,r0,0x400 // exception vector
292+
1:
282293
l.addi r3,r1,0 // pt_regs
283294
/* r4 set be EXCEPTION_HANDLE */ // effective address of fault
284-
l.ori r5,r0,0x400 // exception vector
285295
l.ori r6,r0,0x0 // !write access
286296

287297
/* call fault.c handler in or32/mm/fault.c */

‎arch/openrisc/kernel/head.S‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,7 @@ d_pte_not_present:
10691069
EXCEPTION_LOAD_GPR4
10701070
EXCEPTION_LOAD_GPR5
10711071
EXCEPTION_LOAD_GPR6
1072-
l.j _dispatch_do_dpage_fault
1073-
l.nop
1072+
EXCEPTION_HANDLE(_dtlb_miss_page_fault_handler)
10741073

10751074
/* ==============================================[ ITLB miss handler ]=== */
10761075
ENTRY(itlb_miss_handler)
@@ -1192,8 +1191,7 @@ i_pte_not_present:
11921191
EXCEPTION_LOAD_GPR4
11931192
EXCEPTION_LOAD_GPR5
11941193
EXCEPTION_LOAD_GPR6
1195-
l.j _dispatch_do_ipage_fault
1196-
l.nop
1194+
EXCEPTION_HANDLE(_itlb_miss_page_fault_handler)
11971195

11981196
/* ==============================================[ boot tlb handlers ]=== */
11991197

0 commit comments

Comments
 (0)