[PATCH v2 15/26] xen, irq: call irq_realloc_desc_at() at first

Yinghai Lu
2013-02-08T19:36:08Z

We will pre-reserve irq for all gsi at first for x86, so we have to
use realloc with it.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xensource.com
---
drivers/xen/events.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 0be4df3..dda38db 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -482,8 +482,12 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
/* Legacy IRQ descriptors are already allocated by the arch. */
if (gsi < NR_IRQS_LEGACY)
irq = gsi;
- else
- irq = irq_alloc_desc_at(gsi, -1);
+ else {
+ /* for x86, irq already get reserved for gsi */
+ irq = irq_realloc_desc_at(gsi, -1);
+ if (irq < 0)
+ irq = irq_alloc_desc_at(gsi, -1);
+ }

xen_irq_init(irq);

--
1.7.10.4