Skip to content

Commit

Permalink
x86: unify do_IRQ()
Browse files Browse the repository at this point in the history
With the differences in interrupt handling hoisted into handle_irq(),
do_IRQ is more or less identical between 32 and 64 bit, so unify it.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Feb 9, 2009
1 parent 9b2b76a commit 7c1d7cd
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 61 deletions.
3 changes: 2 additions & 1 deletion arch/x86/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ static inline int irq_canonicalize(int irq)
extern void fixup_irqs(void);
#endif

extern unsigned int do_IRQ(struct pt_regs *regs);
extern void init_IRQ(void);
extern void native_init_IRQ(void);
extern bool handle_irq(unsigned irq, struct pt_regs *regs);

extern unsigned int do_IRQ(struct pt_regs *regs);

/* Interrupt vector management */
extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
extern int vector_used_by_percpu_irq(unsigned int vector);
Expand Down
38 changes: 38 additions & 0 deletions arch/x86/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#include <linux/kernel_stat.h>
#include <linux/seq_file.h>
#include <linux/smp.h>
#include <linux/ftrace.h>

#include <asm/apic.h>
#include <asm/io_apic.h>
#include <asm/irq.h>
#include <asm/idle.h>

atomic_t irq_err_count;

Expand Down Expand Up @@ -188,4 +190,40 @@ u64 arch_irq_stat(void)
return sum;
}


/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
* handlers).
*/
unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);

/* high bit used in ret_from_ code */
unsigned vector = ~regs->orig_ax;
unsigned irq;

exit_idle();
irq_enter();

irq = __get_cpu_var(vector_irq)[vector];

if (!handle_irq(irq, regs)) {
#ifdef CONFIG_X86_64
if (!disable_apic)
ack_APIC_irq();
#endif

if (printk_ratelimit())
printk(KERN_EMERG "%s: %d.%d No irq handler for vector (irq %d)\n",
__func__, smp_processor_id(), vector, irq);
}

irq_exit();

set_irq_regs(old_regs);
return 1;
}

EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
27 changes: 0 additions & 27 deletions arch/x86/kernel/irq_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,33 +211,6 @@ bool handle_irq(unsigned irq, struct pt_regs *regs)
return true;
}

/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
* handlers).
*/
unsigned int do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs;
/* high bit used in ret_from_ code */
unsigned vector = ~regs->orig_ax;
unsigned irq;

old_regs = set_irq_regs(regs);
irq_enter();
irq = __get_cpu_var(vector_irq)[vector];

if (!handle_irq(irq, regs)) {
printk(KERN_EMERG "%s: cannot handle IRQ %d vector %#x cpu %d\n",
__func__, irq, vector, smp_processor_id());
BUG();
}

irq_exit();
set_irq_regs(old_regs);
return 1;
}

#ifdef CONFIG_HOTPLUG_CPU
#include <asm/genapic.h>

Expand Down
33 changes: 0 additions & 33 deletions arch/x86/kernel/irq_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,6 @@ bool handle_irq(unsigned irq, struct pt_regs *regs)
return true;
}

/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
* handlers).
*/
asmlinkage unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);

/* high bit used in ret_from_ code */
unsigned vector = ~regs->orig_ax;
unsigned irq;

exit_idle();
irq_enter();

irq = __get_cpu_var(vector_irq)[vector];

if (!handle_irq(irq, regs)) {
if (!disable_apic)
ack_APIC_irq();

if (printk_ratelimit())
printk(KERN_EMERG "%s: %d.%d No irq handler for vector\n",
__func__, smp_processor_id(), vector);
}

irq_exit();

set_irq_regs(old_regs);
return 1;
}

#ifdef CONFIG_HOTPLUG_CPU
/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
void fixup_irqs(void)
Expand Down

0 comments on commit 7c1d7cd

Please sign in to comment.