Skip to content

Commit 24d02c4

Browse files
M-VaittinenKAGA-KOKO
authored andcommitted
irqdomain: Always associate interrupts for legacy domains
The unification of irq_domain_create_legacy() missed the fact that interrupts must be associated even when the Linux interrupt number provided in the first_irq argument is 0. This breaks all call sites of irq_domain_create_legacy() which supply 0 as the first_irq argument. Enforce the association for legacy domains in __irq_domain_instantiate() to cure this. [ tglx: Massaged it slightly. ] Fixes: 70114e7 ("irqdomain: Simplify simple and legacy domain creation") Reported-by: Jiaxun Yang <[email protected]> Signed-off-by Matti Vaittinen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Jiaxun Yang <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 7b9414c commit 24d02c4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

kernel/irq/irqdomain.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static void irq_domain_instantiate_descs(const struct irq_domain_info *info)
306306
}
307307

308308
static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info *info,
309-
bool cond_alloc_descs)
309+
bool cond_alloc_descs, bool force_associate)
310310
{
311311
struct irq_domain *domain;
312312
int err;
@@ -342,8 +342,12 @@ static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info
342342
if (cond_alloc_descs && info->virq_base > 0)
343343
irq_domain_instantiate_descs(info);
344344

345-
/* Legacy interrupt domains have a fixed Linux interrupt number */
346-
if (info->virq_base > 0) {
345+
/*
346+
* Legacy interrupt domains have a fixed Linux interrupt number
347+
* associated. Other interrupt domains can request association by
348+
* providing a Linux interrupt number > 0.
349+
*/
350+
if (force_associate || info->virq_base > 0) {
347351
irq_domain_associate_many(domain, info->virq_base, info->hwirq_base,
348352
info->size - info->hwirq_base);
349353
}
@@ -366,7 +370,7 @@ static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info
366370
*/
367371
struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info)
368372
{
369-
return __irq_domain_instantiate(info, false);
373+
return __irq_domain_instantiate(info, false, false);
370374
}
371375
EXPORT_SYMBOL_GPL(irq_domain_instantiate);
372376

@@ -470,7 +474,7 @@ struct irq_domain *irq_domain_create_simple(struct fwnode_handle *fwnode,
470474
.ops = ops,
471475
.host_data = host_data,
472476
};
473-
struct irq_domain *domain = __irq_domain_instantiate(&info, true);
477+
struct irq_domain *domain = __irq_domain_instantiate(&info, true, false);
474478

475479
return IS_ERR(domain) ? NULL : domain;
476480
}
@@ -519,7 +523,7 @@ struct irq_domain *irq_domain_create_legacy(struct fwnode_handle *fwnode,
519523
.ops = ops,
520524
.host_data = host_data,
521525
};
522-
struct irq_domain *domain = irq_domain_instantiate(&info);
526+
struct irq_domain *domain = __irq_domain_instantiate(&info, false, true);
523527

524528
return IS_ERR(domain) ? NULL : domain;
525529
}

0 commit comments

Comments
 (0)