From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvTOB-00075u-Mw for qemu-devel@nongnu.org; Thu, 09 Feb 2012 07:46:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvTOA-0003Q1-KR for qemu-devel@nongnu.org; Thu, 09 Feb 2012 07:46:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvTOA-0003Pg-Dl for qemu-devel@nongnu.org; Thu, 09 Feb 2012 07:46:14 -0500 Message-ID: <4F33C00F.7040408@redhat.com> Date: Thu, 09 Feb 2012 13:46:07 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <1328698819-31269-1-git-send-email-kraxel@redhat.com> <1328698819-31269-2-git-send-email-kraxel@redhat.com> <20120209084816.GB18866@redhat.com> <4F33A3C1.1080108@redhat.com> <20120209111928.GH18866@redhat.com> <4F33B5E7.7070502@redhat.com> <20120209123725.GK18866@redhat.com> In-Reply-To: <20120209123725.GK18866@redhat.com> Content-Type: multipart/mixed; boundary="------------060700010606030002030902" Subject: Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060700010606030002030902 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, >> Incremental patch (just infrastructure, no acpi windup yet) attached. >> Something like this? >> > We need to give ACPI ability to prevent wakeup. So, for instance, if RTC > alarm calls wakeup but ACPI detects that RTC_EN is cleared it can > prevent it. Yea, already figured that after reading your rtc reply ... One more incremental attached for review. thanks, Gerd --------------060700010606030002030902 Content-Type: text/plain; name="wakeup-reason-2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="wakeup-reason-2.diff" commit ef93688e70bf11313ec89c7e609fc142259dfd74 Author: Gerd Hoffmann Date: Thu Feb 9 13:44:37 2012 +0100 enable/disable reasons diff --git a/sysemu.h b/sysemu.h index e7060aa..781bdaf 100644 --- a/sysemu.h +++ b/sysemu.h @@ -47,6 +47,7 @@ void qemu_system_reset_request(void); void qemu_system_suspend_request(void); void qemu_register_suspend_notifier(Notifier *notifier); void qemu_system_wakeup_request(WakeupReason reason); +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); void qemu_register_wakeup_notifier(Notifier *notifier); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); diff --git a/vl.c b/vl.c index 17d4b72..1feac41 100644 --- a/vl.c +++ b/vl.c @@ -1288,6 +1288,7 @@ static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); +static uint32_t wakeup_reason_mask; static RunState vmstop_requested = RUN_STATE_MAX; int qemu_shutdown_requested_get(void) @@ -1423,12 +1424,24 @@ void qemu_system_wakeup_request(WakeupReason reason) if (!is_suspended) { return; } + if (!(wakeup_reason_mask & (1 << reason))) { + return; + } notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; qemu_notify_event(); is_suspended = false; } +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled) +{ + if (enabled) { + wakeup_reason_mask |= (1 << reason); + } else { + wakeup_reason_mask &= ~(1 << reason); + } +} + void qemu_register_wakeup_notifier(Notifier *notifier) { notifier_list_add(&wakeup_notifiers, notifier); --------------060700010606030002030902-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [PATCH v3 1/6] suspend: add infrastructure Date: Thu, 09 Feb 2012 13:46:07 +0100 Message-ID: <4F33C00F.7040408@redhat.com> References: <1328698819-31269-1-git-send-email-kraxel@redhat.com> <1328698819-31269-2-git-send-email-kraxel@redhat.com> <20120209084816.GB18866@redhat.com> <4F33A3C1.1080108@redhat.com> <20120209111928.GH18866@redhat.com> <4F33B5E7.7070502@redhat.com> <20120209123725.GK18866@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060700010606030002030902" Return-path: In-Reply-To: <20120209123725.GK18866@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Gleb Natapov Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------060700010606030002030902 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, >> Incremental patch (just infrastructure, no acpi windup yet) attached. >> Something like this? >> > We need to give ACPI ability to prevent wakeup. So, for instance, if RTC > alarm calls wakeup but ACPI detects that RTC_EN is cleared it can > prevent it. Yea, already figured that after reading your rtc reply ... One more incremental attached for review. thanks, Gerd --------------060700010606030002030902 Content-Type: text/plain; name="wakeup-reason-2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="wakeup-reason-2.diff" commit ef93688e70bf11313ec89c7e609fc142259dfd74 Author: Gerd Hoffmann Date: Thu Feb 9 13:44:37 2012 +0100 enable/disable reasons diff --git a/sysemu.h b/sysemu.h index e7060aa..781bdaf 100644 --- a/sysemu.h +++ b/sysemu.h @@ -47,6 +47,7 @@ void qemu_system_reset_request(void); void qemu_system_suspend_request(void); void qemu_register_suspend_notifier(Notifier *notifier); void qemu_system_wakeup_request(WakeupReason reason); +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); void qemu_register_wakeup_notifier(Notifier *notifier); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); diff --git a/vl.c b/vl.c index 17d4b72..1feac41 100644 --- a/vl.c +++ b/vl.c @@ -1288,6 +1288,7 @@ static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); +static uint32_t wakeup_reason_mask; static RunState vmstop_requested = RUN_STATE_MAX; int qemu_shutdown_requested_get(void) @@ -1423,12 +1424,24 @@ void qemu_system_wakeup_request(WakeupReason reason) if (!is_suspended) { return; } + if (!(wakeup_reason_mask & (1 << reason))) { + return; + } notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; qemu_notify_event(); is_suspended = false; } +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled) +{ + if (enabled) { + wakeup_reason_mask |= (1 << reason); + } else { + wakeup_reason_mask &= ~(1 << reason); + } +} + void qemu_register_wakeup_notifier(Notifier *notifier) { notifier_list_add(&wakeup_notifiers, notifier); --------------060700010606030002030902--