qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 40/40] xen: add sysrq support


From: Alexander Graf
Subject: [Qemu-devel] [PATCH 40/40] xen: add sysrq support
Date: Tue, 2 Nov 2010 17:26:28 +0100

Sending sys-requests on Xen is different from the usual keyboard based
ways. For xen, we need to add a xenstored node which the guest pulls the
sysrq information from.

This patch implements said interface by introducing a new human monitor
command to use it. It's purely optional.

Signed-off-by: Alexander Graf <address@hidden>
---
 hmp-commands.hx      |   24 ++++++++++++++++++++++++
 hw/xen.h             |    2 ++
 hw/xen_domainbuild.c |    8 ++++++++
 monitor.c            |    8 ++++++++
 4 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 81999aa..40fdd00 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -436,6 +436,30 @@ This command is useful to send keys that your graphical 
user interface
 intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
 ETEXI
 
+#if defined(CONFIG_XEN) || defined(CONFIG_XENNER)
+    {
+        .name       = "xen_sysrq",
+        .args_type  = "string:s",
+        .params     = "key",
+        .help       = "send sysrq to the Xen VM",
+        .mhandler.cmd = do_xen_sysrq,
+    },
+#endif
+
+STEXI
address@hidden xen_sysrq @var{key}
address@hidden xen_sysrq
+
+Send @var{key} as sys-request to the Xen VM. This is the equivalent to
address@hidden in normal Linux guests. Example:
address@hidden
+xen_sysrq s
address@hidden example
+
+Please keep in mind that this is the only way of sending sys-requests to
+Xen PV machines. The usual address@hidden way does not work.
+ETEXI
+
     {
         .name       = "system_reset",
         .args_type  = "",
diff --git a/hw/xen.h b/hw/xen.h
index 780dcf7..f2ac576 100644
--- a/hw/xen.h
+++ b/hw/xen.h
@@ -18,4 +18,6 @@ enum xen_mode {
 extern uint32_t xen_domid;
 extern enum xen_mode xen_mode;
 
+void xen_sysrq(const char *sysrq);
+
 #endif /* QEMU_HW_XEN_H */
diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c
index 7f1fd66..49962db 100644
--- a/hw/xen_domainbuild.c
+++ b/hw/xen_domainbuild.c
@@ -211,6 +211,14 @@ static int xen_domain_watcher(void)
     _exit(0);
 }
 
+void xen_sysrq(const char *sysrq)
+{
+    void *dom;
+
+    dom = xs_get_domain_path(xenstore, xen_domid);
+    xenstore_write_str(dom, "control/sysrq", sysrq);
+}
+
 /* normal cleanup */
 static void xen_domain_cleanup(void)
 {
diff --git a/monitor.c b/monitor.c
index 61607c5..99aae01 100644
--- a/monitor.c
+++ b/monitor.c
@@ -30,6 +30,7 @@
 #include "hw/pci.h"
 #include "hw/watchdog.h"
 #include "hw/loader.h"
+#include "hw/xen.h"
 #include "gdbstub.h"
 #include "net.h"
 #include "net/slirp.h"
@@ -1639,6 +1640,13 @@ static void release_keys(void *opaque)
     }
 }
 
+#if defined(CONFIG_XEN) || defined(CONFIG_XENNER)
+static void do_xen_sysrq(Monitor *mon, const QDict *qdict)
+{
+    xen_sysrq(strdup(qdict_get_str(qdict, "string")));
+}
+#endif
+
 static void do_sendkey(Monitor *mon, const QDict *qdict)
 {
     char keyname_buf[16];
-- 
1.6.0.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]