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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'irq_urgent_for_v5.11_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Borislav Petkov:

- Prevent device managed IRQ allocation helpers from returning IRQ 0

- A fix for MSI activation of PCI endpoints with multiple MSIs

* tag 'irq_urgent_for_v5.11_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
genirq: Prevent [devm_]irq_alloc_desc from returning irq 0
genirq/msi: Activate Multi-MSI early when MSI_FLAG_ACTIVATE_EARLY is set

+28 -26
+2 -2
include/linux/irq.h
··· 928 928 __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE, NULL) 929 929 930 930 #define irq_alloc_desc(node) \ 931 - irq_alloc_descs(-1, 0, 1, node) 931 + irq_alloc_descs(-1, 1, 1, node) 932 932 933 933 #define irq_alloc_desc_at(at, node) \ 934 934 irq_alloc_descs(at, at, 1, node) ··· 943 943 __devm_irq_alloc_descs(dev, irq, from, cnt, node, THIS_MODULE, NULL) 944 944 945 945 #define devm_irq_alloc_desc(dev, node) \ 946 - devm_irq_alloc_descs(dev, -1, 0, 1, node) 946 + devm_irq_alloc_descs(dev, -1, 1, 1, node) 947 947 948 948 #define devm_irq_alloc_desc_at(dev, at, node) \ 949 949 devm_irq_alloc_descs(dev, at, at, 1, node)
+6
include/linux/msi.h
··· 178 178 list_for_each_entry((desc), dev_to_msi_list((dev)), list) 179 179 #define for_each_msi_entry_safe(desc, tmp, dev) \ 180 180 list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list) 181 + #define for_each_msi_vector(desc, __irq, dev) \ 182 + for_each_msi_entry((desc), (dev)) \ 183 + if ((desc)->irq) \ 184 + for (__irq = (desc)->irq; \ 185 + __irq < ((desc)->irq + (desc)->nvec_used); \ 186 + __irq++) 181 187 182 188 #ifdef CONFIG_IRQ_MSI_IOMMU 183 189 static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
+20 -24
kernel/irq/msi.c
··· 436 436 437 437 can_reserve = msi_check_reservation_mode(domain, info, dev); 438 438 439 - for_each_msi_entry(desc, dev) { 440 - virq = desc->irq; 441 - if (desc->nvec_used == 1) 442 - dev_dbg(dev, "irq %d for MSI\n", virq); 443 - else 439 + /* 440 + * This flag is set by the PCI layer as we need to activate 441 + * the MSI entries before the PCI layer enables MSI in the 442 + * card. Otherwise the card latches a random msi message. 443 + */ 444 + if (!(info->flags & MSI_FLAG_ACTIVATE_EARLY)) 445 + goto skip_activate; 446 + 447 + for_each_msi_vector(desc, i, dev) { 448 + if (desc->irq == i) { 449 + virq = desc->irq; 444 450 dev_dbg(dev, "irq [%d-%d] for MSI\n", 445 451 virq, virq + desc->nvec_used - 1); 446 - /* 447 - * This flag is set by the PCI layer as we need to activate 448 - * the MSI entries before the PCI layer enables MSI in the 449 - * card. Otherwise the card latches a random msi message. 450 - */ 451 - if (!(info->flags & MSI_FLAG_ACTIVATE_EARLY)) 452 - continue; 452 + } 453 453 454 - irq_data = irq_domain_get_irq_data(domain, desc->irq); 454 + irq_data = irq_domain_get_irq_data(domain, i); 455 455 if (!can_reserve) { 456 456 irqd_clr_can_reserve(irq_data); 457 457 if (domain->flags & IRQ_DOMAIN_MSI_NOMASK_QUIRK) ··· 462 462 goto cleanup; 463 463 } 464 464 465 + skip_activate: 465 466 /* 466 467 * If these interrupts use reservation mode, clear the activated bit 467 468 * so request_irq() will assign the final vector. 468 469 */ 469 470 if (can_reserve) { 470 - for_each_msi_entry(desc, dev) { 471 - irq_data = irq_domain_get_irq_data(domain, desc->irq); 471 + for_each_msi_vector(desc, i, dev) { 472 + irq_data = irq_domain_get_irq_data(domain, i); 472 473 irqd_clr_activated(irq_data); 473 474 } 474 475 } 475 476 return 0; 476 477 477 478 cleanup: 478 - for_each_msi_entry(desc, dev) { 479 - struct irq_data *irqd; 480 - 481 - if (desc->irq == virq) 482 - break; 483 - 484 - irqd = irq_domain_get_irq_data(domain, desc->irq); 485 - if (irqd_is_activated(irqd)) 486 - irq_domain_deactivate_irq(irqd); 479 + for_each_msi_vector(desc, i, dev) { 480 + irq_data = irq_domain_get_irq_data(domain, i); 481 + if (irqd_is_activated(irq_data)) 482 + irq_domain_deactivate_irq(irq_data); 487 483 } 488 484 msi_domain_free_irqs(domain, dev); 489 485 return ret;