diff mbox series

[2/3] hmp: introduce wakeup-from-suspend-support command

Message ID 20171206120217.11392-3-danielhb@linux.vnet.ibm.com
State New
Headers show
Series qmp/hmp: wakeup-from-suspend-support command | expand

Commit Message

Daniel Henrique Barboza Dec. 6, 2017, 12:02 p.m. UTC
This is the HMP side of 'query-wakeup-from-suspend-support', a new
QMP command that queries the guest support for system_wakeup.

This is the expected output of the new command when running a
x86 guest:

(qemu) info wakeup_from_suspend_support
wake up from suspend support: enabled
(qemu)

And when running a pseries guest:

(qemu) info wakeup_from_suspend_support
wake up from suspend support: disabled
(qemu)

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
---
 hmp-commands-info.hx | 15 +++++++++++++++
 hmp.c                | 11 +++++++++++
 hmp.h                |  1 +
 3 files changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 54c3e5eac6..9d5e93bfcf 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -867,6 +867,21 @@  Display the amount of initially allocated and present hotpluggable (if
 enabled) memory in bytes.
 ETEXI
 
+    {
+        .name       = "wakeup_from_suspend_support",
+        .args_type  = "",
+        .params     = "",
+        .help       = "shows if the guest has support for wake up "
+                      "from suspend",
+        .cmd        = hmp_info_wakeup_from_suspend_support,
+    },
+
+STEXI
+@item info wakeup_from_suspend_support
+@findex info wakeup_from_suspend_support
+Shows if the guest has support for wake up from suspended state.
+ETEXI
+
 STEXI
 @end table
 ETEXI
diff --git a/hmp.c b/hmp.c
index 35a7041824..3b74b9ee19 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2918,3 +2918,14 @@  void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict)
     }
     hmp_handle_error(mon, &err);
 }
+
+void hmp_info_wakeup_from_suspend_support(Monitor *mon, const QDict *qdict)
+{
+    WakeupSuspendSupportInfo *info;
+
+    info = qmp_query_wakeup_from_suspend_support(NULL);
+    monitor_printf(mon, "wake up from suspend support: %s\n",
+                   info->enabled ? "enabled" : "disabled");
+
+    qapi_free_WakeupSuspendSupportInfo(info);
+}
diff --git a/hmp.h b/hmp.h
index a6f56b1f29..2d394cbec2 100644
--- a/hmp.h
+++ b/hmp.h
@@ -147,5 +147,6 @@  void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
 void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
 void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
+void hmp_info_wakeup_from_suspend_support(Monitor *mon, const QDict *qdict);
 
 #endif