[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 41/48] qmp: add SUSPEND_DISK event
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 41/48] qmp: add SUSPEND_DISK event |
Date: |
Mon, 13 Aug 2012 16:49:02 -0300 |
Emitted when the guest makes a request to enter S4 state.
There are three possible ways of having this event, as described here:
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html
I've decided to add a new event and make it indepedent of SHUTDOWN.
This means that the SHUTDOWN event will eventually follow the
SUSPEND_DISK event.
I've choosen this way because of two reasons:
1. Having an indepedent event makes it possible to query for its
existence by using query-events
2. In the future, we may allow the user to change what QEMU should
do as a result of the guest entering S4. So it's a good idea to
keep both events separated
Signed-off-by: Luiz Capitulino <address@hidden>
---
QMP/qmp-events.txt | 14 ++++++++++++++
hw/acpi.c | 2 ++
monitor.c | 1 +
monitor.h | 1 +
4 files changed, 18 insertions(+)
diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
index df190ac..2878058 100644
--- a/QMP/qmp-events.txt
+++ b/QMP/qmp-events.txt
@@ -252,6 +252,20 @@ Example:
{ "event": "SUSPEND",
"timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
+SUSPEND_DISK
+------------
+
+Emitted when the guest makes a request to enter S4 state.
+
+Data: None.
+
+Example:
+
+{ "event": "SUSPEND_DISK",
+ "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
+
+Note: QEMU shuts down when entering S4 state.
+
VNC_CONNECTED
-------------
diff --git a/hw/acpi.c b/hw/acpi.c
index effc7ec..f7950be 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -22,6 +22,7 @@
#include "hw.h"
#include "pc.h"
#include "acpi.h"
+#include "monitor.h"
struct acpi_table_header {
uint16_t _length; /* our length, not actual part of the hdr */
@@ -386,6 +387,7 @@ void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val, char s4)
break;
default:
if (sus_typ == s4) { /* S4 request */
+ monitor_protocol_event(QEVENT_SUSPEND_DISK, NULL);
qemu_system_shutdown_request();
}
break;
diff --git a/monitor.c b/monitor.c
index 3694590..586abae 100644
--- a/monitor.c
+++ b/monitor.c
@@ -432,6 +432,7 @@ static const char *monitor_event_names[] = {
[QEVENT_BLOCK_JOB_CANCELLED] = "BLOCK_JOB_CANCELLED",
[QEVENT_DEVICE_TRAY_MOVED] = "DEVICE_TRAY_MOVED",
[QEVENT_SUSPEND] = "SUSPEND",
+ [QEVENT_SUSPEND_DISK] = "SUSPEND_DISK",
[QEVENT_WAKEUP] = "WAKEUP",
[QEVENT_BALLOON_CHANGE] = "BALLOON_CHANGE",
};
diff --git a/monitor.h b/monitor.h
index 5f4de1b..4ef9a04 100644
--- a/monitor.h
+++ b/monitor.h
@@ -40,6 +40,7 @@ typedef enum MonitorEvent {
QEVENT_BLOCK_JOB_CANCELLED,
QEVENT_DEVICE_TRAY_MOVED,
QEVENT_SUSPEND,
+ QEVENT_SUSPEND_DISK,
QEVENT_WAKEUP,
QEVENT_BALLOON_CHANGE,
--
1.7.11.2.249.g31c7954.dirty
- [Qemu-devel] [PATCH 26/48] error: add error_get_class(), (continued)
- [Qemu-devel] [PATCH 26/48] error: add error_get_class(), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 29/48] qmp: switch to the new error format on the wire, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 21/48] qapi: don't convert enum strings to lowercase, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 25/48] qerror: add proper ErrorClass value for QERR_ macros, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 48/48] target-ppc: add implementation of query-cpu-definitions (v2), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 24/48] error, qerror: add ErrorClass argument to error functions, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 47/48] target-i386: add implementation of query-cpu-definitions (v2), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 31/48] error: drop error_get_qobject()/error_set_qobject(), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 27/48] hmp: hmp_change(): use error_get_class(), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 30/48] qemu-ga: switch to the new error format on the wire, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 41/48] qmp: add SUSPEND_DISK event,
Luiz Capitulino <=
- [Qemu-devel] [PATCH 23/48] qerror: qerror_table: don't use C99 struct initializers, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 46/48] qapi: add query-cpu-definitions command (v2), Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 39/48] qmp: qmp-events.txt: put events in alphabetical order, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 40/48] qmp: qmp-events.txt: add missing doc for the SUSPEND event, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 32/48] error, qerror: pass desc string to error calls, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 45/48] compiler: add macro for GCC weak symbols, Luiz Capitulino, 2012/08/13
- [Qemu-devel] [PATCH 44/48] qapi: add query-machines command, Luiz Capitulino, 2012/08/13
- Re: [Qemu-devel] [PULL 00/48]: QMP queue, Anthony Liguori, 2012/08/13