Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 70114e7f7585 ("irqdomain: Simplify simple and legacy domain creation")
Reported-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Link: https://lore.kernel.org/all/c3379142-10bc-4f14-b8ac-a46927aeac38@gmail.com

authored by

Matti Vaittinen and committed by
Thomas Gleixner
24d02c4e 7b9414cb

+10 -6
+10 -6
kernel/irq/irqdomain.c
··· 306 306 } 307 307 308 308 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) 310 310 { 311 311 struct irq_domain *domain; 312 312 int err; ··· 342 342 if (cond_alloc_descs && info->virq_base > 0) 343 343 irq_domain_instantiate_descs(info); 344 344 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) { 347 351 irq_domain_associate_many(domain, info->virq_base, info->hwirq_base, 348 352 info->size - info->hwirq_base); 349 353 } ··· 370 366 */ 371 367 struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info) 372 368 { 373 - return __irq_domain_instantiate(info, false); 369 + return __irq_domain_instantiate(info, false, false); 374 370 } 375 371 EXPORT_SYMBOL_GPL(irq_domain_instantiate); 376 372 ··· 474 470 .ops = ops, 475 471 .host_data = host_data, 476 472 }; 477 - struct irq_domain *domain = __irq_domain_instantiate(&info, true); 473 + struct irq_domain *domain = __irq_domain_instantiate(&info, true, false); 478 474 479 475 return IS_ERR(domain) ? NULL : domain; 480 476 } ··· 523 519 .ops = ops, 524 520 .host_data = host_data, 525 521 }; 526 - struct irq_domain *domain = irq_domain_instantiate(&info); 522 + struct irq_domain *domain = __irq_domain_instantiate(&info, false, true); 527 523 528 524 return IS_ERR(domain) ? NULL : domain; 529 525 }