ACPI: Correctly recover from a failed S3 attempt
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
Signature · 4 lines
Jordan Crouse Senior Linux Engineer Advanced Micro Devices, Inc. <www.amd.com/embeddedprocessors>
[PATCH] ACPI: Correctly recover from a failed S3 attempt
From: William Morrrow <[email protected]>
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.
---
arch/i386/kernel/acpi/wakeup.S | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/i386/kernel/acpi/wakeup.S +4 -1
@@ -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
Hi!
Quoted 4 lines
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.
Quoted 8 lines
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?
arch/i386/kernel/acpi/wakeup.S ENTRY(do_suspend_lowlevel) · line 299
Quoted 12 lines
arch/i386/kernel/acpi/wakeup.S +4
-1@@ -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?
Quoted 2 lines
arch/i386/kernel/acpi/wakeup.S +0
-0ret_point: call restore_registers
Signature · 1 line
Thanks for all the (sleeping) penguins.