Skip to content

Commit a76c3d0

Browse files
committed
Merge tag 'irq_urgent_for_v5.16_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq fixes from Borislav Petkov: - Clear the PCI_MSIX_FLAGS_MASKALL bit too on the error path so that it is restored to its reset state - Mask MSI-X vectors late on the init path in order to handle out-of-spec Marvell NVME devices which apparently look at the MSI-X mask even when MSI-X is disabled * tag 'irq_urgent_for_v5.16_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: PCI/MSI: Clear PCI_MSIX_FLAGS_MASKALL on error PCI/MSI: Mask MSI-X vectors only on success
2 parents e1fe1b1 + 94185ad commit a76c3d0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/pci/msi.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,6 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
722722
goto out_disable;
723723
}
724724

725-
/* Ensure that all table entries are masked. */
726-
msix_mask_all(base, tsize);
727-
728725
ret = msix_setup_entries(dev, base, entries, nvec, affd);
729726
if (ret)
730727
goto out_disable;
@@ -751,6 +748,16 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
751748
/* Set MSI-X enabled bits and unmask the function */
752749
pci_intx_for_msi(dev, 0);
753750
dev->msix_enabled = 1;
751+
752+
/*
753+
* Ensure that all table entries are masked to prevent
754+
* stale entries from firing in a crash kernel.
755+
*
756+
* Done late to deal with a broken Marvell NVME device
757+
* which takes the MSI-X mask bits into account even
758+
* when MSI-X is disabled, which prevents MSI delivery.
759+
*/
760+
msix_mask_all(base, tsize);
754761
pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
755762

756763
pcibios_free_irq(dev);
@@ -777,7 +784,7 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
777784
free_msi_irqs(dev);
778785

779786
out_disable:
780-
pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
787+
pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE, 0);
781788

782789
return ret;
783790
}

0 commit comments

Comments
 (0)