xen: use our own eventchannel->irq path
authorJeremy Fitzhardinge <jeremy@goop.org>
Fri, 6 Feb 2009 22:09:43 +0000 (14:09 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 9 Feb 2009 11:17:30 +0000 (12:17 +0100)
Rather than overloading vectors for event channels, take full
responsibility for mapping an event channel to irq directly.  With
this patch Xen has its own irq allocator.

When the kernel gets an event channel upcall, it maps the event
channel number to an irq and injects it into the normal interrupt
path.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/xen/events.h
arch/x86/xen/irq.c
drivers/xen/events.c

index 19144184983aba9ba73bf022453a8ef85e6665db..1df35417c412d2fb7dde775b7cc54dde7468dfa4 100644 (file)
@@ -15,10 +15,4 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
        return raw_irqs_disabled_flags(regs->flags);
 }
 
-static inline void xen_do_IRQ(int irq, struct pt_regs *regs)
-{
-       regs->orig_ax = ~irq;
-       do_IRQ(regs);
-}
-
 #endif /* _ASM_X86_XEN_EVENTS_H */
index 5a070900ad3517dacd26f1c14a5aa65ddcaf8295..cfd17799bd6d23e8e2ce93e2862b09d4270fa442 100644 (file)
@@ -19,21 +19,6 @@ void xen_force_evtchn_callback(void)
        (void)HYPERVISOR_xen_version(0, NULL);
 }
 
-static void __init __xen_init_IRQ(void)
-{
-       int i;
-
-       /* Create identity vector->irq map */
-       for(i = 0; i < NR_VECTORS; i++) {
-               int cpu;
-
-               for_each_possible_cpu(cpu)
-                       per_cpu(vector_irq, cpu)[i] = i;
-       }
-
-       xen_init_IRQ();
-}
-
 static unsigned long xen_save_fl(void)
 {
        struct vcpu_info *vcpu;
@@ -127,7 +112,7 @@ static void xen_halt(void)
 }
 
 static const struct pv_irq_ops xen_irq_ops __initdata = {
-       .init_IRQ = __xen_init_IRQ,
+       .init_IRQ = xen_init_IRQ,
 
        .save_fl = PV_CALLEE_SAVE(xen_save_fl),
        .restore_fl = PV_CALLEE_SAVE(xen_restore_fl),
index 7c3705479ea1bcb5e84b935fcf1dd8dfa04e9bf5..2c8d710713f50e8fb0e590d1a0bf77349043d463 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <asm/ptrace.h>
 #include <asm/irq.h>
+#include <asm/idle.h>
 #include <asm/sync_bitops.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
@@ -517,6 +518,24 @@ irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
 }
 
 
+static void xen_do_irq(unsigned irq, struct pt_regs *regs)
+{
+       struct pt_regs *old_regs = set_irq_regs(regs);
+
+       if (WARN_ON(irq == -1))
+               return;
+
+       exit_idle();
+       irq_enter();
+
+       //printk("cpu %d handling irq %d\n", smp_processor_id(), info->irq);
+       handle_irq(irq, regs);
+
+       irq_exit();
+
+       set_irq_regs(old_regs);
+}
+
 /*
  * Search the CPUs pending events bitmasks.  For each one found, map
  * the event number to an irq, and feed it into do_IRQ() for
@@ -557,8 +576,7 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
                                int port = (word_idx * BITS_PER_LONG) + bit_idx;
                                int irq = evtchn_to_irq[port];
 
-                               if (irq != -1)
-                                       xen_do_IRQ(irq, regs);
+                               xen_do_irq(irq, regs);
                        }
                }