[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/6] x86/suspend: 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> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- 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: -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |