Isaku Yamahata
2008-Oct-07 02:25 UTC
[Xen-ia64-devel] [PATCH] xen: make events.c compile for ia64.
This patch is for the pv_ops patch queue repository. Later more generalization to events.c would be necessary because it assumes x86. For example, LEGACY_IRQS doesn''t make sense for ia64. Since those bits are for dom0 support and pv_ops xen/ia64 doesn''t support dom0 yet, I made it just compile for ia64 for now. xen: make events.c compile for ia64. xen_do_irq() is x86 specific because it calls exit_idle(), handle_irq(). Move it to arch specific file for ia64 support. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> diff -r 4f7cc06552f8 drivers/xen/events.c --- a/drivers/xen/events.c Mon Oct 06 15:24:22 2008 +0900 +++ b/drivers/xen/events.c Mon Oct 06 16:02:56 2008 +0900 @@ -29,7 +29,6 @@ #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> @@ -814,33 +813,6 @@ return IRQ_HANDLED; } - -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; - - { - struct irq_info *info = info_for_irq(irq); - - if (info->type == IRQT_PIRQ) - printk("xen_do_irq: pirq %d, gsi %d, vector %d\n", - irq, info->u.pirq.gsi, info->u.pirq.vector); - } - - 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 diff -r 4f7cc06552f8 include/asm-x86/xen/events.h --- a/include/asm-x86/xen/events.h Mon Oct 06 15:24:22 2008 +0900 +++ b/include/asm-x86/xen/events.h Mon Oct 06 16:02:56 2008 +0900 @@ -1,5 +1,7 @@ #ifndef ASM_X86__XEN__EVENTS_H #define ASM_X86__XEN__EVENTS_H + +#include <asm/idle.h> enum ipi_vector { XEN_RESCHEDULE_VECTOR, @@ -15,4 +17,30 @@ return raw_irqs_disabled_flags(regs->flags); } +static inline 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; + + { + struct irq_info *info = info_for_irq(irq); + + if (info->type == IRQT_PIRQ) + printk("xen_do_irq: pirq %d, gsi %d, vector %d\n", + irq, info->u.pirq.gsi, info->u.pirq.vector); + } + + 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); +} + #endif /* ASM_X86__XEN__EVENTS_H */ -- yamahata _______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel
Jeremy Fitzhardinge
2008-Oct-07 15:10 UTC
[Xen-devel] Re: [PATCH] xen: make events.c compile for ia64.
Isaku Yamahata wrote:> This patch is for the pv_ops patch queue repository. > Later more generalization to events.c would be necessary because > it assumes x86. For example, LEGACY_IRQS doesn''t make sense for ia64. > Since those bits are for dom0 support and pv_ops xen/ia64 doesn''t > support dom0 yet, I made it just compile for ia64 for now. >Yeah, I''d assumed you''d define LEGACY_IRQS to 0.> xen: make events.c compile for ia64. > > xen_do_irq() is x86 specific because it calls > exit_idle(), handle_irq(). > Move it to arch specific file for ia64 support. > > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> > > diff -r 4f7cc06552f8 drivers/xen/events.c > --- a/drivers/xen/events.c Mon Oct 06 15:24:22 2008 +0900 > +++ b/drivers/xen/events.c Mon Oct 06 16:02:56 2008 +0900 > @@ -29,7 +29,6 @@ > > #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> > @@ -814,33 +813,6 @@ > return IRQ_HANDLED; > } > > - > -static void xen_do_irq(unsigned irq, struct pt_regs *regs) >I was hoping this would be generic enough to work on ia64, if you define an appropriate handle_irq() (and exit_idle, I guess). Is there something else you need to do here?> -{ > - struct pt_regs *old_regs = set_irq_regs(regs); > - > - if (WARN_ON(irq == -1)) > - return; > - > - { > - struct irq_info *info = info_for_irq(irq); > - > - if (info->type == IRQT_PIRQ) > - printk("xen_do_irq: pirq %d, gsi %d, vector %d\n", > - irq, info->u.pirq.gsi, info->u.pirq.vector); > - } > - > - 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 > diff -r 4f7cc06552f8 include/asm-x86/xen/events.h > --- a/include/asm-x86/xen/events.h Mon Oct 06 15:24:22 2008 +0900 > +++ b/include/asm-x86/xen/events.h Mon Oct 06 16:02:56 2008 +0900 > @@ -1,5 +1,7 @@ > #ifndef ASM_X86__XEN__EVENTS_H > #define ASM_X86__XEN__EVENTS_H > + > +#include <asm/idle.h> > > enum ipi_vector { > XEN_RESCHEDULE_VECTOR, > @@ -15,4 +17,30 @@ > return raw_irqs_disabled_flags(regs->flags); > } > > +static inline 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; > + > + { > + struct irq_info *info = info_for_irq(irq); > + > + if (info->type == IRQT_PIRQ) > + printk("xen_do_irq: pirq %d, gsi %d, vector %d\n", > + irq, info->u.pirq.gsi, info->u.pirq.vector); > + } > + > + 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); > +} > + > #endif /* ASM_X86__XEN__EVENTS_H */ > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Isaku Yamahata
2008-Oct-10 06:50 UTC
[Xen-ia64-devel] Re: [PATCH] xen: make events.c compile for ia64.
On Tue, Oct 07, 2008 at 08:10:44AM -0700, Jeremy Fitzhardinge wrote:> >-static void xen_do_irq(unsigned irq, struct pt_regs *regs) > > > > I was hoping this would be generic enough to work on ia64, if you define > an appropriate handle_irq() (and exit_idle, I guess). Is there > something else you need to do here?By reviewing my patches, I found that the logic itself is generic enough. But can we prefix exit_idle() and handle_irq() with xen_? They are too generic to be defined in arch xen code. xen: make events.c portable. - prefix xen_ to exit_idle(), handle_irq(). They are too generic name to be defined in arch xen specific code. - move #include <asm/idle.h> from events.c to include/asm-x86/xen/event.h only x86 has it. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> diff -r 9e8842013b3b drivers/xen/events.c --- a/drivers/xen/events.c Mon Oct 06 16:11:39 2008 +0900 +++ b/drivers/xen/events.c Fri Oct 10 15:40:44 2008 +0900 @@ -29,7 +29,6 @@ #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> @@ -830,11 +829,11 @@ irq, info->u.pirq.gsi, info->u.pirq.vector); } - exit_idle(); + xen_exit_idle(); irq_enter(); //printk("cpu %d handling irq %d\n", smp_processor_id(), info->irq); - handle_irq(irq, regs); + xen_handle_irq(irq, regs); irq_exit(); diff -r 9e8842013b3b include/asm-x86/xen/events.h --- a/include/asm-x86/xen/events.h Mon Oct 06 16:11:39 2008 +0900 +++ b/include/asm-x86/xen/events.h Fri Oct 10 15:40:44 2008 +0900 @@ -1,5 +1,7 @@ #ifndef ASM_X86__XEN__EVENTS_H #define ASM_X86__XEN__EVENTS_H + +#include <asm/idle.h> enum ipi_vector { XEN_RESCHEDULE_VECTOR, @@ -15,4 +17,14 @@ return raw_irqs_disabled_flags(regs->flags); } +static inline void xen_exit_idle(void) +{ + exit_idle(); +} + +static inline void xen_handle_irq(unsigned irq, struct pt_regs *regs) +{ + handle_irq(irq, regs); +} + #endif /* ASM_X86__XEN__EVENTS_H */ -- yamahata _______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@lists.xensource.com http://lists.xensource.com/xen-ia64-devel