aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihai Caraman <mihai.caraman@freescale.com>2012-08-05 23:27:06 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-05 01:35:49 -0400
commit79b5c8dbaa4528a6fd03a4d9d8a6d56a46293a3a (patch)
tree1513553a12f5bf406872d0de6e05aa47093bc807
parentfecff0f7243edaea33071865ee5e35839be44f10 (diff)
powerpc/booke64: Eemove mfspr srr1 duplicate in exception prolog
Refactor exception prolog to get rid of mfspr srr1 duplicate. This was introduced by KVM integration, with DO_KVM macro logic expecting srr1 value earlier in r11. Reserve r11 to hold srr1's value also required at the end of the prolog and free up r10 to serve as spare in addition macros. For syscalls case this change does not add any performance penalty. For irq soft-disabled case the change adds a store/load of conditional register value to/from a paca slot. Paca slots fit in one 64-byte cache line so these additional operations have little impact on performance. Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S67
1 files changed, 32 insertions, 35 deletions
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 3b1ad1ba8c48..83c20e84a4fb 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -45,10 +45,9 @@
45 mfcr r10; /* save CR */ \ 45 mfcr r10; /* save CR */ \
46 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ 46 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
47 DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \ 47 DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \
48 stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \
48 addition; /* additional code for that exc. */ \ 49 addition; /* additional code for that exc. */ \
49 std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \ 50 std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \
50 stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \
51 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
52 type##_SET_KSTACK; /* get special stack if necessary */\ 51 type##_SET_KSTACK; /* get special stack if necessary */\
53 andi. r10,r11,MSR_PR; /* save stack pointer */ \ 52 andi. r10,r11,MSR_PR; /* save stack pointer */ \
54 beq 1f; /* branch around if supervisor */ \ 53 beq 1f; /* branch around if supervisor */ \
@@ -109,8 +108,8 @@
109#define PROLOG_ADDITION_NONE_MC(n) 108#define PROLOG_ADDITION_NONE_MC(n)
110 109
111#define PROLOG_ADDITION_MASKABLE_GEN(n) \ 110#define PROLOG_ADDITION_MASKABLE_GEN(n) \
112 lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ 111 lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \
113 cmpwi cr0,r11,0; /* yes -> go out of line */ \ 112 cmpwi cr0,r10,0; /* yes -> go out of line */ \
114 beq masked_interrupt_book3e_##n 113 beq masked_interrupt_book3e_##n
115 114
116#define PROLOG_ADDITION_2REGS_GEN(n) \ 115#define PROLOG_ADDITION_2REGS_GEN(n) \
@@ -624,44 +623,42 @@ kernel_dbg_exc:
624 * accordingly and if the interrupt is level sensitive, we hard disable 623 * accordingly and if the interrupt is level sensitive, we hard disable
625 */ 624 */
626 625
626.macro masked_interrupt_book3e paca_irq full_mask
627 lbz r10,PACAIRQHAPPENED(r13)
628 ori r10,r10,\paca_irq
629 stb r10,PACAIRQHAPPENED(r13)
630
631 .if \full_mask == 1
632 rldicl r10,r11,48,1 /* clear MSR_EE */
633 rotldi r11,r10,16
634 mtspr SPRN_SRR1,r11
635 .endif
636
637 lwz r11,PACA_EXGEN+EX_CR(r13)
638 mtcr r11
639 ld r10,PACA_EXGEN+EX_R10(r13)
640 ld r11,PACA_EXGEN+EX_R11(r13)
641 mfspr r13,SPRN_SPRG_GEN_SCRATCH
642 rfi
643 b .
644.endm
645
627masked_interrupt_book3e_0x500: 646masked_interrupt_book3e_0x500:
628 /* XXX When adding support for EPR, use PACA_IRQ_EE_EDGE */ 647 // XXX When adding support for EPR, use PACA_IRQ_EE_EDGE
629 li r11,PACA_IRQ_EE 648 masked_interrupt_book3e PACA_IRQ_EE 1
630 b masked_interrupt_book3e_full_mask
631 649
632masked_interrupt_book3e_0x900: 650masked_interrupt_book3e_0x900:
633 ACK_DEC(r11); 651 ACK_DEC(r10);
634 li r11,PACA_IRQ_DEC 652 masked_interrupt_book3e PACA_IRQ_DEC 0
635 b masked_interrupt_book3e_no_mask 653
636masked_interrupt_book3e_0x980: 654masked_interrupt_book3e_0x980:
637 ACK_FIT(r11); 655 ACK_FIT(r10);
638 li r11,PACA_IRQ_DEC 656 masked_interrupt_book3e PACA_IRQ_DEC 0
639 b masked_interrupt_book3e_no_mask 657
640masked_interrupt_book3e_0x280: 658masked_interrupt_book3e_0x280:
641masked_interrupt_book3e_0x2c0: 659masked_interrupt_book3e_0x2c0:
642 li r11,PACA_IRQ_DBELL 660 masked_interrupt_book3e PACA_IRQ_DBELL 0
643 b masked_interrupt_book3e_no_mask
644 661
645masked_interrupt_book3e_no_mask:
646 mtcr r10
647 lbz r10,PACAIRQHAPPENED(r13)
648 or r10,r10,r11
649 stb r10,PACAIRQHAPPENED(r13)
650 b 1f
651masked_interrupt_book3e_full_mask:
652 mtcr r10
653 lbz r10,PACAIRQHAPPENED(r13)
654 or r10,r10,r11
655 stb r10,PACAIRQHAPPENED(r13)
656 mfspr r10,SPRN_SRR1
657 rldicl r11,r10,48,1 /* clear MSR_EE */
658 rotldi r10,r11,16
659 mtspr SPRN_SRR1,r10
6601: ld r10,PACA_EXGEN+EX_R10(r13);
661 ld r11,PACA_EXGEN+EX_R11(r13);
662 mfspr r13,SPRN_SPRG_GEN_SCRATCH;
663 rfi
664 b .
665/* 662/*
666 * Called from arch_local_irq_enable when an interrupt needs 663 * Called from arch_local_irq_enable when an interrupt needs
667 * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280 664 * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280