From: Dave Jones <davej@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Improve PCI config space writeback.
Date: Sun, 16 Apr 2006 17:42:15 -0500 [thread overview]
Message-ID: <20060416224215.GA732@redhat.com> (raw)
At least one laptop blew up on resume from suspend with a black screen
due to a lack of this patch. By only writing back config space that
is different, we minimise the possibility of accidents like this.
Signed-off-by: Dave Jones <davej@redhat.com>
--- linux-2.6.16.noarch/drivers/pci/pci.c~ 2006-04-16 17:36:34.000000000 -0500
+++ linux-2.6.16.noarch/drivers/pci/pci.c 2006-04-16 17:37:42.000000000 -0500
@@ -461,9 +461,17 @@ int
pci_restore_state(struct pci_dev *dev)
{
int i;
+ int val;
- for (i = 0; i < 16; i++)
- pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]);
+ for (i = 0; i < 16; i++) {
+ pci_read_config_dword(dev, i * 4, &val);
+ if (val != dev->saved_config_space[i]) {
+ printk (KERN_DEBUG "PM: Writing back config space on device %s at offset %x. (Was %x, writing %x)\n",
+ pci_name(dev), i,
+ val, (int) dev->saved_config_space[i]);
+ pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]);
+ }
+ }
pci_restore_msi_state(dev);
pci_restore_msix_state(dev);
return 0;
next reply other threads:[~2006-04-16 22:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-16 22:42 Dave Jones [this message]
2006-04-17 0:27 ` Improve PCI config space writeback Benjamin Herrenschmidt
2006-04-17 1:16 ` Dave Jones
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=20060416224215.GA732@redhat.com \
--to=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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