[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Change the interface physdev_map_pirq to support new dom0.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1258126305 0 # Node ID 64599a2d310d9d7b7cd48fcb09393f47f1d26026 # Parent 8a1d2e35edfa5d56688b99f8bc8df29b572f1ddd x86: Change the interface physdev_map_pirq to support new dom0. It also keeps compatibility with old dom0. Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> --- xen/arch/x86/irq.c | 18 +++++++++++++++++- xen/arch/x86/physdev.c | 34 +++++++++++++++++++--------------- xen/include/asm-x86/irq.h | 2 ++ 3 files changed, 38 insertions(+), 16 deletions(-) diff -r 8a1d2e35edfa -r 64599a2d310d xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Fri Nov 13 15:31:16 2009 +0000 +++ b/xen/arch/x86/irq.c Fri Nov 13 15:31:45 2009 +0000 @@ -63,6 +63,11 @@ static struct timer irq_ratelimit_timer; /* irq_ratelimit: the max irq rate allowed in every 10ms, set 0 to disable */ static unsigned int __read_mostly irq_ratelimit_threshold = 10000; integer_param("irq_ratelimit", irq_ratelimit_threshold); + +int check_irq_status(int irq) +{ + return irq_status[irq] != IRQ_UNUSED ? 1 : 0; +} /* Must be called when irq disabled */ void lock_vector_lock(void) @@ -716,6 +721,9 @@ int setup_irq(unsigned int irq, struct i desc->status &= ~IRQ_DISABLED; desc->handler->startup(irq); + if ( !check_irq_status(irq) ) + irq_status[irq] = IRQ_USED; + spin_unlock_irqrestore(&desc->lock,flags); return 0; @@ -1404,6 +1412,8 @@ int map_domain_pirq( ASSERT(spin_is_locked(&pcidevs_lock)); ASSERT(spin_is_locked(&d->event_lock)); + + desc = irq_to_desc(irq); if ( !IS_PRIV(current->domain) && !(IS_PRIV_FOR(current->domain, d) && @@ -1417,6 +1427,13 @@ int map_domain_pirq( return -EINVAL; } + if ( desc->action ) + { + dprintk(XENLOG_G_WARNING, "Attempt to map in-use IRQ by Xen," + " irq:%d!\n", irq); + return 0; + } + old_irq = domain_pirq_to_irq(d, pirq); old_pirq = domain_irq_to_pirq(d, irq); @@ -1436,7 +1453,6 @@ int map_domain_pirq( return ret; } - desc = irq_to_desc(irq); if ( type == MAP_PIRQ_TYPE_MSI ) { diff -r 8a1d2e35edfa -r 64599a2d310d xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c Fri Nov 13 15:31:16 2009 +0000 +++ b/xen/arch/x86/physdev.c Fri Nov 13 15:31:45 2009 +0000 @@ -30,7 +30,7 @@ static int physdev_map_pirq(struct physd static int physdev_map_pirq(struct physdev_map_pirq *map) { struct domain *d; - int pirq, irq, ret = 0; + int pirq = 0, irq, ret = 0; struct msi_info _msi; void *map_data = NULL; @@ -55,23 +55,28 @@ static int physdev_map_pirq(struct physd switch ( map->type ) { case MAP_PIRQ_TYPE_GSI: - if ( map->index < 0 || map->index >= nr_irqs_gsi ) + { + int gsi, triggering, polarity; + + gsi = map->index & 0xffff; + triggering = !!(map->index & (1 << 16)); + polarity = !!(map->index & (1 << 24)); + irq = pirq = map->pirq; + + if ( gsi < 0 || gsi >= nr_irqs_gsi ) { - dprintk(XENLOG_G_ERR, "dom%d: map invalid irq %d\n", - d->domain_id, map->index); + dprintk(XENLOG_G_ERR, "dom%d: map invalid gsi %d\n", + d->domain_id, gsi); ret = -EINVAL; goto free_domain; } - irq = domain_pirq_to_irq(current->domain, map->index); - if ( !irq ) - { - dprintk(XENLOG_G_ERR, "dom%d: map pirq with incorrect irq!\n", - d->domain_id); - ret = -EINVAL; - goto free_domain; - } - break; - + if ( !check_irq_status(irq) ) { + mp_register_gsi(gsi, triggering, polarity); + printk("Register gsi:%d for dom:%d, irq:%d\n", gsi, + d->domain_id, irq); + } + break; + } case MAP_PIRQ_TYPE_MSI: irq = map->index; if ( irq == -1 ) @@ -103,7 +108,6 @@ static int physdev_map_pirq(struct physd spin_lock(&pcidevs_lock); /* Verify or get pirq. */ spin_lock(&d->event_lock); - pirq = domain_irq_to_pirq(d, irq); if ( map->pirq < 0 ) { if ( pirq ) diff -r 8a1d2e35edfa -r 64599a2d310d xen/include/asm-x86/irq.h --- a/xen/include/asm-x86/irq.h Fri Nov 13 15:31:16 2009 +0000 +++ b/xen/include/asm-x86/irq.h Fri Nov 13 15:31:45 2009 +0000 @@ -143,6 +143,8 @@ void move_masked_irq(int irq); void irq_set_affinity(int irq, cpumask_t mask); +int check_irq_status(int irq); + #define domain_pirq_to_irq(d, pirq) ((d)->arch.pirq_irq[pirq]) #define domain_irq_to_pirq(d, irq) ((d)->arch.irq_pirq[irq]) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |