* [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
@ 2014-02-26 2:46 Li, Aubrey
2014-02-26 23:50 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Li, Aubrey @ 2014-02-26 2:46 UTC (permalink / raw)
To: linux-kernel, linux-acpi, Len.Brown, rjw, alan, Raj, Ashok
Sleep control and status registers need santity check before ACPI
install acpi_power_off to pm_power_off hook. The checking code in
acpi_enter_sleep_state() is too late, we should not allow a not-working
pm_power_off function hooked.
Signed-off-by: Aubrey Li <aubrey.li@intel.com>
---
drivers/acpi/sleep.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index b718806..0284d22 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -809,8 +809,11 @@ int __init acpi_sleep_init(void)
status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
if (ACPI_SUCCESS(status)) {
sleep_states[ACPI_STATE_S5] = 1;
- pm_power_off_prepare = acpi_power_off_prepare;
- pm_power_off = acpi_power_off;
+ if (acpi_gbl_FADT.sleep_control.address &&
+ acpi_gbl_FADT.sleep_status.address) {
+ pm_power_off_prepare = acpi_power_off_prepare;
+ pm_power_off = acpi_power_off;
+ }
}
supported[0] = 0;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
2014-02-26 2:46 [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed Li, Aubrey
@ 2014-02-26 23:50 ` Rafael J. Wysocki
2014-02-28 5:33 ` Li, Aubrey
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2014-02-26 23:50 UTC (permalink / raw)
To: Li, Aubrey; +Cc: linux-kernel, linux-acpi, Len.Brown, alan, Raj, Ashok
On Wednesday, February 26, 2014 10:46:37 AM Li, Aubrey wrote:
> Sleep control and status registers need santity check before ACPI
> install acpi_power_off to pm_power_off hook. The checking code in
> acpi_enter_sleep_state() is too late, we should not allow a not-working
> pm_power_off function hooked.
>
> Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> ---
> drivers/acpi/sleep.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index b718806..0284d22 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -809,8 +809,11 @@ int __init acpi_sleep_init(void)
> status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
> if (ACPI_SUCCESS(status)) {
> sleep_states[ACPI_STATE_S5] = 1;
Do we still want to set this if the check below fails? If so, then why?
> - pm_power_off_prepare = acpi_power_off_prepare;
> - pm_power_off = acpi_power_off;
> + if (acpi_gbl_FADT.sleep_control.address &&
> + acpi_gbl_FADT.sleep_status.address) {
> + pm_power_off_prepare = acpi_power_off_prepare;
> + pm_power_off = acpi_power_off;
> + }
> }
>
> supported[0] = 0;
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
2014-02-26 23:50 ` Rafael J. Wysocki
@ 2014-02-28 5:33 ` Li, Aubrey
2014-02-28 22:24 ` Li, Aubrey
0 siblings, 1 reply; 7+ messages in thread
From: Li, Aubrey @ 2014-02-28 5:33 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, linux-acpi, Len.Brown, alan, Raj, Ashok
On 2014/2/27 7:50, Rafael J. Wysocki wrote:
> On Wednesday, February 26, 2014 10:46:37 AM Li, Aubrey wrote:
>> Sleep control and status registers need santity check before ACPI
>> install acpi_power_off to pm_power_off hook. The checking code in
>> acpi_enter_sleep_state() is too late, we should not allow a not-working
>> pm_power_off function hooked.
>>
>> Signed-off-by: Aubrey Li <aubrey.li@intel.com>
>> ---
>> drivers/acpi/sleep.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
>> index b718806..0284d22 100644
>> --- a/drivers/acpi/sleep.c
>> +++ b/drivers/acpi/sleep.c
>> @@ -809,8 +809,11 @@ int __init acpi_sleep_init(void)
>> status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
>> if (ACPI_SUCCESS(status)) {
>> sleep_states[ACPI_STATE_S5] = 1;
>
> Do we still want to set this if the check below fails? If so, then why?
We know \_S5_ is valid. The fault is sleep registers, not S5 ACPI object
Thanks,
-Aubrey
>
>> - pm_power_off_prepare = acpi_power_off_prepare;
>> - pm_power_off = acpi_power_off;
>> + if (acpi_gbl_FADT.sleep_control.address &&
>> + acpi_gbl_FADT.sleep_status.address) {
>> + pm_power_off_prepare = acpi_power_off_prepare;
>> + pm_power_off = acpi_power_off;
>> + }
>> }
>>
>> supported[0] = 0;
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
2014-02-28 5:33 ` Li, Aubrey
@ 2014-02-28 22:24 ` Li, Aubrey
2014-03-02 0:39 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Li, Aubrey @ 2014-02-28 22:24 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, linux-acpi, Len.Brown, alan, Raj, Ashok
On 2014/2/28 13:33, Li, Aubrey wrote:
> On 2014/2/27 7:50, Rafael J. Wysocki wrote:
>> On Wednesday, February 26, 2014 10:46:37 AM Li, Aubrey wrote:
>>> Sleep control and status registers need santity check before ACPI
>>> install acpi_power_off to pm_power_off hook. The checking code in
>>> acpi_enter_sleep_state() is too late, we should not allow a not-working
>>> pm_power_off function hooked.
>>>
>>> Signed-off-by: Aubrey Li <aubrey.li@intel.com>
>>> ---
>>> drivers/acpi/sleep.c | 7 +++++--
>>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
>>> index b718806..0284d22 100644
>>> --- a/drivers/acpi/sleep.c
>>> +++ b/drivers/acpi/sleep.c
>>> @@ -809,8 +809,11 @@ int __init acpi_sleep_init(void)
>>> status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
>>> if (ACPI_SUCCESS(status)) {
>>> sleep_states[ACPI_STATE_S5] = 1;
>>
>> Do we still want to set this if the check below fails? If so, then why?
>
> We know \_S5_ is valid. The fault is sleep registers, not S5 ACPI object
Hi Rafael, do you still have any concern?
Thanks,
-Aubrey
>
>>
>>> - pm_power_off_prepare = acpi_power_off_prepare;
>>> - pm_power_off = acpi_power_off;
>>> + if (acpi_gbl_FADT.sleep_control.address &&
>>> + acpi_gbl_FADT.sleep_status.address) {
>>> + pm_power_off_prepare = acpi_power_off_prepare;
>>> + pm_power_off = acpi_power_off;
>>> + }
>>> }
>>>
>>> supported[0] = 0;
>>>
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
2014-02-28 22:24 ` Li, Aubrey
@ 2014-03-02 0:39 ` Rafael J. Wysocki
2014-03-02 0:53 ` Li, Aubrey
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2014-03-02 0:39 UTC (permalink / raw)
To: Li, Aubrey; +Cc: linux-kernel, linux-acpi, Len.Brown, alan, Raj, Ashok
On Saturday, March 01, 2014 06:24:23 AM Li, Aubrey wrote:
> On 2014/2/28 13:33, Li, Aubrey wrote:
> > On 2014/2/27 7:50, Rafael J. Wysocki wrote:
> >> On Wednesday, February 26, 2014 10:46:37 AM Li, Aubrey wrote:
> >>> Sleep control and status registers need santity check before ACPI
> >>> install acpi_power_off to pm_power_off hook. The checking code in
> >>> acpi_enter_sleep_state() is too late, we should not allow a not-working
> >>> pm_power_off function hooked.
> >>>
> >>> Signed-off-by: Aubrey Li <aubrey.li@intel.com>
> >>> ---
> >>> drivers/acpi/sleep.c | 7 +++++--
> >>> 1 file changed, 5 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> >>> index b718806..0284d22 100644
> >>> --- a/drivers/acpi/sleep.c
> >>> +++ b/drivers/acpi/sleep.c
> >>> @@ -809,8 +809,11 @@ int __init acpi_sleep_init(void)
> >>> status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
> >>> if (ACPI_SUCCESS(status)) {
> >>> sleep_states[ACPI_STATE_S5] = 1;
> >>
> >> Do we still want to set this if the check below fails? If so, then why?
> >
> > We know \_S5_ is valid. The fault is sleep registers, not S5 ACPI object
>
> Hi Rafael, do you still have any concern?
Well, I simply don't think we should say that it is "supported" if we aren't
going to do anything with it.
> >>
> >>> - pm_power_off_prepare = acpi_power_off_prepare;
> >>> - pm_power_off = acpi_power_off;
> >>> + if (acpi_gbl_FADT.sleep_control.address &&
> >>> + acpi_gbl_FADT.sleep_status.address) {
> >>> + pm_power_off_prepare = acpi_power_off_prepare;
> >>> + pm_power_off = acpi_power_off;
> >>> + }
> >>> }
> >>>
> >>> supported[0] = 0;
> >>>
> >>
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
2014-03-02 0:39 ` Rafael J. Wysocki
@ 2014-03-02 0:53 ` Li, Aubrey
2014-03-02 23:38 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Li, Aubrey @ 2014-03-02 0:53 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-kernel, linux-acpi, Len.Brown, alan, Raj, Ashok
On 2014/3/2 8:39, Rafael J. Wysocki wrote:
> On Saturday, March 01, 2014 06:24:23 AM Li, Aubrey wrote:
>>>> Do we still want to set this if the check below fails? If so, then why?
>>>
>>> We know \_S5_ is valid. The fault is sleep registers, not S5 ACPI object
>>
>> Hi Rafael, do you still have any concern?
>
> Well, I simply don't think we should say that it is "supported" if we aren't
> going to do anything with it.
>
Make sense to me. Patch refined as below:
Sleep control and status registers need santity check as well before
ACPI install acpi_power_off to pm_power_off hook. The checking code in
acpi_enter_sleep_state() is too late, we should not allow a not-working
pm_power_off function hooked.
Signed-off-by: Aubrey Li <aubrey.li@intel.com>
---
drivers/acpi/sleep.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index b718806..0abfbb1 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -807,7 +807,12 @@ int __init acpi_sleep_init(void)
acpi_sleep_hibernate_setup();
status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
- if (ACPI_SUCCESS(status)) {
+ /*
+ * Check both ACPI S5 object and ACPI sleep registers to
+ * install pm_power_off_prepare/pm_power_off hook
+ */
+ if (ACPI_SUCCESS(status) && acpi_gbl_FADT.sleep_control.address &&
+ acpi_gbl_FADT.sleep_status.address) {
sleep_states[ACPI_STATE_S5] = 1;
pm_power_off_prepare = acpi_power_off_prepare;
pm_power_off = acpi_power_off;
-- 1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed
2014-03-02 0:53 ` Li, Aubrey
@ 2014-03-02 23:38 ` Rafael J. Wysocki
0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2014-03-02 23:38 UTC (permalink / raw)
To: Li, Aubrey; +Cc: linux-kernel, linux-acpi, Len.Brown, alan, Raj, Ashok
On Sunday, March 02, 2014 08:53:57 AM Li, Aubrey wrote:
> On 2014/3/2 8:39, Rafael J. Wysocki wrote:
> > On Saturday, March 01, 2014 06:24:23 AM Li, Aubrey wrote:
> >>>> Do we still want to set this if the check below fails? If so, then why?
> >>>
> >>> We know \_S5_ is valid. The fault is sleep registers, not S5 ACPI object
> >>
> >> Hi Rafael, do you still have any concern?
> >
> > Well, I simply don't think we should say that it is "supported" if we aren't
> > going to do anything with it.
> >
>
> Make sense to me. Patch refined as below:
>
> Sleep control and status registers need santity check as well before
> ACPI install acpi_power_off to pm_power_off hook. The checking code in
> acpi_enter_sleep_state() is too late, we should not allow a not-working
> pm_power_off function hooked.
>
> Signed-off-by: Aubrey Li <aubrey.li@intel.com>
Queued up for 3.15 (with minor changes), thanks!
>
> ---
> drivers/acpi/sleep.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index b718806..0abfbb1 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -807,7 +807,12 @@ int __init acpi_sleep_init(void)
> acpi_sleep_hibernate_setup();
>
> status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
> - if (ACPI_SUCCESS(status)) {
> + /*
> + * Check both ACPI S5 object and ACPI sleep registers to
> + * install pm_power_off_prepare/pm_power_off hook
> + */
> + if (ACPI_SUCCESS(status) && acpi_gbl_FADT.sleep_control.address &&
> + acpi_gbl_FADT.sleep_status.address) {
> sleep_states[ACPI_STATE_S5] = 1;
> pm_power_off_prepare = acpi_power_off_prepare;
> pm_power_off = acpi_power_off;
> -- 1.7.10.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-03-02 23:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26 2:46 [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed Li, Aubrey
2014-02-26 23:50 ` Rafael J. Wysocki
2014-02-28 5:33 ` Li, Aubrey
2014-02-28 22:24 ` Li, Aubrey
2014-03-02 0:39 ` Rafael J. Wysocki
2014-03-02 0:53 ` Li, Aubrey
2014-03-02 23:38 ` Rafael J. Wysocki
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).