From 0536efd5f7a423cb6f3c5c06c3095de8a0f2a941 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 7 Mar 2012 08:00:22 +0100 Subject: [PATCH 08/12] suspend: make acpi timer wakeup the guest. RH-Author: Gerd Hoffmann Message-id: <1331107226-21901-9-git-send-email-kraxel@redhat.com> Patchwork-id: 38362 O-Subject: [RHEL-6.3 qemu-kvm PATCH v3 08/12] suspend: make acpi timer wakeup the guest. Bugzilla: 766303 RH-Acked-by: Paolo Bonzini RH-Acked-by: Gleb Natapov RH-Acked-by: Alex Williamson Make the acpi timer wake up the guest. Guests can enable/disable this via acpi too. Signed-off-by: Gerd Hoffmann upstream: 6595abc04486ef9694b8717b8eea43ccb990bff9 --- hw/acpi.c | 6 ++++++ sysemu.h | 1 + 2 files changed, 7 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- hw/acpi.c | 6 ++++++ sysemu.h | 1 + 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/hw/acpi.c b/hw/acpi.c index 19d7c7a..6c5f3a6 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -84,6 +84,7 @@ typedef struct PIIX4PMState { #define RSM_STS (1 << 15) #define RTC_STS (1 << 10) #define PWRBTN_STS (1 << 8) +#define TMROF_STS (1 << 0) #define RTC_EN (1 << 10) #define PWRBTN_EN (1 << 8) #define GBL_EN (1 << 5) @@ -144,6 +145,7 @@ static void pm_update_sci(PIIX4PMState *s) static void pm_tmr_timer(void *opaque) { PIIX4PMState *s = opaque; + qemu_system_wakeup_request(QEMU_WAKEUP_REASON_PMTIMER); pm_update_sci(s); } @@ -156,6 +158,9 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data) case QEMU_WAKEUP_REASON_RTC: s->pmsts |= (RSM_STS | RTC_STS); break; + case QEMU_WAKEUP_REASON_PMTIMER: + s->pmsts |= (RSM_STS | TMROF_STS); + break; case QEMU_WAKEUP_REASON_OTHER: default: /* RSM_STS should be set on resume. Pretend that resume @@ -188,6 +193,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val) case 0x02: s->pmen = val; qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC, val & RTC_EN); + qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_PMTIMER, val & TMROF_EN); pm_update_sci(s); break; case 0x04: diff --git a/sysemu.h b/sysemu.h index 770c69b..43de0f7 100644 --- a/sysemu.h +++ b/sysemu.h @@ -70,6 +70,7 @@ void cpu_disable_ticks(void); typedef enum WakeupReason { QEMU_WAKEUP_REASON_OTHER = 0, QEMU_WAKEUP_REASON_RTC, + QEMU_WAKEUP_REASON_PMTIMER, } WakeupReason; void qemu_system_reset_request(void); -- 1.7.7.6