Skip to content

Commit 3f57d90

Browse files
chleroympe
authored andcommitted
powerpc/603: Inconditionally use task PGDIR in ITLB misses
Now that modules exec page tables are preallocated, the instruction TLBmiss handler can use task PGDIR inconditionally. Also revise the identification of user vs kernel user space by doing a calculation instead of a comparison: Get the segment number and subtract the number of the first kernel segment. The result is positive for kernel addresses and negative for user addresses, which means that upper 2 bits are 0 for kernel and 3 for user. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/9a3242162ad2faab8019c698e501b326a126ee9e.1724173828.git.christophe.leroy@csgroup.eu
1 parent 31c0e13 commit 3f57d90

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

arch/powerpc/kernel/head_book3s_32.S

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,22 +413,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE)
413413
InstructionTLBMiss:
414414
/* Get PTE (linux-style) and check access */
415415
mfspr r0,SPRN_IMISS
416-
#ifdef CONFIG_EXECMEM
417-
lis r1, TASK_SIZE@h /* check if kernel address */
418-
cmplw 0,r1,r0
419-
#endif
420416
mfspr r2, SPRN_SDR1
421417
li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
422418
rlwinm r2, r2, 28, 0xfffff000
419+
rlwimi r2,r0,12,20,29 /* insert top 10 bits of address */
420+
lwz r2,0(r2) /* get pmd entry */
423421
#ifdef CONFIG_EXECMEM
424-
li r3, 3
425-
bgt- 112f
426-
lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
427-
li r3, 0
428-
addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
422+
rlwinm r3, r0, 4, 0xf
423+
subi r3, r3, (TASK_SIZE >> 28) & 0xf
429424
#endif
430-
112: rlwimi r2,r0,12,20,29 /* insert top 10 bits of address */
431-
lwz r2,0(r2) /* get pmd entry */
432425
rlwinm. r2,r2,0,0,19 /* extract address of pte page */
433426
beq- InstructionAddressInvalid /* return if no mapping */
434427
rlwimi r2,r0,22,20,29 /* insert next 10 bits of address */
@@ -437,7 +430,7 @@ InstructionTLBMiss:
437430
bne- InstructionAddressInvalid /* return if access not permitted */
438431
/* Convert linux-style PTE to low word of PPC-style PTE */
439432
#ifdef CONFIG_EXECMEM
440-
rlwimi r2, r3, 0, 31, 31 /* userspace ? -> PP lsb */
433+
rlwimi r2, r3, 1, 31, 31 /* userspace ? -> PP lsb */
441434
#endif
442435
ori r1, r1, 0xe06 /* clear out reserved bits */
443436
andc r1, r2, r1 /* PP = user? 1 : 0 */

0 commit comments

Comments
 (0)