ia64/xen-unstable

changeset 9555:d76a7a40f3a9

Fix do_IRQ high bit masking.
Instead of setting the highest bit (which isn't easily done on native x86_64),
negate the interrupt vector stored in orig_{e,r}ax.
Also add patch for native build.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Fri Mar 31 17:44:26 2006 +0100 (2006-03-31)
parents dadadf9aeee7
children e1267ac3cc36
files linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S linux-2.6-xen-sparse/arch/i386/kernel/irq-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S linux-2.6-xen-sparse/arch/x86_64/kernel/irq-xen.c linux-2.6-xen-sparse/drivers/xen/core/evtchn.c patches/linux-2.6.16/x86-increase-interrupt-vector-range.patch
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S	Fri Mar 31 15:34:52 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S	Fri Mar 31 17:44:26 2006 +0100
     1.3 @@ -461,7 +461,7 @@ vector=0
     1.4  ENTRY(irq_entries_start)
     1.5  .rept NR_IRQS
     1.6  	ALIGN
     1.7 -1:	pushl 0x80000000+$vector
     1.8 +1:	pushl $~(vector)
     1.9  	jmp common_interrupt
    1.10  .data
    1.11  	.long 1b
    1.12 @@ -478,7 +478,7 @@ common_interrupt:
    1.13  
    1.14  #define BUILD_INTERRUPT(name, nr)	\
    1.15  ENTRY(name)				\
    1.16 -	pushl 0x80000000+$nr;		\
    1.17 +	pushl $~(nr);			\
    1.18  	SAVE_ALL			\
    1.19  	movl %esp,%eax;			\
    1.20  	call smp_/**/name;		\
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/irq-xen.c	Fri Mar 31 15:34:52 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/irq-xen.c	Fri Mar 31 17:44:26 2006 +0100
     2.3 @@ -54,7 +54,7 @@ static union irq_ctx *softirq_ctx[NR_CPU
     2.4  fastcall unsigned int do_IRQ(struct pt_regs *regs)
     2.5  {	
     2.6  	/* high bit used in ret_from_ code */
     2.7 -	int irq = regs->orig_eax & __IRQ_MASK(BITS_PER_LONG - 1);
     2.8 +	int irq = ~regs->orig_eax;
     2.9  #ifdef CONFIG_4KSTACKS
    2.10  	union irq_ctx *curctx, *irqctx;
    2.11  	u32 *isp;
     3.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S	Fri Mar 31 15:34:52 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S	Fri Mar 31 17:44:26 2006 +0100
     3.3 @@ -584,7 +584,7 @@ retint_kernel:
     3.4   */		
     3.5  	.macro apicinterrupt num,func
     3.6  	INTR_FRAME
     3.7 -	pushq 0x8000000000000000+$\num
     3.8 +	pushq $~(\num)
     3.9  	CFI_ADJUST_CFA_OFFSET 8
    3.10  	interrupt \func
    3.11  	jmp error_entry
     4.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/irq-xen.c	Fri Mar 31 15:34:52 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/irq-xen.c	Fri Mar 31 17:44:26 2006 +0100
     4.3 @@ -97,7 +97,7 @@ skip:
     4.4  asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
     4.5  {	
     4.6  	/* high bit used in ret_from_ code  */
     4.7 -        int irq = regs->orig_rax & __IRQ_MASK(BITS_PER_LONG - 1);
     4.8 +	unsigned irq = ~regs->orig_rax;
     4.9  
    4.10  	exit_idle();
    4.11  	irq_enter();
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Fri Mar 31 15:34:52 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Fri Mar 31 17:44:26 2006 +0100
     5.3 @@ -170,9 +170,9 @@ static inline void exit_idle(void) {}
     5.4  #include <asm/idle.h>
     5.5  #define IRQ_REG orig_rax
     5.6  #endif
     5.7 -#define do_IRQ(irq, regs) do {					\
     5.8 -	(regs)->IRQ_REG = (irq) | (1UL << (BITS_PER_LONG - 1));	\
     5.9 -	do_IRQ((regs));						\
    5.10 +#define do_IRQ(irq, regs) do {		\
    5.11 +	(regs)->IRQ_REG = ~(irq);	\
    5.12 +	do_IRQ((regs));			\
    5.13  } while (0)
    5.14  #endif
    5.15  
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/linux-2.6.16/x86-increase-interrupt-vector-range.patch	Fri Mar 31 17:44:26 2006 +0100
     6.3 @@ -0,0 +1,107 @@
     6.4 +Subject: Increase x86 interrupt vector range
     6.5 +
     6.6 +Remove the limit of 256 interrupt vectors by changing the value
     6.7 +stored in orig_{e,r}ax to be the negated interrupt vector.
     6.8 +The orig_{e,r}ax needs to be < 0 to allow the signal code to
     6.9 +distinguish between return from interrupt and return from syscall.
    6.10 +With this change applied, NR_IRQS can be > 256.
    6.11 +
    6.12 +Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
    6.13 +---
    6.14 + arch/i386/kernel/entry.S    |    4 ++--
    6.15 + arch/i386/kernel/irq.c      |    4 ++--
    6.16 + arch/x86_64/kernel/entry.S  |    2 +-
    6.17 + arch/x86_64/kernel/irq.c    |    4 ++--
    6.18 + arch/x86_64/kernel/smp.c    |    4 ++--
    6.19 + include/asm-x86_64/hw_irq.h |    2 +-
    6.20 + 6 files changed, 10 insertions(+), 10 deletions(-)
    6.21 +
    6.22 +diff -r 7d239c83edea arch/i386/kernel/entry.S
    6.23 +--- a/arch/i386/kernel/entry.S	Mon Mar 20 06:00:20 2006 +0000
    6.24 ++++ b/arch/i386/kernel/entry.S	Fri Mar 31 17:01:35 2006 +0100
    6.25 +@@ -406,7 +406,7 @@ ENTRY(irq_entries_start)
    6.26 + ENTRY(irq_entries_start)
    6.27 + .rept NR_IRQS
    6.28 + 	ALIGN
    6.29 +-1:	pushl $vector-256
    6.30 ++1:	pushl $~(vector)
    6.31 + 	jmp common_interrupt
    6.32 + .data
    6.33 + 	.long 1b
    6.34 +@@ -423,7 +423,7 @@ common_interrupt:
    6.35 + 
    6.36 + #define BUILD_INTERRUPT(name, nr)	\
    6.37 + ENTRY(name)				\
    6.38 +-	pushl $nr-256;			\
    6.39 ++	pushl $~(nr);			\
    6.40 + 	SAVE_ALL			\
    6.41 + 	movl %esp,%eax;			\
    6.42 + 	call smp_/**/name;		\
    6.43 +diff -r 7d239c83edea arch/i386/kernel/irq.c
    6.44 +--- a/arch/i386/kernel/irq.c	Mon Mar 20 06:00:20 2006 +0000
    6.45 ++++ b/arch/i386/kernel/irq.c	Fri Mar 31 17:01:35 2006 +0100
    6.46 +@@ -53,8 +53,8 @@ static union irq_ctx *softirq_ctx[NR_CPU
    6.47 +  */
    6.48 + fastcall unsigned int do_IRQ(struct pt_regs *regs)
    6.49 + {	
    6.50 +-	/* high bits used in ret_from_ code */
    6.51 +-	int irq = regs->orig_eax & 0xff;
    6.52 ++	/* high bit used in ret_from_ code */
    6.53 ++	int irq = ~regs->orig_eax;
    6.54 + #ifdef CONFIG_4KSTACKS
    6.55 + 	union irq_ctx *curctx, *irqctx;
    6.56 + 	u32 *isp;
    6.57 +diff -r 7d239c83edea arch/x86_64/kernel/entry.S
    6.58 +--- a/arch/x86_64/kernel/entry.S	Mon Mar 20 06:00:20 2006 +0000
    6.59 ++++ b/arch/x86_64/kernel/entry.S	Fri Mar 31 17:01:35 2006 +0100
    6.60 +@@ -609,7 +609,7 @@ retint_kernel:
    6.61 +  */		
    6.62 + 	.macro apicinterrupt num,func
    6.63 + 	INTR_FRAME
    6.64 +-	pushq $\num-256
    6.65 ++	pushq $~(\num)
    6.66 + 	CFI_ADJUST_CFA_OFFSET 8
    6.67 + 	interrupt \func
    6.68 + 	jmp ret_from_intr
    6.69 +diff -r 7d239c83edea arch/x86_64/kernel/irq.c
    6.70 +--- a/arch/x86_64/kernel/irq.c	Mon Mar 20 06:00:20 2006 +0000
    6.71 ++++ b/arch/x86_64/kernel/irq.c	Fri Mar 31 17:01:35 2006 +0100
    6.72 +@@ -96,8 +96,8 @@ skip:
    6.73 +  */
    6.74 + asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
    6.75 + {	
    6.76 +-	/* high bits used in ret_from_ code  */
    6.77 +-	unsigned irq = regs->orig_rax & 0xff;
    6.78 ++	/* high bit used in ret_from_ code  */
    6.79 ++	unsigned irq = ~regs->orig_rax;
    6.80 + 
    6.81 + 	exit_idle();
    6.82 + 	irq_enter();
    6.83 +diff -r 7d239c83edea arch/x86_64/kernel/smp.c
    6.84 +--- a/arch/x86_64/kernel/smp.c	Mon Mar 20 06:00:20 2006 +0000
    6.85 ++++ b/arch/x86_64/kernel/smp.c	Fri Mar 31 17:01:35 2006 +0100
    6.86 +@@ -135,10 +135,10 @@ asmlinkage void smp_invalidate_interrupt
    6.87 + 
    6.88 + 	cpu = smp_processor_id();
    6.89 + 	/*
    6.90 +-	 * orig_rax contains the interrupt vector - 256.
    6.91 ++	 * orig_rax contains the negated interrupt vector.
    6.92 + 	 * Use that to determine where the sender put the data.
    6.93 + 	 */
    6.94 +-	sender = regs->orig_rax + 256 - INVALIDATE_TLB_VECTOR_START;
    6.95 ++	sender = ~regs->orig_rax - INVALIDATE_TLB_VECTOR_START;
    6.96 + 	f = &per_cpu(flush_state, sender);
    6.97 + 
    6.98 + 	if (!cpu_isset(cpu, f->flush_cpumask))
    6.99 +diff -r 7d239c83edea include/asm-x86_64/hw_irq.h
   6.100 +--- a/include/asm-x86_64/hw_irq.h	Mon Mar 20 06:00:20 2006 +0000
   6.101 ++++ b/include/asm-x86_64/hw_irq.h	Fri Mar 31 17:01:35 2006 +0100
   6.102 +@@ -127,7 +127,7 @@ __asm__( \
   6.103 + __asm__( \
   6.104 + "\n.p2align\n" \
   6.105 + "IRQ" #nr "_interrupt:\n\t" \
   6.106 +-	"push $" #nr "-256 ; " \
   6.107 ++	"push $~(" #nr ") ; " \
   6.108 + 	"jmp common_interrupt");
   6.109 + 
   6.110 + #if defined(CONFIG_X86_IO_APIC)