Skip to contentSkip to conversation

PCI/MSI: Prevent MSI/X masking IO to a removed device

PATCH New Jon Derrick 1 participant 1 message Oct 25, 2018 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/MSI: Prevent MSI/X masking IO to a removed device

A removed device won't be able to accept mmio or config cycles setting or clearing MSI/X mask bits. Shortcut this path by preventing the writes and subsequent reads which may result in unsupported requests or completer abort.

---
 drivers/pci/msi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/pci/msi.c +8 -0
index af24ed5..3a41024 100644
@@ -227,6 +227,14 @@ static void msi_set_mask_bit(struct irq_data *data, u32 flag)
 {
 	struct msi_desc *desc = irq_data_get_msi_desc(data);
 
+	/*
+	 * Prevent non-posted IO to the device if it has been removed and is in
+	 * the process of removal cleanup, in order to prevent unsupported
+	 * requests or completer aborts or other issues.
+	 */
+	if (pci_dev_is_disconnected(msi_desc_to_pci_dev(desc)))
+		return;
+
 	if (desc->msi_attrib.is_msix) {
 		msix_mask_irq(desc, flag);
 		readl(desc->mask_base);		/* Flush write to device */
Signature · 1 line
1.8.3.1