Message ID | 1462772495-71113-1-git-send-email-hehy1@lenovo.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote: > The _PTS control method is defined in the section 7.4.1 of acpi 6.0 > spec. The _PTS control method is executed by the OS during the sleep > transition process for S1, S2, S3, S4, and for orderly S5 shutdown. > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 > soft-off state) is passed to the _PTS control method. This method > is called after OSPM has notified native device drivers of the sleep > state transition and before the OSPM has had a chance to fully > prepare the system for a sleep state transition. > > The _PTS control method provides the BIOS a mechanism for performing > some housekeeping, such as writing the sleep type value to the embedded > controller, before entering the system sleeping state. > > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. > > Thus, a _PTS block notifier is added to the reboot notifier list so that > the _PTS object will also be evaluated when the system reboot. So I understand why it may be necessary to evaluate _PTS before entering S5, but I'm totally unsure about reboot. What does reboot have to do with S5? > Signed-off-by: Ocean He <hehy1@lenovo.com> > Signed-off-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com> > --- > drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c > index 2a8b596..8b290fb 100644 > --- a/drivers/acpi/sleep.c > +++ b/drivers/acpi/sleep.c > @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { > .priority = 0, > }; > > +static int pts_notify_reboot(struct notifier_block *this, > + unsigned long code, void *x) > +{ > + acpi_status status; > + > + status = acpi_execute_simple_method(NULL, "\\_PTS", ACPI_STATE_S5); > + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { > + /* It won't break anything. */ > + printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); > + } > + > + return NOTIFY_DONE; > +} > + > +static struct notifier_block pts_notifier = { > + .notifier_call = pts_notify_reboot, > + .next = NULL, > + .priority = 0, > +}; > + > static int acpi_sleep_prepare(u32 acpi_state) > { > #ifdef CONFIG_ACPI_SLEEP > @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) > * object can also be evaluated when the system enters S5. > */ > register_reboot_notifier(&tts_notifier); > + > + /* > + * According to section 7.5 of acpi 6.0 spec, _PTS should run after > + * _TTS when the system enters S5. > + */ > + register_reboot_notifier(&pts_notifier); Why do you have to add a second notifier? Why can't _TTS and _PTS be evaluated from one notifier? > + > return 0; > } > Thanks, Rafael -- 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
Hi Rafael, Please see my reply in below. Regards, Ocean He SW Development Dept. Beijing Design Center Enterprise Product Group Mobile: 18911778926 E-mail: hehy1@lenovo.com No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > -----Original Message----- > From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net] > Sent: Wednesday, June 22, 2016 7:56 AM > To: Ocean HY1 He > Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; > linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > Subject: Re: [PATCH] ACPI: Execute the _PTS method when system reboot > > On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote: > > The _PTS control method is defined in the section 7.4.1 of acpi 6.0 > > spec. The _PTS control method is executed by the OS during the sleep > > transition process for S1, S2, S3, S4, and for orderly S5 shutdown. > > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 > > soft-off state) is passed to the _PTS control method. This method > > is called after OSPM has notified native device drivers of the sleep > > state transition and before the OSPM has had a chance to fully > > prepare the system for a sleep state transition. > > > > The _PTS control method provides the BIOS a mechanism for performing > > some housekeeping, such as writing the sleep type value to the > embedded > > controller, before entering the system sleeping state. > > > > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. > > > > Thus, a _PTS block notifier is added to the reboot notifier list so that > > the _PTS object will also be evaluated when the system reboot. > > So I understand why it may be necessary to evaluate _PTS before entering > S5, > but I'm totally unsure about reboot. > > What does reboot have to do with S5? > In ACPI spec, there is no explicit words saying _PTS should be executed when reboot. But reboot could be equal to the process S0->S5->S0. Thus _PTS should be executed when reboot. I am thinking this is the same as _TTS. In ACPI spec, there is also no explicit words saying _TTS should be executed when reboot. But kernel executes _TTS when reboot indeed. > > Signed-off-by: Ocean He <hehy1@lenovo.com> > > Signed-off-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com> > > --- > > drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c > > index 2a8b596..8b290fb 100644 > > --- a/drivers/acpi/sleep.c > > +++ b/drivers/acpi/sleep.c > > @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { > > .priority = 0, > > }; > > > > +static int pts_notify_reboot(struct notifier_block *this, > > + unsigned long code, void *x) > > +{ > > + acpi_status status; > > + > > + status = acpi_execute_simple_method(NULL, "\\_PTS", > ACPI_STATE_S5); > > + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { > > + /* It won't break anything. */ > > + printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); > > + } > > + > > + return NOTIFY_DONE; > > +} > > + > > +static struct notifier_block pts_notifier = { > > + .notifier_call = pts_notify_reboot, > > + .next = NULL, > > + .priority = 0, > > +}; > > + > > static int acpi_sleep_prepare(u32 acpi_state) > > { > > #ifdef CONFIG_ACPI_SLEEP > > @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) > > * object can also be evaluated when the system enters S5. > > */ > > register_reboot_notifier(&tts_notifier); > > + > > + /* > > + * According to section 7.5 of acpi 6.0 spec, _PTS should run after > > + * _TTS when the system enters S5. > > + */ > > + register_reboot_notifier(&pts_notifier); > > Why do you have to add a second notifier? > > Why can't _TTS and _PTS be evaluated from one notifier? > If execute _PTS method in tts_notify_reboot(), then it would break definition of tts_notify_reboot(). My intention is to keep new codes has limited impact on existed codes. Of course, it's possible to merge _TTS and _PTS into one unified notifier. The advantage is more actions could be added into the unified notifier in future. Which way you prefer? > > + > > return 0; > > } > > > > Thanks, > Rafael
On Thu, Jun 23, 2016 at 2:55 PM, Ocean HY1 He <hehy1@lenovo.com> wrote: > Hi Rafael, > Please see my reply in below. > > Regards, > Ocean He > SW Development Dept. > Beijing Design Center > Enterprise Product Group > Mobile: 18911778926 > E-mail: hehy1@lenovo.com > No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > >> -----Original Message----- >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net] >> Sent: Wednesday, June 22, 2016 7:56 AM >> To: Ocean HY1 He >> Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; >> linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar >> Subject: Re: [PATCH] ACPI: Execute the _PTS method when system reboot >> >> On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote: >> > The _PTS control method is defined in the section 7.4.1 of acpi 6.0 >> > spec. The _PTS control method is executed by the OS during the sleep >> > transition process for S1, S2, S3, S4, and for orderly S5 shutdown. >> > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 >> > soft-off state) is passed to the _PTS control method. This method >> > is called after OSPM has notified native device drivers of the sleep >> > state transition and before the OSPM has had a chance to fully >> > prepare the system for a sleep state transition. >> > >> > The _PTS control method provides the BIOS a mechanism for performing >> > some housekeeping, such as writing the sleep type value to the >> embedded >> > controller, before entering the system sleeping state. >> > >> > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. >> > >> > Thus, a _PTS block notifier is added to the reboot notifier list so that >> > the _PTS object will also be evaluated when the system reboot. >> >> So I understand why it may be necessary to evaluate _PTS before entering >> S5, >> but I'm totally unsure about reboot. >> >> What does reboot have to do with S5? >> > In ACPI spec, there is no explicit words saying _PTS should be > executed when reboot. But reboot could be equal to the > process S0->S5->S0. Not in general. In particular, wakeup devices that would be set up for S5 need not be set up for that. Also the mechanism by which transitions to S5 are entered is different from the reboot one, at least from the OS perspective. > Thus _PTS should be executed when reboot. No, it doesn't follow. > I am thinking this is the same as _TTS. In ACPI spec, there is also > no explicit words saying _TTS should be executed when reboot. > But kernel executes _TTS when reboot indeed. Yes, it does. Maybe it shouldn't? It may not hurt to call _PTS before reboot too, but is it guaranteed to work across the board on all systems everywhere? >> > Signed-off-by: Ocean He <hehy1@lenovo.com> >> > Signed-off-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com> >> > --- >> > drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++ >> > 1 file changed, 27 insertions(+) >> > >> > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c >> > index 2a8b596..8b290fb 100644 >> > --- a/drivers/acpi/sleep.c >> > +++ b/drivers/acpi/sleep.c >> > @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { >> > .priority = 0, >> > }; >> > >> > +static int pts_notify_reboot(struct notifier_block *this, >> > + unsigned long code, void *x) >> > +{ >> > + acpi_status status; >> > + >> > + status = acpi_execute_simple_method(NULL, "\\_PTS", >> ACPI_STATE_S5); >> > + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { >> > + /* It won't break anything. */ >> > + printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); >> > + } >> > + >> > + return NOTIFY_DONE; >> > +} >> > + >> > +static struct notifier_block pts_notifier = { >> > + .notifier_call = pts_notify_reboot, >> > + .next = NULL, >> > + .priority = 0, >> > +}; >> > + >> > static int acpi_sleep_prepare(u32 acpi_state) >> > { >> > #ifdef CONFIG_ACPI_SLEEP >> > @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) >> > * object can also be evaluated when the system enters S5. >> > */ >> > register_reboot_notifier(&tts_notifier); >> > + >> > + /* >> > + * According to section 7.5 of acpi 6.0 spec, _PTS should run after >> > + * _TTS when the system enters S5. >> > + */ >> > + register_reboot_notifier(&pts_notifier); >> >> Why do you have to add a second notifier? >> >> Why can't _TTS and _PTS be evaluated from one notifier? >> > If execute _PTS method in tts_notify_reboot(), then it would break > definition of tts_notify_reboot(). What exactly would it break? > My intention is to keep new codes > has limited impact on existed codes. Even if that makes a little sense? > Of course, it's possible to merge _TTS and _PTS into one unified notifier. > The advantage is more actions could be added into the unified notifier in future. > Which way you prefer? I would just use one notifier. Thanks, Rafael -- 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
SGksDQoNCj4gRnJvbTogbGludXgtYWNwaS1vd25lckB2Z2VyLmtlcm5lbC5vcmcgW21haWx0bzps aW51eC1hY3BpLQ0KPiBvd25lckB2Z2VyLmtlcm5lbC5vcmddIE9uIEJlaGFsZiBPZiBPY2VhbiBI WTEgSGUNCj4gU3ViamVjdDogUkU6IFtQQVRDSF0gQUNQSTogRXhlY3V0ZSB0aGUgX1BUUyBtZXRo b2Qgd2hlbiBzeXN0ZW0gcmVib290DQo+IA0KPiBIaSBSYWZhZWwsDQo+IFBsZWFzZSBzZWUgbXkg cmVwbHkgaW4gYmVsb3cuDQo+IA0KPiBSZWdhcmRzLA0KPiBPY2VhbiBIZQ0KPiBTVyBEZXZlbG9w bWVudCBEZXB0Lg0KPiBCZWlqaW5nIERlc2lnbiBDZW50ZXINCj4gRW50ZXJwcmlzZSBQcm9kdWN0 IEdyb3VwDQo+IE1vYmlsZTogMTg5MTE3Nzg5MjYNCj4gRS1tYWlsOiBoZWh5MUBsZW5vdm8uY29t DQo+IE5vLjYgQ2h1YW5nIFllIFJvYWQsIEhhaWRpYW4gRGlzdHJpY3QsIEJlaWppbmcsIENoaW5h IDEwMDA4NQ0KPiANCj4gPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiA+IEZyb206IFJh ZmFlbCBKLiBXeXNvY2tpIFttYWlsdG86cmp3QHJqd3lzb2NraS5uZXRdDQo+ID4gU2VudDogV2Vk bmVzZGF5LCBKdW5lIDIyLCAyMDE2IDc6NTYgQU0NCj4gPiBUbzogT2NlYW4gSFkxIEhlDQo+ID4g Q2M6IGxlbm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iBpdCB3b3VsZCBicmVhaw0KPiBkZWZpbml0aW9uIG9mIHR0c19ub3RpZnlfcmVib290KCku IE15IGludGVudGlvbiBpcyB0byBrZWVwIG5ldyBjb2Rlcw0KPiBoYXMgbGltaXRlZCBpbXBhY3Qg b24gZXhpc3RlZCBjb2Rlcy4NCj4gT2YgY291cnNlLCBpdCdzIHBvc3NpYmxlIHRvIG1lcmdlIF9U VFMgYW5kIF9QVFMgaW50byBvbmUgdW5pZmllZCBub3RpZmllci4NCj4gVGhlIGFkdmFudGFnZSBp cyBtb3JlIGFjdGlvbnMgY291bGQgYmUgYWRkZWQgaW50byB0aGUgdW5pZmllZCBub3RpZmllciBp bg0KPiBmdXR1cmUuDQo+IFdoaWNoIHdheSB5b3UgcHJlZmVyPw0KPiA+ID4gKw0KPiA+ID4gIAly ZXR1cm4gMDsNCj4gPiA+ICB9DQo+ID4gPg0KPiA+DQo+ID4gVGhhbmtzLA0KPiA+IFJhZmFlbA0K PiANCj4gE++/ve+/vey5uxzvv70m77+9fu+/vSbvv70Y77+977+9Ky0NCj4g77+977+93bYX77+9 77+9d++/ve+/vcub77+977+977+9be+/vWLvv73vv71acu+/ve+/ve+/ve+/vV5u77+9cu+/ve+/ ve+/vXrvv70a77+977+9aO+/ve+/ve+/ve+/vSbvv73vv70e77+9R++/ve+/ve+/vWjvv70DKO+/ vemajg0KPiDvv73domoi77+977+9Gu+/vRtt77+977+977+977+977+9eu+/vd6W77+977+977+9 Zu+/ve+/ve+/vWjvv73vv73vv71+77+9be+/vQ0K -- 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
Regards, Ocean He SW Development Dept. Beijing Design Center Enterprise Product Group Mobile: 18911778926 E-mail: hehy1@lenovo.com No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > -----Original Message----- > From: Zheng, Lv [mailto:lv.zheng@intel.com] > Sent: Friday, June 24, 2016 8:30 AM > To: Ocean HY1 He; Rafael J. Wysocki > Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; > linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > Subject: RE: [PATCH] ACPI: Execute the _PTS method when system reboot > > Hi, > > > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi- > > owner@vger.kernel.org] On Behalf Of Ocean HY1 He > > Subject: RE: [PATCH] ACPI: Execute the _PTS method when system > reboot > > > > Hi Rafael, > > Please see my reply in below. > > > > Regards, > > Ocean He > > SW Development Dept. > > Beijing Design Center > > Enterprise Product Group > > Mobile: 18911778926 > > E-mail: hehy1@lenovo.com > > No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > > > > > -----Original Message----- > > > From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net] > > > Sent: Wednesday, June 22, 2016 7:56 AM > > > To: Ocean HY1 He > > > Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; > > > linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > > > Subject: Re: [PATCH] ACPI: Execute the _PTS method when system > > reboot > > > > > > On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote: > > > > The _PTS control method is defined in the section 7.4.1 of acpi 6.0 > > > > spec. The _PTS control method is executed by the OS during the > sleep > > > > transition process for S1, S2, S3, S4, and for orderly S5 shutdown. > > > > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 > > > > soft-off state) is passed to the _PTS control method. This method > > > > is called after OSPM has notified native device drivers of the sleep > > > > state transition and before the OSPM has had a chance to fully > > > > prepare the system for a sleep state transition. > > > > > > > > The _PTS control method provides the BIOS a mechanism for > > performing > > > > some housekeeping, such as writing the sleep type value to the > > > embedded > > > > controller, before entering the system sleeping state. > > > > > > > > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. > > > > > > > > Thus, a _PTS block notifier is added to the reboot notifier list so that > > > > the _PTS object will also be evaluated when the system reboot. > > > > > > So I understand why it may be necessary to evaluate _PTS before > > entering > > > S5, > > > but I'm totally unsure about reboot. > > > > > > What does reboot have to do with S5? > > > > > In ACPI spec, there is no explicit words saying _PTS should be > > executed when reboot. But reboot could be equal to the > > process S0->S5->S0. Thus _PTS should be executed when reboot. > > > > I am thinking this is the same as _TTS. In ACPI spec, there is also > > no explicit words saying _TTS should be executed when reboot. > > But kernel executes _TTS when reboot indeed. > [Lv Zheng] > What's the de-facto standard behavior here? > Lenovo should be able to modify BIOS, should you try to boot different > Windows clones to confirm the necessity of doing this? > > Thanks and best regards > -Lv > I have consulted Lenovo UEFI/BIOS archtect, David Tanaka. He says the de-facto standard behavior is that _PTS should be executed when reboot, at least for Windows. Windows does not differentiate OS reboot and shutdown. And, our test on Windows shows _PTS is executed when reboot actually. I try to find the difference between OS reboot and shutdown(S5) in ACPI spec, but I cann't find the answer. So, in my mind I consider reboot equals S0->S5->S0. Maybe you have evidence shows they are different, please let me know. It would help me a lot. Thanks. Ocean. > > > > > > Signed-off-by: Ocean He <hehy1@lenovo.com> > > > > Signed-off-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com> > > > > --- > > > > drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++ > > > > 1 file changed, 27 insertions(+) > > > > > > > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c > > > > index 2a8b596..8b290fb 100644 > > > > --- a/drivers/acpi/sleep.c > > > > +++ b/drivers/acpi/sleep.c > > > > @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { > > > > .priority = 0, > > > > }; > > > > > > > > +static int pts_notify_reboot(struct notifier_block *this, > > > > + unsigned long code, void *x) > > > > +{ > > > > + acpi_status status; > > > > + > > > > + status = acpi_execute_simple_method(NULL, "\\_PTS", > > > ACPI_STATE_S5); > > > > + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { > > > > + /* It won't break anything. */ > > > > + printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); > > > > + } > > > > + > > > > + return NOTIFY_DONE; > > > > +} > > > > + > > > > +static struct notifier_block pts_notifier = { > > > > + .notifier_call = pts_notify_reboot, > > > > + .next = NULL, > > > > + .priority = 0, > > > > +}; > > > > + > > > > static int acpi_sleep_prepare(u32 acpi_state) > > > > { > > > > #ifdef CONFIG_ACPI_SLEEP > > > > @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) > > > > * object can also be evaluated when the system enters S5. > > > > */ > > > > register_reboot_notifier(&tts_notifier); > > > > + > > > > + /* > > > > + * According to section 7.5 of acpi 6.0 spec, _PTS should run after > > > > + * _TTS when the system enters S5. > > > > + */ > > > > + register_reboot_notifier(&pts_notifier); > > > > > > Why do you have to add a second notifier? > > > > > > Why can't _TTS and _PTS be evaluated from one notifier? > > > > > If execute _PTS method in tts_notify_reboot(), then it would break > > definition of tts_notify_reboot(). My intention is to keep new codes > > has limited impact on existed codes. > > Of course, it's possible to merge _TTS and _PTS into one unified notifier. > > The advantage is more actions could be added into the unified notifier > in > > future. > > Which way you prefer? > > > > + > > > > return 0; > > > > } > > > > > > > > > > Thanks, > > > Rafael > > > > ��칻�&�~�&���+- > > > ��ݶ��w��˛���m�b��Zr����^n�r���z���h����&���G���h�(� > 階 > > �ݢj"���m�����z�ޖ���f���h���~�m�
Regards, Ocean He SW Development Dept. Beijing Design Center Enterprise Product Group Mobile: 18911778926 E-mail: hehy1@lenovo.com No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > -----Original Message----- > From: rjwysocki@gmail.com [mailto:rjwysocki@gmail.com] On Behalf Of > Rafael J. Wysocki > Sent: Thursday, June 23, 2016 9:13 PM > To: Ocean HY1 He > Cc: Rafael J. Wysocki; lenb@kernel.org; linux-acpi@vger.kernel.org; > linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > Subject: Re: [PATCH] ACPI: Execute the _PTS method when system reboot > > On Thu, Jun 23, 2016 at 2:55 PM, Ocean HY1 He <hehy1@lenovo.com> > wrote: > > Hi Rafael, > > Please see my reply in below. > > > > Regards, > > Ocean He > > SW Development Dept. > > Beijing Design Center > > Enterprise Product Group > > Mobile: 18911778926 > > E-mail: hehy1@lenovo.com > > No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > > > >> -----Original Message----- > >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net] > >> Sent: Wednesday, June 22, 2016 7:56 AM > >> To: Ocean HY1 He > >> Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; > >> linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > >> Subject: Re: [PATCH] ACPI: Execute the _PTS method when system > reboot > >> > >> On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote: > >> > The _PTS control method is defined in the section 7.4.1 of acpi 6.0 > >> > spec. The _PTS control method is executed by the OS during the sleep > >> > transition process for S1, S2, S3, S4, and for orderly S5 shutdown. > >> > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 > >> > soft-off state) is passed to the _PTS control method. This method > >> > is called after OSPM has notified native device drivers of the sleep > >> > state transition and before the OSPM has had a chance to fully > >> > prepare the system for a sleep state transition. > >> > > >> > The _PTS control method provides the BIOS a mechanism for > performing > >> > some housekeeping, such as writing the sleep type value to the > >> embedded > >> > controller, before entering the system sleeping state. > >> > > >> > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. > >> > > >> > Thus, a _PTS block notifier is added to the reboot notifier list so that > >> > the _PTS object will also be evaluated when the system reboot. > >> > >> So I understand why it may be necessary to evaluate _PTS before > entering > >> S5, > >> but I'm totally unsure about reboot. > >> > >> What does reboot have to do with S5? > >> > > In ACPI spec, there is no explicit words saying _PTS should be > > executed when reboot. But reboot could be equal to the > > process S0->S5->S0. > > Not in general. > > In particular, wakeup devices that would be set up for S5 need not be > set up for that. Also the mechanism by which transitions to S5 are > entered is different from the reboot one, at least from the OS > perspective. > > > Thus _PTS should be executed when reboot. > > No, it doesn't follow. > > > I am thinking this is the same as _TTS. In ACPI spec, there is also > > no explicit words saying _TTS should be executed when reboot. > > But kernel executes _TTS when reboot indeed. > > Yes, it does. Maybe it shouldn't? > > It may not hurt to call _PTS before reboot too, but is it guaranteed > to work across the board on all systems everywhere? > I try to clarify the key point of this case: does devices should go to S5(shutdown) when reboot? I think the answer is yes. And It has no hurt to let devices go to S5 before reboot is invoked, here is the reasons: #1 The new _PTS codes block nothing thus reboot can be guaranteed to be invoked eventually. #2. Devices are mandatory to support S5 state, this means go to S5 could be a safe trip. #3 Reboot would cause devices re-initialization from the scratch. What's your decision then? ;-) Regards, Ocean. > >> > Signed-off-by: Ocean He <hehy1@lenovo.com> > >> > Signed-off-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com> > >> > --- > >> > drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++ > >> > 1 file changed, 27 insertions(+) > >> > > >> > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c > >> > index 2a8b596..8b290fb 100644 > >> > --- a/drivers/acpi/sleep.c > >> > +++ b/drivers/acpi/sleep.c > >> > @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { > >> > .priority = 0, > >> > }; > >> > > >> > +static int pts_notify_reboot(struct notifier_block *this, > >> > + unsigned long code, void *x) > >> > +{ > >> > + acpi_status status; > >> > + > >> > + status = acpi_execute_simple_method(NULL, "\\_PTS", > >> ACPI_STATE_S5); > >> > + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { > >> > + /* It won't break anything. */ > >> > + printk(KERN_NOTICE "Failure in evaluating _PTS > object\n"); > >> > + } > >> > + > >> > + return NOTIFY_DONE; > >> > +} > >> > + > >> > +static struct notifier_block pts_notifier = { > >> > + .notifier_call = pts_notify_reboot, > >> > + .next = NULL, > >> > + .priority = 0, > >> > +}; > >> > + > >> > static int acpi_sleep_prepare(u32 acpi_state) > >> > { > >> > #ifdef CONFIG_ACPI_SLEEP > >> > @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) > >> > * object can also be evaluated when the system enters S5. > >> > */ > >> > register_reboot_notifier(&tts_notifier); > >> > + > >> > + /* > >> > + * According to section 7.5 of acpi 6.0 spec, _PTS should run > after > >> > + * _TTS when the system enters S5. > >> > + */ > >> > + register_reboot_notifier(&pts_notifier); > >> > >> Why do you have to add a second notifier? > >> > >> Why can't _TTS and _PTS be evaluated from one notifier? > >> > > If execute _PTS method in tts_notify_reboot(), then it would break > > definition of tts_notify_reboot(). > > What exactly would it break? > > > My intention is to keep new codes > > has limited impact on existed codes. > > Even if that makes a little sense? > > > Of course, it's possible to merge _TTS and _PTS into one unified notifier. > > The advantage is more actions could be added into the unified notifier > in future. > > Which way you prefer? > > I would just use one notifier. I follow you. > > Thanks, > Rafael
On Friday, June 24, 2016 02:59:24 AM Ocean HY1 He wrote: > > Regards, > Ocean He > SW Development Dept. > Beijing Design Center > Enterprise Product Group > Mobile: 18911778926 > E-mail: hehy1@lenovo.com > No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > > > > -----Original Message----- > > From: rjwysocki@gmail.com [mailto:rjwysocki@gmail.com] On Behalf Of > > Rafael J. Wysocki > > Sent: Thursday, June 23, 2016 9:13 PM > > To: Ocean HY1 He > > Cc: Rafael J. Wysocki; lenb@kernel.org; linux-acpi@vger.kernel.org; > > linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > > Subject: Re: [PATCH] ACPI: Execute the _PTS method when system reboot > > > > On Thu, Jun 23, 2016 at 2:55 PM, Ocean HY1 He <hehy1@lenovo.com> > > wrote: > > > Hi Rafael, > > > Please see my reply in below. > > > > > > Regards, > > > Ocean He > > > SW Development Dept. > > > Beijing Design Center > > > Enterprise Product Group > > > Mobile: 18911778926 > > > E-mail: hehy1@lenovo.com > > > No.6 Chuang Ye Road, Haidian District, Beijing, China 100085 > > > > > >> -----Original Message----- > > >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net] > > >> Sent: Wednesday, June 22, 2016 7:56 AM > > >> To: Ocean HY1 He > > >> Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; > > >> linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar > > >> Subject: Re: [PATCH] ACPI: Execute the _PTS method when system > > reboot > > >> > > >> On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote: > > >> > The _PTS control method is defined in the section 7.4.1 of acpi 6.0 > > >> > spec. The _PTS control method is executed by the OS during the sleep > > >> > transition process for S1, S2, S3, S4, and for orderly S5 shutdown. > > >> > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5 > > >> > soft-off state) is passed to the _PTS control method. This method > > >> > is called after OSPM has notified native device drivers of the sleep > > >> > state transition and before the OSPM has had a chance to fully > > >> > prepare the system for a sleep state transition. > > >> > > > >> > The _PTS control method provides the BIOS a mechanism for > > performing > > >> > some housekeeping, such as writing the sleep type value to the > > >> embedded > > >> > controller, before entering the system sleeping state. > > >> > > > >> > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS. > > >> > > > >> > Thus, a _PTS block notifier is added to the reboot notifier list so that > > >> > the _PTS object will also be evaluated when the system reboot. > > >> > > >> So I understand why it may be necessary to evaluate _PTS before > > entering > > >> S5, > > >> but I'm totally unsure about reboot. > > >> > > >> What does reboot have to do with S5? > > >> > > > In ACPI spec, there is no explicit words saying _PTS should be > > > executed when reboot. But reboot could be equal to the > > > process S0->S5->S0. > > > > Not in general. > > > > In particular, wakeup devices that would be set up for S5 need not be > > set up for that. Also the mechanism by which transitions to S5 are > > entered is different from the reboot one, at least from the OS > > perspective. > > > > > Thus _PTS should be executed when reboot. > > > > No, it doesn't follow. > > > > > I am thinking this is the same as _TTS. In ACPI spec, there is also > > > no explicit words saying _TTS should be executed when reboot. > > > But kernel executes _TTS when reboot indeed. > > > > Yes, it does. Maybe it shouldn't? > > > > It may not hurt to call _PTS before reboot too, but is it guaranteed > > to work across the board on all systems everywhere? > > > I try to clarify the key point of this case: does devices should go to S5(shutdown) when reboot? > > I think the answer is yes. > And It has no hurt to let devices go to S5 before reboot is invoked, here is the reasons: S5 is a platform (system) state, not a device state. You seem to be confusing platforms with devices. > #1 The new _PTS codes block nothing thus reboot can be guaranteed to be invoked eventually. > #2. Devices are mandatory to support S5 state, this means go to S5 could be a safe trip. > #3 Reboot would cause devices re-initialization from the scratch. > > What's your decision then? ;-) I guess you can argue that since _TTS is already executed in the reboot path, it might be good to execute _PTS in that path too and that might help to avoid issues in some cases. That is a reasonable argument, but then there still is the question if that is not going to break anything. I guess that cannot be answered without trying, so the simplest patch would be to add a _PTS evaulation to the existing notifier (and maybe change the notifiers name to reflect the fact that it's not for _TTS ony any more). Thanks, Rafael -- 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
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 2a8b596..8b290fb 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = { .priority = 0, }; +static int pts_notify_reboot(struct notifier_block *this, + unsigned long code, void *x) +{ + acpi_status status; + + status = acpi_execute_simple_method(NULL, "\\_PTS", ACPI_STATE_S5); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + /* It won't break anything. */ + printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); + } + + return NOTIFY_DONE; +} + +static struct notifier_block pts_notifier = { + .notifier_call = pts_notify_reboot, + .next = NULL, + .priority = 0, +}; + static int acpi_sleep_prepare(u32 acpi_state) { #ifdef CONFIG_ACPI_SLEEP @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void) * object can also be evaluated when the system enters S5. */ register_reboot_notifier(&tts_notifier); + + /* + * According to section 7.5 of acpi 6.0 spec, _PTS should run after + * _TTS when the system enters S5. + */ + register_reboot_notifier(&pts_notifier); + return 0; }