ia64/xen-unstable

changeset 8500:e0a0ebad0535

Add dubug key for dumping guest-bound physical interrupts
and their current status.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jan 04 12:18:02 2006 +0100 (2006-01-04)
parents d186157615d6
children f26ae65f3f95
files xen/arch/x86/irq.c
line diff
     1.1 --- a/xen/arch/x86/irq.c	Wed Jan 04 11:37:41 2006 +0100
     1.2 +++ b/xen/arch/x86/irq.c	Wed Jan 04 12:18:02 2006 +0100
     1.3 @@ -12,6 +12,7 @@
     1.4  #include <xen/irq.h>
     1.5  #include <xen/perfc.h>
     1.6  #include <xen/sched.h>
     1.7 +#include <xen/keyhandler.h>
     1.8  #include <asm/current.h>
     1.9  #include <asm/smpboot.h>
    1.10  
    1.11 @@ -198,15 +199,21 @@ int pirq_guest_unmask(struct domain *d)
    1.12  
    1.13  int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
    1.14  {
    1.15 -    unsigned int        vector = irq_to_vector(irq);
    1.16 -    irq_desc_t         *desc = &irq_desc[vector];
    1.17 +    unsigned int        vector;
    1.18 +    irq_desc_t         *desc;
    1.19      irq_guest_action_t *action;
    1.20      unsigned long       flags;
    1.21      int                 rc = 0;
    1.22      cpumask_t           cpumask = CPU_MASK_NONE;
    1.23  
    1.24 +    if ( (irq < 0) || (irq >= NR_IRQS) )
    1.25 +        return -EINVAL;
    1.26 +
    1.27 +    vector = irq_to_vector(irq);
    1.28      if ( vector == 0 )
    1.29 -        return -EBUSY;
    1.30 +        return -EINVAL;
    1.31 +
    1.32 +    desc = &irq_desc[vector];
    1.33  
    1.34      spin_lock_irqsave(&desc->lock, flags);
    1.35  
    1.36 @@ -305,3 +312,54 @@ int pirq_guest_unbind(struct domain *d, 
    1.37      spin_unlock_irqrestore(&desc->lock, flags);    
    1.38      return 0;
    1.39  }
    1.40 +
    1.41 +static void dump_irqs(unsigned char key)
    1.42 +{
    1.43 +    int i, irq, vector;
    1.44 +    irq_desc_t *desc;
    1.45 +    irq_guest_action_t *action;
    1.46 +    struct domain *d;
    1.47 +    unsigned long flags;
    1.48 +
    1.49 +    for ( irq = 0; irq < NR_IRQS; irq++ )
    1.50 +    {
    1.51 +        vector = irq_to_vector(irq);
    1.52 +        if ( vector == 0 )
    1.53 +            continue;
    1.54 +
    1.55 +        desc = &irq_desc[vector];
    1.56 +
    1.57 +        spin_lock_irqsave(&desc->lock, flags);
    1.58 +
    1.59 +        if ( desc->status & IRQ_GUEST )
    1.60 +        {
    1.61 +            action = (irq_guest_action_t *)desc->action;
    1.62 +
    1.63 +            printk("IRQ%3d Vec%3d: type=%-15s in-flight=%d domain-list=",
    1.64 +                   irq, vector, desc->handler->typename, action->in_flight);
    1.65 +
    1.66 +            for ( i = 0; i < action->nr_guests; i++ )
    1.67 +            {
    1.68 +                d = action->guest[i];
    1.69 +                printk("%u(%c%c)",
    1.70 +                       d->domain_id,
    1.71 +                       (test_bit(d->pirq_to_evtchn[irq],
    1.72 +                                 &d->shared_info->evtchn_mask[0]) ? 'M' : '-'),
    1.73 +                       (test_bit(irq, &d->pirq_mask) ? 'M' : '-'));
    1.74 +                if ( i != action->nr_guests )
    1.75 +                    printk(",");
    1.76 +            }
    1.77 +
    1.78 +            printk("\n");
    1.79 +        }
    1.80 +
    1.81 +        spin_unlock_irqrestore(&desc->lock, flags);
    1.82 +    }
    1.83 +}
    1.84 +
    1.85 +static int __init setup_dump_irqs(void)
    1.86 +{
    1.87 +    register_keyhandler('i', dump_irqs, "dump interrupt bindings");
    1.88 +    return 0;
    1.89 +}
    1.90 +__initcall(setup_dump_irqs);