diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2011-09-13 10:35:44 +0100 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2011-09-13 10:35:44 +0100 |
commit | 59a616e7edafb9f144c05521ee11e73f359b77e0 (patch) | |
tree | 25313b20c6401adf1ef69e525069819982bd6559 | |
parent | 0e07c9a70a686734cf1ccdee69a92af349bc3175 (diff) | |
download | xen-59a616e7edafb9f144c05521ee11e73f359b77e0.tar.gz xen-59a616e7edafb9f144c05521ee11e73f359b77e0.tar.bz2 xen-59a616e7edafb9f144c05521ee11e73f359b77e0.zip |
xen: if mapping GSIs we run out of pirq < nr_irqs_gsi, use the others
PV on HVM guests can have more GSIs than the host, in that case we
could run out of pirq < nr_irqs_gsi. When that happens use pirq >=
nr_irqs_gsi rather than returning an error.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Benjamin Schweikert <b.schweikert@googlemail.com>
xen-unstable changeset: 23832:ad3b4bb097cb
xen-unstable date: Tue Sep 13 10:32:24 2011 +0100
-rw-r--r-- | xen/arch/x86/irq.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 410b9e8cd6..142894688d 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1463,24 +1463,18 @@ int get_free_pirq(struct domain *d, int type, int index) { if ( !is_hvm_domain(d) || d->arch.pirq_emuirq[i] == IRQ_UNBOUND ) - break; + return i; } - if ( i == nr_irqs_gsi ) - return -ENOSPC; } - else - { - for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- ) - if ( !d->arch.pirq_irq[i] ) - { - if ( !is_hvm_domain(d) || - d->arch.pirq_emuirq[i] == IRQ_UNBOUND ) - break; - } - if ( i < nr_irqs_gsi ) - return -ENOSPC; - } - + for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- ) + if ( !d->arch.pirq_irq[i] ) + { + if ( !is_hvm_domain(d) || + d->arch.pirq_emuirq[i] == IRQ_UNBOUND ) + break; + } + if ( i < nr_irqs_gsi ) + return -ENOSPC; return i; } |