From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvTsL-0008Qj-V8 for qemu-devel@nongnu.org; Thu, 09 Feb 2012 08:17:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvTsG-0002qi-22 for qemu-devel@nongnu.org; Thu, 09 Feb 2012 08:17:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvTsF-0002qY-OP for qemu-devel@nongnu.org; Thu, 09 Feb 2012 08:17:20 -0500 Date: Thu, 9 Feb 2012 15:17:14 +0200 From: Gleb Natapov Message-ID: <20120209131714.GM18866@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> <4F33C00F.7040408@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F33C00F.7040408@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org On Thu, Feb 09, 2012 at 01:46:07PM +0100, Gerd Hoffmann wrote: > 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. > We can start from that. But other devices can use STS/EN registers from different GPEs, so they will have same "reason" bit, but in different registers. Also I'd rather hide this logic in ACPI code instead of having it in vl.c. > thanks, > Gerd > > 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); -- Gleb. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v3 1/6] suspend: add infrastructure Date: Thu, 9 Feb 2012 15:17:14 +0200 Message-ID: <20120209131714.GM18866@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> <4F33C00F.7040408@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <4F33C00F.7040408@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: Gerd Hoffmann Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org List-Id: xen-devel@lists.xenproject.org On Thu, Feb 09, 2012 at 01:46:07PM +0100, Gerd Hoffmann wrote: > 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. > We can start from that. But other devices can use STS/EN registers from different GPEs, so they will have same "reason" bit, but in different registers. Also I'd rather hide this logic in ACPI code instead of having it in vl.c. > thanks, > Gerd > > 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); -- Gleb.