public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: linux-pm <linux-pm@lists.osdl.org>
Cc: Pavel Machek <pavel@ucw.cz>
Subject: Re: A reference implementation of PCI suspend/resume?
Date: Fri, 27 May 2005 14:49:13 +0800	[thread overview]
Message-ID: <1117176553.3925.6.camel@linux-hp.sh.intel.com> (raw)
In-Reply-To: <1115861087.3817.23.camel@linux-hp.sh.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2226 bytes --]

>
> 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
 ~~~~~~~~~~~~
 
_



[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2005-05-27  6:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-12  1:24 A reference implementation of PCI suspend/resume? Shaohua Li
2005-05-12  6:21 ` Adam Belay
2005-05-12  7:03   ` Shaohua Li
2005-05-27  6:49 ` Shaohua Li [this message]
2005-05-27  7:20   ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2005-05-14  5:06 Fabrice Gautier
2005-05-16  4:53 ` David Brownell
2005-05-16  8:55 ` Shaohua Li
2005-05-16 20:16 ` Adam Belay
2005-05-16 20:56   ` Rafael J. Wysocki
2005-05-16 21:19   ` Jordan Crouse
2005-05-17  0:26     ` David Brownell
2005-05-17  9:10       ` Rafael J. Wysocki
2005-05-17 18:35         ` David Brownell
2005-05-17 19:28           ` Rafael J. Wysocki
2005-05-18  1:26             ` Adam Belay
2005-05-18 17:40               ` Rafael J. Wysocki
2005-05-18 18:32                 ` Alan Stern
2005-05-16 19:02 Fabrice Gautier
2005-05-16 19:39 ` David Brownell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1117176553.3925.6.camel@linux-hp.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=linux-pm@lists.osdl.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox