[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure
From: |
Gleb Natapov |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure |
Date: |
Thu, 9 Feb 2012 15:17:14 +0200 |
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 <address@hidden>
> 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.
- Re: [Qemu-devel] [PATCH v3 2/6] suspend: switch acpi s3 to new infrastructure., (continued)
[Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gerd Hoffmann, 2012/02/08
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gleb Natapov, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gerd Hoffmann, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gleb Natapov, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gerd Hoffmann, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gleb Natapov, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gerd Hoffmann, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure,
Gleb Natapov <=
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gerd Hoffmann, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gerd Hoffmann, 2012/02/09
- Re: [Qemu-devel] [PATCH v3 1/6] suspend: add infrastructure, Gleb Natapov, 2012/02/09
[Qemu-devel] [PATCH v3 5/6] suspend: make serial ports wakeup the guest., Gerd Hoffmann, 2012/02/08
[Qemu-devel] [PATCH v3 3/6] suspend: add system_wakeup monitor command, Gerd Hoffmann, 2012/02/08