* [GIT PULL/PATCH] gts and bfs fixes (v5). @ 2012-04-23 3:03 Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 1/2] ACPI: Convert wake_sleep_flags to a value instead of function (v5) Konrad Rzeszutek Wilk ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Konrad Rzeszutek Wilk @ 2012-04-23 3:03 UTC (permalink / raw) To: ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, hpa, x86, rjw Please git pull (or use the patches that follow this email) the following branch: git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/for-x86-for-3.4 Changes since v4 [https://lkml.org/lkml/2012/4/18/396] - Added Acked and Reviewed-by v2 [https://lkml.org/lkml/2012/4/9/474] - ditched the assembler version and used a C wrapper With git commit a2ef5c4fd44ce3922435139393b89f2cce47f576 "ACPI: Move module parameter gts and bfs to sleep.c" the sampling of gts/bfs module parameters flag by acpi_enter_sleep_state has been moved. It has been moved out of the inner ACPI code and out in the more x86 specific. This means that any caller of the exported acpi_enter_sleep_state function needs to provide two parameters now: sleep state and the bit flag whether to us _GTS|_BFS. All of the callers of acpi_enter_sleep_state did that, with the exception of the assembler version and as well any third-party callers of acpi_enter_sleep_state. These two patches expose 'wake_sleep_flags' as the product of the gts/bfs module parameter invocation. And also use said flag in the assembler 'do_suspend_lowlevel()' function. Konrad Rzeszutek Wilk (2): ACPI: Convert wake_sleep_flags to a value instead of function (v5) x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2). arch/x86/kernel/acpi/sleep.c | 4 +++ arch/x86/kernel/acpi/sleep.h | 4 +++ arch/x86/kernel/acpi/wakeup_32.S | 4 +-- arch/x86/kernel/acpi/wakeup_64.S | 4 +-- drivers/acpi/sleep.c | 52 ++++++++++++++++++++----------------- 5 files changed, 38 insertions(+), 30 deletions(-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ACPI: Convert wake_sleep_flags to a value instead of function (v5) 2012-04-23 3:03 [GIT PULL/PATCH] gts and bfs fixes (v5) Konrad Rzeszutek Wilk @ 2012-04-23 3:03 ` Konrad Rzeszutek Wilk 2012-04-23 21:43 ` [tip:x86/urgent] ACPI: Convert wake_sleep_flags to a value instead of function tip-bot for Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 2/2] x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2) Konrad Rzeszutek Wilk 2012-04-23 11:34 ` [GIT PULL/PATCH] gts and bfs fixes (v5) Rafael J. Wysocki 2 siblings, 1 reply; 9+ messages in thread From: Konrad Rzeszutek Wilk @ 2012-04-23 3:03 UTC (permalink / raw) To: ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, hpa, x86, rjw Cc: Konrad Rzeszutek Wilk With commit a2ef5c4fd44ce3922435139393b89f2cce47f576 "ACPI: Move module parameter gts and bfs to sleep.c" the wake_sleep_flags is required when calling acpi_enter_sleep_state, which means that if there are functions outside the sleep.c code they can't get the wake_sleep_flags values. This converts the function in to a exported value and converts the module config operands to a function. Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Lin Ming <ming.m.lin@intel.com> [v2: Parameters can be turned on/off dynamically] [v3: unsigned char -> u8] [v4: val -> kp->arg] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- arch/x86/kernel/acpi/sleep.h | 2 + drivers/acpi/sleep.c | 52 ++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index 416d4be..fe5fdda 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h @@ -9,6 +9,8 @@ extern long saved_magic; extern int wakeup_pmode_return; +extern u8 wake_sleep_flags; + extern unsigned long acpi_copy_wakeup_routine(unsigned long); extern void wakeup_long64(void); diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 1d661b5..eb6fd23 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -28,23 +28,33 @@ #include "internal.h" #include "sleep.h" +u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS; static unsigned int gts, bfs; -module_param(gts, uint, 0644); -module_param(bfs, uint, 0644); -MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); -MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); - -static u8 wake_sleep_flags(void) +static int set_param_wake_flag(const char *val, struct kernel_param *kp) { - u8 flags = ACPI_NO_OPTIONAL_METHODS; + int ret = param_set_int(val, kp); - if (gts) - flags |= ACPI_EXECUTE_GTS; - if (bfs) - flags |= ACPI_EXECUTE_BFS; + if (ret) + return ret; - return flags; + if (kp->arg == (const char *)>s) { + if (gts) + wake_sleep_flags |= ACPI_EXECUTE_GTS; + else + wake_sleep_flags &= ~ACPI_EXECUTE_GTS; + } + if (kp->arg == (const char *)&bfs) { + if (bfs) + wake_sleep_flags |= ACPI_EXECUTE_BFS; + else + wake_sleep_flags &= ~ACPI_EXECUTE_BFS; + } + return ret; } +module_param_call(gts, set_param_wake_flag, param_get_int, >s, 0644); +module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644); +MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); +MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); static u8 sleep_states[ACPI_S_STATE_COUNT]; @@ -263,7 +273,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) { acpi_status status = AE_OK; u32 acpi_state = acpi_target_sleep_state; - u8 flags = wake_sleep_flags(); int error; ACPI_FLUSH_CPU_CACHE(); @@ -271,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) switch (acpi_state) { case ACPI_STATE_S1: barrier(); - status = acpi_enter_sleep_state(acpi_state, flags); + status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); break; case ACPI_STATE_S3: @@ -286,7 +295,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); /* Reprogram control registers and execute _BFS */ - acpi_leave_sleep_state_prep(acpi_state, flags); + acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); /* ACPI 3.0 specs (P62) says that it's the responsibility * of the OSPM to clear the status bit [ implying that the @@ -550,30 +559,27 @@ static int acpi_hibernation_begin(void) static int acpi_hibernation_enter(void) { - u8 flags = wake_sleep_flags(); acpi_status status = AE_OK; ACPI_FLUSH_CPU_CACHE(); /* This shouldn't return. If it returns, we have a problem */ - status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); + status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); /* Reprogram control registers and execute _BFS */ - acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); + acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); return ACPI_SUCCESS(status) ? 0 : -EFAULT; } static void acpi_hibernation_leave(void) { - u8 flags = wake_sleep_flags(); - /* * If ACPI is not enabled by the BIOS and the boot kernel, we need to * enable it here. */ acpi_enable(); /* Reprogram control registers and execute _BFS */ - acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); + acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); /* Check the hardware signature */ if (facs && s4_hardware_signature != facs->hardware_signature) { printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " @@ -828,12 +834,10 @@ static void acpi_power_off_prepare(void) static void acpi_power_off(void) { - u8 flags = wake_sleep_flags(); - /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ printk(KERN_DEBUG "%s called\n", __func__); local_irq_disable(); - acpi_enter_sleep_state(ACPI_STATE_S5, flags); + acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); } /* -- 1.7.7.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:x86/urgent] ACPI: Convert wake_sleep_flags to a value instead of function 2012-04-23 3:03 ` [PATCH 1/2] ACPI: Convert wake_sleep_flags to a value instead of function (v5) Konrad Rzeszutek Wilk @ 2012-04-23 21:43 ` tip-bot for Konrad Rzeszutek Wilk 0 siblings, 0 replies; 9+ messages in thread From: tip-bot for Konrad Rzeszutek Wilk @ 2012-04-23 21:43 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, mingo, konrad.wilk, ming.m.lin, tglx, rjw, hpa Commit-ID: 2a14e541ed87bca0c125b82961ca3c6f808607d2 Gitweb: http://git.kernel.org/tip/2a14e541ed87bca0c125b82961ca3c6f808607d2 Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> AuthorDate: Sun, 22 Apr 2012 23:03:17 -0400 Committer: H. Peter Anvin <hpa@linux.intel.com> CommitDate: Mon, 23 Apr 2012 13:29:07 -0700 ACPI: Convert wake_sleep_flags to a value instead of function With commit a2ef5c4fd44ce3922435139393b89f2cce47f576 "ACPI: Move module parameter gts and bfs to sleep.c" the wake_sleep_flags is required when calling acpi_enter_sleep_state, which means that if there are functions outside the sleep.c code they can't get the wake_sleep_flags values. This converts the function in to a exported value and converts the module config operands to a function. Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Lin Ming <ming.m.lin@intel.com> [v2: Parameters can be turned on/off dynamically] [v3: unsigned char -> u8] [v4: val -> kp->arg] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Link: http://lkml.kernel.org/r/1335150198-21899-2-git-send-email-konrad.wilk@oracle.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> --- arch/x86/kernel/acpi/sleep.h | 2 + drivers/acpi/sleep.c | 52 ++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index 416d4be..fe5fdda 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h @@ -9,6 +9,8 @@ extern long saved_magic; extern int wakeup_pmode_return; +extern u8 wake_sleep_flags; + extern unsigned long acpi_copy_wakeup_routine(unsigned long); extern void wakeup_long64(void); diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 1d661b5..eb6fd23 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -28,23 +28,33 @@ #include "internal.h" #include "sleep.h" +u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS; static unsigned int gts, bfs; -module_param(gts, uint, 0644); -module_param(bfs, uint, 0644); -MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); -MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); - -static u8 wake_sleep_flags(void) +static int set_param_wake_flag(const char *val, struct kernel_param *kp) { - u8 flags = ACPI_NO_OPTIONAL_METHODS; + int ret = param_set_int(val, kp); - if (gts) - flags |= ACPI_EXECUTE_GTS; - if (bfs) - flags |= ACPI_EXECUTE_BFS; + if (ret) + return ret; - return flags; + if (kp->arg == (const char *)>s) { + if (gts) + wake_sleep_flags |= ACPI_EXECUTE_GTS; + else + wake_sleep_flags &= ~ACPI_EXECUTE_GTS; + } + if (kp->arg == (const char *)&bfs) { + if (bfs) + wake_sleep_flags |= ACPI_EXECUTE_BFS; + else + wake_sleep_flags &= ~ACPI_EXECUTE_BFS; + } + return ret; } +module_param_call(gts, set_param_wake_flag, param_get_int, >s, 0644); +module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644); +MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); +MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); static u8 sleep_states[ACPI_S_STATE_COUNT]; @@ -263,7 +273,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) { acpi_status status = AE_OK; u32 acpi_state = acpi_target_sleep_state; - u8 flags = wake_sleep_flags(); int error; ACPI_FLUSH_CPU_CACHE(); @@ -271,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) switch (acpi_state) { case ACPI_STATE_S1: barrier(); - status = acpi_enter_sleep_state(acpi_state, flags); + status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); break; case ACPI_STATE_S3: @@ -286,7 +295,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); /* Reprogram control registers and execute _BFS */ - acpi_leave_sleep_state_prep(acpi_state, flags); + acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); /* ACPI 3.0 specs (P62) says that it's the responsibility * of the OSPM to clear the status bit [ implying that the @@ -550,30 +559,27 @@ static int acpi_hibernation_begin(void) static int acpi_hibernation_enter(void) { - u8 flags = wake_sleep_flags(); acpi_status status = AE_OK; ACPI_FLUSH_CPU_CACHE(); /* This shouldn't return. If it returns, we have a problem */ - status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); + status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); /* Reprogram control registers and execute _BFS */ - acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); + acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); return ACPI_SUCCESS(status) ? 0 : -EFAULT; } static void acpi_hibernation_leave(void) { - u8 flags = wake_sleep_flags(); - /* * If ACPI is not enabled by the BIOS and the boot kernel, we need to * enable it here. */ acpi_enable(); /* Reprogram control registers and execute _BFS */ - acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); + acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); /* Check the hardware signature */ if (facs && s4_hardware_signature != facs->hardware_signature) { printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " @@ -828,12 +834,10 @@ static void acpi_power_off_prepare(void) static void acpi_power_off(void) { - u8 flags = wake_sleep_flags(); - /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ printk(KERN_DEBUG "%s called\n", __func__); local_irq_disable(); - acpi_enter_sleep_state(ACPI_STATE_S5, flags); + acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); } /* ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2). 2012-04-23 3:03 [GIT PULL/PATCH] gts and bfs fixes (v5) Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 1/2] ACPI: Convert wake_sleep_flags to a value instead of function (v5) Konrad Rzeszutek Wilk @ 2012-04-23 3:03 ` Konrad Rzeszutek Wilk 2012-04-23 21:43 ` [tip:x86/urgent] x86, acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler tip-bot for Konrad Rzeszutek Wilk 2012-04-23 11:34 ` [GIT PULL/PATCH] gts and bfs fixes (v5) Rafael J. Wysocki 2 siblings, 1 reply; 9+ messages in thread From: Konrad Rzeszutek Wilk @ 2012-04-23 3:03 UTC (permalink / raw) To: ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, hpa, x86, rjw Cc: Konrad Rzeszutek Wilk With commit a2ef5c4fd44ce3922435139393b89f2cce47f576 "ACPI: Move module parameter gts and bfs to sleep.c" the wake_sleep_flags is required when calling acpi_enter_sleep_state. The assembler code in wakeup_*.S did not do that. One solution is to call it from assembler and stick the wake_sleep_flags on the stack (for 32-bit) or in %esi (for 64-bit). hpa and rafael both suggested however to create a wrapper function to call acpi_enter_sleep_state and call said wrapper function ("acpi_enter_s3") from assembler. For 32-bit, the acpi_enter_s3 ends up looking as so: push %ebp mov %esp,%ebp sub $0x8,%esp movzbl 0xc1809314,%eax [wake_sleep_flags] movl $0x3,(%esp) mov %eax,0x4(%esp) call 0xc12d1fa0 <acpi_enter_sleep_state> leave ret And 64-bit: movzbl 0x9afde1(%rip),%esi [wake_sleep_flags] push %rbp mov $0x3,%edi mov %rsp,%rbp callq 0xffffffff812e9800 <acpi_enter_sleep_state> leaveq retq Reviewed-by: H. Peter Anvin <hpa@zytor.com> Suggested-by: H. Peter Anvin <hpa@zytor.com> [v2: Remove extra assembler operations, per hpa review] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- arch/x86/kernel/acpi/sleep.c | 4 ++++ arch/x86/kernel/acpi/sleep.h | 2 ++ arch/x86/kernel/acpi/wakeup_32.S | 4 +--- arch/x86/kernel/acpi/wakeup_64.S | 4 +--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 103b6ab..146a49c 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c @@ -24,6 +24,10 @@ unsigned long acpi_realmode_flags; static char temp_stack[4096]; #endif +asmlinkage void acpi_enter_s3(void) +{ + acpi_enter_sleep_state(3, wake_sleep_flags); +} /** * acpi_suspend_lowlevel - save kernel state * diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index fe5fdda..d68677a 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h @@ -3,6 +3,7 @@ */ #include <asm/trampoline.h> +#include <linux/linkage.h> extern unsigned long saved_video_mode; extern long saved_magic; @@ -10,6 +11,7 @@ extern long saved_magic; extern int wakeup_pmode_return; extern u8 wake_sleep_flags; +extern asmlinkage void acpi_enter_s3(void); extern unsigned long acpi_copy_wakeup_routine(unsigned long); extern void wakeup_long64(void); diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S index 13ab720..7261083 100644 --- a/arch/x86/kernel/acpi/wakeup_32.S +++ b/arch/x86/kernel/acpi/wakeup_32.S @@ -74,9 +74,7 @@ restore_registers: ENTRY(do_suspend_lowlevel) call save_processor_state call save_registers - pushl $3 - call acpi_enter_sleep_state - addl $4, %esp + call acpi_enter_s3 # In case of S3 failure, we'll emerge here. Jump # to ret_point to recover diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index 8ea5164..014d1d2 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S @@ -71,9 +71,7 @@ ENTRY(do_suspend_lowlevel) movq %rsi, saved_rsi addq $8, %rsp - movl $3, %edi - xorl %eax, %eax - call acpi_enter_sleep_state + call acpi_enter_s3 /* in case something went wrong, restore the machine status and go on */ jmp resume_point -- 1.7.7.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:x86/urgent] x86, acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler 2012-04-23 3:03 ` [PATCH 2/2] x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2) Konrad Rzeszutek Wilk @ 2012-04-23 21:43 ` tip-bot for Konrad Rzeszutek Wilk 0 siblings, 0 replies; 9+ messages in thread From: tip-bot for Konrad Rzeszutek Wilk @ 2012-04-23 21:43 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, konrad.wilk, tglx, hpa Commit-ID: cd74257b974d6d26442c97891c4d05772748b177 Gitweb: http://git.kernel.org/tip/cd74257b974d6d26442c97891c4d05772748b177 Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> AuthorDate: Sun, 22 Apr 2012 23:03:18 -0400 Committer: H. Peter Anvin <hpa@linux.intel.com> CommitDate: Mon, 23 Apr 2012 13:29:18 -0700 x86, acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler With commit a2ef5c4fd44ce3922435139393b89f2cce47f576 "ACPI: Move module parameter gts and bfs to sleep.c" the wake_sleep_flags is required when calling acpi_enter_sleep_state. The assembler code in wakeup_*.S did not do that. One solution is to call it from assembler and stick the wake_sleep_flags on the stack (for 32-bit) or in %esi (for 64-bit). hpa and rafael both suggested however to create a wrapper function to call acpi_enter_sleep_state and call said wrapper function ("acpi_enter_s3") from assembler. For 32-bit, the acpi_enter_s3 ends up looking as so: push %ebp mov %esp,%ebp sub $0x8,%esp movzbl 0xc1809314,%eax [wake_sleep_flags] movl $0x3,(%esp) mov %eax,0x4(%esp) call 0xc12d1fa0 <acpi_enter_sleep_state> leave ret And 64-bit: movzbl 0x9afde1(%rip),%esi [wake_sleep_flags] push %rbp mov $0x3,%edi mov %rsp,%rbp callq 0xffffffff812e9800 <acpi_enter_sleep_state> leaveq retq Reviewed-by: H. Peter Anvin <hpa@zytor.com> Suggested-by: H. Peter Anvin <hpa@zytor.com> [v2: Remove extra assembler operations, per hpa review] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Link: http://lkml.kernel.org/r/1335150198-21899-3-git-send-email-konrad.wilk@oracle.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> --- arch/x86/kernel/acpi/sleep.c | 4 ++++ arch/x86/kernel/acpi/sleep.h | 2 ++ arch/x86/kernel/acpi/wakeup_32.S | 4 +--- arch/x86/kernel/acpi/wakeup_64.S | 4 +--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 103b6ab..146a49c 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c @@ -24,6 +24,10 @@ unsigned long acpi_realmode_flags; static char temp_stack[4096]; #endif +asmlinkage void acpi_enter_s3(void) +{ + acpi_enter_sleep_state(3, wake_sleep_flags); +} /** * acpi_suspend_lowlevel - save kernel state * diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index fe5fdda..d68677a 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h @@ -3,6 +3,7 @@ */ #include <asm/trampoline.h> +#include <linux/linkage.h> extern unsigned long saved_video_mode; extern long saved_magic; @@ -10,6 +11,7 @@ extern long saved_magic; extern int wakeup_pmode_return; extern u8 wake_sleep_flags; +extern asmlinkage void acpi_enter_s3(void); extern unsigned long acpi_copy_wakeup_routine(unsigned long); extern void wakeup_long64(void); diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S index 13ab720..7261083 100644 --- a/arch/x86/kernel/acpi/wakeup_32.S +++ b/arch/x86/kernel/acpi/wakeup_32.S @@ -74,9 +74,7 @@ restore_registers: ENTRY(do_suspend_lowlevel) call save_processor_state call save_registers - pushl $3 - call acpi_enter_sleep_state - addl $4, %esp + call acpi_enter_s3 # In case of S3 failure, we'll emerge here. Jump # to ret_point to recover diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index 8ea5164..014d1d2 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S @@ -71,9 +71,7 @@ ENTRY(do_suspend_lowlevel) movq %rsi, saved_rsi addq $8, %rsp - movl $3, %edi - xorl %eax, %eax - call acpi_enter_sleep_state + call acpi_enter_s3 /* in case something went wrong, restore the machine status and go on */ jmp resume_point ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [GIT PULL/PATCH] gts and bfs fixes (v5). 2012-04-23 3:03 [GIT PULL/PATCH] gts and bfs fixes (v5) Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 1/2] ACPI: Convert wake_sleep_flags to a value instead of function (v5) Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 2/2] x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2) Konrad Rzeszutek Wilk @ 2012-04-23 11:34 ` Rafael J. Wysocki 2012-04-23 17:34 ` H. Peter Anvin 2 siblings, 1 reply; 9+ messages in thread From: Rafael J. Wysocki @ 2012-04-23 11:34 UTC (permalink / raw) To: Konrad Rzeszutek Wilk, hpa Cc: ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, x86 On Monday, April 23, 2012, Konrad Rzeszutek Wilk wrote: > Please git pull (or use the patches that follow this email) the following branch: > > git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git stable/for-x86-for-3.4 > > Changes since v4 [https://lkml.org/lkml/2012/4/18/396] > - Added Acked and Reviewed-by > v2 [https://lkml.org/lkml/2012/4/9/474] > - ditched the assembler version and used a C wrapper > > With git commit a2ef5c4fd44ce3922435139393b89f2cce47f576 > "ACPI: Move module parameter gts and bfs to sleep.c" the > sampling of gts/bfs module parameters flag by acpi_enter_sleep_state > has been moved. It has been moved out of the inner ACPI code and > out in the more x86 specific. This means that any caller of > the exported acpi_enter_sleep_state function needs to provide > two parameters now: sleep state and the bit flag whether to us _GTS|_BFS. > > All of the callers of acpi_enter_sleep_state did that, with > the exception of the assembler version and as well any > third-party callers of acpi_enter_sleep_state. > > These two patches expose 'wake_sleep_flags' as the product > of the gts/bfs module parameter invocation. And also use said > flag in the assembler 'do_suspend_lowlevel()' function. > > Konrad Rzeszutek Wilk (2): > ACPI: Convert wake_sleep_flags to a value instead of function (v5) > x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2). > > arch/x86/kernel/acpi/sleep.c | 4 +++ > arch/x86/kernel/acpi/sleep.h | 4 +++ > arch/x86/kernel/acpi/wakeup_32.S | 4 +-- > arch/x86/kernel/acpi/wakeup_64.S | 4 +-- > drivers/acpi/sleep.c | 52 ++++++++++++++++++++----------------- > 5 files changed, 38 insertions(+), 30 deletions(-) Peter, are you going to take this? Rafael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [GIT PULL/PATCH] gts and bfs fixes (v5). 2012-04-23 11:34 ` [GIT PULL/PATCH] gts and bfs fixes (v5) Rafael J. Wysocki @ 2012-04-23 17:34 ` H. Peter Anvin 2012-04-23 17:39 ` Konrad Rzeszutek Wilk 0 siblings, 1 reply; 9+ messages in thread From: H. Peter Anvin @ 2012-04-23 17:34 UTC (permalink / raw) To: Rafael J. Wysocki, Konrad Rzeszutek Wilk Cc: ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, x86 Do I have your ACK? "Rafael J. Wysocki" <rjw@sisk.pl> wrote: >On Monday, April 23, 2012, Konrad Rzeszutek Wilk wrote: >> Please git pull (or use the patches that follow this email) the >following branch: >> >> git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git >stable/for-x86-for-3.4 >> >> Changes since v4 [https://lkml.org/lkml/2012/4/18/396] >> - Added Acked and Reviewed-by >> v2 [https://lkml.org/lkml/2012/4/9/474] >> - ditched the assembler version and used a C wrapper >> >> With git commit a2ef5c4fd44ce3922435139393b89f2cce47f576 >> "ACPI: Move module parameter gts and bfs to sleep.c" the >> sampling of gts/bfs module parameters flag by acpi_enter_sleep_state >> has been moved. It has been moved out of the inner ACPI code and >> out in the more x86 specific. This means that any caller of >> the exported acpi_enter_sleep_state function needs to provide >> two parameters now: sleep state and the bit flag whether to us >_GTS|_BFS. >> >> All of the callers of acpi_enter_sleep_state did that, with >> the exception of the assembler version and as well any >> third-party callers of acpi_enter_sleep_state. >> >> These two patches expose 'wake_sleep_flags' as the product >> of the gts/bfs module parameter invocation. And also use said >> flag in the assembler 'do_suspend_lowlevel()' function. >> >> Konrad Rzeszutek Wilk (2): >> ACPI: Convert wake_sleep_flags to a value instead of function >(v5) >> x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C >function from assembler (v2). >> >> arch/x86/kernel/acpi/sleep.c | 4 +++ >> arch/x86/kernel/acpi/sleep.h | 4 +++ >> arch/x86/kernel/acpi/wakeup_32.S | 4 +-- >> arch/x86/kernel/acpi/wakeup_64.S | 4 +-- >> drivers/acpi/sleep.c | 52 >++++++++++++++++++++----------------- >> 5 files changed, 38 insertions(+), 30 deletions(-) > >Peter, are you going to take this? > >Rafael -- Sent from my mobile phone. Please excuse brevity and lack of formatting. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [GIT PULL/PATCH] gts and bfs fixes (v5). 2012-04-23 17:34 ` H. Peter Anvin @ 2012-04-23 17:39 ` Konrad Rzeszutek Wilk 2012-04-23 18:00 ` H. Peter Anvin 0 siblings, 1 reply; 9+ messages in thread From: Konrad Rzeszutek Wilk @ 2012-04-23 17:39 UTC (permalink / raw) To: H. Peter Anvin Cc: Rafael J. Wysocki, ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, x86 On Mon, Apr 23, 2012 at 10:34:44AM -0700, H. Peter Anvin wrote: > Do I have your ACK? Yes from me. Rafeal already Acked: https://lkml.org/lkml/2012/4/18/472 https://lkml.org/lkml/2012/4/18/473 Duh! I forgot to stick his Acked-by on the last patch. .. snip.. > >Peter, are you going to take this? > > > >Rafael ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [GIT PULL/PATCH] gts and bfs fixes (v5). 2012-04-23 17:39 ` Konrad Rzeszutek Wilk @ 2012-04-23 18:00 ` H. Peter Anvin 0 siblings, 0 replies; 9+ messages in thread From: H. Peter Anvin @ 2012-04-23 18:00 UTC (permalink / raw) To: Konrad Rzeszutek Wilk Cc: Rafael J. Wysocki, ming.m.lin, linux-kernel, linux-pm, lenb, linux-acpi, x86 No problem ... I'll pull it after lunch. Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote: >On Mon, Apr 23, 2012 at 10:34:44AM -0700, H. Peter Anvin wrote: >> Do I have your ACK? > >Yes from me. Rafeal already Acked: > >https://lkml.org/lkml/2012/4/18/472 >https://lkml.org/lkml/2012/4/18/473 > >Duh! I forgot to stick his Acked-by on the last patch. >.. snip.. > >> >Peter, are you going to take this? >> > >> >Rafael -- Sent from my mobile phone. Please excuse brevity and lack of formatting. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-04-23 21:44 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-23 3:03 [GIT PULL/PATCH] gts and bfs fixes (v5) Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 1/2] ACPI: Convert wake_sleep_flags to a value instead of function (v5) Konrad Rzeszutek Wilk 2012-04-23 21:43 ` [tip:x86/urgent] ACPI: Convert wake_sleep_flags to a value instead of function tip-bot for Konrad Rzeszutek Wilk 2012-04-23 3:03 ` [PATCH 2/2] x86/acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler (v2) Konrad Rzeszutek Wilk 2012-04-23 21:43 ` [tip:x86/urgent] x86, acpi: Call acpi_enter_sleep_state via an asmlinkage C function from assembler tip-bot for Konrad Rzeszutek Wilk 2012-04-23 11:34 ` [GIT PULL/PATCH] gts and bfs fixes (v5) Rafael J. Wysocki 2012-04-23 17:34 ` H. Peter Anvin 2012-04-23 17:39 ` Konrad Rzeszutek Wilk 2012-04-23 18:00 ` H. Peter Anvin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.