aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/entry_64.S
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-10-04 02:47:49 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-16 02:31:36 -0400
commitd04c56f73c30a5e593202ecfcf25ed43d42363a2 (patch)
treebec1208293c904b73f12dd9179ebf8e88dbdb085 /arch/powerpc/kernel/entry_64.S
parent284a940675a64df253e3dffc60b09bb4bbb149e4 (diff)
[POWERPC] Lazy interrupt disabling for 64-bit machines
This implements a lazy strategy for disabling interrupts. This means that local_irq_disable() et al. just clear the 'interrupts are enabled' flag in the paca. If an interrupt comes along, the interrupt entry code notices that interrupts are supposed to be disabled, and clears the EE bit in SRR1, clears the 'interrupts are hard-enabled' flag in the paca, and returns. This means that interrupts only actually get disabled in the processor when an interrupt comes along. When interrupts are enabled by local_irq_enable() et al., the code sets the interrupts-enabled flag in the paca, and then checks whether interrupts got hard-disabled. If so, it also sets the EE bit in the MSR to hard-enable the interrupts. This has the potential to improve performance, and also makes it easier to make a kernel that can boot on iSeries and on other 64-bit machines, since this lazy-disable strategy is very similar to the soft-disable strategy that iSeries already uses. This version renames paca->proc_enabled to paca->soft_enabled, and changes a couple of soft-disables in the kexec code to hard-disables, which should fix the crash that Michael Ellerman saw. This doesn't yet use a reserved CR field for the soft_enabled and hard_enabled flags. This applies on top of Stephen Rothwell's patches to make it possible to build a combined iSeries/other kernel. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r--arch/powerpc/kernel/entry_64.S39
1 files changed, 18 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 748e74fcf541..efda48741b29 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -87,6 +87,10 @@ system_call_common:
87 addi r9,r1,STACK_FRAME_OVERHEAD 87 addi r9,r1,STACK_FRAME_OVERHEAD
88 ld r11,exception_marker@toc(r2) 88 ld r11,exception_marker@toc(r2)
89 std r11,-16(r9) /* "regshere" marker */ 89 std r11,-16(r9) /* "regshere" marker */
90 li r10,1
91 stb r10,PACASOFTIRQEN(r13)
92 stb r10,PACAHARDIRQEN(r13)
93 std r10,SOFTE(r1)
90#ifdef CONFIG_PPC_ISERIES 94#ifdef CONFIG_PPC_ISERIES
91BEGIN_FW_FTR_SECTION 95BEGIN_FW_FTR_SECTION
92 /* Hack for handling interrupts when soft-enabling on iSeries */ 96 /* Hack for handling interrupts when soft-enabling on iSeries */
@@ -94,8 +98,6 @@ BEGIN_FW_FTR_SECTION
94 andi. r10,r12,MSR_PR /* from kernel */ 98 andi. r10,r12,MSR_PR /* from kernel */
95 crand 4*cr0+eq,4*cr1+eq,4*cr0+eq 99 crand 4*cr0+eq,4*cr1+eq,4*cr0+eq
96 beq hardware_interrupt_entry 100 beq hardware_interrupt_entry
97 lbz r10,PACAPROCENABLED(r13)
98 std r10,SOFTE(r1)
99END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 101END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
100#endif 102#endif
101 mfmsr r11 103 mfmsr r11
@@ -460,9 +462,9 @@ _GLOBAL(ret_from_except_lite)
460#endif 462#endif
461 463
462restore: 464restore:
465 ld r5,SOFTE(r1)
463#ifdef CONFIG_PPC_ISERIES 466#ifdef CONFIG_PPC_ISERIES
464BEGIN_FW_FTR_SECTION 467BEGIN_FW_FTR_SECTION
465 ld r5,SOFTE(r1)
466 cmpdi 0,r5,0 468 cmpdi 0,r5,0
467 beq 4f 469 beq 4f
468 /* Check for pending interrupts (iSeries) */ 470 /* Check for pending interrupts (iSeries) */
@@ -472,16 +474,16 @@ BEGIN_FW_FTR_SECTION
472 beq+ 4f /* skip do_IRQ if no interrupts */ 474 beq+ 4f /* skip do_IRQ if no interrupts */
473 475
474 li r3,0 476 li r3,0
475 stb r3,PACAPROCENABLED(r13) /* ensure we are soft-disabled */ 477 stb r3,PACASOFTIRQEN(r13) /* ensure we are soft-disabled */
476 ori r10,r10,MSR_EE 478 ori r10,r10,MSR_EE
477 mtmsrd r10 /* hard-enable again */ 479 mtmsrd r10 /* hard-enable again */
478 addi r3,r1,STACK_FRAME_OVERHEAD 480 addi r3,r1,STACK_FRAME_OVERHEAD
479 bl .do_IRQ 481 bl .do_IRQ
480 b .ret_from_except_lite /* loop back and handle more */ 482 b .ret_from_except_lite /* loop back and handle more */
481 4834:
4824: stb r5,PACAPROCENABLED(r13)
483END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 484END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
484#endif 485#endif
486 stb r5,PACASOFTIRQEN(r13)
485 487
486 ld r3,_MSR(r1) 488 ld r3,_MSR(r1)
487 andi. r0,r3,MSR_RI 489 andi. r0,r3,MSR_RI
@@ -538,25 +540,15 @@ do_work:
538 /* Check that preempt_count() == 0 and interrupts are enabled */ 540 /* Check that preempt_count() == 0 and interrupts are enabled */
539 lwz r8,TI_PREEMPT(r9) 541 lwz r8,TI_PREEMPT(r9)
540 cmpwi cr1,r8,0 542 cmpwi cr1,r8,0
541#ifdef CONFIG_PPC_ISERIES
542BEGIN_FW_FTR_SECTION
543 ld r0,SOFTE(r1) 543 ld r0,SOFTE(r1)
544 cmpdi r0,0 544 cmpdi r0,0
545END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
546#endif
547BEGIN_FW_FTR_SECTION
548 andi. r0,r3,MSR_EE
549END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
550 crandc eq,cr1*4+eq,eq 545 crandc eq,cr1*4+eq,eq
551 bne restore 546 bne restore
552 /* here we are preempting the current task */ 547 /* here we are preempting the current task */
5531: 5481:
554#ifdef CONFIG_PPC_ISERIES
555BEGIN_FW_FTR_SECTION
556 li r0,1 549 li r0,1
557 stb r0,PACAPROCENABLED(r13) 550 stb r0,PACASOFTIRQEN(r13)
558END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) 551 stb r0,PACAHARDIRQEN(r13)
559#endif
560 ori r10,r10,MSR_EE 552 ori r10,r10,MSR_EE
561 mtmsrd r10,1 /* reenable interrupts */ 553 mtmsrd r10,1 /* reenable interrupts */
562 bl .preempt_schedule 554 bl .preempt_schedule
@@ -639,8 +631,7 @@ _GLOBAL(enter_rtas)
639 /* There is no way it is acceptable to get here with interrupts enabled, 631 /* There is no way it is acceptable to get here with interrupts enabled,
640 * check it with the asm equivalent of WARN_ON 632 * check it with the asm equivalent of WARN_ON
641 */ 633 */
642 mfmsr r6 634 lbz r0,PACASOFTIRQEN(r13)
643 andi. r0,r6,MSR_EE
6441: tdnei r0,0 6351: tdnei r0,0
645.section __bug_table,"a" 636.section __bug_table,"a"
646 .llong 1b,__LINE__ + 0x1000000, 1f, 2f 637 .llong 1b,__LINE__ + 0x1000000, 1f, 2f
@@ -649,7 +640,13 @@ _GLOBAL(enter_rtas)
6491: .asciz __FILE__ 6401: .asciz __FILE__
6502: .asciz "enter_rtas" 6412: .asciz "enter_rtas"
651.previous 642.previous
652 643
644 /* Hard-disable interrupts */
645 mfmsr r6
646 rldicl r7,r6,48,1
647 rotldi r7,r7,16
648 mtmsrd r7,1
649
653 /* Unfortunately, the stack pointer and the MSR are also clobbered, 650 /* Unfortunately, the stack pointer and the MSR are also clobbered,
654 * so they are saved in the PACA which allows us to restore 651 * so they are saved in the PACA which allows us to restore
655 * our original state after RTAS returns. 652 * our original state after RTAS returns.