Skip to content

Commit 1318a48

Browse files
committed
genirq: Provide default irq init flags
Arch code sets it's own irq_desc.status flags right after boot and for dynamically allocated interrupts. That might involve iterating over a huge array. Allow ARCH_IRQ_INIT_FLAGS to set separate flags aside of IRQ_DISABLED which is the default. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
1 parent d895f51 commit 1318a48

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎include/linux/irq.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ struct irq_chip {
214214
*/
215215
#include <asm/hw_irq.h>
216216

217+
#ifndef ARCH_IRQ_INIT_FLAGS
218+
# define ARCH_IRQ_INIT_FLAGS 0
219+
#endif
220+
221+
#define IRQ_DEFAULT_INIT_FLAGS (IRQ_DISABLED | ARCH_IRQ_INIT_FLAGS)
222+
217223
struct irqaction;
218224
extern int setup_irq(unsigned int irq, struct irqaction *new);
219225
extern void remove_irq(unsigned int irq, struct irqaction *act);

‎kernel/irq/chip.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void dynamic_irq_init_x(unsigned int irq, bool keep_chip_data)
3131

3232
/* Ensure we don't have left over values from a previous use of this irq */
3333
raw_spin_lock_irqsave(&desc->lock, flags);
34-
desc->status = IRQ_DISABLED;
34+
desc->status = IRQ_DEFAULT_INIT_FLAGS;
3535
desc->irq_data.chip = &no_irq_chip;
3636
desc->handle_irq = handle_bad_irq;
3737
desc->depth = 1;

‎kernel/irq/irqdesc.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ EXPORT_SYMBOL_GPL(nr_irqs);
3939
#ifdef CONFIG_SPARSE_IRQ
4040

4141
static struct irq_desc irq_desc_init = {
42-
.status = IRQ_DISABLED,
42+
.status = IRQ_DEFAULT_INIT_FLAGS,
4343
.handle_irq = handle_bad_irq,
4444
.depth = 1,
4545
.lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
@@ -113,7 +113,7 @@ void replace_irq_desc(unsigned int irq, struct irq_desc *desc)
113113

114114
static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = {
115115
[0 ... NR_IRQS_LEGACY-1] = {
116-
.status = IRQ_DISABLED,
116+
.status = IRQ_DEFAULT_INIT_FLAGS,
117117
.handle_irq = handle_bad_irq,
118118
.depth = 1,
119119
.lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
@@ -204,7 +204,7 @@ struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
204204

205205
struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
206206
[0 ... NR_IRQS-1] = {
207-
.status = IRQ_DISABLED,
207+
.status = IRQ_DEFAULT_INIT_FLAGS,
208208
.handle_irq = handle_bad_irq,
209209
.depth = 1,
210210
.lock = __RAW_SPIN_LOCK_UNLOCKED(irq_desc->lock),

0 commit comments

Comments
 (0)