Skip to contentSkip to conversation

initial suspend support

PATCH Superseded Gerd Hoffmann 4 participants 21 messages Feb 15, 2012 – Feb 22, 2012

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover initial suspend support

Hi,

Next and hopefully final suspend support patch series. It makes s3 support alot more useful by leaving guests actually suspended and allowing them to be woken up by certain events, with ps/2 keyboard input (wakeup-by-tap-enter) and real time clock (see 'man rtcwake') being the most useful ones.

ACPI integration is there, so the guest can enable/disable wakeup events like it is done on real hardware. The patch series also features some acpi cleanups which where needed to get this done.

QMP support is there, which consists of qmp events which are sent out on suspend and wakeup and a monitor command to wakeup a suspended guest.

cheers,
Gerd

The following changes since commit 59f971d451fbabee3194bb565f40846398ee6e6f:

qdev: print error message before aborting (2012-02-14 18:57:33 +0000)

are available in the git repository at:
git://git.kraxel.org/qemu suspend.1

Gerd Hoffmann (12):
acpi: move around structs
acpi: add ACPIREGS
acpi: don't pass overflow_time to acpi_pm1_evt_get_sts
acpi: add acpi_pm1_evt_write_en
suspend: add infrastructure
suspend: switch acpi s3 to new infrastructure.
suspend: add system_wakeup monitor command
suspend: make ps/2 devices wakeup the guest
suspend: make serial ports wakeup the guest.
suspend: make rtc alarm wakeup the guest.
suspend: make acpi timer wakeup the guest.
suspend: add qmp events

 hmp-commands.hx  |   14 +++++
 hmp.c            |    5 ++
 hmp.h            |    1 +
 hw/acpi.c        |  172 +++++++++++++++++++++++++++++++-----------------------
 hw/acpi.h        |   93 ++++++++++++++++-------------
 hw/acpi_piix4.c  |   70 ++++++++++------------
 hw/mc146818rtc.c |   13 ++++
 hw/mips_malta.c  |    2 +-
 hw/pc.c          |   11 ----
 hw/pc.h          |    3 +-
 hw/pc_piix.c     |    8 +--
 hw/ps2.c         |    6 ++
 hw/serial.c      |    6 ++
 hw/vt82c686.c    |   42 ++++++-------
 monitor.c        |    6 ++
 monitor.h        |    2 +
 qapi-schema.json |   11 ++++
 qmp-commands.hx  |   21 +++++++
 qmp.c            |    5 ++
 sysemu.h         |   11 ++++
 vl.c             |   82 ++++++++++++++++++++++++++
 xen-all.c        |   11 ++--
 22 files changed, 396 insertions(+), 199 deletions(-)
#1 lore raw

PATCH v5 1/12 acpi: move around structs

Group all structs at the top of hw/acpi.h.
Just moving around lines, no code changes.

---
 hw/acpi.h |   48 +++++++++++++++++++++++-------------------------
 1 files changed, 23 insertions(+), 25 deletions(-)
hw/acpi.h +23 -25
index c141e65..5c43b7d 100644
@@ -73,9 +73,11 @@
 /* PM2_CNT */
 #define ACPI_BITMASK_ARB_DISABLE                0x0001
 
-/* PM_TMR */
-struct ACPIPMTimer;
+/* structs */
 typedef struct ACPIPMTimer ACPIPMTimer;
+typedef struct ACPIPM1EVT ACPIPM1EVT;
+typedef struct ACPIPM1CNT ACPIPM1CNT;
+typedef struct ACPIGPE ACPIGPE;
 
 typedef void (*acpi_update_sci_fn)(ACPIPMTimer *tmr);
 
@@ -86,6 +88,25 @@ struct ACPIPMTimer {
     acpi_update_sci_fn update_sci;
 };
 
+struct ACPIPM1EVT {
+    uint16_t sts;
+    uint16_t en;
+};
+
+struct ACPIPM1CNT {
+    uint16_t cnt;
+    qemu_irq cmos_s3;
+};
+
+struct ACPIGPE {
+    uint32_t blk;
+    uint8_t len;
+
+    uint8_t *sts;
+    uint8_t *en;
+};
+
+/* PM_TMR */
 void acpi_pm_tmr_update(ACPIPMTimer *tmr, bool enable);
 void acpi_pm_tmr_calc_overflow_time(ACPIPMTimer *tmr);
 uint32_t acpi_pm_tmr_get(ACPIPMTimer *tmr);
@@ -100,26 +121,12 @@ static inline int64_t acpi_pm_tmr_get_clock(void)
 }
 
 /* PM1a_EVT: piix and ich9 don't implement PM1b. */
-struct ACPIPM1EVT
-{
-    uint16_t sts;
-    uint16_t en;
-};
-typedef struct ACPIPM1EVT ACPIPM1EVT;
-
 uint16_t acpi_pm1_evt_get_sts(ACPIPM1EVT *pm1, int64_t overflow_time);
 void acpi_pm1_evt_write_sts(ACPIPM1EVT *pm1, ACPIPMTimer *tmr, uint16_t val);
 void acpi_pm1_evt_power_down(ACPIPM1EVT *pm1, ACPIPMTimer *tmr);
 void acpi_pm1_evt_reset(ACPIPM1EVT *pm1);
 
 /* PM1a_CNT: piix and ich9 don't implement PM1b CNT. */
-struct ACPIPM1CNT {
-    uint16_t cnt;
-
-    qemu_irq cmos_s3;
-};
-typedef struct ACPIPM1CNT ACPIPM1CNT;
-
 void acpi_pm1_cnt_init(ACPIPM1CNT *pm1_cnt, qemu_irq cmos_s3);
 void acpi_pm1_cnt_write(ACPIPM1EVT *pm1a, ACPIPM1CNT *pm1_cnt, uint16_t val);
 void acpi_pm1_cnt_update(ACPIPM1CNT *pm1_cnt,
@@ -127,15 +134,6 @@ void acpi_pm1_cnt_update(ACPIPM1CNT *pm1_cnt,
 void acpi_pm1_cnt_reset(ACPIPM1CNT *pm1_cnt);
 
 /* GPE0 */
-struct ACPIGPE {
-    uint32_t blk;
-    uint8_t len;
-
-    uint8_t *sts;
-    uint8_t *en;
-};
-typedef struct ACPIGPE ACPIGPE;
-
 void acpi_gpe_init(ACPIGPE *gpe, uint8_t len);
 void acpi_gpe_blk(ACPIGPE *gpe, uint32_t blk);
 void acpi_gpe_reset(ACPIGPE *gpe);
Signature · 1 line
1.7.1
#2 lore raw

PATCH v5 2/12 acpi: add ACPIREGS

In reply to Gerd Hoffmann

All those acpi structs are not independent from each other. Various acpi functions expecting multiple acpi structs passed in are a clean indicator for that ;)

So this patch bundles all acpi structs in the new ACPIREGS struct, then use it everythere pass around acpi state.

---
 hw/acpi.c       |  130 +++++++++++++++++++++++++++----------------------------
 hw/acpi.h       |   48 ++++++++++++--------
 hw/acpi_piix4.c |   68 +++++++++++++---------------
 hw/vt82c686.c   |   42 ++++++++---------
 4 files changed, 145 insertions(+), 143 deletions(-)
hw/acpi.c +64 -66
index 79b179b..1922e53 100644
@@ -249,63 +249,61 @@ int acpi_table_add(const char *t)
 }
 
 /* ACPI PM1a EVT */
-uint16_t acpi_pm1_evt_get_sts(ACPIPM1EVT *pm1, int64_t overflow_time)
+uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar, int64_t overflow_time)
 {
     int64_t d = acpi_pm_tmr_get_clock();
     if (d >= overflow_time) {
-        pm1->sts |= ACPI_BITMASK_TIMER_STATUS;
+        ar->pm1.evt.sts |= ACPI_BITMASK_TIMER_STATUS;
     }
-    return pm1->sts;
+    return ar->pm1.evt.sts;
 }
 
-void acpi_pm1_evt_write_sts(ACPIPM1EVT *pm1, ACPIPMTimer *tmr, uint16_t val)
+void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val)
 {
-    uint16_t pm1_sts = acpi_pm1_evt_get_sts(pm1, tmr->overflow_time);
+    uint16_t pm1_sts = acpi_pm1_evt_get_sts(ar, ar->tmr.overflow_time);
     if (pm1_sts & val & ACPI_BITMASK_TIMER_STATUS) {
         /* if TMRSTS is reset, then compute the new overflow time */
-        acpi_pm_tmr_calc_overflow_time(tmr);
+        acpi_pm_tmr_calc_overflow_time(ar);
     }
-    pm1->sts &= ~val;
+    ar->pm1.evt.sts &= ~val;
 }
 
-void acpi_pm1_evt_power_down(ACPIPM1EVT *pm1, ACPIPMTimer *tmr)
+void acpi_pm1_evt_power_down(ACPIREGS *ar)
 {
-    if (!pm1) {
-        qemu_system_shutdown_request();
-    } else if (pm1->en & ACPI_BITMASK_POWER_BUTTON_ENABLE) {
-        pm1->sts |= ACPI_BITMASK_POWER_BUTTON_STATUS;
-        tmr->update_sci(tmr);
+    if (ar->pm1.evt.en & ACPI_BITMASK_POWER_BUTTON_ENABLE) {
+        ar->pm1.evt.sts |= ACPI_BITMASK_POWER_BUTTON_STATUS;
+        ar->tmr.update_sci(ar);
     }
 }
 
-void acpi_pm1_evt_reset(ACPIPM1EVT *pm1)
+void acpi_pm1_evt_reset(ACPIREGS *ar)
 {
-    pm1->sts = 0;
-    pm1->en = 0;
+    ar->pm1.evt.sts = 0;
+    ar->pm1.evt.en = 0;
 }
 
 /* ACPI PM_TMR */
-void acpi_pm_tmr_update(ACPIPMTimer *tmr, bool enable)
+void acpi_pm_tmr_update(ACPIREGS *ar, bool enable)
 {
     int64_t expire_time;
 
     /* schedule a timer interruption if needed */
     if (enable) {
-        expire_time = muldiv64(tmr->overflow_time, get_ticks_per_sec(),
+        expire_time = muldiv64(ar->tmr.overflow_time, get_ticks_per_sec(),
                                PM_TIMER_FREQUENCY);
-        qemu_mod_timer(tmr->timer, expire_time);
+        qemu_mod_timer(ar->tmr.timer, expire_time);
     } else {
-        qemu_del_timer(tmr->timer);
+        qemu_del_timer(ar->tmr.timer);
     }
 }
 
-void acpi_pm_tmr_calc_overflow_time(ACPIPMTimer *tmr)
+void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar)
 {
     int64_t d = acpi_pm_tmr_get_clock();
-    tmr->overflow_time = (d + 0x800000LL) & ~0x7fffffLL;
+    ar->tmr.overflow_time = (d + 0x800000LL) & ~0x7fffffLL;
 }
 
-uint32_t acpi_pm_tmr_get(ACPIPMTimer *tmr)
+uint32_t acpi_pm_tmr_get(ACPIREGS *ar)
 {
     uint32_t d = acpi_pm_tmr_get_clock();
     return d & 0xffffff;
@@ -313,31 +311,31 @@ uint32_t acpi_pm_tmr_get(ACPIPMTimer *tmr)
 
 static void acpi_pm_tmr_timer(void *opaque)
 {
-    ACPIPMTimer *tmr = opaque;
-    tmr->update_sci(tmr);
+    ACPIREGS *ar = opaque;
+    ar->tmr.update_sci(ar);
 }
 
-void acpi_pm_tmr_init(ACPIPMTimer *tmr, acpi_update_sci_fn update_sci)
+void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci)
 {
-    tmr->update_sci = update_sci;
-    tmr->timer = qemu_new_timer_ns(vm_clock, acpi_pm_tmr_timer, tmr);
+    ar->tmr.update_sci = update_sci;
+    ar->tmr.timer = qemu_new_timer_ns(vm_clock, acpi_pm_tmr_timer, ar);
 }
 
-void acpi_pm_tmr_reset(ACPIPMTimer *tmr)
+void acpi_pm_tmr_reset(ACPIREGS *ar)
 {
-    tmr->overflow_time = 0;
-    qemu_del_timer(tmr->timer);
+    ar->tmr.overflow_time = 0;
+    qemu_del_timer(ar->tmr.timer);
 }
 
 /* ACPI PM1aCNT */
-void acpi_pm1_cnt_init(ACPIPM1CNT *pm1_cnt, qemu_irq cmos_s3)
+void acpi_pm1_cnt_init(ACPIREGS *ar, qemu_irq cmos_s3)
 {
-    pm1_cnt->cmos_s3 = cmos_s3;
+    ar->pm1.cnt.cmos_s3 = cmos_s3;
 }
 
-void acpi_pm1_cnt_write(ACPIPM1EVT *pm1a, ACPIPM1CNT *pm1_cnt, uint16_t val)
+void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
 {
-    pm1_cnt->cnt = val & ~(ACPI_BITMASK_SLEEP_ENABLE);
+    ar->pm1.cnt.cnt = val & ~(ACPI_BITMASK_SLEEP_ENABLE);
 
     if (val & ACPI_BITMASK_SLEEP_ENABLE) {
         /* change suspend type */
@@ -349,62 +347,62 @@ void acpi_pm1_cnt_write(ACPIPM1EVT *pm1a, ACPIPM1CNT *pm1_cnt, uint16_t val)
         case 1:
             /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
                Pretend that resume was caused by power button */
-            pm1a->sts |=
+            ar->pm1.evt.sts |=
                 (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);
             qemu_system_reset_request();
-            qemu_irq_raise(pm1_cnt->cmos_s3);
+            qemu_irq_raise(ar->pm1.cnt.cmos_s3);
         default:
             break;
         }
     }
 }
 
-void acpi_pm1_cnt_update(ACPIPM1CNT *pm1_cnt,
+void acpi_pm1_cnt_update(ACPIREGS *ar,
                          bool sci_enable, bool sci_disable)
 {
     /* ACPI specs 3.0, 4.7.2.5 */
     if (sci_enable) {
-        pm1_cnt->cnt |= ACPI_BITMASK_SCI_ENABLE;
+        ar->pm1.cnt.cnt |= ACPI_BITMASK_SCI_ENABLE;
     } else if (sci_disable) {
-        pm1_cnt->cnt &= ~ACPI_BITMASK_SCI_ENABLE;
+        ar->pm1.cnt.cnt &= ~ACPI_BITMASK_SCI_ENABLE;
     }
 }
 
-void acpi_pm1_cnt_reset(ACPIPM1CNT *pm1_cnt)
+void acpi_pm1_cnt_reset(ACPIREGS *ar)
 {
-    pm1_cnt->cnt = 0;
-    if (pm1_cnt->cmos_s3) {
-        qemu_irq_lower(pm1_cnt->cmos_s3);
+    ar->pm1.cnt.cnt = 0;
+    if (ar->pm1.cnt.cmos_s3) {
+        qemu_irq_lower(ar->pm1.cnt.cmos_s3);
     }
 }
 
 /* ACPI GPE */
-void acpi_gpe_init(ACPIGPE *gpe, uint8_t len)
+void acpi_gpe_init(ACPIREGS *ar, uint8_t len)
 {
-    gpe->len = len;
-    gpe->sts = g_malloc0(len / 2);
-    gpe->en = g_malloc0(len / 2);
+    ar->gpe.len = len;
+    ar->gpe.sts = g_malloc0(len / 2);
+    ar->gpe.en = g_malloc0(len / 2);
 }
 
-void acpi_gpe_blk(ACPIGPE *gpe, uint32_t blk)
+void acpi_gpe_blk(ACPIREGS *ar, uint32_t blk)
 {
-    gpe->blk = blk;
+    ar->gpe.blk = blk;
 }
 
-void acpi_gpe_reset(ACPIGPE *gpe)
+void acpi_gpe_reset(ACPIREGS *ar)
 {
-    memset(gpe->sts, 0, gpe->len / 2);
-    memset(gpe->en, 0, gpe->len / 2);
+    memset(ar->gpe.sts, 0, ar->gpe.len / 2);
+    memset(ar->gpe.en, 0, ar->gpe.len / 2);
 }
 
-static uint8_t *acpi_gpe_ioport_get_ptr(ACPIGPE *gpe, uint32_t addr)
+static uint8_t *acpi_gpe_ioport_get_ptr(ACPIREGS *ar, uint32_t addr)
 {
     uint8_t *cur = NULL;
 
-    if (addr < gpe->len / 2) {
-        cur = gpe->sts + addr;
-    } else if (addr < gpe->len) {
-        cur = gpe->en + addr - gpe->len / 2;
+    if (addr < ar->gpe.len / 2) {
+        cur = ar->gpe.sts + addr;
+    } else if (addr < ar->gpe.len) {
+        cur = ar->gpe.en + addr - ar->gpe.len / 2;
     } else {
         abort();
     }
@@ -412,16 +410,16 @@ static uint8_t *acpi_gpe_ioport_get_ptr(ACPIGPE *gpe, uint32_t addr)
     return cur;
 }
 
-void acpi_gpe_ioport_writeb(ACPIGPE *gpe, uint32_t addr, uint32_t val)
+void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val)
 {
     uint8_t *cur;
 
-    addr -= gpe->blk;
-    cur = acpi_gpe_ioport_get_ptr(gpe, addr);
-    if (addr < gpe->len / 2) {
+    addr -= ar->gpe.blk;
+    cur = acpi_gpe_ioport_get_ptr(ar, addr);
+    if (addr < ar->gpe.len / 2) {
         /* GPE_STS */
         *cur = (*cur) & ~val;
-    } else if (addr < gpe->len) {
+    } else if (addr < ar->gpe.len) {
         /* GPE_EN */
         *cur = val;
     } else {
@@ -429,13 +427,13 @@ void acpi_gpe_ioport_writeb(ACPIGPE *gpe, uint32_t addr, uint32_t val)
     }
 }
 
-uint32_t acpi_gpe_ioport_readb(ACPIGPE *gpe, uint32_t addr)
+uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
 {
     uint8_t *cur;
     uint32_t val;
 
-    addr -= gpe->blk;
-    cur = acpi_gpe_ioport_get_ptr(gpe, addr);
+    addr -= ar->gpe.blk;
+    cur = acpi_gpe_ioport_get_ptr(ar, addr);
     val = 0;
     if (cur != NULL) {
         val = *cur;
hw/acpi.h +29 -19

73 lines not on this page · raw message

hw/acpi_piix4.c +32 -36

185 lines not on this page · raw message

hw/vt82c686.c +20 -22

106 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH v5 3/12 acpi: don't pass overflow_time to acpi_pm1_evt_get_sts

In reply to Gerd Hoffmann

Pretty pointless, can easily be reached via ACPIREGS now.

---
 hw/acpi.c       |    6 +++---
 hw/acpi.h       |    2 +-
 hw/acpi_piix4.c |    4 ++--
 hw/vt82c686.c   |    4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
hw/acpi.c +3 -3
index 1922e53..1129335 100644
@@ -249,10 +249,10 @@ int acpi_table_add(const char *t)
 }
 
 /* ACPI PM1a EVT */
-uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar, int64_t overflow_time)
+uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar)
 {
     int64_t d = acpi_pm_tmr_get_clock();
-    if (d >= overflow_time) {
+    if (d >= ar->tmr.overflow_time) {
         ar->pm1.evt.sts |= ACPI_BITMASK_TIMER_STATUS;
     }
     return ar->pm1.evt.sts;
@@ -260,7 +260,7 @@ uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar, int64_t overflow_time)
 
 void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val)
 {
-    uint16_t pm1_sts = acpi_pm1_evt_get_sts(ar, ar->tmr.overflow_time);
+    uint16_t pm1_sts = acpi_pm1_evt_get_sts(ar);
     if (pm1_sts & val & ACPI_BITMASK_TIMER_STATUS) {
         /* if TMRSTS is reset, then compute the new overflow time */
         acpi_pm_tmr_calc_overflow_time(ar);
hw/acpi.h +1 -1
index 530c86a..e1d5e3b 100644
@@ -131,7 +131,7 @@ static inline int64_t acpi_pm_tmr_get_clock(void)
 }
 
 /* PM1a_EVT: piix and ich9 don't implement PM1b. */
-uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar, int64_t overflow_time);
+uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar);
 void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val);
 void acpi_pm1_evt_power_down(ACPIREGS *ar);
 void acpi_pm1_evt_reset(ACPIREGS *ar);
hw/acpi_piix4.c +2 -2
index afb37e2..b6899f4 100644
@@ -80,7 +80,7 @@ static void pm_update_sci(PIIX4PMState *s)
 {
     int sci_level, pmsts;
 
-    pmsts = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);
+    pmsts = acpi_pm1_evt_get_sts(&s->ar);
     sci_level = (((pmsts & s->ar.pm1.evt.en) &
                   (ACPI_BITMASK_RT_CLOCK_ENABLE |
                    ACPI_BITMASK_POWER_BUTTON_ENABLE |
@@ -138,7 +138,7 @@ static void pm_ioport_read(IORange *ioport, uint64_t addr, unsigned width,
 
     switch(addr) {
     case 0x00:
-        val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);
+        val = acpi_pm1_evt_get_sts(&s->ar);
         break;
     case 0x02:
         val = s->ar.pm1.evt.en;
hw/vt82c686.c +2 -2
index 8370434..10e066b 100644
@@ -177,7 +177,7 @@ static void pm_update_sci(VT686PMState *s)
 {
     int sci_level, pmsts;
 
-    pmsts = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);
+    pmsts = acpi_pm1_evt_get_sts(&s->ar);
     sci_level = (((pmsts & s->ar.pm1.evt.en) &
                   (ACPI_BITMASK_RT_CLOCK_ENABLE |
                    ACPI_BITMASK_POWER_BUTTON_ENABLE |
@@ -226,7 +226,7 @@ static uint32_t pm_ioport_readw(void *opaque, uint32_t addr)
     addr &= 0x0f;
     switch (addr) {
     case 0x00:
-        val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);
+        val = acpi_pm1_evt_get_sts(&s->ar);
         break;
     case 0x02:
         val = s->ar.pm1.evt.en;
Signature · 1 line
1.7.1
#4 lore raw

PATCH v5 4/12 acpi: add acpi_pm1_evt_write_en

In reply to Gerd Hoffmann

Do APCIREGS->pm1.evt.en updates using the new acpi_pm1_evt_write_en function, so the acpi code will see those updates.

---
 hw/acpi.c       |    5 +++++
 hw/acpi.h       |    1 +
 hw/acpi_piix4.c |    2 +-
 hw/vt82c686.c   |    2 +-
 4 files changed, 8 insertions(+), 2 deletions(-)
hw/acpi.c +5 -0
index 1129335..407949b 100644
@@ -268,6 +268,11 @@ void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val)
     ar->pm1.evt.sts &= ~val;
 }
 
+void acpi_pm1_evt_write_en(ACPIREGS *ar, uint16_t val)
+{
+    ar->pm1.evt.en = val;
+}
+
 void acpi_pm1_evt_power_down(ACPIREGS *ar)
 {
     if (ar->pm1.evt.en & ACPI_BITMASK_POWER_BUTTON_ENABLE) {
hw/acpi.h +1 -0
index e1d5e3b..88f8051 100644
@@ -133,6 +133,7 @@ static inline int64_t acpi_pm_tmr_get_clock(void)
 /* PM1a_EVT: piix and ich9 don't implement PM1b. */
 uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar);
 void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val);
+void acpi_pm1_evt_write_en(ACPIREGS *ar, uint16_t val);
 void acpi_pm1_evt_power_down(ACPIREGS *ar);
 void acpi_pm1_evt_reset(ACPIREGS *ar);
 
hw/acpi_piix4.c +1 -1
index b6899f4..9c72e62 100644
@@ -117,7 +117,7 @@ static void pm_ioport_write(IORange *ioport, uint64_t addr, unsigned width,
         pm_update_sci(s);
         break;
     case 0x02:
-        s->ar.pm1.evt.en = val;
+        acpi_pm1_evt_write_en(&s->ar, val);
         pm_update_sci(s);
         break;
     case 0x04:
hw/vt82c686.c +1 -1
index 10e066b..d8f4e26 100644
@@ -206,7 +206,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
         pm_update_sci(s);
         break;
     case 0x02:
-        s->ar.pm1.evt.en = val;
+        acpi_pm1_evt_write_en(&s->ar, val);
         pm_update_sci(s);
         break;
     case 0x04:
Signature · 1 line
1.7.1
#5 lore raw

PATCH v5 5/12 suspend: add infrastructure

In reply to Gerd Hoffmann

This patch adds some infrastructure to handle suspend and resume to qemu. First there are two functions to switch state and second there is a suspend notifier:

* qemu_system_suspend_request is supposed to be called when the guest asks for being be suspended, for example via ACPI.

* qemu_system_wakeup_request is supposed to be called on events which should wake up the guest.

* qemu_register_suspend_notifier can be used to register a notifier which will be called when the guest is suspended. Machine types and device models can hook in there to modify state if needed.

* qemu_register_wakeup_notifier can be used to register a notifier which will be called when the guest is woken up. Machine types and device models can hook in there to modify state if needed.

* qemu_system_wakeup_enable can be used to enable/disable wakeup events.

---
 sysemu.h |    9 ++++++++
 vl.c     |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)
sysemu.h +9 -0
index 9d5ce33..af73813 100644
@@ -38,7 +38,16 @@ void vm_start(void);
 void vm_stop(RunState state);
 void vm_stop_force_state(RunState state);
 
+typedef enum WakeupReason {
+    QEMU_WAKEUP_REASON_OTHER = 0,
+} WakeupReason;
+
 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);
 void qemu_system_debug_request(void);
vl.c +67 -0

91 lines not on this page · raw message

Signature · 1 line
1.7.1
#6 lore raw

PATCH v5 6/12 suspend: switch acpi s3 to new infrastructure.

In reply to Gerd Hoffmann

This patch switches pc s3 suspend over to the new infrastructure. The cmos_s3 qemu_irq is killed, the new notifier is used instead. The xen hack goes away with that too, the hypercall can simply be done in a notifier function now.

This patch also makes the guest actually stay suspended instead of leaving suspend instantly, so it is useful for more than just testing whenever the suspend/resume cycle actually works.

---
 hw/acpi.c        |   32 +++++++++++++++++++++-----------
 hw/acpi.h        |    4 ++--
 hw/acpi_piix4.c  |    4 ++--
 hw/mc146818rtc.c |   12 ++++++++++++
 hw/mips_malta.c  |    2 +-
 hw/pc.c          |   11 -----------
 hw/pc.h          |    3 +--
 hw/pc_piix.c     |    8 +-------
 hw/vt82c686.c    |    2 +-
 xen-all.c        |   11 ++++++-----
 10 files changed, 47 insertions(+), 42 deletions(-)
hw/acpi.c +21 -11
index 407949b..7b16716 100644
@@ -248,6 +248,22 @@ int acpi_table_add(const char *t)
 
 }
 
+static void acpi_notify_wakeup(Notifier *notifier, void *data)
+{
+    ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup);
+    WakeupReason *reason = data;
+
+    switch (*reason) {
+    case QEMU_WAKEUP_REASON_OTHER:
+    default:
+        /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
+           Pretend that resume was caused by power button */
+        ar->pm1.evt.sts |=
+            (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);
+        break;
+    }
+}
+
 /* ACPI PM1a EVT */
 uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar)
 {
@@ -333,9 +349,10 @@ void acpi_pm_tmr_reset(ACPIREGS *ar)
 }
 
 /* ACPI PM1aCNT */
-void acpi_pm1_cnt_init(ACPIREGS *ar, qemu_irq cmos_s3)
+void acpi_pm1_cnt_init(ACPIREGS *ar)
 {
-    ar->pm1.cnt.cmos_s3 = cmos_s3;
+    ar->wakeup.notify = acpi_notify_wakeup;
+    qemu_register_wakeup_notifier(&ar->wakeup);
 }
 
 void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
@@ -350,12 +367,8 @@ void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
             qemu_system_shutdown_request();
             break;
         case 1:
-            /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
-               Pretend that resume was caused by power button */
-            ar->pm1.evt.sts |=
-                (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_POWER_BUTTON_STATUS);
-            qemu_system_reset_request();
-            qemu_irq_raise(ar->pm1.cnt.cmos_s3);
+            qemu_system_suspend_request();
+            break;
         default:
             break;
         }
@@ -376,9 +389,6 @@ void acpi_pm1_cnt_update(ACPIREGS *ar,
 void acpi_pm1_cnt_reset(ACPIREGS *ar)
 {
     ar->pm1.cnt.cnt = 0;
-    if (ar->pm1.cnt.cmos_s3) {
-        qemu_irq_lower(ar->pm1.cnt.cmos_s3);
-    }
 }
 
 /* ACPI GPE */
hw/acpi.h +2 -2
index 88f8051..fe8cdb4 100644
@@ -96,7 +96,6 @@ struct ACPIPM1EVT {
 
 struct ACPIPM1CNT {
     uint16_t cnt;
-    qemu_irq cmos_s3;
 };
 
 struct ACPIGPE {
@@ -114,6 +113,7 @@ struct ACPIREGS {
         ACPIPM1EVT  evt;
         ACPIPM1CNT  cnt;
     } pm1;
+    Notifier wakeup;
 };
 
 /* PM_TMR */
@@ -138,7 +138,7 @@ void acpi_pm1_evt_power_down(ACPIREGS *ar);
 void acpi_pm1_evt_reset(ACPIREGS *ar);
 
 /* PM1a_CNT: piix and ich9 don't implement PM1b CNT. */
-void acpi_pm1_cnt_init(ACPIREGS *ar, qemu_irq cmos_s3);
+void acpi_pm1_cnt_init(ACPIREGS *ar);
 void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val);
 void acpi_pm1_cnt_update(ACPIREGS *ar,
                          bool sci_enable, bool sci_disable);
hw/acpi_piix4.c +2 -2
index 9c72e62..f7f0a47 100644
@@ -372,7 +372,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
 }
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-                       qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
+                       qemu_irq sci_irq, qemu_irq smi_irq,
                        int kvm_enabled)
 {
     PCIDevice *dev;
@@ -383,7 +383,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
 
     s = DO_UPCAST(PIIX4PMState, dev, dev);
     s->irq = sci_irq;
-    acpi_pm1_cnt_init(&s->ar, cmos_s3);
+    acpi_pm1_cnt_init(&s->ar);
     s->smi_irq = smi_irq;
     s->kvm_enabled = kvm_enabled;
 
hw/mc146818rtc.c +12 -0
index 4a43225..314ed52 100644
@@ -102,6 +102,7 @@ typedef struct RTCState {
     QEMUTimer *second_timer2;
     Notifier clock_reset_notifier;
     LostTickPolicy lost_tick_policy;
+    Notifier suspend_notifier;
 } RTCState;
 
 static void rtc_set_time(RTCState *s);
@@ -596,6 +597,14 @@ static void rtc_notify_clock_reset(Notifier *notifier, void *data)
 #endif
 }
 
+/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
+   BIOS will read it and start S3 resume at POST Entry */
+static void rtc_notify_suspend(Notifier *notifier, void *data)
+{
+    RTCState *s = container_of(notifier, RTCState, suspend_notifier);
+    rtc_set_memory(&s->dev, 0xF, 0xFE);
+}
+
 static void rtc_reset(void *opaque)
 {
     RTCState *s = opaque;
@@ -676,6 +685,9 @@ static int rtc_initfn(ISADevice *dev)
     s->clock_reset_notifier.notify = rtc_notify_clock_reset;
     qemu_register_clock_reset_notifier(rtc_clock, &s->clock_reset_notifier);
 
+    s->suspend_notifier.notify = rtc_notify_suspend;
+    qemu_register_suspend_notifier(&s->suspend_notifier);
+
     s->next_second_time =
         qemu_get_clock_ns(rtc_clock) + (get_ticks_per_sec() * 99) / 100;
     qemu_mod_timer(s->second_timer2, s->next_second_time);
hw/mips_malta.c +1 -1
index d232630..fe02c93 100644
@@ -966,7 +966,7 @@ void mips_malta_init (ram_addr_t ram_size,
     pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
     usb_uhci_piix4_init(pci_bus, piix4_devfn + 2);
     smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
-                          isa_get_irq(NULL, 9), NULL, NULL, 0);
+                          isa_get_irq(NULL, 9), NULL, 0);
     /* TODO: Populate SPD eeprom data.  */
     smbus_eeprom_init(smbus, 8, NULL, 0);
     pit = pit_init(isa_bus, 0x40, 0);
hw/pc.c +0 -11
index 7f3aa65..7b93aee 100644
@@ -915,17 +915,6 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
     return dev;
 }
 
-/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
-   BIOS will read it and start S3 resume at POST Entry */
-void pc_cmos_set_s3_resume(void *opaque, int irq, int level)
-{
-    ISADevice *s = opaque;
-
-    if (level) {
-        rtc_set_memory(s, 0xF, 0xFE);
-    }
-}
-
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
 {
     CPUState *s = opaque;
hw/pc.h +1 -2
index c666ec9..571c915 100644
@@ -128,7 +128,6 @@ void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
 extern int fd_bootchk;
 
 void pc_register_ferr_irq(qemu_irq irq);
-void pc_cmos_set_s3_resume(void *opaque, int irq, int level);
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(const char *cpu_model);
@@ -167,7 +166,7 @@ int acpi_table_add(const char *table_desc);
 /* acpi_piix.c */
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
-                       qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
+                       qemu_irq sci_irq, qemu_irq smi_irq,
                        int kvm_enabled);
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
 
hw/pc_piix.c +1 -7
index c06f1b5..918f5ac 100644
@@ -139,7 +139,6 @@ static void pc_init1(MemoryRegion *system_memory,
     qemu_irq *cpu_irq;
     qemu_irq *gsi;
     qemu_irq *i8259;
-    qemu_irq *cmos_s3;
     qemu_irq *smi_irq;
     GSIState *gsi_state;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
@@ -291,15 +290,10 @@ static void pc_init1(MemoryRegion *system_memory,
     if (pci_enabled && acpi_enabled) {
         i2c_bus *smbus;
 
-        if (!xen_enabled()) {
-            cmos_s3 = qemu_allocate_irqs(pc_cmos_set_s3_resume, rtc_state, 1);
-        } else {
-            cmos_s3 = qemu_allocate_irqs(xen_cmos_set_s3_resume, rtc_state, 1);
-        }
         smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
         /* TODO: Populate SPD eeprom data.  */
         smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
-                              gsi[9], *cmos_s3, *smi_irq,
+                              gsi[9], *smi_irq,
                               kvm_enabled());
         smbus_eeprom_init(smbus, 8, NULL, 0);
     }
hw/vt82c686.c +1 -1
index d8f4e26..75e29f8 100644
@@ -444,7 +444,7 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
     apm_init(&s->apm, NULL, s);
 
     acpi_pm_tmr_init(&s->ar, pm_tmr_timer);
-    acpi_pm1_cnt_init(&s->ar, NULL);
+    acpi_pm1_cnt_init(&s->ar);
 
     pm_smbus_init(&s->dev.qdev, &s->smb);
 
xen-all.c +6 -5
index fd39168..b0ed1ed 100644
@@ -89,6 +89,7 @@ typedef struct XenIOState {
     const XenPhysmap *log_for_dirtybit;
 
     Notifier exit;
+    Notifier suspend;
 } XenIOState;
 
 /* Xen specific function for piix pci */
@@ -121,12 +122,9 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len)
     }
 }
 
-void xen_cmos_set_s3_resume(void *opaque, int irq, int level)
+static void xen_suspend_notifier(Notifier *notifier, void *data)
 {
-    pc_cmos_set_s3_resume(opaque, irq, level);
-    if (level) {
-        xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3);
-    }
+    xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3);
 }
 
 /* Xen Interrupt Controller */
@@ -936,6 +934,9 @@ int xen_hvm_init(void)
     state->exit.notify = xen_exit_notifier;
     qemu_add_exit_notifier(&state->exit);
 
+    state->suspend.notify = xen_suspend_notifier;
+    qemu_register_suspend_notifier(&state->suspend);
+
     xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
     DPRINTF("shared page at pfn %lx\n", ioreq_pfn);
     state->shared_page = xc_map_foreign_range(xen_xc, xen_domid, XC_PAGE_SIZE,
Signature · 1 line
1.7.1
#7 lore raw

PATCH v5 7/12 suspend: add system_wakeup monitor command

In reply to Gerd Hoffmann

This patch adds the system_wakeup monitor command which will simply wake up suspended guests.

---
 hmp-commands.hx  |   14 ++++++++++++++
 hmp.c            |    5 +++++
 hmp.h            |    1 +
 qapi-schema.json |   11 +++++++++++
 qmp-commands.hx  |   21 +++++++++++++++++++++
 qmp.c            |    5 +++++
 6 files changed, 57 insertions(+), 0 deletions(-)
hmp-commands.hx +14 -0
index 573b823..64b3656 100644
@@ -352,6 +352,20 @@ Resume emulation.
 ETEXI
 
     {
+        .name       = "system_wakeup",
+        .args_type  = "",
+        .params     = "",
+        .help       = "wakeup guest from suspend",
+        .mhandler.cmd = hmp_system_wakeup,
+    },
+
+STEXI
+@item system_wakeup
+@findex system_wakeup
+Wakeup guest from suspend.
+ETEXI
+
+    {
         .name       = "gdbserver",
         .args_type  = "device:s?",
         .params     = "[device]",
hmp.c +5 -0
index 8ff8c94..3a54455 100644
@@ -632,6 +632,11 @@ void hmp_cont(Monitor *mon, const QDict *qdict)
     }
 }
 
+void hmp_system_wakeup(Monitor *mon, const QDict *qdict)
+{
+    qmp_system_wakeup(NULL);
+}
+
 void hmp_inject_nmi(Monitor *mon, const QDict *qdict)
 {
     Error *errp = NULL;
hmp.h +1 -0
index 18eecbd..5409464 100644
@@ -41,6 +41,7 @@ void hmp_cpu(Monitor *mon, const QDict *qdict);
 void hmp_memsave(Monitor *mon, const QDict *qdict);
 void hmp_pmemsave(Monitor *mon, const QDict *qdict);
 void hmp_cont(Monitor *mon, const QDict *qdict);
+void hmp_system_wakeup(Monitor *mon, const QDict *qdict);
 void hmp_inject_nmi(Monitor *mon, const QDict *qdict);
 void hmp_set_link(Monitor *mon, const QDict *qdict);
 void hmp_block_passwd(Monitor *mon, const QDict *qdict);
qapi-schema.json +11 -0
index d02ee86..226c1da 100644
@@ -999,6 +999,17 @@
 { 'command': 'cont' }
 
 ##
+# @system_wakeup:
+#
+# Wakeup guest from suspend
+#
+# Since:  1.1
+#
+# Returns:  nothing.
+##
+{ 'command': 'system_wakeup' }
+
+##
 # @inject-nmi:
 #
 # Injects an Non-Maskable Interrupt into all guest's VCPUs.
qmp-commands.hx +21 -0
index b5e2ab8..f5081e2 100644
@@ -212,6 +212,27 @@ Example:
 EQMP
 
     {
+        .name       = "system_wakeup",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_system_wakeup,
+    },
+
+SQMP
+system_wakeup
+-------------
+
+Wakeup guest from suspend.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "system_wakeup" }
+<- { "return": {} }
+
+EQMP
+
+    {
         .name       = "system_reset",
         .args_type  = "",
         .mhandler.cmd_new = qmp_marshal_input_system_reset,
qmp.c +5 -0
index 1f64844..a182b51 100644
@@ -163,6 +163,11 @@ void qmp_cont(Error **errp)
     vm_start();
 }
 
+void qmp_system_wakeup(Error **errp)
+{
+    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
+}
+
 ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
 {
     Object *obj;
Signature · 1 line
1.7.1
#8 lore raw

Re: [Qemu-devel] [PATCH v5 07/12] suspend: add system_wakeup monitor command

Quoted 71 lines · On Wed, 15 Feb 2012 11:28:16 +0100 Gerd Hoffmann <[email protected]> wrote:

This patch adds the system_wakeup monitor command which will simply wake up suspended guests.

---
 hmp-commands.hx  |   14 ++++++++++++++
 hmp.c            |    5 +++++
 hmp.h            |    1 +
 qapi-schema.json |   11 +++++++++++
 qmp-commands.hx  |   21 +++++++++++++++++++++
 qmp.c            |    5 +++++
 6 files changed, 57 insertions(+), 0 deletions(-)
hmp-commands.hx +14 -0
index 573b823..64b3656 100644
@@ -352,6 +352,20 @@ Resume emulation.
 ETEXI
 
     {
+        .name       = "system_wakeup",
+        .args_type  = "",
+        .params     = "",
+        .help       = "wakeup guest from suspend",
+        .mhandler.cmd = hmp_system_wakeup,
+    },
+
+STEXI
+@item system_wakeup
+@findex system_wakeup
+Wakeup guest from suspend.
+ETEXI
+
+    {
         .name       = "gdbserver",
         .args_type  = "device:s?",
         .params     = "[device]",
hmp.c +5 -0
index 8ff8c94..3a54455 100644
@@ -632,6 +632,11 @@ void hmp_cont(Monitor *mon, const QDict *qdict)
     }
 }
 
+void hmp_system_wakeup(Monitor *mon, const QDict *qdict)
+{
+    qmp_system_wakeup(NULL);
+}
+
 void hmp_inject_nmi(Monitor *mon, const QDict *qdict)
 {
     Error *errp = NULL;
hmp.h +1 -0
index 18eecbd..5409464 100644
@@ -41,6 +41,7 @@ void hmp_cpu(Monitor *mon, const QDict *qdict);
 void hmp_memsave(Monitor *mon, const QDict *qdict);
 void hmp_pmemsave(Monitor *mon, const QDict *qdict);
 void hmp_cont(Monitor *mon, const QDict *qdict);
+void hmp_system_wakeup(Monitor *mon, const QDict *qdict);
 void hmp_inject_nmi(Monitor *mon, const QDict *qdict);
 void hmp_set_link(Monitor *mon, const QDict *qdict);
 void hmp_block_passwd(Monitor *mon, const QDict *qdict);
qapi-schema.json +0 -0
index d02ee86..226c1da 100644

qapi-schema.json line 1008

Quoted 10 lines
qapi-schema.json +7 -0
@@ -999,6 +999,17 @@
 { 'command': 'cont' }
 
 ##
+# @system_wakeup:
+#
+# Wakeup guest from suspend
+#
+# Since:  1.1
+#
+# Returns:  nothing.

Would be nice to note that this command does nothing if the guest is already suspended (btw, does is_suspend account for guest initiated suspends too?).

Quoted 44 lines
qapi-schema.json +4 -0
+##
+{ 'command': 'system_wakeup' }
+
+##
 # @inject-nmi:
 #
 # Injects an Non-Maskable Interrupt into all guest's VCPUs.
qmp-commands.hx +21 -0
index b5e2ab8..f5081e2 100644
@@ -212,6 +212,27 @@ Example:
 EQMP
 
     {
+        .name       = "system_wakeup",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_system_wakeup,
+    },
+
+SQMP
+system_wakeup
+-------------
+
+Wakeup guest from suspend.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "system_wakeup" }
+<- { "return": {} }
+
+EQMP
+
+    {
         .name       = "system_reset",
         .args_type  = "",
         .mhandler.cmd_new = qmp_marshal_input_system_reset,
qmp.c +0 -0
index 1f64844..a182b51 100644

qmp.c void qmp_cont(Error **errp) · line 168

Quoted 6 lines
qmp.c +3 -0
@@ -163,6 +163,11 @@ void qmp_cont(Error **errp)
     vm_start();
 }
 
+void qmp_system_wakeup(Error **errp)
+{
+    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);

qemu_system_wakeup_request() does:

    if (!(wakeup_reason_mask & (1 << reason))) {
        return;
    }

But I think you never disable REASON_OTHER, meaning that this will never be true when the wakeup request comes from the command, right?

If that's right, this patch is fine with me. Otherwise we need to return an error.

Quoted 5 lines
qmp.c +2 -0
+}
+
 ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
 {
     Object *obj;
#9 lore raw

Re: [Qemu-devel] [PATCH v5 07/12] suspend: add system_wakeup monitor command

Hi,

Quoted 10 lines

qapi-schema.json line 1008

Quoted 7 lines
qapi-schema.json +7 -0
+# @system_wakeup:
+#
+# Wakeup guest from suspend
+#
+# Since:  1.1
+#
+# Returns:  nothing.

Would be nice to note that this command does nothing if the guest is already suspended (btw, does is_suspend account for guest initiated suspends too?).

s/suspended/running/, but yes.

There are only guest initiated suspends (well, libvirt-via-agent is somewhat grey ...).

cheers,
Gerd

Quoted 14 lines

qmp.c void qmp_cont(Error **errp) · line 168

Quoted 11 lines
qmp.c +3 -0
index 1f64844..a182b51 100644
@@ -163,6 +163,11 @@ void qmp_cont(Error **errp)
     vm_start();
 }
 
+void qmp_system_wakeup(Error **errp)
+{
+    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);

qemu_system_wakeup_request() does:

Quoted 6 lines
    if (!(wakeup_reason_mask & (1 << reason))) {
        return;
    }

But I think you never disable REASON_OTHER, meaning that this will never be true when the wakeup request comes from the command, right?

Correct. The mask is for wakeup events the guest is able to enable/disable (i.e. rtc wakeups can be enabled/disabled via acpi). REASON_OTHER can't be maked.

cheers,
Gerd

#10 lore raw

PATCH v5 8/12 suspend: make ps/2 devices wakeup the guest

In reply to Gerd Hoffmann

This patch adds wakeup support to ps/2 emulation. Any key press on the ps/2 keyboard will wakeup the guest. Likewise any mouse button press will wakeup the guest. Mouse moves are ignored, so the guest will not wakeup in case your mouse crosses the vnc window of a suspended guest by accident.

---
 hw/ps2.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hw/ps2.c +6 -0
index 1d9057b..b1a67bc 100644
@@ -24,6 +24,7 @@
 #include "hw.h"
 #include "ps2.h"
 #include "console.h"
+#include "sysemu.h"
 
 /* debug PC keyboard */
 //#define DEBUG_KBD
@@ -154,6 +155,7 @@ static void ps2_put_keycode(void *opaque, int keycode)
 {
     PS2KbdState *s = opaque;
 
+    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
     /* XXX: add support for scancode set 1 */
     if (!s->translate && keycode < 0xe0 && s->scancode_set > 1) {
         if (keycode & 0x80) {
@@ -368,6 +370,10 @@ static void ps2_mouse_event(void *opaque,
 	return;
     s->mouse_buttons = buttons_state;
 
+    if (buttons_state) {
+        qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
+    }
+
     if (!(s->mouse_status & MOUSE_STATUS_REMOTE) &&
         (s->common.queue.count < (PS2_QUEUE_SIZE - 16))) {
         for(;;) {
Signature · 1 line
1.7.1
#11 lore raw

PATCH v5 9/12 suspend: make serial ports wakeup the guest.

In reply to Gerd Hoffmann

Add a 'wakeup' property to the serial port. It is off by default. When enabled any incoming character on the serial line will wake up the guest. Useful for guests which have a serial console configured.

---
 hw/serial.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hw/serial.c +6 -0
index 82917e2..8224607 100644
@@ -139,6 +139,7 @@ struct SerialState {
     int it_shift;
     int baudbase;
     int tsr_retry;
+    uint32_t wakeup;
 
     uint64_t last_xmit_ts;              /* Time when the last byte was successfully sent out of the tsr */
     SerialFIFO recv_fifo;
@@ -635,6 +636,10 @@ static int serial_can_receive1(void *opaque)
 static void serial_receive1(void *opaque, const uint8_t *buf, int size)
 {
     SerialState *s = opaque;
+
+    if (s->wakeup) {
+        qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
+    }
     if(s->fcr & UART_FCR_FE) {
         int i;
         for (i = 0; i < size; i++) {
@@ -884,6 +889,7 @@ static Property serial_isa_properties[] = {
     DEFINE_PROP_HEX32("iobase", ISASerialState, iobase,  -1),
     DEFINE_PROP_UINT32("irq",   ISASerialState, isairq,  -1),
     DEFINE_PROP_CHR("chardev",  ISASerialState, state.chr),
+    DEFINE_PROP_UINT32("wakeup", ISASerialState, state.wakeup, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
Signature · 1 line
1.7.1
#12 lore raw

PATCH v5 10/12 suspend: make rtc alarm wakeup the guest.

In reply to Gerd Hoffmann

Make the rtc wake up the guest when the alarm fires. Add acpi windup to property support RTC_EN, so guests can enable and disable this.

---
 hw/acpi.c        |    7 +++++++
 hw/mc146818rtc.c |    1 +
 sysemu.h         |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)
hw/acpi.c +7 -0
index 7b16716..c05dde6 100644
@@ -254,6 +254,10 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data)
     WakeupReason *reason = data;
 
     switch (*reason) {
+    case QEMU_WAKEUP_REASON_RTC:
+        ar->pm1.evt.sts |=
+            (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_RT_CLOCK_STATUS);
+        break;
     case QEMU_WAKEUP_REASON_OTHER:
     default:
         /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
@@ -287,6 +291,8 @@ void acpi_pm1_evt_write_sts(ACPIREGS *ar, uint16_t val)
 void acpi_pm1_evt_write_en(ACPIREGS *ar, uint16_t val)
 {
     ar->pm1.evt.en = val;
+    qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC,
+                              val & ACPI_BITMASK_RT_CLOCK_ENABLE);
 }
 
 void acpi_pm1_evt_power_down(ACPIREGS *ar)
@@ -301,6 +307,7 @@ void acpi_pm1_evt_reset(ACPIREGS *ar)
 {
     ar->pm1.evt.sts = 0;
     ar->pm1.evt.en = 0;
+    qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC, 0);
 }
 
 /* ACPI PM_TMR */
hw/mc146818rtc.c +1 -0
index 314ed52..37adddb 100644
@@ -437,6 +437,7 @@ static void rtc_update_second2(void *opaque)
 
         s->cmos_data[RTC_REG_C] |= REG_C_AF;
         if (s->cmos_data[RTC_REG_B] & REG_B_AIE) {
+            qemu_system_wakeup_request(QEMU_WAKEUP_REASON_RTC);
             qemu_irq_raise(s->irq);
             s->cmos_data[RTC_REG_C] |= REG_C_IRQF;
         }
sysemu.h +1 -0
index af73813..781bdaf 100644
@@ -40,6 +40,7 @@ void vm_stop_force_state(RunState state);
 
 typedef enum WakeupReason {
     QEMU_WAKEUP_REASON_OTHER = 0,
+    QEMU_WAKEUP_REASON_RTC,
 } WakeupReason;
 
 void qemu_system_reset_request(void);
Signature · 1 line
1.7.1
#13 lore raw

PATCH v5 11/12 suspend: make acpi timer wakeup the guest.

In reply to Gerd Hoffmann

Make the acpi timer wake up the guest.
Guests can enable/disable this via acpi too.

---
 hw/acpi.c |    8 ++++++++
 sysemu.h  |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)
hw/acpi.c +8 -0
index c05dde6..5d521e5 100644
@@ -258,6 +258,10 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data)
         ar->pm1.evt.sts |=
             (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_RT_CLOCK_STATUS);
         break;
+    case QEMU_WAKEUP_REASON_PMTIMER:
+        ar->pm1.evt.sts |=
+            (ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_TIMER_STATUS);
+        break;
     case QEMU_WAKEUP_REASON_OTHER:
     default:
         /* ACPI_BITMASK_WAKE_STATUS should be set on resume.
@@ -293,6 +297,8 @@ void acpi_pm1_evt_write_en(ACPIREGS *ar, uint16_t val)
     ar->pm1.evt.en = val;
     qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC,
                               val & ACPI_BITMASK_RT_CLOCK_ENABLE);
+    qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_PMTIMER,
+                              val & ACPI_BITMASK_TIMER_ENABLE);
 }
 
 void acpi_pm1_evt_power_down(ACPIREGS *ar)
@@ -308,6 +314,7 @@ void acpi_pm1_evt_reset(ACPIREGS *ar)
     ar->pm1.evt.sts = 0;
     ar->pm1.evt.en = 0;
     qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_RTC, 0);
+    qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_PMTIMER, 0);
 }
 
 /* ACPI PM_TMR */
@@ -340,6 +347,7 @@ uint32_t acpi_pm_tmr_get(ACPIREGS *ar)
 static void acpi_pm_tmr_timer(void *opaque)
 {
     ACPIREGS *ar = opaque;
+    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_PMTIMER);
     ar->tmr.update_sci(ar);
 }
 
sysemu.h +1 -0
index 781bdaf..98118cc 100644
@@ -41,6 +41,7 @@ void vm_stop_force_state(RunState state);
 typedef enum WakeupReason {
     QEMU_WAKEUP_REASON_OTHER = 0,
     QEMU_WAKEUP_REASON_RTC,
+    QEMU_WAKEUP_REASON_PMTIMER,
 } WakeupReason;
 
 void qemu_system_reset_request(void);
Signature · 1 line
1.7.1
#14 lore raw

PATCH v5 12/12 suspend: add qmp events

In reply to Gerd Hoffmann

Send qmp events on suspend and wakeup so libvirt
has a chance to track the vm state.

---
 monitor.c |    6 ++++++
 monitor.h |    2 ++
 vl.c      |   15 +++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
monitor.c +6 -0
index aadbdcb..e6f5fad 100644
@@ -485,6 +485,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         case QEVENT_BLOCK_JOB_CANCELLED:
             event_name = "BLOCK_JOB_CANCELLED";
             break;
+        case QEVENT_SUSPEND:
+            event_name = "SUSPEND";
+            break;
+        case QEVENT_WAKEUP:
+            event_name = "WAKEUP";
+            break;
         default:
             abort();
             break;
monitor.h +2 -0
index b72ea07..9df3bab 100644
@@ -38,6 +38,8 @@ typedef enum MonitorEvent {
     QEVENT_SPICE_DISCONNECTED,
     QEVENT_BLOCK_JOB_COMPLETED,
     QEVENT_BLOCK_JOB_CANCELLED,
+    QEVENT_SUSPEND,
+    QEVENT_WAKEUP,
     QEVENT_MAX,
 } MonitorEvent;
 
vl.c +15 -0
index bfdcb7c..570ea05 100644
@@ -1416,6 +1416,7 @@ static void qemu_system_suspend(void)
 {
     pause_all_vcpus();
     notifier_list_notify(&suspend_notifiers, NULL);
+    monitor_protocol_event(QEVENT_SUSPEND, NULL);
     is_suspended = true;
 }
 
@@ -1436,12 +1437,26 @@ void qemu_register_suspend_notifier(Notifier *notifier)
 
 void qemu_system_wakeup_request(WakeupReason reason)
 {
+    static const char *names[] = {
+        [QEMU_WAKEUP_REASON_OTHER]   = "other",
+        [QEMU_WAKEUP_REASON_RTC]     = "rtc",
+        [QEMU_WAKEUP_REASON_PMTIMER] = "pmtimer",
+    };
+    const char *name;
+    QObject *data;
+
     if (!is_suspended) {
         return;
     }
     if (!(wakeup_reason_mask & (1 << reason))) {
         return;
     }
+
+    name = (reason < ARRAY_SIZE(names)) ? names[reason] : "unknown";
+    data = qobject_from_jsonf("{ 'reason': %s }", name);
+    monitor_protocol_event(QEVENT_WAKEUP, data);
+    qobject_decref(data);
+
     notifier_list_notify(&wakeup_notifiers, &reason);
     reset_requested = 1;
     qemu_notify_event();
Signature · 1 line
1.7.1
#15 lore raw

Re: [Qemu-devel] [PATCH v5 12/12] suspend: add qmp events

Quoted 4 lines · Gerd Hoffmann

Send qmp events on suspend and wakeup so libvirt
has a chance to track the vm state.

Luiz, please Ack.

Regards,

Anthony Liguori

Quoted 75 lines
---
  monitor.c |    6 ++++++
  monitor.h |    2 ++
  vl.c      |   15 +++++++++++++++
  3 files changed, 23 insertions(+), 0 deletions(-)
monitor.c +6 -0
index aadbdcb..e6f5fad 100644
@@ -485,6 +485,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
          case QEVENT_BLOCK_JOB_CANCELLED:
              event_name = "BLOCK_JOB_CANCELLED";
              break;
+        case QEVENT_SUSPEND:
+            event_name = "SUSPEND";
+            break;
+        case QEVENT_WAKEUP:
+            event_name = "WAKEUP";
+            break;
          default:
              abort();
              break;
monitor.h +2 -0
index b72ea07..9df3bab 100644
@@ -38,6 +38,8 @@ typedef enum MonitorEvent {
      QEVENT_SPICE_DISCONNECTED,
      QEVENT_BLOCK_JOB_COMPLETED,
      QEVENT_BLOCK_JOB_CANCELLED,
+    QEVENT_SUSPEND,
+    QEVENT_WAKEUP,
      QEVENT_MAX,
  } MonitorEvent;
 
vl.c +15 -0
index bfdcb7c..570ea05 100644
@@ -1416,6 +1416,7 @@ static void qemu_system_suspend(void)
  {
      pause_all_vcpus();
      notifier_list_notify(&suspend_notifiers, NULL);
+    monitor_protocol_event(QEVENT_SUSPEND, NULL);
      is_suspended = true;
  }
 
@@ -1436,12 +1437,26 @@ void qemu_register_suspend_notifier(Notifier *notifier)
 
  void qemu_system_wakeup_request(WakeupReason reason)
  {
+    static const char *names[] = {
+        [QEMU_WAKEUP_REASON_OTHER]   = "other",
+        [QEMU_WAKEUP_REASON_RTC]     = "rtc",
+        [QEMU_WAKEUP_REASON_PMTIMER] = "pmtimer",
+    };
+    const char *name;
+    QObject *data;
+
      if (!is_suspended) {
          return;
      }
      if (!(wakeup_reason_mask&  (1<<  reason))) {
          return;
      }
+
+    name = (reason<  ARRAY_SIZE(names)) ? names[reason] : "unknown";
+    data = qobject_from_jsonf("{ 'reason': %s }", name);
+    monitor_protocol_event(QEVENT_WAKEUP, data);
+    qobject_decref(data);
+
      notifier_list_notify(&wakeup_notifiers,&reason);
      reset_requested = 1;
      qemu_notify_event();
#16 lore raw

Re: [Qemu-devel] [PATCH v5 12/12] suspend: add qmp events

In reply to Gerd Hoffmann
Quoted 53 lines · On Wed, 15 Feb 2012 11:28:21 +0100 Gerd Hoffmann <[email protected]> wrote:

Send qmp events on suspend and wakeup so libvirt
has a chance to track the vm state.

---
 monitor.c |    6 ++++++
 monitor.h |    2 ++
 vl.c      |   15 +++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
monitor.c +6 -0
index aadbdcb..e6f5fad 100644
@@ -485,6 +485,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         case QEVENT_BLOCK_JOB_CANCELLED:
             event_name = "BLOCK_JOB_CANCELLED";
             break;
+        case QEVENT_SUSPEND:
+            event_name = "SUSPEND";
+            break;
+        case QEVENT_WAKEUP:
+            event_name = "WAKEUP";
+            break;
         default:
             abort();
             break;
monitor.h +2 -0
index b72ea07..9df3bab 100644
@@ -38,6 +38,8 @@ typedef enum MonitorEvent {
     QEVENT_SPICE_DISCONNECTED,
     QEVENT_BLOCK_JOB_COMPLETED,
     QEVENT_BLOCK_JOB_CANCELLED,
+    QEVENT_SUSPEND,
+    QEVENT_WAKEUP,
     QEVENT_MAX,
 } MonitorEvent;
 
vl.c +1 -0
index bfdcb7c..570ea05 100644
@@ -1416,6 +1416,7 @@ static void qemu_system_suspend(void)
 {
     pause_all_vcpus();
     notifier_list_notify(&suspend_notifiers, NULL);
+    monitor_protocol_event(QEVENT_SUSPEND, NULL);
     is_suspended = true;
 }
 

vl.c void qemu_register_suspend_notifier(Notifier *notifier) · line 1443

Quoted 7 lines
vl.c +4 -0
@@ -1436,12 +1437,26 @@ void qemu_register_suspend_notifier(Notifier *notifier)
 
 void qemu_system_wakeup_request(WakeupReason reason)
 {
+    static const char *names[] = {
+        [QEMU_WAKEUP_REASON_OTHER]   = "other",
+        [QEMU_WAKEUP_REASON_RTC]     = "rtc",
+        [QEMU_WAKEUP_REASON_PMTIMER] = "pmtimer",

Is the reason really important for mngt? Can we just leave it out?

Quoted 19 lines
vl.c +10 -0
+    };
+    const char *name;
+    QObject *data;
+
     if (!is_suspended) {
         return;
     }
     if (!(wakeup_reason_mask & (1 << reason))) {
         return;
     }
+
+    name = (reason < ARRAY_SIZE(names)) ? names[reason] : "unknown";
+    data = qobject_from_jsonf("{ 'reason': %s }", name);
+    monitor_protocol_event(QEVENT_WAKEUP, data);
+    qobject_decref(data);
+
     notifier_list_notify(&wakeup_notifiers, &reason);
     reset_requested = 1;
     qemu_notify_event();
#17 lore raw

Re: [Qemu-devel] [PATCH v5 12/12] suspend: add qmp events

Quoted 5 lines · Luiz Capitulino
Quoted 2 lines · On Wed, 15 Feb 2012 11:28:21 +0100 Gerd Hoffmann <[email protected]> wrote:

Send qmp events on suspend and wakeup so libvirt
has a chance to track the vm state.

[ added libvirt to Cc:, leaving full context.
this is about qmp events when the guest enters/leaves s3 ].

Quoted 51 lines
Quoted 51 lines
---
 monitor.c |    6 ++++++
 monitor.h |    2 ++
 vl.c      |   15 +++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
monitor.c +6 -0
index aadbdcb..e6f5fad 100644
@@ -485,6 +485,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         case QEVENT_BLOCK_JOB_CANCELLED:
             event_name = "BLOCK_JOB_CANCELLED";
             break;
+        case QEVENT_SUSPEND:
+            event_name = "SUSPEND";
+            break;
+        case QEVENT_WAKEUP:
+            event_name = "WAKEUP";
+            break;
         default:
             abort();
             break;
monitor.h +2 -0
index b72ea07..9df3bab 100644
@@ -38,6 +38,8 @@ typedef enum MonitorEvent {
     QEVENT_SPICE_DISCONNECTED,
     QEVENT_BLOCK_JOB_COMPLETED,
     QEVENT_BLOCK_JOB_CANCELLED,
+    QEVENT_SUSPEND,
+    QEVENT_WAKEUP,
     QEVENT_MAX,
 } MonitorEvent;
 
vl.c +1 -0
index bfdcb7c..570ea05 100644
@@ -1416,6 +1416,7 @@ static void qemu_system_suspend(void)
 {
     pause_all_vcpus();
     notifier_list_notify(&suspend_notifiers, NULL);
+    monitor_protocol_event(QEVENT_SUSPEND, NULL);
     is_suspended = true;
 }
 
@@ -1436,12 +1437,26 @@ void qemu_register_suspend_notifier(Notifier *notifier)
 
Quoted 8 lines

vl.c void qemu_register_suspend_notifier(Notifier *notifier) · line 1443

Quoted 6 lines
vl.c +4 -0
 void qemu_system_wakeup_request(WakeupReason reason)
 {
+    static const char *names[] = {
+        [QEMU_WAKEUP_REASON_OTHER]   = "other",
+        [QEMU_WAKEUP_REASON_RTC]     = "rtc",
+        [QEMU_WAKEUP_REASON_PMTIMER] = "pmtimer",

Is the reason really important for mngt? Can we just leave it out?

I assumed the wakeup reason could be useful, but dunno. Zapping the code is no problem of course.

Lets ask mgmt aka libvirt folks ;)

cheers,
Gerd

Quoted 20 lines
Quoted 19 lines
vl.c +10 -0
+    };
+    const char *name;
+    QObject *data;
+
     if (!is_suspended) {
         return;
     }
     if (!(wakeup_reason_mask & (1 << reason))) {
         return;
     }
+
+    name = (reason < ARRAY_SIZE(names)) ? names[reason] : "unknown";
+    data = qobject_from_jsonf("{ 'reason': %s }", name);
+    monitor_protocol_event(QEVENT_WAKEUP, data);
+    qobject_decref(data);
+
     notifier_list_notify(&wakeup_notifiers, &reason);
     reset_requested = 1;
     qemu_notify_event();
#18 lore raw

Re: [Qemu-devel] [PATCH v5 12/12] suspend: add qmp events

Quoted 15 lines · Gerd Hoffmann

[ added libvirt to Cc:, leaving full context.
this is about qmp events when the guest enters/leaves s3 ].

Quoted 10 lines

vl.c void qemu_register_suspend_notifier(Notifier *notifier) · line 1443

Quoted 8 lines
vl.c +4 -0
@@ -1436,12 +1437,26 @@ void qemu_register_suspend_notifier(Notifier *notifier)
 
 void qemu_system_wakeup_request(WakeupReason reason)
 {
+    static const char *names[] = {
+        [QEMU_WAKEUP_REASON_OTHER]   = "other",
+        [QEMU_WAKEUP_REASON_RTC]     = "rtc",
+        [QEMU_WAKEUP_REASON_PMTIMER] = "pmtimer",

Is the reason really important for mngt? Can we just leave it out?

Quoted 4 lines

I assumed the wakeup reason could be useful, but dunno. Zapping the code is no problem of course.

Lets ask mgmt aka libvirt folks ;)

If you present the reason, libvirt will pass it on to the management app. But I don't see any reason why libvirt itself would care about the reason, so it won't hurt libvirt if you drop a reason field. I don't know whether higher-level management apps, like oVirt, would care or not.

Isn't this something where it is easier to omit first and add later once we have a use case, than to add up front only to find that no one cares?

Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#19 lore raw

Re: [Qemu-devel] [PATCH v5 12/12] suspend: add qmp events

Hi,

Quoted 3 lines

Isn't this something where it is easier to omit first and add later once we have a use case, than to add up front only to find that no one cares?

Yes. I'll drop it.

cheers,
Gerd

#20 lore raw

Re: [Qemu-devel] [PATCH v5 12/12] suspend: add qmp events

Quoted 7 lines · On Wed, 22 Feb 2012 13:08:16 +0100 Gerd Hoffmann <[email protected]> wrote:

Hi,

Quoted 3 lines

Isn't this something where it is easier to omit first and add later once we have a use case, than to add up front only to find that no one cares?

Yes. I'll drop it.

Yes, I think it's better to drop it for now and add it back if really needed, when we'll know better how mngt apps are going to use this.