[RFC PATCH 4/5] s390: Mark bits in allocated_irqs in general code

From: Yinghai Lu
Date: Sun Apr 06 2014 - 01:39:44 EST


Second irq_reserve_irqs calling is from arch s390, and
s390 does not use SPARSE_IRQ yet.

We could set bits for legacy bits early in !SPARSE_IRQ version
early_irq_init() directly instead of calling irq_reserve_irqs later.

Adding weak version arch_proble_early_allocate_nr_irqs() for
!SPARESE_IRQ, and let s390 to have specific version to
pass correct irq number that need to be marked in allocated_irqs.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
Cc: linux390@xxxxxxxxxx
---
arch/s390/kernel/irq.c | 6 +++++-
include/linux/irq.h | 1 +
kernel/irq/irqdesc.c | 10 ++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index d42b14c..2838928 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -90,9 +90,13 @@ static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = {
[CPU_RST] = {.name = "RST", .desc = "[CPU] CPU Restart"},
};

+int arch_probe_early_allocate_nr_irqs(void)
+{
+ return THIN_INTERRUPT;
+}
+
void __init init_IRQ(void)
{
- irq_reserve_irqs(0, THIN_INTERRUPT);
init_cio_interrupts();
init_airq_interrupts();
init_ext_interrupts();
diff --git a/include/linux/irq.h b/include/linux/irq.h
index d278838..7588ee9 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -623,6 +623,7 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,

void irq_free_descs(unsigned int irq, unsigned int cnt);
int irq_reserve_irqs(unsigned int from, unsigned int cnt);
+int arch_probe_early_allocate_nr_irqs(void);

static inline void irq_free_desc(unsigned int irq)
{
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index a7174617..dfb971c 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -248,10 +248,16 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
}
};

+int __weak arch_probe_early_allocate_nr_irqs(void)
+{
+ return 0;
+}
+
int __init early_irq_init(void)
{
int count, i, node = first_online_node;
struct irq_desc *desc;
+ int nr = arch_probe_early_allocate_nr_irqs();

init_irq_default_affinity();

@@ -267,6 +273,10 @@ int __init early_irq_init(void)
lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
desc_set_defaults(i, &desc[i], node, NULL);
}
+
+ for (i = 0; i < nr; i++)
+ set_bit(i, allocated_irqs);
+
return arch_early_irq_init();
}

--
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/