kernel-ark/arch
David Howells 28baebae73 [PATCH] FRV: Use virtual interrupt disablement
Make the FRV arch use virtual interrupt disablement because accesses to the
processor status register (PSR) are relatively slow and because we will
soon have the need to deal with multiple interrupt controls at the same
time (separate h/w and inter-core interrupts).

The way this is done is to dedicate one of the four integer condition code
registers (ICC2) to maintaining a virtual interrupt disablement state
whilst inside the kernel.  This uses the ICC2.Z flag (Zero) to indicate
whether the interrupts are virtually disabled and the ICC2.C flag (Carry)
to indicate whether the interrupts are physically disabled.

ICC2.Z is set to indicate interrupts are virtually disabled.  ICC2.C is set
to indicate interrupts are physically enabled.  Under normal running
conditions Z==0 and C==1.

Disabling interrupts with local_irq_disable() doesn't then actually
physically disable interrupts - it merely sets ICC2.Z to 1.  Should an
interrupt then happen, the exception prologue will note ICC2.Z is set and
branch out of line using one instruction (an unlikely BEQ).  Here it will
physically disable interrupts and clear ICC2.C.

When it comes time to enable interrupts (local_irq_enable()), this simply
clears the ICC2.Z flag and invokes a trap #2 if both Z and C flags are
clear (the HI integer condition).  This can be done with the TIHI
conditional trap instruction.

The trap then physically reenables interrupts and sets ICC2.C again.  Upon
returning the interrupt will be taken as interrupts will then be enabled.
Note that whilst processing the trap, the whole exceptions system is
disabled, and so an interrupt can't happen till it returns.

If no pending interrupt had happened, ICC2.C would still be set, the HI
condition would not be fulfilled, and no trap will happen.

Saving interrupts (local_irq_save) is simply a matter of pulling the ICC2.Z
flag out of the CCR register, shifting it down and masking it off.  This
gives a result of 0 if interrupts were enabled and 1 if they weren't.

Restoring interrupts (local_irq_restore) is then a matter of taking the
saved value mentioned previously and XOR'ing it against 1.  If it was one,
the result will be zero, and if it was zero the result will be non-zero.
This result is then used to affect the ICC2.Z flag directly (it is a
condition code flag after all).  An XOR instruction does not affect the
Carry flag, and so that bit of state is unchanged.  The two flags can then
be sampled to see if they're both zero using the trap (TIHI) as for the
unconditional reenablement (local_irq_enable).

This patch also:

 (1) Modifies the debugging stub (break.S) to handle single-stepping crossing
     into the trap #2 handler and into virtually disabled interrupts.

 (2) Removes superseded fixup pointers from the second instructions in the trap
     tables (there's no a separate fixup table for this).

 (3) Declares the trap #3 vector for use in .org directives in the trap table.

 (4) Moves irq_enter() and irq_exit() in do_IRQ() to avoid problems with
     virtual interrupt handling, and removes the duplicate code that has now
     been folded into irq_exit() (softirq and preemption handling).

 (5) Tells the compiler in the arch Makefile that ICC2 is now reserved.

 (6) Documents the in-kernel ABI, including the virtual interrupts.

 (7) Renames the old irq management functions to different names.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-14 16:09:35 -08:00
..
alpha [PATCH] alpha: set cpu_possible_map much earlier 2006-02-08 07:57:37 -08:00
arm [ARM] 3326/1: H1940 - Control latches 2006-02-10 22:40:51 +00:00
arm26 [PATCH] arm26: select BLK_DEV_FD only on A5K 2006-02-01 08:53:22 -08:00
cris [PATCH] fallout from ptrace consolidation patch: cris/arch-v10 2006-02-07 20:57:19 -05:00
frv [PATCH] FRV: Use virtual interrupt disablement 2006-02-14 16:09:35 -08:00
h8300 [PATCH] hrtimer: round up relative start time on low-res arches 2006-02-14 16:09:35 -08:00
i386 [PATCH] x86: fix oprofile kernel callgraph regression 2006-02-14 08:25:29 -08:00
ia64 Pull new-syscalls into release branch 2006-02-09 14:43:58 -08:00
m32r [PATCH] drive_info removal outside of arch/i386 2006-02-07 20:56:47 -05:00
m68k [PATCH] hrtimer: round up relative start time on low-res arches 2006-02-14 16:09:35 -08:00
m68knommu [PATCH] hrtimer: round up relative start time on low-res arches 2006-02-14 16:09:35 -08:00
mips [MIPS] Fix typo in _sys32_rt_sigreturn and _sysn32_rt_sigreturn. 2006-02-14 19:13:26 +00:00
parisc [PATCH] hrtimer: round up relative start time on low-res arches 2006-02-14 16:09:35 -08:00
powerpc Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge 2006-02-10 14:52:31 -08:00
ppc ppc: Use the system call table from arch/powerpc/kernel/systbl.S 2006-02-10 16:02:20 +11:00
s390 [PATCH] s390: fix __delay implementation 2006-02-14 16:09:35 -08:00
sh [PATCH] sh: lvalues abuse in arch/sh/boards/renesas/rts7751r2d/io.c 2006-02-08 01:06:09 -05:00
sh64 [PATCH] drive_info removal outside of arch/i386 2006-02-07 20:56:47 -05:00
sparc [SPARC]: sys_newfstatat --> sys_fstatat64 2006-02-12 23:30:11 -08:00
sparc64 [SPARC]: sys_newfstatat --> sys_fstatat64 2006-02-12 23:30:11 -08:00
um [PATCH] uml: remove a dead file 2006-02-07 16:12:32 -08:00
v850 [PATCH] hrtimer: round up relative start time on low-res arches 2006-02-14 16:09:35 -08:00
x86_64 [PATCH] x86_64: GART DMA merging fix 2006-02-12 16:10:47 -08:00
xtensa [PATCH] Fix some ucLinux breakage from the tty updates 2006-02-03 08:32:04 -08:00