All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Dave Jones <davej@redhat.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Improve PCI config space writeback.
Date: Mon, 17 Apr 2006 10:27:07 +1000	[thread overview]
Message-ID: <1145233627.9833.19.camel@localhost.localdomain> (raw)
In-Reply-To: <20060416224215.GA732@redhat.com>

On Sun, 2006-04-16 at 17:42 -0500, Dave Jones wrote:
> 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>

I think it's a mistake to restore the command register before the rest.
It should be restored last.

> 
> --- 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;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


  reply	other threads:[~2006-04-17  0:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-16 22:42 Improve PCI config space writeback Dave Jones
2006-04-17  0:27 ` Benjamin Herrenschmidt [this message]
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=1145233627.9833.19.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.