ia64/xen-unstable

changeset 3055:a4de65374ede

bitkeeper revision 1.1159.181.1 (419ddd65nxpGF43pG96SSRICzT_NdA)

evtchn.c:
Make dynamic irq handlers safe to use with the unmodified irq probing code.
irq.c:
Remove changes to the irq probing code.
author cl349@arcadians.cl.cam.ac.uk
date Fri Nov 19 11:47:49 2004 +0000 (2004-11-19)
parents ceacd1c23c6c
children c74e9fdfcab7
files linux-2.6.9-xen-sparse/arch/xen/i386/kernel/irq.c linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c
line diff
     1.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/irq.c	Thu Nov 18 16:06:12 2004 +0000
     1.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/irq.c	Fri Nov 19 11:47:49 2004 +0000
     1.3 @@ -695,7 +695,6 @@ void free_irq(unsigned int irq, void *de
     1.4  	p = &desc->action;
     1.5  	for (;;) {
     1.6  		struct irqaction * action = *p;
     1.7 -
     1.8  		if (action) {
     1.9  			struct irqaction **pp = p;
    1.10  			p = &action->next;
    1.11 @@ -757,7 +756,7 @@ unsigned long probe_irq_on(void)
    1.12  	 * something may have generated an irq long ago and we want to
    1.13  	 * flush such a longstanding irq before considering it as spurious. 
    1.14  	 */
    1.15 -	for (i = NR_PIRQS-1; i > 0; i--)  {
    1.16 +	for (i = NR_IRQS-1; i > 0; i--)  {
    1.17  		desc = irq_desc + i;
    1.18  
    1.19  		spin_lock_irq(&desc->lock);
    1.20 @@ -775,7 +774,7 @@ unsigned long probe_irq_on(void)
    1.21  	 * (we must startup again here because if a longstanding irq
    1.22  	 * happened in the previous stage, it may have masked itself)
    1.23  	 */
    1.24 -	for (i = NR_PIRQS-1; i > 0; i--) {
    1.25 +	for (i = NR_IRQS-1; i > 0; i--) {
    1.26  		desc = irq_desc + i;
    1.27  
    1.28  		spin_lock_irq(&desc->lock);
    1.29 @@ -797,7 +796,7 @@ unsigned long probe_irq_on(void)
    1.30  	 * Now filter out any obviously spurious interrupts
    1.31  	 */
    1.32  	val = 0;
    1.33 -	for (i = 0; i < NR_PIRQS; i++) {
    1.34 +	for (i = 0; i < NR_IRQS; i++) {
    1.35  		irq_desc_t *desc = irq_desc + i;
    1.36  		unsigned int status;
    1.37  
    1.38 @@ -844,7 +843,7 @@ unsigned int probe_irq_mask(unsigned lon
    1.39  	unsigned int mask;
    1.40  
    1.41  	mask = 0;
    1.42 -	for (i = 0; i < NR_PIRQS; i++) {
    1.43 +	for (i = 0; i < NR_IRQS; i++) {
    1.44  		irq_desc_t *desc = irq_desc + i;
    1.45  		unsigned int status;
    1.46  
    1.47 @@ -894,7 +893,7 @@ int probe_irq_off(unsigned long val)
    1.48  
    1.49  	nr_irqs = 0;
    1.50  	irq_found = 0;
    1.51 -	for (i = 0; i < NR_PIRQS; i++) {
    1.52 +	for (i = 0; i < NR_IRQS; i++) {
    1.53  		irq_desc_t *desc = irq_desc + i;
    1.54  		unsigned int status;
    1.55  
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c	Thu Nov 18 16:06:12 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/kernel/evtchn.c	Fri Nov 19 11:47:49 2004 +0000
     2.3 @@ -70,7 +70,7 @@ static unsigned long pirq_needs_unmask_n
     2.4  /* Upcall to generic IRQ layer. */
     2.5  extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs);
     2.6  
     2.7 -#define VALID_EVTCHN(_chn) ((_chn) != -1)
     2.8 +#define VALID_EVTCHN(_chn) ((_chn) >= 0)
     2.9  
    2.10  /*
    2.11   * Force a proper event-channel callback from Xen after clearing the
    2.12 @@ -229,35 +229,51 @@ void unbind_evtchn_from_irq(int evtchn)
    2.13  
    2.14  static unsigned int startup_dynirq(unsigned int irq)
    2.15  {
    2.16 -    unmask_evtchn(irq_to_evtchn[irq]);
    2.17 +    int evtchn = irq_to_evtchn[irq];
    2.18 +
    2.19 +    if ( !VALID_EVTCHN(evtchn) )
    2.20 +        return 0;
    2.21 +    unmask_evtchn(evtchn);
    2.22      return 0;
    2.23  }
    2.24  
    2.25  static void shutdown_dynirq(unsigned int irq)
    2.26  {
    2.27 -    mask_evtchn(irq_to_evtchn[irq]);
    2.28 +    int evtchn = irq_to_evtchn[irq];
    2.29 +
    2.30 +    if ( !VALID_EVTCHN(evtchn) )
    2.31 +        return;
    2.32 +    mask_evtchn(evtchn);
    2.33  }
    2.34  
    2.35  static void enable_dynirq(unsigned int irq)
    2.36  {
    2.37 -    unmask_evtchn(irq_to_evtchn[irq]);
    2.38 +    int evtchn = irq_to_evtchn[irq];
    2.39 +
    2.40 +    unmask_evtchn(evtchn);
    2.41  }
    2.42  
    2.43  static void disable_dynirq(unsigned int irq)
    2.44  {
    2.45 -    mask_evtchn(irq_to_evtchn[irq]);
    2.46 +    int evtchn = irq_to_evtchn[irq];
    2.47 +
    2.48 +    mask_evtchn(evtchn);
    2.49  }
    2.50  
    2.51  static void ack_dynirq(unsigned int irq)
    2.52  {
    2.53 -    mask_evtchn(irq_to_evtchn[irq]);
    2.54 -    clear_evtchn(irq_to_evtchn[irq]);
    2.55 +    int evtchn = irq_to_evtchn[irq];
    2.56 +
    2.57 +    mask_evtchn(evtchn);
    2.58 +    clear_evtchn(evtchn);
    2.59  }
    2.60  
    2.61  static void end_dynirq(unsigned int irq)
    2.62  {
    2.63 +    int evtchn = irq_to_evtchn[irq];
    2.64 +
    2.65      if ( !(irq_desc[irq].status & IRQ_DISABLED) )
    2.66 -        unmask_evtchn(irq_to_evtchn[irq]);
    2.67 +        unmask_evtchn(evtchn);
    2.68  }
    2.69  
    2.70  static struct hw_interrupt_type dynirq_type = {