From 24db12773f03433050c3f6bff871bc083dd4b354 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 7 Mar 2012 08:00:18 +0100
Subject: [PATCH 04/12] suspend: add system_wakeup monitor command

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1331107226-21901-5-git-send-email-kraxel@redhat.com>
Patchwork-id: 38357
O-Subject: [RHEL-6.3 qemu-kvm PATCH v3 04/12] suspend: add system_wakeup monitor command
Bugzilla: 766303
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Gleb Natapov <gleb@redhat.com>
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

upstream: 9b9df25a474bfee59dd46d033eb4ccc16582aac2
---
 monitor.c       |    6 ++++++
 qemu-monitor.hx |   15 +++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 monitor.c       |    6 ++++++
 qemu-monitor.hx |   15 +++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/monitor.c b/monitor.c
index 49a395a..4961f17 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1414,6 +1414,12 @@ static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data)
     }
 }
 
+static int do_system_wakeup(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
+    return 0;
+}
+
 static void bdrv_key_cb(void *opaque, int err)
 {
     Monitor *mon = opaque;
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 76a6587..ca5dec9 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -611,6 +611,21 @@ Example:
 EQMP
 
     {
+        .name       = "system_wakeup",
+        .args_type  = "",
+        .params     = "",
+        .help       = "wakeup guest from suspend",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_system_wakeup,
+    },
+
+STEXI
+@item system_wakeup
+@findex system_wakeup
+Wakeup guest from suspend.
+ETEXI
+
+    {
         .name       = "gdbserver",
         .args_type  = "device:s?",
         .params     = "[device]",
-- 
1.7.7.6