|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86/S3: Clarify and improve the behaviour of do_suspend_lowlevel()
commit 62874a4df3b9653e862fe36ad2779b60234ea7b9
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Dec 13 17:36:09 2019 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Dec 18 11:42:54 2019 +0000
x86/S3: Clarify and improve the behaviour of do_suspend_lowlevel()
do_suspend_lowlevel() behaves as a function call, even when the trampoline
jumps back into the middle of it. Discuss this property, while renaming the
far-too-generic __ret_point to s3_resume.
Optimise the calling logic for acpi_enter_sleep_state(). $3 doesn't
require a
64bit write, and the function isn't variadic so doesn't need to specify zero
FPU registers in use.
In the case of an acpi_enter_sleep_state() error, we didn't actually lose
state so don't need to restore it. Jump straight to the end.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/acpi/wakeup_prot.S | 23 ++++++++++++++++-------
xen/arch/x86/boot/wakeup.S | 2 +-
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index 74261cb4f1..8c525a802b 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -42,15 +42,23 @@ ENTRY(do_suspend_lowlevel)
call save_rest_processor_state
- mov $3, %rdi
- xor %eax, %eax
-
/* enter sleep state physically */
+ mov $3, %edi
call acpi_enter_sleep_state
- jmp __ret_point
-
-ENTRY(__ret_point)
+ /* It seems we didn't suspend. Get out of here. */
+ jmp .Lsuspend_err
+
+ /*
+ * do_suspend_lowlevel() is arranged to behave as a regular function
+ * call, even if hardware actually goes to sleep in the middle.
+ *
+ * The trampoline re-intercepts here. State is:
+ * - 64bit mode
+ *
+ * Everything else, including the stack, needs restoring.
+ */
+ENTRY(s3_resume)
lgdt boot_gdtr(%rip)
/* mmu_cr4_features contains latest cr4 setting */
@@ -92,7 +100,8 @@ ENTRY(__ret_point)
LOAD_GREG(13)
LOAD_GREG(14)
LOAD_GREG(15)
- ret
+.Lsuspend_err:
+ ret
.data
.align 16
diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index fc47721f43..c17d613b61 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -151,7 +151,7 @@ wakeup_32:
.code64
wakeup_64:
/* Jump to high mappings and the higher-level wakeup code. */
- movabs $__ret_point, %rbx
+ movabs $s3_resume, %rbx
jmp *%rbx
bogus_saved_magic:
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |