linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/MSI: Prevent MSI/X masking IO to a removed device
@ 2018-10-25 17:44 Jon Derrick
  0 siblings, 0 replies; only message in thread
From: Jon Derrick @ 2018-10-25 17:44 UTC (permalink / raw)
  To: linux-pci; +Cc: Bjorn Helgaas, Lorenzo Pieralisi, Jon Derrick

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@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-25 17:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25 17:44 [PATCH] PCI/MSI: Prevent MSI/X masking IO to a removed device Jon Derrick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).