* Re: [Bug 9528] x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM [not found] ` <fa.n/XQFa64Zg8snHoyB/rrKzCvAL0@ifi.uio.no> @ 2007-12-24 16:59 ` Robert Hancock 0 siblings, 0 replies; 22+ messages in thread From: Robert Hancock @ 2007-12-24 16:59 UTC (permalink / raw) To: Linus Torvalds Cc: Carlos Corbacho, Linux Kernel Mailing List, Rafael J. Wysocki, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, bugme-daemon Linus Torvalds wrote: > > On Sun, 23 Dec 2007, Carlos Corbacho wrote: >> Fix suspend-to-RAM on nForce 4 (CK804) boards by increasing >> PCIBIOS_MIN_IO. >> >> Fixes kernel bugzilla #9528 >> >> Problem: >> >> Linus' patch (52ade9b3b97fd3bea42842a056fe0786c28d0555) to re-order >> suspend (and fix fall out from Rafael's earlier suspend reordering work) >> broke suspend-to-RAM on nForce 4 (CK804) boards. >> >> Why: >> >> After debugging _PTS() in the DSDT, it turns out these nVidia boards are >> trying to write to an IO port > 0x1000 (0x142E) during suspend. Before the >> re-ordering, we got away with this. > > Very interesting. > > HOWEVER. > > I'd much rather figure out what the magic IO resource is that clashes. > > It's almost certainly some hidden and undocumented (or badly documented) > ACPI IO area that the kernel doesn't know about, because it's not a > regular PCI BAR resource, but some northbridge (or southbridge) magic > register range. > > Those ranges *should* be reserved by the BIOS in the ACPI tables, but this > would definitely not be the first time that doesn't happen. I'm having trouble sorting out which report is for which BIOS (and some of them don't have any dmesg posted), but I believe in these cases that memory region is indeed reported as reserved by the BIOS, and no PCI resources should end up allocated there. So I'm not sure why fiddling with PCIBIOS_MIN_IO would have any effect (other than by accident). I wonder if this is the culprit (from Arthur Erhardt's dmesg): pnpacpi: exceeded the max number of mem resources: 12 pnpacpi: exceeded the max number of mem resources: 12 which means we're ignoring some of the memory reservations. I wonder if some IO reservations are also being ignored? Why do we have this silly hard limit of number of resources anyway? If we just ignore random reservations provided by the BIOS, we shouldn't be surprised if things break randomly. This warning at the very least should be much louder (i.e. "Warning: This problem may break your system").. > > But the right fix would be for us to just figure out what the range is ass > a PCI quirk, and just know to avoid it on purpose, ratehr than just being > lucky and happen to avoid it because PCIBIOS_MIN_IO just happens to be > bigger than the particular address. > > So can you: > - show what your /proc/ioports contains (*with* the bug triggering, ie > non-working suspend, so we see what it is that actually ends up using > that area) > - send out 'dmesg' for a boot (same deal) > - add "lspci -xxxvv" output to the deal too. > > and also make them part of the bugzilla history (I'm cc'ing bugzilla here, > and added the bug number to the subject, so hopefully this thread ends up > being archived there too). > >> There was some previous work in the PCIBIOS_MIN_IO area over two years ago >> (71db63acff69618b3d9d3114bd061938150e146b) which bumped this to 0x4000, >> but this was reverted (2ba84684e8cf6f980e4e95a2300f53a505eb794e) after >> causing new and entirely different problems on another nForce board. > > The problem here is classic: these magic ranges tend to be *different* on > different boards (because they don't tend to be fixed by hardware, they > are programmed regions set up by firmware), so trying to change > PCIBIOS_MIN_IO to avoid a problem on one board is almost certain to just > introduce it on another board instead. > > On *your* particular board, 0x142E is used for something, but on somebody > elses board it might be 0x162E, and now changing PCIBIOS_MIN_IO to 0x1500 > might make that other board hang instead. > > So you seem to have debugged this very successfully, and I'm wondering if > you might be able to find out where that 0x142e comes from, and we could > fix it for *all* boards using that chipset by just figuring out what the > *hardware* rules (rather than the random firmware setup that will be > different on different boards) for that chipset actually are! I suspect it's board specific. Looking at the DSDT for my A8N-SLI Deluxe, that SMIP region is defined at 0x442E (and is reported as reserved). This BIOS doesn't write there in the _PTS method like the ones in the report apparently do though. -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <fa.5MPS0t6OtOOALbc90ywKDrtik+4@ifi.uio.no>]
[parent not found: <fa.zg2cR0292Evub+o7LgQUdg4A7ZM@ifi.uio.no>]
[parent not found: <fa.ZBHAMdWAEaW7Flaz8/Gc8PLZUNg@ifi.uio.no>]
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM [not found] ` <fa.ZBHAMdWAEaW7Flaz8/Gc8PLZUNg@ifi.uio.no> @ 2007-12-24 22:40 ` Robert Hancock 2007-12-25 0:03 ` Carlos Corbacho 0 siblings, 1 reply; 22+ messages in thread From: Robert Hancock @ 2007-12-24 22:40 UTC (permalink / raw) To: Carlos Corbacho Cc: Linus Torvalds, Rafael J. Wysocki, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list Carlos Corbacho wrote: > On Monday 24 December 2007 18:34:21 Linus Torvalds wrote: >> On Mon, 24 Dec 2007, Rafael J. Wysocki wrote: >>> Well, having considered that for a longer while, I think the AML code is >>> referring to a device that we have suspended already, and since it's in a >>> low power state, it just can't handle the reference. >>> >>> If that is the case, we'll have to find the device (that should be >>> possible using some code instrumentation) and move the suspending of it >>> into the late stage. >> Yes. > > My own experimentation (in device_suspend(), calling _PTS() in the AML after > each suspend_device() runs, until one device causes it to hang) points to > ohci_hcd being the culprit here (with or without any devices attached). With > the ohci_hcd module unloaded, the machine suspends just fine[1]. > > Of course, I'm at a complete loss as to why suspending OHCI would cause a > problem for an IO port write. The name of the operation region, SMIP, suggests that the BIOS has an SMI trap on that port. In that case, writing to that port will result in the BIOS taking control. We have little idea what it could be doing. Could be it's trying to access the OHCI controller which has been suspended already. This sounds kind of like the Toshiba laptops that go nuts somewhere if the AHCI SATA controller gets put into suspend state before the system suspends.. The ACPI spec has the following to say about the _PTS method: "The platform must not make any assumptions about the state of the machine when _PTS is called. For example, operation region accesses that require devices to be configured and enabled may not succeed, as these devices may be in a non-decoding state due to plug and play or power management operations." I would guess some BIOS writers failed to heed this.. > >> NOTE! This following patch is just for discussion, and while I think it's >> conceptually a good thing to try, I don't think it will help Carlos' >> problem. But removing the "pci_set_power_state()" in agp_nvidia_suspend() >> might. > > nvidia-agp cannot be built on x86-64, so it's not the culprit in this case. Yeah, and this is a PCI Express system not AGP, so it wouldn't load anyway. -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-24 22:40 ` Robert Hancock @ 2007-12-25 0:03 ` Carlos Corbacho 2007-12-25 2:41 ` ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) Carlos Corbacho 2007-12-25 13:26 ` x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM Rafael J. Wysocki 0 siblings, 2 replies; 22+ messages in thread From: Carlos Corbacho @ 2007-12-25 0:03 UTC (permalink / raw) To: Robert Hancock Cc: Linus Torvalds, Rafael J. Wysocki, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list On Monday 24 December 2007 22:40:46 Robert Hancock wrote: > The ACPI spec has the following to say about the _PTS method: > > "The platform must not make any assumptions about the state of the > machine when _PTS is called. For example, operation region accesses that > require devices to be configured and enabled may not succeed, as these > devices may be in a non-decoding state due to plug and play or power > management operations." That is from the 3.0 spec though. And it looks like the definition changed from pre-3.0 to 3.0 and above. This is what the 1.0B spec says (and this is also repeated verbatim in 2.0, 2.0a, 2.0b, and 2.0c): "The _PTS control method is executed by the operating system at the beginning of the sleep process for S1, S2, S3, S4, and for orderly S5 shutdown. The sleeping state value (1, 2, 3, 4, or 5) is passed to the _PTS control method. Before the OS notifies native device drivers and prepares the system software for a system sleeping state, it executes this ACPI control method. Thus, this control method can be executed a relatively long time before actually entering the desired sleeping state. In addition, the OS can abort the sleeping operation without notification to the ACPI driver, in which case another _PTS would occur some time before the next attempt by the OS to enter a sleeping state. The _PTS control method cannot modify the current configuration or power state of any device in the system. For example, _PTS would simply store the sleep type in the embedded controller in sequencing the system into a sleep state when the SLP_EN bit is set." According to the earlier versions of the ACPI spec, Linux is doing the wrong thing - we should call _PTS() before we start powerding down devices, or notifying device drivers to start suspending. So, my limited understanding of what we currently do for ACPI suspend-to-RAM is: 1) Freeze processes/ devices 2) Put all devices into low power mode 3) Execute _PTS() 4) Suspend system So the problem is - our current suspend order is fine for ACPI 3.0 and above, but for pre-3.0 systems, this violates the older specs, where 2) and 3) should be reversed. > I would guess some BIOS writers failed to heed this.. No, it looks like the BIOS is obeying the older specs, and Linux is at fault here for breaking the suspend logic of pre ACPI 3.0 systems. -Carlos -- E-Mail: carlos@strangeworlds.co.uk Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D ^ permalink raw reply [flat|nested] 22+ messages in thread
* ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) 2007-12-25 0:03 ` Carlos Corbacho @ 2007-12-25 2:41 ` Carlos Corbacho 2007-12-25 13:36 ` Rafael J. Wysocki 2007-12-25 13:26 ` x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM Rafael J. Wysocki 1 sibling, 1 reply; 22+ messages in thread From: Carlos Corbacho @ 2007-12-25 2:41 UTC (permalink / raw) To: Robert Hancock Cc: Linus Torvalds, Rafael J. Wysocki, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, linux-acpi Adding Linux-ACPI to CC. On Tuesday 25 December 2007 00:03:25 Carlos Corbacho wrote: > According to the earlier versions of the ACPI spec, Linux is doing the > wrong thing - we should call _PTS() before we start powerding down devices, > or notifying device drivers to start suspending. > > So, my limited understanding of what we currently do for ACPI > suspend-to-RAM is: > > 1) Freeze processes/ devices > 2) Put all devices into low power mode > 3) Execute _PTS() > 4) Suspend system > > So the problem is - our current suspend order is fine for ACPI 3.0 and > above, but for pre-3.0 systems, this violates the older specs, where 2) and > 3) should be reversed. The following is a hack to illustrate what I'm getting at (this is tested on x86-64) (it's a hack since it does all the ACPI prepare bits during set_target() for the pre ACPI 3.0 systems, rather than prepare() - whether this can be cleaned up to move out just the _PTS() call, I don't know). It abuses suspend_ops->set_target(), but was the easiest way to quickly demonstrate this (since the kerneldoc for set_target() says it will always be executed before we suspend the devices). -Carlos --- drivers/acpi/sleep/main.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 96d23b3..89e708b 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c @@ -77,8 +77,19 @@ static int acpi_pm_set_target(suspend_state_t pm_state) } else { printk(KERN_ERR "ACPI does not support this state: %d\n", pm_state); - error = -ENOSYS; + return -ENOSYS; } + + /* + * For ACPI 1.0 and 2.0 systems, we must run the preparation methods + * before we put the devices into low power mode. + */ + if (acpi_gbl_FADT.header.revision < 3) { + error = acpi_sleep_prepare(acpi_target_sleep_state); + if (error) + acpi_target_sleep_state = ACPI_STATE_S0; + } + return error; } @@ -91,10 +102,17 @@ static int acpi_pm_set_target(suspend_state_t pm_state) static int acpi_pm_prepare(void) { - int error = acpi_sleep_prepare(acpi_target_sleep_state); + int error = 0; - if (error) - acpi_target_sleep_state = ACPI_STATE_S0; + /* + * For ACPI 3.0 or newer systems, we must run the preparation methods + * after we put the devices into low power mode. + */ + if (acpi_gbl_FADT.header.revision >= 3) { + error = acpi_sleep_prepare(acpi_target_sleep_state); + if (error) + acpi_target_sleep_state = ACPI_STATE_S0; + } return error; } ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) 2007-12-25 2:41 ` ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) Carlos Corbacho @ 2007-12-25 13:36 ` Rafael J. Wysocki 2007-12-25 14:07 ` Rafael J. Wysocki 0 siblings, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-25 13:36 UTC (permalink / raw) To: Carlos Corbacho Cc: Robert Hancock, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, linux-acpi On Tuesday, 25 of December 2007, Carlos Corbacho wrote: > Adding Linux-ACPI to CC. > > On Tuesday 25 December 2007 00:03:25 Carlos Corbacho wrote: > > According to the earlier versions of the ACPI spec, Linux is doing the > > wrong thing - we should call _PTS() before we start powerding down devices, > > or notifying device drivers to start suspending. > > > > So, my limited understanding of what we currently do for ACPI > > suspend-to-RAM is: > > > > 1) Freeze processes/ devices > > 2) Put all devices into low power mode > > 3) Execute _PTS() > > 4) Suspend system > > > > So the problem is - our current suspend order is fine for ACPI 3.0 and > > above, but for pre-3.0 systems, this violates the older specs, where 2) and > > 3) should be reversed. > > The following is a hack to illustrate what I'm getting at (this is > tested on x86-64) (it's a hack since it does all the ACPI prepare bits > during set_target() for the pre ACPI 3.0 systems, rather than prepare() - > whether this can be cleaned up to move out just the _PTS() call, I don't > know). > > It abuses suspend_ops->set_target(), but was the easiest way to quickly > demonstrate this (since the kerneldoc for set_target() says it will always > be executed before we suspend the devices). Please, don't do that. The current code is following the ACPI 2.0 specification (and later) quite closely and while we can add a special case for the 1.0-copmpilant systems, the failing ones tend to be supposed to follow ACPI 2.0 (or later). > drivers/acpi/sleep/main.c | 26 ++++++++++++++++++++++---- > 1 files changed, 22 insertions(+), 4 deletions(-) > > > diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c > index 96d23b3..89e708b 100644 > --- a/drivers/acpi/sleep/main.c > +++ b/drivers/acpi/sleep/main.c > @@ -77,8 +77,19 @@ static int acpi_pm_set_target(suspend_state_t pm_state) > } else { > printk(KERN_ERR "ACPI does not support this state: %d\n", > pm_state); > - error = -ENOSYS; > + return -ENOSYS; > } > + > + /* > + * For ACPI 1.0 and 2.0 systems, we must run the preparation methods > + * before we put the devices into low power mode. > + */ > + if (acpi_gbl_FADT.header.revision < 3) { acpi_gbl_FADT.header.revision is equal to 3 for ACPI 2.0-compilant systems (section 5.2.8 of the specification). > + error = acpi_sleep_prepare(acpi_target_sleep_state); > + if (error) > + acpi_target_sleep_state = ACPI_STATE_S0; > + } > + > return error; > } > > @@ -91,10 +102,17 @@ static int acpi_pm_set_target(suspend_state_t pm_state) > > static int acpi_pm_prepare(void) > { > - int error = acpi_sleep_prepare(acpi_target_sleep_state); > + int error = 0; > > - if (error) > - acpi_target_sleep_state = ACPI_STATE_S0; > + /* > + * For ACPI 3.0 or newer systems, we must run the preparation methods > + * after we put the devices into low power mode. > + */ > + if (acpi_gbl_FADT.header.revision >= 3) { Same here (so the comment is wrong). > + error = acpi_sleep_prepare(acpi_target_sleep_state); > + if (error) > + acpi_target_sleep_state = ACPI_STATE_S0; > + } > > return error; > } Thanks, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) 2007-12-25 13:36 ` Rafael J. Wysocki @ 2007-12-25 14:07 ` Rafael J. Wysocki 2007-12-25 13:52 ` Carlos Corbacho 0 siblings, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-25 14:07 UTC (permalink / raw) To: Carlos Corbacho Cc: Robert Hancock, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, linux-acpi On Tuesday, 25 of December 2007, Rafael J. Wysocki wrote: > On Tuesday, 25 of December 2007, Carlos Corbacho wrote: > > Adding Linux-ACPI to CC. > > > > On Tuesday 25 December 2007 00:03:25 Carlos Corbacho wrote: > > > According to the earlier versions of the ACPI spec, Linux is doing the > > > wrong thing - we should call _PTS() before we start powerding down devices, > > > or notifying device drivers to start suspending. > > > > > > So, my limited understanding of what we currently do for ACPI > > > suspend-to-RAM is: > > > > > > 1) Freeze processes/ devices > > > 2) Put all devices into low power mode > > > 3) Execute _PTS() > > > 4) Suspend system > > > > > > So the problem is - our current suspend order is fine for ACPI 3.0 and > > > above, but for pre-3.0 systems, this violates the older specs, where 2) and > > > 3) should be reversed. > > > > The following is a hack to illustrate what I'm getting at (this is > > tested on x86-64) (it's a hack since it does all the ACPI prepare bits > > during set_target() for the pre ACPI 3.0 systems, rather than prepare() - > > whether this can be cleaned up to move out just the _PTS() call, I don't > > know). > > > > It abuses suspend_ops->set_target(), but was the easiest way to quickly > > demonstrate this (since the kerneldoc for set_target() says it will always > > be executed before we suspend the devices). > > Please, don't do that. OK, sorry, the approach is generally reasonable, IMO, but it needs to be a bit more fine grained. I'll try to prepare some patches along these lines soon. Thanks, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) 2007-12-25 14:07 ` Rafael J. Wysocki @ 2007-12-25 13:52 ` Carlos Corbacho 0 siblings, 0 replies; 22+ messages in thread From: Carlos Corbacho @ 2007-12-25 13:52 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Robert Hancock, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, linux-acpi On Tuesday 25 December 2007 14:07:22 Rafael J. Wysocki wrote: > OK, sorry, the approach is generally reasonable, IMO, but it needs to be a > bit more fine grained. I know, hence this was marked as a hack and not signed off; it's just a demonstration of the general idea with code instead of words. > I'll try to prepare some patches along these lines soon. Much appreciated - I'm much happier with someone who's more familiar with this code than I working on it. -Carlos (Now going back to unwrapping Christmas presents...) -- E-Mail: carlos@strangeworlds.co.uk Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-25 0:03 ` Carlos Corbacho 2007-12-25 2:41 ` ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) Carlos Corbacho @ 2007-12-25 13:26 ` Rafael J. Wysocki 2007-12-25 13:12 ` Carlos Corbacho 1 sibling, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-25 13:26 UTC (permalink / raw) To: Carlos Corbacho, pm list Cc: Robert Hancock, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton On Tuesday, 25 of December 2007, Carlos Corbacho wrote: > On Monday 24 December 2007 22:40:46 Robert Hancock wrote: > > The ACPI spec has the following to say about the _PTS method: > > > > "The platform must not make any assumptions about the state of the > > machine when _PTS is called. For example, operation region accesses that > > require devices to be configured and enabled may not succeed, as these > > devices may be in a non-decoding state due to plug and play or power > > management operations." > > That is from the 3.0 spec though. And it looks like the definition changed > from pre-3.0 to 3.0 and above. > > This is what the 1.0B spec says (and this is also repeated verbatim in 2.0, > 2.0a, 2.0b, and 2.0c): > > "The _PTS control method is executed by the operating system at the beginning > of the sleep process for S1, S2, S3, S4, and for orderly S5 shutdown. The > sleeping state value (1, 2, 3, 4, or 5) is passed to the _PTS control method. > Before the OS notifies native device drivers and prepares the system software > for a system sleeping state, it executes this ACPI control method. Thus, this > control method can be executed a relatively long time before actually > entering the desired sleeping state. In addition, the OS can abort the > sleeping operation without notification to the ACPI driver, in which case > another _PTS would occur some time before the next attempt by the OS to enter > a sleeping state. The _PTS control method cannot modify the current > configuration or power state of any device in the system. For example, _PTS > would simply store the sleep type in the embedded controller in sequencing > the system into a sleep state when the SLP_EN bit is set." > > According to the earlier versions of the ACPI spec, Linux is doing the wrong > thing - we should call _PTS() before we start powerding down devices, or > notifying device drivers to start suspending. Well, citing from the ACPI 2.0 specification, section 9.1.6 Transitioning from the Working to the Sleeping State (which is what we're discussing here): 3. OSPM places all device drivers into their respective Dx state. If the device is enabled for wake, it enters the Dx state associated with the wake capability. If the device is not enabled to wake the system, it enters the D3 state. 4. OSPM executes the _PTS control method, passing an argument that indicates the desired sleeping state (1, 2, 3, or 4 representing S1, S2, S3, and S4). My opinion is that we should follow this part of the specification and so we do. > So, my limited understanding of what we currently do for ACPI suspend-to-RAM > is: > > 1) Freeze processes/ devices > 2) Put all devices into low power mode > 3) Execute _PTS() > 4) Suspend system > > So the problem is - our current suspend order is fine for ACPI 3.0 and above, > but for pre-3.0 systems, this violates the older specs, where 2) and 3) > should be reversed. > > > I would guess some BIOS writers failed to heed this.. > > No, it looks like the BIOS is obeying the older specs, and Linux is at fault > here for breaking the suspend logic of pre ACPI 3.0 systems. You're wrong, sorry. Greetings, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-25 13:26 ` x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM Rafael J. Wysocki @ 2007-12-25 13:12 ` Carlos Corbacho 2007-12-25 14:11 ` Rafael J. Wysocki 2007-12-25 17:17 ` Robert Hancock 0 siblings, 2 replies; 22+ messages in thread From: Carlos Corbacho @ 2007-12-25 13:12 UTC (permalink / raw) To: Rafael J. Wysocki Cc: pm list, Robert Hancock, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton On Tuesday 25 December 2007 13:26:12 Rafael J. Wysocki wrote: > Well, citing from the ACPI 2.0 specification, section 9.1.6 Transitioning > from the Working to the Sleeping State (which is what we're discussing > here): > > 3. OSPM places all device drivers into their respective Dx state. If the > device is enabled for wake, it enters the Dx state associated with the wake > capability. If the device is not enabled to wake the system, it enters the > D3 state. > 4. OSPM executes the _PTS control method, passing an argument that > indicates the desired sleeping state (1, 2, 3, or 4 representing S1, S2, > S3, and S4). > > My opinion is that we should follow this part of the specification and so > we do. This is that same section from ACPI 1.0B: 3. The OS executes the Prepare To Sleep (_PTS) control method, passing an argument that indicates the desired sleeping state (1, 2, 3, or 4 representing S1, S2, S3, and S4). 4. The OS places all device drivers into their respective Dx state. If the device is enabled for wakeup, it enters the Dx state associated with the wakeup capability. If the device is not enabled to wakeup the system, it enters the D3 state. The DSDTs in question also claim ACPI 1.0 compatiblity. > You're wrong, sorry. No, I'm not entirely wrong - read the 1.0 spec, and read section 7.3.2 of the ACPI 2.0 spec. * ACPI 1.0 is very clear - we are breaking the 1.0 spec * ACPI 2.0 is contradictory - section 7.3.2 repeats 1.0 ad verbatim (which is what I quote in reply to Robert Hancock), but as you point out, 9.3.2 says the opposite. So, 1.0 and 3.0 are very clear and rather different on this, and 2.0 is contradictory (and I presume this is one of the points ACPI 3.0 set out to clean up). I will rescind my point on ACPI 2.0 - I don't know what we should or shouldn't be doing there, the spec is unclear. But for ACPI 1.0, we are doing the wrong thing. -Carlos -- E-Mail: carlos@strangeworlds.co.uk Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-25 13:12 ` Carlos Corbacho @ 2007-12-25 14:11 ` Rafael J. Wysocki 2007-12-25 17:17 ` Robert Hancock 1 sibling, 0 replies; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-25 14:11 UTC (permalink / raw) To: Carlos Corbacho Cc: pm list, Robert Hancock, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton On Tuesday, 25 of December 2007, Carlos Corbacho wrote: > On Tuesday 25 December 2007 13:26:12 Rafael J. Wysocki wrote: > > Well, citing from the ACPI 2.0 specification, section 9.1.6 Transitioning > > from the Working to the Sleeping State (which is what we're discussing > > here): > > > > 3. OSPM places all device drivers into their respective Dx state. If the > > device is enabled for wake, it enters the Dx state associated with the wake > > capability. If the device is not enabled to wake the system, it enters the > > D3 state. > > 4. OSPM executes the _PTS control method, passing an argument that > > indicates the desired sleeping state (1, 2, 3, or 4 representing S1, S2, > > S3, and S4). > > > > My opinion is that we should follow this part of the specification and so > > we do. > > This is that same section from ACPI 1.0B: > > 3. The OS executes the Prepare To Sleep (_PTS) control method, passing an > argument that indicates the desired sleeping state (1, 2, 3, or 4 representing > S1, S2, S3, and S4). > > 4. The OS places all device drivers into their respective Dx state. If the > device is enabled for wakeup, it enters the Dx state associated with the > wakeup capability. If the device is not enabled to wakeup the system, it > enters the D3 state. > > The DSDTs in question also claim ACPI 1.0 compatiblity. > > > You're wrong, sorry. > > No, I'm not entirely wrong - read the 1.0 spec, and read section 7.3.2 of the > ACPI 2.0 spec. > > * ACPI 1.0 is very clear - we are breaking the 1.0 spec By following the 2.0 and later ones. Well ... > * ACPI 2.0 is contradictory - section 7.3.2 repeats 1.0 ad verbatim (which is > what I quote in reply to Robert Hancock), but as you point out, 9.3.2 says > the opposite. > > So, 1.0 and 3.0 are very clear and rather different on this, and 2.0 is > contradictory (and I presume this is one of the points ACPI 3.0 set out to > clean up). > > I will rescind my point on ACPI 2.0 - I don't know what we should or shouldn't > be doing there, the spec is unclear. I think we should follow section 9.3.2 that is explicit and has been reiterated in the 3.0 specification. > But for ACPI 1.0, we are doing the wrong thing. Yes, we are. OK, I think we can rearrange things to call _PTS early for ACPI 1.0x-compliant systems. Thanks, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-25 13:12 ` Carlos Corbacho 2007-12-25 14:11 ` Rafael J. Wysocki @ 2007-12-25 17:17 ` Robert Hancock 2007-12-25 18:26 ` Rafael J. Wysocki 1 sibling, 1 reply; 22+ messages in thread From: Robert Hancock @ 2007-12-25 17:17 UTC (permalink / raw) To: Carlos Corbacho Cc: Rafael J. Wysocki, pm list, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton Carlos Corbacho wrote: > On Tuesday 25 December 2007 13:26:12 Rafael J. Wysocki wrote: >> Well, citing from the ACPI 2.0 specification, section 9.1.6 Transitioning >> from the Working to the Sleeping State (which is what we're discussing >> here): >> >> 3. OSPM places all device drivers into their respective Dx state. If the >> device is enabled for wake, it enters the Dx state associated with the wake >> capability. If the device is not enabled to wake the system, it enters the >> D3 state. >> 4. OSPM executes the _PTS control method, passing an argument that >> indicates the desired sleeping state (1, 2, 3, or 4 representing S1, S2, >> S3, and S4). >> >> My opinion is that we should follow this part of the specification and so >> we do. > > This is that same section from ACPI 1.0B: > > 3. The OS executes the Prepare To Sleep (_PTS) control method, passing an > argument that indicates the desired sleeping state (1, 2, 3, or 4 representing > S1, S2, S3, and S4). > > 4. The OS places all device drivers into their respective Dx state. If the > device is enabled for wakeup, it enters the Dx state associated with the > wakeup capability. If the device is not enabled to wakeup the system, it > enters the D3 state. > > The DSDTs in question also claim ACPI 1.0 compatiblity. > >> You're wrong, sorry. > > No, I'm not entirely wrong - read the 1.0 spec, and read section 7.3.2 of the > ACPI 2.0 spec. > > * ACPI 1.0 is very clear - we are breaking the 1.0 spec > > * ACPI 2.0 is contradictory - section 7.3.2 repeats 1.0 ad verbatim (which is > what I quote in reply to Robert Hancock), but as you point out, 9.3.2 says > the opposite. > > So, 1.0 and 3.0 are very clear and rather different on this, and 2.0 is > contradictory (and I presume this is one of the points ACPI 3.0 set out to > clean up). > > I will rescind my point on ACPI 2.0 - I don't know what we should or shouldn't > be doing there, the spec is unclear. > > But for ACPI 1.0, we are doing the wrong thing. Correct me if I'm wrong, but it appears ACPI 1.0 wants _PTS called before any devices are suspended, ACPI 2.0 is contradictory, and ACPI 3.0 says that you can't assume anything about device state. My guess is that unless Windows has different behavior depending on ACPI version, it probably has called _PTS before suspending devices all along. Therefore it would likely be safest to emulate that behavior, no? -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-25 17:17 ` Robert Hancock @ 2007-12-25 18:26 ` Rafael J. Wysocki 2007-12-26 4:29 ` Linus Torvalds 0 siblings, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-25 18:26 UTC (permalink / raw) To: Robert Hancock Cc: Carlos Corbacho, pm list, Linus Torvalds, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton On Tuesday, 25 of December 2007, Robert Hancock wrote: > Carlos Corbacho wrote: > > On Tuesday 25 December 2007 13:26:12 Rafael J. Wysocki wrote: > >> Well, citing from the ACPI 2.0 specification, section 9.1.6 Transitioning > >> from the Working to the Sleeping State (which is what we're discussing > >> here): > >> > >> 3. OSPM places all device drivers into their respective Dx state. If the > >> device is enabled for wake, it enters the Dx state associated with the wake > >> capability. If the device is not enabled to wake the system, it enters the > >> D3 state. > >> 4. OSPM executes the _PTS control method, passing an argument that > >> indicates the desired sleeping state (1, 2, 3, or 4 representing S1, S2, > >> S3, and S4). > >> > >> My opinion is that we should follow this part of the specification and so > >> we do. > > > > This is that same section from ACPI 1.0B: > > > > 3. The OS executes the Prepare To Sleep (_PTS) control method, passing an > > argument that indicates the desired sleeping state (1, 2, 3, or 4 representing > > S1, S2, S3, and S4). > > > > 4. The OS places all device drivers into their respective Dx state. If the > > device is enabled for wakeup, it enters the Dx state associated with the > > wakeup capability. If the device is not enabled to wakeup the system, it > > enters the D3 state. > > > > The DSDTs in question also claim ACPI 1.0 compatiblity. > > > >> You're wrong, sorry. > > > > No, I'm not entirely wrong - read the 1.0 spec, and read section 7.3.2 of the > > ACPI 2.0 spec. > > > > * ACPI 1.0 is very clear - we are breaking the 1.0 spec > > > > * ACPI 2.0 is contradictory - section 7.3.2 repeats 1.0 ad verbatim (which is > > what I quote in reply to Robert Hancock), but as you point out, 9.3.2 says > > the opposite. > > > > So, 1.0 and 3.0 are very clear and rather different on this, and 2.0 is > > contradictory (and I presume this is one of the points ACPI 3.0 set out to > > clean up). > > > > I will rescind my point on ACPI 2.0 - I don't know what we should or shouldn't > > be doing there, the spec is unclear. > > > > But for ACPI 1.0, we are doing the wrong thing. > > Correct me if I'm wrong, but it appears ACPI 1.0 wants _PTS called > before any devices are suspended, ACPI 2.0 is contradictory, and ACPI > 3.0 says that you can't assume anything about device state. My guess is > that unless Windows has different behavior depending on ACPI version, it > probably has called _PTS before suspending devices all along. Therefore > it would likely be safest to emulate that behavior, no? Well, I don't think so. In fact ACPI 3.0 repeats the 2.0 wording in section 9.1.6 (so the current requirement seems to be to put devices into low power states before calling _PTS) and I _guess_ there was a change in the default behavior of Windows that caused the specification to be modified (I'd bet that was between 2000 and XP or something like this). IMO, we should check which version of the specification we're supposed to follow, on the basis of FADT contents, for example, and follow this one. Thanks, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-25 18:26 ` Rafael J. Wysocki @ 2007-12-26 4:29 ` Linus Torvalds 2007-12-26 5:13 ` Robert Hancock 2007-12-26 7:23 ` Avi Kivity 0 siblings, 2 replies; 22+ messages in thread From: Linus Torvalds @ 2007-12-26 4:29 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Robert Hancock, Carlos Corbacho, pm list, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton On Tue, 25 Dec 2007, Rafael J. Wysocki wrote: > > > > Correct me if I'm wrong, but it appears ACPI 1.0 wants _PTS called > > before any devices are suspended, ACPI 2.0 is contradictory, and ACPI > > 3.0 says that you can't assume anything about device state. My guess is > > that unless Windows has different behavior depending on ACPI version, it > > probably has called _PTS before suspending devices all along. Therefore > > it would likely be safest to emulate that behavior, no? > > Well, I don't think so. It would *definitely* always be safest to emulate what Windows does. > In fact ACPI 3.0 repeats the 2.0 wording in section 9.1.6 (so the current > requirement seems to be to put devices into low power states before calling > _PTS) and I _guess_ there was a change in the default behavior of Windows that > caused the specification to be modified (I'd bet that was between 2000 and XP > or something like this). You seem to put a lot of trust in a piece of documentation. Do you realize how those pieces of paper are written? They are written by people who have absolutely *nothing* to do with the actual implementation, and whose job it is to write documentation. And while the people who actually do the programming etc are supposed to help them, the two parties generally detest each other. Technical writers hate the "real engineers" for not helping them, and the "real engineers" tend to dislike having to be pestered to explain their stuff and have to read through some document that isn't meant for them, but that they need to sign off on. In other words: please do *not* expect that the documentation actually matches reality. You seem to think that the documentation came first and/or is quite accurate. That's not at all likely to be true. > IMO, we should check which version of the specification we're supposed to > follow, on the basis of FADT contents, for example, and follow this one. No, we should try to figure out what Windows does. *If* windows checks the version, we should do that too. But we should absolutely *not* just assume that the documentation is an accurate picture of reality. Does anybody know how we could find out? Linus ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-26 4:29 ` Linus Torvalds @ 2007-12-26 5:13 ` Robert Hancock 2007-12-26 7:23 ` Avi Kivity 1 sibling, 0 replies; 22+ messages in thread From: Robert Hancock @ 2007-12-26 5:13 UTC (permalink / raw) To: Linus Torvalds Cc: Rafael J. Wysocki, Carlos Corbacho, pm list, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton Linus Torvalds wrote: >> IMO, we should check which version of the specification we're supposed to >> follow, on the basis of FADT contents, for example, and follow this one. > > No, we should try to figure out what Windows does. *If* windows checks the > version, we should do that too. But we should absolutely *not* just assume > that the documentation is an accurate picture of reality. > > Does anybody know how we could find out? > > Linus > Well, it seems that if one had a checked (debug) build of Windows (or at least the acpi.sys driver) installed, as well as a copy of the Microsoft ASL compiler, they could compile and temporarily override the DSDT with a hacked one that would output what the device power states were in some fashion (maybe through the kernel debugger). Some info about this here: http://download.microsoft.com/download/1/8/f/18f8cee2-0b64-41f2-893d-a6f2295b40c8/TW04015_WINHEC2004.ppt I suspect that might require more Windows hacking skill and/or motivation than one might be likely to find on this list, though :-) -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM 2007-12-26 4:29 ` Linus Torvalds 2007-12-26 5:13 ` Robert Hancock @ 2007-12-26 7:23 ` Avi Kivity 1 sibling, 0 replies; 22+ messages in thread From: Avi Kivity @ 2007-12-26 7:23 UTC (permalink / raw) To: Linus Torvalds Cc: Rafael J. Wysocki, Robert Hancock, Carlos Corbacho, pm list, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton Linus Torvalds wrote: > >> IMO, we should check which version of the specification we're supposed to >> follow, on the basis of FADT contents, for example, and follow this one. >> > > No, we should try to figure out what Windows does. *If* windows checks the > version, we should do that too. But we should absolutely *not* just assume > that the documentation is an accurate picture of reality. > > Does anybody know how we could find out? > > Run it in a virtual machine, with the ACPI methods of interest wired to output to some port, and log that I/O port in the monitor/emulator. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <fa.WvaVh83zJOh/eZUrjQOZy4J8JFk@ifi.uio.no>]
[parent not found: <fa.VsyhBr+FAHB0bTb9poSZS80xN/0@ifi.uio.no>]
[parent not found: <fa.XycBwhGuyvtVl/QW5HONqLwOags@ifi.uio.no>]
* Re: Suspend code ordering (again) [not found] ` <fa.XycBwhGuyvtVl/QW5HONqLwOags@ifi.uio.no> @ 2007-12-27 18:07 ` Robert Hancock 2007-12-27 20:00 ` Rafael J. Wysocki 0 siblings, 1 reply; 22+ messages in thread From: Robert Hancock @ 2007-12-27 18:07 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Linus Torvalds, Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List Rafael J. Wysocki wrote: > On Wednesday, 26 of December 2007, Linus Torvalds wrote: >> On Tue, 25 Dec 2007, Rafael J. Wysocki wrote: >>> the ACPI specification between versions 1.0x and 2.0. Namely, while ACPI >>> 2.0 and later wants us to put devices into low power states before calling >>> _PTS, ACPI 1.0x wants us to do that after calling _PTS. Since we're following >>> the 2.0 and later specifications right now, we're not doing the right thing for >>> the (strictly) ACPI 1.0x-compliant systems. >>> >>> We ought to be able to fix things on the high level, by calling _PTS earlier on >>> systems that claim to be ACPI 1.0x-compliant. That will require us to modify >>> the generic susped code quite a bit and will need to be tested for some time. >> That's insane. Are you really saying that ACPI wants totally different >> orderings for different versions of the spec? > > Yes, I am. > >> And does Windows really do that? > > I don't know. > >> Please don't make lots of modifications to the generic suspend code. The >> only thing that is worth doing is to just have a firmware callback before >> the "device_suspend()" thing (and then on a ACPI-1.0 system, call _PTS >> *there*), and on an ACPI-2.0 system, call _PTS *after* device_suspend(). > > Yes, that's what I'm going to do, but I need to untangle some ACPI code for > this purpose. > >> Still, the fact is, some (most, I think) drivers *should* put themselves >> into D3 only in "late_suspend()", so if ACPI-2.0 really expects _PTS to be >> called after that, we're just screwed. > > Well, section 9.1.6 of ACPI 2.0 specifies the suspend ordering directly and > says exactly that _PTS is to be executed after putting devices into respective > D states. I would not take those sections as gospel, they're really an example only. It's quite possible that Windows does not follow that ordering. Also, as was pointed out, pre-Vista versions of Windows follow ACPI 1.0 and Vista follows 3.0, so 2.0 doesn't really matter since BIOS people won't test against it. 1.0 specifies that _PTS is to be called before suspending devices and 3.0 says that the AML must not depend on any specific device power state, so in both cases it should be safe to call _PTS before suspending, no? -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) 2007-12-27 18:07 ` Suspend code ordering (again) Robert Hancock @ 2007-12-27 20:00 ` Rafael J. Wysocki 2007-12-28 0:25 ` Robert Hancock 0 siblings, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-27 20:00 UTC (permalink / raw) To: Robert Hancock Cc: Linus Torvalds, Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List On Thursday, 27 of December 2007, Robert Hancock wrote: > Rafael J. Wysocki wrote: > > On Wednesday, 26 of December 2007, Linus Torvalds wrote: > >> On Tue, 25 Dec 2007, Rafael J. Wysocki wrote: > >>> the ACPI specification between versions 1.0x and 2.0. Namely, while ACPI > >>> 2.0 and later wants us to put devices into low power states before calling > >>> _PTS, ACPI 1.0x wants us to do that after calling _PTS. Since we're following > >>> the 2.0 and later specifications right now, we're not doing the right thing for > >>> the (strictly) ACPI 1.0x-compliant systems. > >>> > >>> We ought to be able to fix things on the high level, by calling _PTS earlier on > >>> systems that claim to be ACPI 1.0x-compliant. That will require us to modify > >>> the generic susped code quite a bit and will need to be tested for some time. > >> That's insane. Are you really saying that ACPI wants totally different > >> orderings for different versions of the spec? > > > > Yes, I am. > > > >> And does Windows really do that? > > > > I don't know. > > > >> Please don't make lots of modifications to the generic suspend code. The > >> only thing that is worth doing is to just have a firmware callback before > >> the "device_suspend()" thing (and then on a ACPI-1.0 system, call _PTS > >> *there*), and on an ACPI-2.0 system, call _PTS *after* device_suspend(). > > > > Yes, that's what I'm going to do, but I need to untangle some ACPI code for > > this purpose. > > > >> Still, the fact is, some (most, I think) drivers *should* put themselves > >> into D3 only in "late_suspend()", so if ACPI-2.0 really expects _PTS to be > >> called after that, we're just screwed. > > > > Well, section 9.1.6 of ACPI 2.0 specifies the suspend ordering directly and > > says exactly that _PTS is to be executed after putting devices into respective > > D states. > > I would not take those sections as gospel, they're really an example > only. It's quite possible that Windows does not follow that ordering. > > Also, as was pointed out, pre-Vista versions of Windows follow ACPI 1.0 > and Vista follows 3.0, so 2.0 doesn't really matter since BIOS people > won't test against it. 1.0 specifies that _PTS is to be called before > suspending devices and 3.0 says that the AML must not depend on any > specific device power state, so in both cases it should be safe to call > _PTS before suspending, no? Well, IMO, if we take one option only (whichever that is) and there are systems that follow the other one, they will likely break. Apart from this, there are BIOSes that openly claim ACPI 2.0 support (for example, the one in my HP nx6325 does that) and they may actually prefer the post-ACPI-1.0 ordering even if they work with the pre-ACPI-2.0 one. Greetings, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) 2007-12-27 20:00 ` Rafael J. Wysocki @ 2007-12-28 0:25 ` Robert Hancock 2007-12-28 5:41 ` Linus Torvalds 2008-01-08 3:03 ` Shaohua Li 0 siblings, 2 replies; 22+ messages in thread From: Robert Hancock @ 2007-12-28 0:25 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Linus Torvalds, Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List Rafael J. Wysocki wrote: >> Also, as was pointed out, pre-Vista versions of Windows follow ACPI 1.0 >> and Vista follows 3.0, so 2.0 doesn't really matter since BIOS people >> won't test against it. 1.0 specifies that _PTS is to be called before >> suspending devices and 3.0 says that the AML must not depend on any >> specific device power state, so in both cases it should be safe to call >> _PTS before suspending, no? > > Well, IMO, if we take one option only (whichever that is) and there are systems > that follow the other one, they will likely break. > > Apart from this, there are BIOSes that openly claim ACPI 2.0 support (for > example, the one in my HP nx6325 does that) and they may actually prefer the > post-ACPI-1.0 ordering even if they work with the pre-ACPI-2.0 one. I doubt they would prefer the later ordering in any way that matters, if the Windows version they were designed for uses the earlier ordering. It would be best if somebody could manage to find out what ordering Windows XP (and Windows Vista, for good measure) actually use, then we could just use that. Virtual machine trickery might be an option - the only complication being that it'll be using the DSDT for the fake machine and not the real one.. -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) 2007-12-28 0:25 ` Robert Hancock @ 2007-12-28 5:41 ` Linus Torvalds 2008-01-08 3:03 ` Shaohua Li 1 sibling, 0 replies; 22+ messages in thread From: Linus Torvalds @ 2007-12-28 5:41 UTC (permalink / raw) To: Robert Hancock Cc: Rafael J. Wysocki, Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List On Thu, 27 Dec 2007, Robert Hancock wrote: > > I doubt they would prefer the later ordering in any way that matters, if the > Windows version they were designed for uses the earlier ordering. Well, I wouldn't say it's abotu "preferring" one over the other. It's very possible that the BIOS writers were *intending* to prefer ACPI 2.0, and it may even be likely that they thought that they wrote it that way, but the real issue is that it has apparently never ever been *tested* that way. So yes, maybe the vendors actually thought they were a good ACPI-2.0 implementation, but if Windows doesn't do the ordering that the 2.0 spec expects, then that is pretty much just a theoretical thing. But yeah, it would be really nice to have this verified some way. Somebody must already know (whether it's a VM person or a BIOS writer, and whether they'd tell us, is obviously another issue). Linus ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) 2007-12-28 0:25 ` Robert Hancock 2007-12-28 5:41 ` Linus Torvalds @ 2008-01-08 3:03 ` Shaohua Li 1 sibling, 0 replies; 22+ messages in thread From: Shaohua Li @ 2008-01-08 3:03 UTC (permalink / raw) To: Robert Hancock Cc: Rafael J. Wysocki, Linus Torvalds, Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List [-- Attachment #1: Type: text/plain, Size: 2169 bytes --] On Fri, 2007-12-28 at 08:25 +0800, Robert Hancock wrote: > Rafael J. Wysocki wrote: > >> Also, as was pointed out, pre-Vista versions of Windows follow ACPI > 1.0 > >> and Vista follows 3.0, so 2.0 doesn't really matter since BIOS > people > >> won't test against it. 1.0 specifies that _PTS is to be called > before > >> suspending devices and 3.0 says that the AML must not depend on > any > >> specific device power state, so in both cases it should be safe to > call > >> _PTS before suspending, no? > > > > Well, IMO, if we take one option only (whichever that is) and there > are systems > > that follow the other one, they will likely break. > > > > Apart from this, there are BIOSes that openly claim ACPI 2.0 support > (for > > example, the one in my HP nx6325 does that) and they may actually > prefer the > > post-ACPI-1.0 ordering even if they work with the pre-ACPI-2.0 one. > > I doubt they would prefer the later ordering in any way that matters, > if > the Windows version they were designed for uses the earlier ordering. > > It would be best if somebody could manage to find out what ordering > Windows XP (and Windows Vista, for good measure) actually use, then > we > could just use that. Virtual machine trickery might be an option - > the > only complication being that it'll be using the DSDT for the fake > machine and not the real one.. I modified Qemu and use it to observe how winxp does suspend/resume. So far, I just get some data for s4 suspend. I did have some interesting finding. 1. xp seems not save pci config space. Or it appears just save config PCICMD. 2. the order winxp does looks like a. save config (PCICMD), put device to D3 (it appears only for ne2000 NIC) b. _PTS c. write mem to disk d. write ACPI PM1_control register, then system shutdown 3. xp write ACPI GBL_EN bit just after _PTS (for both S4/S5), don't know why Attached is the log winxp does s4 suspend, it only includes pci config read/write and ACPI register read/write. I managed to make xp enter S3, but fails, so can't get the data for S3 so far. Anybody has other ideas which need to verify winxp, pls let me know. Thanks, Shaohua [-- Attachment #2: xplog --] [-- Type: text/plain, Size: 2050 bytes --] PCI NE2000 read addr 4, val 7 PCI NE2000 read addr 50, val 1 PCI NE2000 read addr 52, val c9c2 PCI NE2000 read addr 54, val 8000 PCI NE2000 write addr 54, val 8003 PCI NE2000 read addr 54, val 8003 PCI NE2000 read addr 4, val 7 PCI NE2000 write addr 4, val 0 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 0, val 71138086 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 64, val 8000000 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 0, val 71138086 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 64, val 8000000 PCI Cirrus VGA read addr 4, val 7 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PIIX3 IDE read addr 4, val 7 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 0, val 71138086 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 5c, val 90000000 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 0, val 71138086 PCI PIIX3 read addr 0, val 70008086 PCI PIIX3 read addr 4, val 7 PCI PIIX3 read addr 8, val 6010000 PCI PIIX3 read addr c, val 800000 PCI PM read addr 5c, val 90000000 ACPI: DBG: 0x00000002 PM readw port=0x0002 val=0xb002 PM writew port=0x0002 val=0x0020 PM readw port=0x0002 val=0xb002 PM readw port=0x0004 val=0xb004 PM readw port=0x0004 val=0xb004 PM writew port=0x0004 val=0x2801 type 2 ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <200712231419.40207.carlos@strangeworlds.co.uk>]
* Suspend code ordering (again) (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) @ 2007-12-25 16:13 ` Rafael J. Wysocki 2007-12-26 4:11 ` Linus Torvalds 0 siblings, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-25 16:13 UTC (permalink / raw) To: Linus Torvalds Cc: Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List On Monday, 24 of December 2007, Linus Torvalds wrote: > > On Mon, 24 Dec 2007, Rafael J. Wysocki wrote: > > > > Well, having considered that for a longer while, I think the AML code is > > referring to a device that we have suspended already, and since it's in a low > > power state, it just can't handle the reference. > > > > If that is the case, we'll have to find the device (that should be possible > > using some code instrumentation) and move the suspending of it into the late > > stage. > > Yes. > > In general, I'm personally of the opinion that drivers should *not* > actually go into D3 at all in the regular "->suspend()" phase. It should > be done in ->suspend_late. The early suspend is for saving state and > returning errors. > > Sadly, we've made it a bit too inconvenient to actually do that. Almost > all drivers only do the "->suspend" thing, and the default PCI behaviour > doesn't help us in any way either. > > Anyway, I wonder if a patch like this could make it easier for driver > writers to handle things. It basically does: > > - if you don't have a regular "suspend()" function, we'll just save state > at suspend time. > > - if you don't have a "suspend_late()" function, we'll look at the > current state, and if it's still in PCI_D0, we'll suspend to PCI_D3hot > if it's a regular PCI device (ie not a bridge or something else odd). > > - then, at resume time, by default we don't do anything in the early > resume, but in the late resume we'll undo everything, of course. > > Anyway, with this, most drivers could just remove the > "pci_set_power_state()" call *entirely*, and let the default > suspend_late action power the device down. But if you want to override > that default action, you can either: > > - set the power state in your own ->suspend() routine (either by using > pci_set_power_state(), or by just explicitly setting the state to > unknown with "dev->current_state = PCI_UNKNOWN" > > - have a "late_suspend()" action, which obviously will override the > default action entirely. > > Hmm? Well, as Carlos correctly noticed, the problem is related to the change in the ACPI specification between versions 1.0x and 2.0. Namely, while ACPI 2.0 and later wants us to put devices into low power states before calling _PTS, ACPI 1.0x wants us to do that after calling _PTS. Since we're following the 2.0 and later specifications right now, we're not doing the right thing for the (strictly) ACPI 1.0x-compliant systems. We ought to be able to fix things on the high level, by calling _PTS earlier on systems that claim to be ACPI 1.0x-compliant. That will require us to modify the generic susped code quite a bit and will need to be tested for some time. I'm going to prepare patches to implement this idea targeted for the 2.6.25 time frame. Greetings, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) 2007-12-25 16:13 ` Suspend code ordering (again) (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) Rafael J. Wysocki @ 2007-12-26 4:11 ` Linus Torvalds 2007-12-26 15:07 ` Rafael J. Wysocki 0 siblings, 1 reply; 22+ messages in thread From: Linus Torvalds @ 2007-12-26 4:11 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List On Tue, 25 Dec 2007, Rafael J. Wysocki wrote: > > the ACPI specification between versions 1.0x and 2.0. Namely, while ACPI > 2.0 and later wants us to put devices into low power states before calling > _PTS, ACPI 1.0x wants us to do that after calling _PTS. Since we're following > the 2.0 and later specifications right now, we're not doing the right thing for > the (strictly) ACPI 1.0x-compliant systems. > > We ought to be able to fix things on the high level, by calling _PTS earlier on > systems that claim to be ACPI 1.0x-compliant. That will require us to modify > the generic susped code quite a bit and will need to be tested for some time. That's insane. Are you really saying that ACPI wants totally different orderings for different versions of the spec? And does Windows really do that? Please don't make lots of modifications to the generic suspend code. The only thing that is worth doing is to just have a firmware callback before the "device_suspend()" thing (and then on a ACPI-1.0 system, call _PTS *there*), and on an ACPI-2.0 system, call _PTS *after* device_suspend(). Still, the fact is, some (most, I think) drivers *should* put themselves into D3 only in "late_suspend()", so if ACPI-2.0 really expects _PTS to be called after that, we're just screwed. That's when the system is really down, interrupts disabled etc, we don't want to call anything but the final ACPI "turn us off" stuff there! Linus ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) 2007-12-26 4:11 ` Linus Torvalds @ 2007-12-26 15:07 ` Rafael J. Wysocki 2007-12-26 15:24 ` Suspend code ordering (again) Alexey Starikovskiy 0 siblings, 1 reply; 22+ messages in thread From: Rafael J. Wysocki @ 2007-12-26 15:07 UTC (permalink / raw) To: Linus Torvalds Cc: Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List On Wednesday, 26 of December 2007, Linus Torvalds wrote: > > On Tue, 25 Dec 2007, Rafael J. Wysocki wrote: > > > > the ACPI specification between versions 1.0x and 2.0. Namely, while ACPI > > 2.0 and later wants us to put devices into low power states before calling > > _PTS, ACPI 1.0x wants us to do that after calling _PTS. Since we're following > > the 2.0 and later specifications right now, we're not doing the right thing for > > the (strictly) ACPI 1.0x-compliant systems. > > > > We ought to be able to fix things on the high level, by calling _PTS earlier on > > systems that claim to be ACPI 1.0x-compliant. That will require us to modify > > the generic susped code quite a bit and will need to be tested for some time. > > That's insane. Are you really saying that ACPI wants totally different > orderings for different versions of the spec? Yes, I am. > And does Windows really do that? I don't know. > Please don't make lots of modifications to the generic suspend code. The > only thing that is worth doing is to just have a firmware callback before > the "device_suspend()" thing (and then on a ACPI-1.0 system, call _PTS > *there*), and on an ACPI-2.0 system, call _PTS *after* device_suspend(). Yes, that's what I'm going to do, but I need to untangle some ACPI code for this purpose. > Still, the fact is, some (most, I think) drivers *should* put themselves > into D3 only in "late_suspend()", so if ACPI-2.0 really expects _PTS to be > called after that, we're just screwed. Well, section 9.1.6 of ACPI 2.0 specifies the suspend ordering directly and says exactly that _PTS is to be executed after putting devices into respective D states. > That's when the system is really down, interrupts disabled etc, we don't want > to call anything but the final ACPI "turn us off" stuff there! OTOH, we ought to be able to put devices into low power states at any time, for example when they are not used, without any problems and having to put them back into D0 just in order to execute _PTS doesn't seem very logical to me. ;-) Greetings, Rafael ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) 2007-12-26 15:07 ` Rafael J. Wysocki @ 2007-12-26 15:24 ` Alexey Starikovskiy 2007-12-26 17:50 ` H. Peter Anvin 0 siblings, 1 reply; 22+ messages in thread From: Alexey Starikovskiy @ 2007-12-26 15:24 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Linus Torvalds, Carlos Corbacho, H. Peter Anvin, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List Rafael J. Wysocki wrote: > On Wednesday, 26 of December 2007, Linus Torvalds wrote: > >> On Tue, 25 Dec 2007, Rafael J. Wysocki wrote: >> >>> the ACPI specification between versions 1.0x and 2.0. Namely, while ACPI >>> 2.0 and later wants us to put devices into low power states before calling >>> _PTS, ACPI 1.0x wants us to do that after calling _PTS. Since we're following >>> the 2.0 and later specifications right now, we're not doing the right thing for >>> the (strictly) ACPI 1.0x-compliant systems. >>> >>> We ought to be able to fix things on the high level, by calling _PTS earlier on >>> systems that claim to be ACPI 1.0x-compliant. That will require us to modify >>> the generic susped code quite a bit and will need to be tested for some time. >>> >> That's insane. Are you really saying that ACPI wants totally different >> orderings for different versions of the spec? >> > > Yes, I am. > > >> And does Windows really do that? >> > > I don't know. > Windows was compliant only with 1.x spec until Vista. With Vista claims are 3.x compliance. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Suspend code ordering (again) 2007-12-26 15:24 ` Suspend code ordering (again) Alexey Starikovskiy @ 2007-12-26 17:50 ` H. Peter Anvin 0 siblings, 0 replies; 22+ messages in thread From: H. Peter Anvin @ 2007-12-26 17:50 UTC (permalink / raw) To: Alexey Starikovskiy Cc: Rafael J. Wysocki, Linus Torvalds, Carlos Corbacho, Linux Kernel Mailing List, Greg KH, Ingo Molnar, Thomas Gleixner, Len Brown, Andrew Morton, pm list, ACPI Devel Maling List Alexey Starikovskiy wrote: >> >> I don't know. >> > Windows was compliant only with 1.x spec until Vista. > With Vista claims are 3.x compliance. > In other words, the 1.x spec is the only thing that matters, at least in the short term (*noone* is giving up XP compatibility at this point.) -hpa ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2008-01-08 3:02 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <fa.Tr7qmPdet0rF2FSRX/94s2UEMSE@ifi.uio.no>
[not found] ` <fa.n/XQFa64Zg8snHoyB/rrKzCvAL0@ifi.uio.no>
2007-12-24 16:59 ` [Bug 9528] x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM Robert Hancock
[not found] ` <fa.5MPS0t6OtOOALbc90ywKDrtik+4@ifi.uio.no>
[not found] ` <fa.zg2cR0292Evub+o7LgQUdg4A7ZM@ifi.uio.no>
[not found] ` <fa.ZBHAMdWAEaW7Flaz8/Gc8PLZUNg@ifi.uio.no>
2007-12-24 22:40 ` Robert Hancock
2007-12-25 0:03 ` Carlos Corbacho
2007-12-25 2:41 ` ACPI: _PTS ordering needs fixing for pre ACPI 3.0 systems (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) Carlos Corbacho
2007-12-25 13:36 ` Rafael J. Wysocki
2007-12-25 14:07 ` Rafael J. Wysocki
2007-12-25 13:52 ` Carlos Corbacho
2007-12-25 13:26 ` x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM Rafael J. Wysocki
2007-12-25 13:12 ` Carlos Corbacho
2007-12-25 14:11 ` Rafael J. Wysocki
2007-12-25 17:17 ` Robert Hancock
2007-12-25 18:26 ` Rafael J. Wysocki
2007-12-26 4:29 ` Linus Torvalds
2007-12-26 5:13 ` Robert Hancock
2007-12-26 7:23 ` Avi Kivity
[not found] ` <fa.WvaVh83zJOh/eZUrjQOZy4J8JFk@ifi.uio.no>
[not found] ` <fa.VsyhBr+FAHB0bTb9poSZS80xN/0@ifi.uio.no>
[not found] ` <fa.XycBwhGuyvtVl/QW5HONqLwOags@ifi.uio.no>
2007-12-27 18:07 ` Suspend code ordering (again) Robert Hancock
2007-12-27 20:00 ` Rafael J. Wysocki
2007-12-28 0:25 ` Robert Hancock
2007-12-28 5:41 ` Linus Torvalds
2008-01-08 3:03 ` Shaohua Li
[not found] <200712231419.40207.carlos@strangeworlds.co.uk>
2007-12-25 16:13 ` Suspend code ordering (again) (was: Re: x86: Increase PCIBIOS_MIN_IO to 0x1500 to fix nForce 4 suspend-to-RAM) Rafael J. Wysocki
2007-12-26 4:11 ` Linus Torvalds
2007-12-26 15:07 ` Rafael J. Wysocki
2007-12-26 15:24 ` Suspend code ordering (again) Alexey Starikovskiy
2007-12-26 17:50 ` H. Peter Anvin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox