[linux-pm] A reference implementation of PCI suspend/resume?

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

 



>
> Currently many drivers don't call 
> free_irq/request_irq/pci_disable_device, which makes unexpected 
> interrupt occur and even break suspend/resume in some systems. The 
> reason is we disable PIC/IOAPIC/irq router very later (they are
> treated 
> as a sysdev), so there is a window between when a device is suspend
> and 
> when its PIC/IOAPIC/irq router pin are disabled. The ideal way is 
> PIC/IOAPIC/irq router's pins are disabled soon after no device is 
> referencing them. I'm now working on disabling irq router if no 
> reference on it, but first I'd like to know your opinions about the 
> proposal (the reference .suspend/.resume implementation).
Hi Pavel,
Could this be put into your tree? We should fix many PCI drivers, this
possibly will help us.

Thanks,
Shaohua

---

 linux-2.6.11-rc5-mm1-root/Documentation/power/pci.txt |   38 ++++++++++++++++++
 1 files changed, 38 insertions(+)

diff -puN Documentation/power/pci.txt~int-doc Documentation/power/pci.txt
--- linux-2.6.11-rc5-mm1/Documentation/power/pci.txt~int-doc	2005-05-27 10:43:51.893015912 +0800
+++ linux-2.6.11-rc5-mm1-root/Documentation/power/pci.txt	2005-05-27 14:26:19.492872304 +0800
@@ -291,6 +291,44 @@ a request to enable wake events from D3,
 pci_enable_wake (one for both D3hot and D3cold).
 
 
+A reference implementation
+-------------------------
+.suspend()
+{
+	/* driver specific operations */
+
+	/* Disable IRQ */
+	free_irq();
+	/* If using MSI */
+	pci_disable_msi();
+
+	pci_save_state();
+	pci_enable_wake();
+	/* Disable IO/bus master/irq router */
+	pci_disable_device();
+	pci_set_power_state(pci_choose_state());
+}
+
+.resume()
+{
+	pci_set_power_state(PCI_D0);
+	pci_restore_state();
+	/* device's irq possibly is changed, driver should take care */
+	pci_enable_device();
+	pci_set_master();
+
+	/* if using MSI, device's vector possibly is changed */
+	pci_enable_msi();
+
+	request_irq();
+	/* driver specific operations; */
+}
+
+This is a typical implementation. Drivers can slightly change the order
+of the operations in the implementation, ignore some operations or add
+more deriver specific operations in it, but drivers should do something like
+this on the whole.
+
 5. Resources
 ~~~~~~~~~~~~
 
_



[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux