Skip to content

Commit eeba1f7

Browse files
chleroyScott Wood
authored and
Scott Wood
committed
powerpc/8xx: Add support for TASK_SIZE greater than 0x80000000
By default, TASK_SIZE is set to 0x80000000 for PPC_8xx, which is most likely sufficient for most cases. However, kernel configuration allows to set TASK_SIZE to another value, so the 8xx shall handle it. This patch also takes into account the case of PAGE_OFFSET lower than 0x80000000, allthought most of the time it is equal to 0xC0000000 Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Scott Wood <[email protected]>
1 parent b821c5f commit eeba1f7

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

arch/powerpc/kernel/head_8xx.S

+19-6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@
4848
mtspr spr, reg
4949
#endif
5050

51+
/* Macro to test if an address is a kernel address */
52+
#if CONFIG_TASK_SIZE <= 0x80000000 && CONFIG_PAGE_OFFSET >= 0x80000000
53+
#define IS_KERNEL(tmp, addr) \
54+
andis. tmp, addr, 0x8000 /* Address >= 0x80000000 */
55+
#define BRANCH_UNLESS_KERNEL(label) beq label
56+
#else
57+
#define IS_KERNEL(tmp, addr) \
58+
rlwinm tmp, addr, 16, 16, 31; \
59+
cmpli cr0, tmp, PAGE_OFFSET >> 16
60+
#define BRANCH_UNLESS_KERNEL(label) blt label
61+
#endif
62+
63+
5164
/*
5265
* Value for the bits that have fixed value in RPN entries.
5366
* Also used for tagging DAR for DTLBerror.
@@ -322,9 +335,9 @@ InstructionTLBMiss:
322335
mfspr r11, SPRN_SRR0 /* Get effective address of fault */
323336
INVALIDATE_ADJACENT_PAGES_CPU15(r10, r11)
324337
mfcr r10
325-
andis. r11, r11, 0x8000 /* Address >= 0x80000000 */
338+
IS_KERNEL(r11, r11)
326339
mfspr r11, SPRN_M_TW /* Get level 1 table */
327-
beq 3f
340+
BRANCH_UNLESS_KERNEL(3f)
328341
lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
329342
3:
330343
mtcr r10
@@ -379,9 +392,9 @@ DataStoreTLBMiss:
379392
* kernel page tables.
380393
*/
381394
mfspr r11, SPRN_MD_EPN
382-
andis. r11, r11, 0x8000
395+
IS_KERNEL(r11, r11)
383396
mfspr r11, SPRN_M_TW /* Get level 1 table */
384-
beq 3f
397+
BRANCH_UNLESS_KERNEL(3f)
385398
lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
386399
3:
387400
mtcr r10
@@ -513,9 +526,9 @@ FixupDAR:/* Entry point for dcbx workaround. */
513526
mtspr SPRN_SPRG_SCRATCH2, r10
514527
/* fetch instruction from memory. */
515528
mfspr r10, SPRN_SRR0
516-
andis. r11, r10, 0x8000 /* Address >= 0x80000000 */
529+
IS_KERNEL(r11, r10)
517530
mfspr r11, SPRN_M_TW /* Get level 1 table */
518-
beq 3f
531+
BRANCH_UNLESS_KERNEL(3f)
519532
lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
520533
/* Insert level 1 index */
521534
3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29

0 commit comments

Comments
 (0)