# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e0a0ebad053566f3de8c10b169ffab246aa1317d
# Parent d186157615d66829104041652746d4759a82d39c
Add dubug key for dumping guest-bound physical interrupts
and their current status.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r d186157615d6 -r e0a0ebad0535 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c Wed Jan 4 10:37:41 2006
+++ b/xen/arch/x86/irq.c Wed Jan 4 11:18:02 2006
@@ -12,6 +12,7 @@
#include <xen/irq.h>
#include <xen/perfc.h>
#include <xen/sched.h>
+#include <xen/keyhandler.h>
#include <asm/current.h>
#include <asm/smpboot.h>
@@ -198,15 +199,21 @@
int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
{
- unsigned int vector = irq_to_vector(irq);
- irq_desc_t *desc = &irq_desc[vector];
+ unsigned int vector;
+ irq_desc_t *desc;
irq_guest_action_t *action;
unsigned long flags;
int rc = 0;
cpumask_t cpumask = CPU_MASK_NONE;
+ if ( (irq < 0) || (irq >= NR_IRQS) )
+ return -EINVAL;
+
+ vector = irq_to_vector(irq);
if ( vector == 0 )
- return -EBUSY;
+ return -EINVAL;
+
+ desc = &irq_desc[vector];
spin_lock_irqsave(&desc->lock, flags);
@@ -305,3 +312,54 @@
spin_unlock_irqrestore(&desc->lock, flags);
return 0;
}
+
+static void dump_irqs(unsigned char key)
+{
+ int i, irq, vector;
+ irq_desc_t *desc;
+ irq_guest_action_t *action;
+ struct domain *d;
+ unsigned long flags;
+
+ for ( irq = 0; irq < NR_IRQS; irq++ )
+ {
+ vector = irq_to_vector(irq);
+ if ( vector == 0 )
+ continue;
+
+ desc = &irq_desc[vector];
+
+ spin_lock_irqsave(&desc->lock, flags);
+
+ if ( desc->status & IRQ_GUEST )
+ {
+ action = (irq_guest_action_t *)desc->action;
+
+ printk("IRQ%3d Vec%3d: type=%-15s in-flight=%d domain-list=",
+ irq, vector, desc->handler->typename, action->in_flight);
+
+ for ( i = 0; i < action->nr_guests; i++ )
+ {
+ d = action->guest[i];
+ printk("%u(%c%c)",
+ d->domain_id,
+ (test_bit(d->pirq_to_evtchn[irq],
+ &d->shared_info->evtchn_mask[0]) ? 'M' : '-'),
+ (test_bit(irq, &d->pirq_mask) ? 'M' : '-'));
+ if ( i != action->nr_guests )
+ printk(",");
+ }
+
+ printk("\n");
+ }
+
+ spin_unlock_irqrestore(&desc->lock, flags);
+ }
+}
+
+static int __init setup_dump_irqs(void)
+{
+ register_keyhandler('i', dump_irqs, "dump interrupt bindings");
+ return 0;
+}
+__initcall(setup_dump_irqs);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|