public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bugfix 3.9] PCI: Don't try to disable Bus Master on disconnected PCI devices
@ 2013-03-14 14:49 Konstantin Khlebnikov
  2013-04-01  8:00 ` Konstantin Khlebnikov
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2013-03-14 14:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rafael J. Wysocki, kexec, Eric W. Biederman, Bjorn Helgaas,
	Jeff Garzik, Vivek Goyal

This is fix for commit 7897e6022761ace7377f0f784fca059da55f5d71 from v3.9-rc1
("PCI: Disable Bus Master unconditionally in pci_device_shutdown()")
in turn that was fix for b566a22c23327f18ce941ffad0ca907e50a53d41 from v3.5-rc1
("PCI: disable Bus Master on PCI device shutdown")

Unfortunately fixing one bug uncovers another:
->shutdown() callback might switch device to deep sleep state.
PCI config space no longer available after that.

Link: https://lkml.org/lkml/2013/3/12/529
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Reported-and-Tested-by: Vivek Goyal <vgoyal@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/pci/pci-driver.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 1fa1e48..79277fb 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -390,9 +390,10 @@ static void pci_device_shutdown(struct device *dev)
 
 	/*
 	 * Turn off Bus Master bit on the device to tell it to not
-	 * continue to do DMA
+	 * continue to do DMA. Don't touch devices in D3cold or unknown states.
 	 */
-	pci_clear_master(pci_dev);
+	if (pci_dev->current_state <= PCI_D3hot)
+		pci_clear_master(pci_dev);
 }
 
 #ifdef CONFIG_PM


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-03 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-14 14:49 [PATCH bugfix 3.9] PCI: Don't try to disable Bus Master on disconnected PCI devices Konstantin Khlebnikov
2013-04-01  8:00 ` Konstantin Khlebnikov
2013-04-03 16:15   ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox