diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-07-09 07:36:40 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2013-08-26 00:10:25 -0400 |
commit | fce16bc35ae4a45634f3dc348d8d297a25c277cf (patch) | |
tree | ad8bd83bf1ec3210208bad9a566a7585583ee876 | |
parent | 37f3ac498c988536f0d42b4659fb5d2c050b2f96 (diff) |
ARC: Entry Handler tweaks: Optimize away redundant IRQ_DISABLE_SAVE
In the exception return path, for both U/K cases, intr are already
disabled (for various existing reasons). So when we drop down to
@restore_regs, we need not redo that.
There was subtle issue - when intr were NOT being disabled for
ret-to-kernel-but-no-preemption case - now fixed by moving the
IRQ_DISABLE further up in @resume_kernel_mode.
So what do we gain:
* Shaves off a few insn in return path.
* Eliminates the need for IRQ_DISABLE_SAVE assembler macro for ARCv2
hence allows for entry code sharing.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r-- | arch/arc/include/asm/irqflags.h | 7 | ||||
-rw-r--r-- | arch/arc/kernel/entry.S | 10 |
2 files changed, 5 insertions, 12 deletions
diff --git a/arch/arc/include/asm/irqflags.h b/arch/arc/include/asm/irqflags.h index d99f79bcf865..b68b53f458d1 100644 --- a/arch/arc/include/asm/irqflags.h +++ b/arch/arc/include/asm/irqflags.h | |||
@@ -157,13 +157,6 @@ static inline void arch_unmask_irq(unsigned int irq) | |||
157 | flag \scratch | 157 | flag \scratch |
158 | .endm | 158 | .endm |
159 | 159 | ||
160 | .macro IRQ_DISABLE_SAVE scratch, save | ||
161 | lr \scratch, [status32] | ||
162 | mov \save, \scratch /* Make a copy */ | ||
163 | bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) | ||
164 | flag \scratch | ||
165 | .endm | ||
166 | |||
167 | .macro IRQ_ENABLE scratch | 160 | .macro IRQ_ENABLE scratch |
168 | lr \scratch, [status32] | 161 | lr \scratch, [status32] |
169 | or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) | 162 | or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) |
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 059ca94e3df8..b908dde8a331 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S | |||
@@ -612,6 +612,9 @@ resume_kernel_mode: | |||
612 | 612 | ||
613 | #ifdef CONFIG_PREEMPT | 613 | #ifdef CONFIG_PREEMPT |
614 | 614 | ||
615 | ; This is a must for preempt_schedule_irq() | ||
616 | IRQ_DISABLE r9 | ||
617 | |||
615 | ; Can't preempt if preemption disabled | 618 | ; Can't preempt if preemption disabled |
616 | GET_CURR_THR_INFO_FROM_SP r10 | 619 | GET_CURR_THR_INFO_FROM_SP r10 |
617 | ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] | 620 | ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] |
@@ -621,8 +624,6 @@ resume_kernel_mode: | |||
621 | ld r9, [r10, THREAD_INFO_FLAGS] | 624 | ld r9, [r10, THREAD_INFO_FLAGS] |
622 | bbit0 r9, TIF_NEED_RESCHED, restore_regs | 625 | bbit0 r9, TIF_NEED_RESCHED, restore_regs |
623 | 626 | ||
624 | IRQ_DISABLE r9 | ||
625 | |||
626 | ; Invoke PREEMPTION | 627 | ; Invoke PREEMPTION |
627 | bl preempt_schedule_irq | 628 | bl preempt_schedule_irq |
628 | 629 | ||
@@ -635,12 +636,11 @@ resume_kernel_mode: | |||
635 | ; | 636 | ; |
636 | ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) | 637 | ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) |
637 | ; IRQ shd definitely not happen between now and rtie | 638 | ; IRQ shd definitely not happen between now and rtie |
639 | ; All 2 entry points to here already disable interrupts | ||
638 | 640 | ||
639 | restore_regs : | 641 | restore_regs : |
640 | 642 | ||
641 | ; Disable Interrupts while restoring reg-file back | 643 | lr r10, [status32] |
642 | ; XXX can this be optimised out | ||
643 | IRQ_DISABLE_SAVE r9, r10 ;@r10 has prisitine (pre-disable) copy | ||
644 | 644 | ||
645 | ; Restore REG File. In case multiple Events outstanding, | 645 | ; Restore REG File. In case multiple Events outstanding, |
646 | ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None | 646 | ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None |