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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Jon Derrick <jonathan.derrick@xxxxxxxxx>
---
 drivers/pci/msi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index af24ed5..3a41024 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -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 */
-- 
1.8.3.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux