Skip to content

Commit 83dbf89

Browse files
stroeseKAGA-KOKO
authored andcommitted
PCI/MSI: Mask MSI-X vectors only on success
Masking all unused MSI-X entries is done to ensure that a crash kernel starts from a clean slate, which correponds to the reset state of the device as defined in the PCI-E specificion 3.0 and later: Vector Control for MSI-X Table Entries -------------------------------------- "00: Mask bit: When this bit is set, the function is prohibited from sending a message using this MSI-X Table entry. ... This bit’s state after reset is 1 (entry is masked)." A Marvell NVME device fails to deliver MSI interrupts after trying to enable MSI-X interrupts due to that masking. It seems to take the MSI-X mask bits into account even when MSI-X is disabled. While not specification compliant, this can be cured by moving the masking into the success path, so that the MSI-X table entries stay in device reset state when the MSI-X setup fails. [ tglx: Move it into the success path, add comment and amend changelog ] Fixes: aa8092c ("PCI/MSI: Mask all unused MSI-X entries") Signed-off-by: Stefan Roese <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: Bjorn Helgaas <[email protected]> Cc: Michal Simek <[email protected]> Cc: Marek Vasut <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 2585cf9 commit 83dbf89

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/pci/msi.c

Lines changed: 10 additions & 3 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);

0 commit comments

Comments
 (0)