Skip to content

Commit 25db691

Browse files
committed
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fix from Ingo Molnar: "A fix for an MSI regression" * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: genirq/msi: Make sure PCI MSIs are activated early
2 parents 0e1117b + f3b0946 commit 25db691

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

drivers/pci/msi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,8 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
14111411
if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
14121412
pci_msi_domain_update_chip_ops(info);
14131413

1414+
info->flags |= MSI_FLAG_ACTIVATE_EARLY;
1415+
14141416
domain = msi_create_irq_domain(fwnode, info, parent);
14151417
if (!domain)
14161418
return NULL;

include/linux/msi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ enum {
270270
MSI_FLAG_MULTI_PCI_MSI = (1 << 2),
271271
/* Support PCI MSIX interrupts */
272272
MSI_FLAG_PCI_MSIX = (1 << 3),
273+
/* Needs early activate, required for PCI */
274+
MSI_FLAG_ACTIVATE_EARLY = (1 << 4),
273275
};
274276

275277
int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,

kernel/irq/msi.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,17 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
359359
else
360360
dev_dbg(dev, "irq [%d-%d] for MSI\n",
361361
virq, virq + desc->nvec_used - 1);
362+
/*
363+
* This flag is set by the PCI layer as we need to activate
364+
* the MSI entries before the PCI layer enables MSI in the
365+
* card. Otherwise the card latches a random msi message.
366+
*/
367+
if (info->flags & MSI_FLAG_ACTIVATE_EARLY) {
368+
struct irq_data *irq_data;
369+
370+
irq_data = irq_domain_get_irq_data(domain, desc->irq);
371+
irq_domain_activate_irq(irq_data);
372+
}
362373
}
363374

364375
return 0;

0 commit comments

Comments
 (0)