public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* A reference implementation of PCI suspend/resume?
@ 2005-05-12  1:24 Shaohua Li
  2005-05-12  6:21 ` Adam Belay
  2005-05-27  6:49 ` Shaohua Li
  0 siblings, 2 replies; 20+ messages in thread
From: Shaohua Li @ 2005-05-12  1:24 UTC (permalink / raw)
  To: linux-pm

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

Hi,
There are still many PCI drivers don't implement their .suspend/.resume
methods correctly. I felt it would be quite helpful there is a reference
implementation. Here is my thought:

.suspend()
{
	driver specific operations;
	pci_save_state();
	pci_enable_wake();
	/* as a result, PIC/IOAPIC pin is disabled */
	free_irq();
	/* as a result, bus master/irq router are disabled */
	pci_disable_device();
	pci_set_power_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();
	request_irq();
	driver specific operations;
}

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).

Thanks,
Shaohua


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



^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: A reference implementation of PCI suspend/resume?
@ 2005-05-14  5:06 Fabrice Gautier
  2005-05-16  4:53 ` David Brownell
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Fabrice Gautier @ 2005-05-14  5:06 UTC (permalink / raw)
  To: Shaohua Li, linux-pm

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

Hi,

> From: Shaohua Li [mailto:shaohua.li@intel.com] 
> Sent: Wednesday, May 11, 2005 6:25 PM
> To: linux-pm
> Subject: [linux-pm] A reference implementation of PCI suspend/resume?
> 
> Hi,
> There are still many PCI drivers don't implement their 
> .suspend/.resume
> methods correctly. I felt it would be quite helpful there is 
> a reference
> implementation. Here is my thought:
> 
> [...snip...]
> 
> 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. 

I don't understand why not calling free_irq would cause unexpected
interrupts.

The way I understand the PCI spec is: if you suspend a PCI device, its IRQ
should be disabled. If an IRQ come from this device anyway (in violation of
the spec) then the driver for this device should handle it so you should NOT
unregister its irq_handler.
(How does such a device would handle such a irq is another matter - a device
specific one I guess)

I'm not understanding where your unexpected interrupt is coming from.

Care to elaborate?

Btw: I'm suspending PCI devices not in the context of a full suspend
situation, maybe that's why I'm missing your point. But your sample
implementation should work in both cases.

  Thanks

-- Fabrice


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



^ permalink raw reply	[flat|nested] 20+ messages in thread
* RE: A reference implementation of PCI suspend/resume?
@ 2005-05-16 19:02 Fabrice Gautier
  2005-05-16 19:39 ` David Brownell
  0 siblings, 1 reply; 20+ messages in thread
From: Fabrice Gautier @ 2005-05-16 19:02 UTC (permalink / raw)
  To: David Brownell, linux-pm; +Cc: Fabrice Gautier

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

> From: David Brownell [mailto:david-b@pacbell.net] 
> Sent: Sunday, May 15, 2005 9:54 PM
> To: linux-pm@lists.osdl.org
> Cc: Fabrice Gautier; Shaohua Li
> Subject: Re: [linux-pm] A reference implementation of PCI 
> suspend/resume?
> 
> On Friday 13 May 2005 10:06 pm, Fabrice Gautier wrote:
> 
> > The way I understand the PCI spec is: if you suspend a PCI 
> > device, its IRQ should be disabled. If an IRQ come from
> > this device anyway (in violation of
> > the spec) then the driver for this device should handle it 
> > so you should NOT unregister its irq_handler.
> 
> There's PCI ... and PCI with PM capabilities.  That rule about only
> issuing PME transactions while suspended can only apply in the latter
> case.  That is, not all PCI devices support the PCI PM rules; drivers
> may need to help the hardware.

You mean, you support some kind of power management on PCI devices without
PM capabilities ? How are you even sure that the pci_set_power_state will
work in those kind of devices.
 
In any case, anyway it works I would say this is very much device specific
and not really part of a reference implementation. This is supposed to be a
reference implementation for "PCI PM compliant" devices right ?

-- Fabrice

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



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2005-05-27  7:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox