diff options
author | LEROY Christophe <christophe.leroy@c-s.fr> | 2015-01-20 04:57:34 -0500 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2015-01-29 22:59:02 -0500 |
commit | fde5a9057fcf2e96da1de3b6acf815c1e7d73f1e (patch) | |
tree | 5a9bb25c9216625025ba11f7ce89eb75ce0361be | |
parent | 17bb312f4c75e59ef6f18015011c4efbb545a748 (diff) |
powerpc/8xx: Optimise access to swapper_pg_dir
All accessed to PGD entries are done via 0(r11).
By using lower part of swapper_pg_dir as load index to r11, we can remove the
ori instruction.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r-- | arch/powerpc/kernel/head_8xx.S | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 0ab16b66d712..24934e79cd23 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S | |||
@@ -319,16 +319,15 @@ InstructionTLBMiss: | |||
319 | * pin the first 8MB of kernel memory */ | 319 | * pin the first 8MB of kernel memory */ |
320 | andis. r11, r10, 0x8000 /* Address >= 0x80000000 */ | 320 | andis. r11, r10, 0x8000 /* Address >= 0x80000000 */ |
321 | #endif | 321 | #endif |
322 | mfspr r11, SPRN_M_TW /* Get level 1 table base address */ | 322 | mfspr r11, SPRN_M_TW /* Get level 1 table */ |
323 | #ifdef CONFIG_MODULES | 323 | #ifdef CONFIG_MODULES |
324 | beq 3f | 324 | beq 3f |
325 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@h | 325 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha |
326 | ori r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l | ||
327 | 3: | 326 | 3: |
328 | #endif | 327 | #endif |
329 | /* Insert level 1 index */ | 328 | /* Insert level 1 index */ |
330 | rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 | 329 | rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 |
331 | lwz r11, 0(r11) /* Get the level 1 entry */ | 330 | lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */ |
332 | 331 | ||
333 | /* Load the MI_TWC with the attributes for this "segment." */ | 332 | /* Load the MI_TWC with the attributes for this "segment." */ |
334 | MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */ | 333 | MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */ |
@@ -374,14 +373,13 @@ DataStoreTLBMiss: | |||
374 | * kernel page tables. | 373 | * kernel page tables. |
375 | */ | 374 | */ |
376 | andis. r11, r10, 0x8000 | 375 | andis. r11, r10, 0x8000 |
377 | mfspr r11, SPRN_M_TW /* Get level 1 table base address */ | 376 | mfspr r11, SPRN_M_TW /* Get level 1 table */ |
378 | beq 3f | 377 | beq 3f |
379 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@h | 378 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha |
380 | ori r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l | ||
381 | 3: | 379 | 3: |
382 | /* Insert level 1 index */ | 380 | /* Insert level 1 index */ |
383 | rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 | 381 | rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 |
384 | lwz r11, 0(r11) /* Get the level 1 entry */ | 382 | lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */ |
385 | 383 | ||
386 | /* We have a pte table, so load fetch the pte from the table. | 384 | /* We have a pte table, so load fetch the pte from the table. |
387 | */ | 385 | */ |
@@ -506,13 +504,12 @@ FixupDAR:/* Entry point for dcbx workaround. */ | |||
506 | /* fetch instruction from memory. */ | 504 | /* fetch instruction from memory. */ |
507 | mfspr r10, SPRN_SRR0 | 505 | mfspr r10, SPRN_SRR0 |
508 | andis. r11, r10, 0x8000 /* Address >= 0x80000000 */ | 506 | andis. r11, r10, 0x8000 /* Address >= 0x80000000 */ |
509 | mfspr r11, SPRN_M_TW /* Get level 1 table base address */ | 507 | mfspr r11, SPRN_M_TW /* Get level 1 table */ |
510 | beq- 3f /* Branch if user space */ | 508 | beq 3f |
511 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@h | 509 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha |
512 | ori r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l | ||
513 | /* Insert level 1 index */ | 510 | /* Insert level 1 index */ |
514 | 3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 | 511 | 3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 |
515 | lwz r11, 0(r11) /* Get the level 1 entry */ | 512 | lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */ |
516 | rlwinm r11, r11,0,0,19 /* Extract page descriptor page address */ | 513 | rlwinm r11, r11,0,0,19 /* Extract page descriptor page address */ |
517 | /* Insert level 2 index */ | 514 | /* Insert level 2 index */ |
518 | rlwimi r11, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29 | 515 | rlwimi r11, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29 |
@@ -667,8 +664,7 @@ start_here: | |||
667 | * init's THREAD like the context switch code does, but this is | 664 | * init's THREAD like the context switch code does, but this is |
668 | * easier......until someone changes init's static structures. | 665 | * easier......until someone changes init's static structures. |
669 | */ | 666 | */ |
670 | lis r6, swapper_pg_dir@h | 667 | lis r6, swapper_pg_dir@ha |
671 | ori r6, r6, swapper_pg_dir@l | ||
672 | tophys(r6,r6) | 668 | tophys(r6,r6) |
673 | #ifdef CONFIG_8xx_CPU6 | 669 | #ifdef CONFIG_8xx_CPU6 |
674 | lis r4, cpu6_errata_word@h | 670 | lis r4, cpu6_errata_word@h |
@@ -847,6 +843,13 @@ _GLOBAL(set_context) | |||
847 | stw r4, 0x4(r5) | 843 | stw r4, 0x4(r5) |
848 | #endif | 844 | #endif |
849 | 845 | ||
846 | /* Register M_TW will contain base address of level 1 table minus the | ||
847 | * lower part of the kernel PGDIR base address, so that all accesses to | ||
848 | * level 1 table are done relative to lower part of kernel PGDIR base | ||
849 | * address. | ||
850 | */ | ||
851 | li r5, (swapper_pg_dir-PAGE_OFFSET)@l | ||
852 | sub r4, r4, r5 | ||
850 | #ifdef CONFIG_8xx_CPU6 | 853 | #ifdef CONFIG_8xx_CPU6 |
851 | lis r6, cpu6_errata_word@h | 854 | lis r6, cpu6_errata_word@h |
852 | ori r6, r6, cpu6_errata_word@l | 855 | ori r6, r6, cpu6_errata_word@l |
@@ -854,7 +857,7 @@ _GLOBAL(set_context) | |||
854 | li r7, 0x3f80 | 857 | li r7, 0x3f80 |
855 | stw r7, 12(r6) | 858 | stw r7, 12(r6) |
856 | lwz r7, 12(r6) | 859 | lwz r7, 12(r6) |
857 | mtspr SPRN_M_TW, r4 /* Update MMU base address */ | 860 | mtspr SPRN_M_TW, r4 /* Update pointeur to level 1 table */ |
858 | li r7, 0x3380 | 861 | li r7, 0x3380 |
859 | stw r7, 12(r6) | 862 | stw r7, 12(r6) |
860 | lwz r7, 12(r6) | 863 | lwz r7, 12(r6) |