From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426AbcFWM4x (ORCPT ); Thu, 23 Jun 2016 08:56:53 -0400 Received: from mail1.bemta12.messagelabs.com ([216.82.251.8]:46574 "EHLO mail1.bemta12.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018AbcFWM4u (ORCPT ); Thu, 23 Jun 2016 08:56:50 -0400 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjleJIrShJLcpLzFFi42JJl3vhrttyJzv c4ORZQYudD9+yWSzf189ocXnXHDaLM6cvsTqweGxa1cnmseVqO4vH501yAcxRrJl5SfkVCawZ Pf+7mAp26FY8O3iLqYHxjU4XIxeHkMBNRol9c08zdjFyAjkLGCV+3rIAsdkEVCVurn7FCmKLC GhLzO05xQzSwCzwjVHiasM8ZpCEsICrxJf9q9kgitwkns6eCWUbSUzcdxdsKAvQoDmff4DZvA I+EvNvfmOBWJYq8eVwD1Ccg4NTwEDieZcRSJhRQFZi2qP7TCA2s4C4xNxps8BukBAQkFiy5zw zhC0q8fLxP1aQVgkBeYktswRBTGYBTYn1u/QhOhUlpnQ/ZIdYKihxcuYTlgmMIrOQDJ2F0DEL SccsJB0LGFlWMaoXpxaVpRbpGuolFWWmZ5TkJmbm6BoaGunlphYXJ6an5iQmFesl5+duYgTGD wMQ7GA83ul8iFGSg0lJlJdxc3a4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQlezdtAOcGi1PTUir TMHGAkw6QlOHiURHhzQNK8xQWJucWZ6RCpU4yKUuK8CSAJAZBERmkeXBsseVxilJUS5mUEOkS IpyC1KDezBFX+FaM4B6OSMG8iyBSezLwSuOmvgBYzAS2+2w+2uCQRISXVwGhS0P57y/4piX/W nt/PuGBxyvrEFdymDt6RrFd3KuT4Sv5rFOQ7+dm62m3Sfe+z8ocPveeTf126U5772HLT6Cf6e 2vfL318K/NxuKyMt/b21e4Z3/2f3A7S01E3d75XsMv7LquD+m/tasskvT0H3kRf473I/fCzqY G87MyDXTEaWq3q/j1T7JRYijMSDbWYi4oTARX/0Y4ZAwAA X-Env-Sender: hehy1@lenovo.com X-Msg-Ref: server-13.tower-168.messagelabs.com!1466686594!27991885!1 X-Originating-IP: [103.30.232.71] X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked From: Ocean HY1 He To: "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 Thread-Topic: [PATCH] ACPI: Execute the _PTS method when system reboot Thread-Index: AQHRzBfzWO0WEN7pKkCJgcCagKBiSp/2/IJg Date: Thu, 23 Jun 2016 12:55:54 +0000 Message-ID: References: <1462772495-71113-1-git-send-email-hehy1@lenovo.com> <2611430.1T9CgX71hW@vostro.rjw.lan> In-Reply-To: <2611430.1T9CgX71hW@vostro.rjw.lan> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.96.19.89] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u5NCuvUt018497 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 > > Signed-off-by: Nagananda Chumbalkar > > --- > > 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