diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2016-09-16 02:42:08 -0400 |
---|---|---|
committer | Scott Wood <oss@buserror.net> | 2016-09-25 03:38:57 -0400 |
commit | 36eb1542fc97c3164a08751b97dafdac0f9e1366 (patch) | |
tree | 5d5e1f9ed80ecde278250ded9faafbf87a0e6bdd /arch/powerpc | |
parent | 73a532061c65f4e15a3aa7d75fde81203749562b (diff) |
powerpc/8xx: make user addr DTLB miss the short path
User space DTLB miss represent approximatly 90% of TLB misses
so make it the shortest path.
Also remove an unneccessary double jump in FixupDAR
Before this patch, we spend 3.3 TB ticks in the handler for each
user address miss and 3.4 TB ticks for each kernel address miss
After this patch, we send 3.0 TB ticks in the handler for each
user address miss and 3.9 TB ticks for each kernel address miss
Taking into account that user misses represent 90% of the total,
this patch provides an improvement of approx. 9%
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/head_8xx.S | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index f674dfae1e95..033a6b735487 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S | |||
@@ -382,30 +382,31 @@ InstructionTLBMiss: | |||
382 | 382 | ||
383 | . = 0x1200 | 383 | . = 0x1200 |
384 | DataStoreTLBMiss: | 384 | DataStoreTLBMiss: |
385 | mtspr SPRN_SPRG_SCRATCH2, r3 | ||
385 | EXCEPTION_PROLOG_0 | 386 | EXCEPTION_PROLOG_0 |
386 | mfcr r10 | 387 | mfcr r3 |
387 | 388 | ||
388 | /* If we are faulting a kernel address, we have to use the | 389 | /* If we are faulting a kernel address, we have to use the |
389 | * kernel page tables. | 390 | * kernel page tables. |
390 | */ | 391 | */ |
391 | mfspr r11, SPRN_MD_EPN | 392 | mfspr r10, SPRN_MD_EPN |
392 | rlwinm r11, r11, 16, 0xfff8 | 393 | rlwinm r10, r10, 16, 0xfff8 |
394 | cmpli cr0, r10, PAGE_OFFSET@h | ||
395 | mfspr r11, SPRN_M_TW /* Get level 1 table */ | ||
396 | blt+ 3f | ||
393 | #ifndef CONFIG_PIN_TLB_IMMR | 397 | #ifndef CONFIG_PIN_TLB_IMMR |
394 | cmpli cr0, r11, VIRT_IMMR_BASE@h | 398 | cmpli cr0, r10, VIRT_IMMR_BASE@h |
395 | #endif | 399 | #endif |
396 | cmpli cr7, r11, PAGE_OFFSET@h | 400 | _ENTRY(DTLBMiss_cmp) |
401 | cmpli cr7, r10, (PAGE_OFFSET + 0x1800000)@h | ||
402 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha | ||
397 | #ifndef CONFIG_PIN_TLB_IMMR | 403 | #ifndef CONFIG_PIN_TLB_IMMR |
398 | _ENTRY(DTLBMiss_jmp) | 404 | _ENTRY(DTLBMiss_jmp) |
399 | beq- DTLBMissIMMR | 405 | beq- DTLBMissIMMR |
400 | #endif | 406 | #endif |
401 | bge- cr7, DTLBMissLinear | 407 | blt cr7, DTLBMissLinear |
402 | |||
403 | mfspr r11, SPRN_M_TW /* Get level 1 table */ | ||
404 | 3: | 408 | 3: |
405 | mtcr r10 | 409 | mtcr r3 |
406 | #ifdef CONFIG_8xx_CPU6 | ||
407 | mtspr SPRN_SPRG_SCRATCH2, r3 | ||
408 | #endif | ||
409 | mfspr r10, SPRN_MD_EPN | 410 | mfspr r10, SPRN_MD_EPN |
410 | 411 | ||
411 | /* Insert level 1 index */ | 412 | /* Insert level 1 index */ |
@@ -458,9 +459,7 @@ _ENTRY(DTLBMiss_jmp) | |||
458 | MTSPR_CPU6(SPRN_MD_RPN, r10, r3) /* Update TLB entry */ | 459 | MTSPR_CPU6(SPRN_MD_RPN, r10, r3) /* Update TLB entry */ |
459 | 460 | ||
460 | /* Restore registers */ | 461 | /* Restore registers */ |
461 | #ifdef CONFIG_8xx_CPU6 | ||
462 | mfspr r3, SPRN_SPRG_SCRATCH2 | 462 | mfspr r3, SPRN_SPRG_SCRATCH2 |
463 | #endif | ||
464 | mtspr SPRN_DAR, r11 /* Tag DAR */ | 463 | mtspr SPRN_DAR, r11 /* Tag DAR */ |
465 | EXCEPTION_EPILOG_0 | 464 | EXCEPTION_EPILOG_0 |
466 | rfi | 465 | rfi |
@@ -531,7 +530,7 @@ DARFixed:/* Return from dcbx instruction bug workaround */ | |||
531 | * not enough space in the DataStoreTLBMiss area. | 530 | * not enough space in the DataStoreTLBMiss area. |
532 | */ | 531 | */ |
533 | DTLBMissIMMR: | 532 | DTLBMissIMMR: |
534 | mtcr r10 | 533 | mtcr r3 |
535 | /* Set 512k byte guarded page and mark it valid */ | 534 | /* Set 512k byte guarded page and mark it valid */ |
536 | li r10, MD_PS512K | MD_GUARDED | MD_SVALID | 535 | li r10, MD_PS512K | MD_GUARDED | MD_SVALID |
537 | MTSPR_CPU6(SPRN_MD_TWC, r10, r11) | 536 | MTSPR_CPU6(SPRN_MD_TWC, r10, r11) |
@@ -543,27 +542,23 @@ DTLBMissIMMR: | |||
543 | 542 | ||
544 | li r11, RPN_PATTERN | 543 | li r11, RPN_PATTERN |
545 | mtspr SPRN_DAR, r11 /* Tag DAR */ | 544 | mtspr SPRN_DAR, r11 /* Tag DAR */ |
545 | mfspr r3, SPRN_SPRG_SCRATCH2 | ||
546 | EXCEPTION_EPILOG_0 | 546 | EXCEPTION_EPILOG_0 |
547 | rfi | 547 | rfi |
548 | 548 | ||
549 | DTLBMissLinear: | 549 | DTLBMissLinear: |
550 | _ENTRY(DTLBMiss_cmp) | 550 | mtcr r3 |
551 | cmpli cr0, r11, (PAGE_OFFSET + 0x1800000)@h | ||
552 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha | ||
553 | bge- 3b | ||
554 | |||
555 | mtcr r10 | ||
556 | /* Set 8M byte page and mark it valid */ | 551 | /* Set 8M byte page and mark it valid */ |
557 | li r10, MD_PS8MEG | MD_SVALID | 552 | li r11, MD_PS8MEG | MD_SVALID |
558 | MTSPR_CPU6(SPRN_MD_TWC, r10, r11) | 553 | MTSPR_CPU6(SPRN_MD_TWC, r11, r3) |
559 | mfspr r10, SPRN_MD_EPN | 554 | rlwinm r10, r10, 16, 0x0f800000 /* 8xx supports max 256Mb RAM */ |
560 | rlwinm r10, r10, 0, 0x0f800000 /* 8xx supports max 256Mb RAM */ | ||
561 | ori r10, r10, 0xf0 | MD_SPS16K | _PAGE_SHARED | _PAGE_DIRTY | \ | 555 | ori r10, r10, 0xf0 | MD_SPS16K | _PAGE_SHARED | _PAGE_DIRTY | \ |
562 | _PAGE_PRESENT | 556 | _PAGE_PRESENT |
563 | MTSPR_CPU6(SPRN_MD_RPN, r10, r11) /* Update TLB entry */ | 557 | MTSPR_CPU6(SPRN_MD_RPN, r10, r11) /* Update TLB entry */ |
564 | 558 | ||
565 | li r11, RPN_PATTERN | 559 | li r11, RPN_PATTERN |
566 | mtspr SPRN_DAR, r11 /* Tag DAR */ | 560 | mtspr SPRN_DAR, r11 /* Tag DAR */ |
561 | mfspr r3, SPRN_SPRG_SCRATCH2 | ||
567 | EXCEPTION_EPILOG_0 | 562 | EXCEPTION_EPILOG_0 |
568 | rfi | 563 | rfi |
569 | 564 | ||
@@ -583,7 +578,9 @@ FixupDAR:/* Entry point for dcbx workaround. */ | |||
583 | rlwinm r11, r10, 16, 0xfff8 | 578 | rlwinm r11, r10, 16, 0xfff8 |
584 | _ENTRY(FixupDAR_cmp) | 579 | _ENTRY(FixupDAR_cmp) |
585 | cmpli cr7, r11, (PAGE_OFFSET + 0x1800000)@h | 580 | cmpli cr7, r11, (PAGE_OFFSET + 0x1800000)@h |
586 | blt- cr7, 200f | 581 | /* create physical page address from effective address */ |
582 | tophys(r11, r10) | ||
583 | blt- cr7, 201f | ||
587 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha | 584 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha |
588 | /* Insert level 1 index */ | 585 | /* Insert level 1 index */ |
589 | 3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 | 586 | 3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 |
@@ -613,10 +610,6 @@ _ENTRY(FixupDAR_cmp) | |||
613 | 141: mfspr r10,SPRN_SPRG_SCRATCH2 | 610 | 141: mfspr r10,SPRN_SPRG_SCRATCH2 |
614 | b DARFixed /* Nope, go back to normal TLB processing */ | 611 | b DARFixed /* Nope, go back to normal TLB processing */ |
615 | 612 | ||
616 | /* create physical page address from effective address */ | ||
617 | 200: tophys(r11, r10) | ||
618 | b 201b | ||
619 | |||
620 | 144: mfspr r10, SPRN_DSISR | 613 | 144: mfspr r10, SPRN_DSISR |
621 | rlwinm r10, r10,0,7,5 /* Clear store bit for buggy dcbst insn */ | 614 | rlwinm r10, r10,0,7,5 /* Clear store bit for buggy dcbst insn */ |
622 | mtspr SPRN_DSISR, r10 | 615 | mtspr SPRN_DSISR, r10 |