linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH] ACPI:  Correctly recover from a failed S3 attempt
@ 2006-08-08 20:04 Jordan Crouse
  2006-08-17 15:48 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Jordan Crouse @ 2006-08-08 20:04 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel, william.morrow

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

We have a poorly behaving BIOS that simply returns from its suspend
procedure, rather then jumping to the restart routine indicated by
the FACS.  This appears to Linux as a failed S3 attempt.

This would normally succeed, but the sysenter msrs are not
restored and the restart fails.  It is not clear if this is the only
omission, but if the sysenter msrs are manually entered in the debugger, 
the OS resumes.

The attached patch would invoke the register restore function on failure.
This has absolutely no effect on correct systems, and, "does the right thing"
for failed or stupid BIOSes, at least as far as I am concerned.

Comments?
Jordan

-- 
Jordan Crouse
Senior Linux Engineer
Advanced Micro Devices, Inc.
<www.amd.com/embeddedprocessors>

[-- Attachment #2: acpi-s3-fix.patch --]
[-- Type: text/plain, Size: 1137 bytes --]

[PATCH] ACPI:  Correctly recover from a failed S3 attempt

From: William Morrrow <william.morrow@amd.com>

This was discovered on a broken BIOS that simply returned from its 
suspend procedure, appearing to the OS as a failed S3 attempt. 

It is possible to invoke the protected mode register restore routine (which
would normally restore the sysenter registers) when the bios returns from S3. 
This has no effect on a correctly running system and repairs the damage
from broken BIOS.

Signed-off-by: William Morrow <william.morrow@amd.com>
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 arch/i386/kernel/acpi/wakeup.S |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S
index 9f408ee..b781b38 100644
--- a/arch/i386/kernel/acpi/wakeup.S
+++ b/arch/i386/kernel/acpi/wakeup.S
@@ -292,7 +292,10 @@ ENTRY(do_suspend_lowlevel)
 	pushl	$3
 	call	acpi_enter_sleep_state
 	addl	$4, %esp
-	ret
+
+#	In case of S3 failure, we'll emerge here.  Jump
+# 	to ret_point to recover
+	jmp	ret_point
 	.p2align 4,,7
 ret_point:
 	call	restore_registers

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

* Re: [RFC/PATCH] ACPI:  Correctly recover from a failed S3 attempt
  2006-08-08 20:04 [RFC/PATCH] ACPI: Correctly recover from a failed S3 attempt Jordan Crouse
@ 2006-08-17 15:48 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2006-08-17 15:48 UTC (permalink / raw)
  To: Jordan Crouse; +Cc: linux-acpi, linux-kernel, william.morrow

Hi!

> We have a poorly behaving BIOS that simply returns from its suspend
> procedure, rather then jumping to the restart routine indicated by
> the FACS.  This appears to Linux as a failed S3 attempt.
> 
> This would normally succeed, but the sysenter msrs are not
> restored and the restart fails.  It is not clear if this is the only
> omission, but if the sysenter msrs are manually entered in the debugger, 
> the OS resumes.
> 
> The attached patch would invoke the register restore function on failure.
> This has absolutely no effect on correct systems, and, "does the right thing"
> for failed or stupid BIOSes, at least as far as I am concerned.

Can we get fixed bios, too?

What machines are affected?

> --- a/arch/i386/kernel/acpi/wakeup.S
> +++ b/arch/i386/kernel/acpi/wakeup.S
> @@ -292,7 +292,10 @@ ENTRY(do_suspend_lowlevel)
>  	pushl	$3
>  	call	acpi_enter_sleep_state
>  	addl	$4, %esp
> -	ret
> +
> +#	In case of S3 failure, we'll emerge here.  Jump
> +# 	to ret_point to recover
> +	jmp	ret_point
>  	.p2align 4,,7

%esp manipulation is now unneccessary?

Can we somehow propagate the error condition?

Why jmp when ret_point is next instruction?

>  ret_point:
>  	call	restore_registers


-- 
Thanks for all the (sleeping) penguins.

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

end of thread, other threads:[~2006-08-17 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-08 20:04 [RFC/PATCH] ACPI: Correctly recover from a failed S3 attempt Jordan Crouse
2006-08-17 15:48 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).