Skip to content

Commit

Permalink
genirq: Make nr_irqs runtime expandable
Browse files Browse the repository at this point in the history
We face more and more the requirement to expand nr_irqs at
runtime. The reason are irq expanders which can not be detected in the
early boot stage. So we speculate nr_irqs to have enough room. Further
Xen needs extra irq numbers and we really want to avoid adding more
"detection" code into the early boot. There is no real good reason why
we need to limit nr_irqs at early boot.

Allow the allocation code to expand nr_irqs. We have already 8k extra
number space in the allocation bitmap, so lets use it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner committed Feb 19, 2011
1 parent 218502b commit e7bcecb
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions kernel/irq/irqdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
return NULL;
}

static int irq_expand_nr_irqs(unsigned int cnt)
{
if (nr_irqs + cnt > IRQ_BITMAP_BITS)
return -ENOMEM;
nr_irqs += cnt;
return 0;
}

int __init early_irq_init(void)
{
int i, initcnt, node = first_online_node;
Expand Down Expand Up @@ -287,6 +295,12 @@ static inline int alloc_descs(unsigned int start, unsigned int cnt, int node)
{
return start;
}

static int irq_expand_nr_irqs(unsigned int cnt)
{
return -ENOMEM;
}

#endif /* !CONFIG_SPARSE_IRQ */

/* Dynamic interrupt handling */
Expand Down Expand Up @@ -335,9 +349,11 @@ irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node)
if (irq >=0 && start != irq)
goto err;

ret = -ENOMEM;
if (start >= nr_irqs)
goto err;
if (start >= nr_irqs) {
ret = irq_expand_nr_irqs(cnt);
if (ret)
goto err;
}

bitmap_set(allocated_irqs, start, cnt);
mutex_unlock(&sparse_irq_lock);
Expand Down

0 comments on commit e7bcecb

Please sign in to comment.