lkml.org 
[lkml]   [2005]   [Nov]   [16]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 6/6] PCI PM: pci_save/restore_state improvements
FromAdam Belay <>
DateWed, 16 Nov 2005 02:26:04 -0500
On Tue, 2005-11-15 at 22:31 -0800, Greg KH wrote:
> On Tue, Nov 15, 2005 at 10:31:42PM -0500, Adam Belay wrote:
> > This patch makes some improvements to pci_save_state and
> > pci_restore_state.  Instead of saving and restoring all standard
> > registers (even read-only ones), it only restores necessary registers.
> > Also, the command register is handled more carefully.  Let me know if
> > I'm missing anything important.
> > 
> > 
> > --- a/drivers/pci/pm.c	2005-11-13 20:32:24.000000000 -0500
> > +++ b/drivers/pci/pm.c	2005-11-13 20:29:32.000000000 -0500
> > @@ -53,10 +53,13 @@
> >   */
> >  int pci_save_state(struct pci_dev *dev)
> >  {
> > -	int i;
> > -	/* XXX: 100% dword access ok here? */
> > -	for (i = 0; i < 16; i++)
> > -		pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]);
> > +	struct pci_dev_config * conf = &dev->saved_config;
> > +
> > +	pci_read_config_word(dev, PCI_COMMAND, &conf->command);
> > +	pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &conf->cacheline_size);
> > +	pci_read_config_byte(dev, PCI_LATENCY_TIMER, &conf->latency_timer);
> > +	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &conf->interrupt_line);
> 
> Why are we saving and restoring smaller ammounts of config space now?

After looking at the spec, it seems that most of the registers we were
restoring were read-only and couldn't possibly need to be restored.
Also, the PCI PM spec suggests that only a subset of the registers
should be restored.  Finally, things like BIST should probably never be
touched.

This patch is one of the main reasons I'm looking for comments.  I
wanted to see if there are any other necessary registers.  I'm also
thinking we might want to restore some capability structures (which we
don't do now).

Thanks,
Adam


-
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/

\
 
 \ /
  Last update: 2005-11-16 08:19    [from the cache]
©2003-2008