diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-03-01 19:33:52 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-03-08 18:55:20 -0500 |
commit | d9ada91ae2969ae6b6dc3574fd08a6ebda5df766 (patch) | |
tree | a4509657892acb0b853760d6d26729a913a5fc2b /arch | |
parent | 9424fabf8617c15e18a5ffd29bc3bcfa36620473 (diff) |
powerpc: Replace mfmsr instructions with load from PACA kernel_msr field
On 64-bit, the mfmsr instruction can be quite slow, slower
than loading a field from the cache-hot PACA, which happens
to already contain the value we want in most cases.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/exception-64s.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/hw_irq.h | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 14 | ||||
-rw-r--r-- | arch/powerpc/kernel/exceptions-64s.S | 5 |
4 files changed, 10 insertions, 15 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 7f4718c4f04a..70354af0740e 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h | |||
@@ -298,7 +298,7 @@ label##_hv: \ | |||
298 | 298 | ||
299 | /* Exception addition: Keep interrupt state */ | 299 | /* Exception addition: Keep interrupt state */ |
300 | #define ENABLE_INTS \ | 300 | #define ENABLE_INTS \ |
301 | mfmsr r11; \ | 301 | ld r11,PACAKMSR(r13); \ |
302 | ld r12,_MSR(r1); \ | 302 | ld r12,_MSR(r1); \ |
303 | rlwimi r11,r12,0,MSR_EE; \ | 303 | rlwimi r11,r12,0,MSR_EE; \ |
304 | mtmsrd r11,1 | 304 | mtmsrd r11,1 |
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index 531ba00fcbab..6c6fa955baa7 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -68,8 +68,8 @@ static inline bool arch_irqs_disabled(void) | |||
68 | #define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); | 68 | #define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); |
69 | #define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); | 69 | #define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); |
70 | #else | 70 | #else |
71 | #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) | 71 | #define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1) |
72 | #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) | 72 | #define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1) |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #define hard_irq_disable() \ | 75 | #define hard_irq_disable() \ |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index cc030b73174b..c513beb78b3b 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -557,10 +557,8 @@ _GLOBAL(ret_from_except_lite) | |||
557 | #ifdef CONFIG_PPC_BOOK3E | 557 | #ifdef CONFIG_PPC_BOOK3E |
558 | wrteei 0 | 558 | wrteei 0 |
559 | #else | 559 | #else |
560 | mfmsr r10 /* Get current interrupt state */ | 560 | ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */ |
561 | rldicl r9,r10,48,1 /* clear MSR_EE */ | 561 | mtmsrd r10,1 /* Update machine state */ |
562 | rotldi r9,r9,16 | ||
563 | mtmsrd r9,1 /* Update machine state */ | ||
564 | #endif /* CONFIG_PPC_BOOK3E */ | 562 | #endif /* CONFIG_PPC_BOOK3E */ |
565 | 563 | ||
566 | #ifdef CONFIG_PREEMPT | 564 | #ifdef CONFIG_PREEMPT |
@@ -625,8 +623,8 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) | |||
625 | * userspace and we take an exception after restoring r13, | 623 | * userspace and we take an exception after restoring r13, |
626 | * we end up corrupting the userspace r13 value. | 624 | * we end up corrupting the userspace r13 value. |
627 | */ | 625 | */ |
628 | mfmsr r4 | 626 | ld r4,PACAKMSR(r13) /* Get kernel MSR without EE */ |
629 | andc r4,r4,r0 /* r0 contains MSR_RI here */ | 627 | andc r4,r4,r0 /* r0 contains MSR_RI here */ |
630 | mtmsrd r4,1 | 628 | mtmsrd r4,1 |
631 | 629 | ||
632 | /* | 630 | /* |
@@ -686,9 +684,7 @@ do_work: | |||
686 | #ifdef CONFIG_PPC_BOOK3E | 684 | #ifdef CONFIG_PPC_BOOK3E |
687 | wrteei 0 | 685 | wrteei 0 |
688 | #else | 686 | #else |
689 | mfmsr r10 | 687 | ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */ |
690 | rldicl r10,r10,48,1 | ||
691 | rotldi r10,r10,16 | ||
692 | mtmsrd r10,1 | 688 | mtmsrd r10,1 |
693 | #endif /* CONFIG_PPC_BOOK3E */ | 689 | #endif /* CONFIG_PPC_BOOK3E */ |
694 | li r0,0 | 690 | li r0,0 |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 0fb42ae21694..02448ea58ad3 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -848,9 +848,8 @@ fast_exception_return: | |||
848 | REST_GPR(0, r1) | 848 | REST_GPR(0, r1) |
849 | REST_8GPRS(2, r1) | 849 | REST_8GPRS(2, r1) |
850 | 850 | ||
851 | mfmsr r10 | 851 | ld r10,PACAKMSR(r13) |
852 | rldicl r10,r10,48,1 /* clear EE */ | 852 | clrrdi r10,r10,2 /* clear RI */ |
853 | rldicr r10,r10,16,61 /* clear RI (LE is 0 already) */ | ||
854 | mtmsrd r10,1 | 853 | mtmsrd r10,1 |
855 | 854 | ||
856 | mtspr SPRN_SRR1,r12 | 855 | mtspr SPRN_SRR1,r12 |