summary refs log tree commit diff stats
path: root/hw/spapr_rtas.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2012-03-29 08:39:47 +1100
committerAndreas Färber <afaerber@suse.de>2012-04-15 17:07:19 +0200
commitc821a43c60e55fdfb8bc9c64696238e409d96192 (patch)
tree0370d8b721b74f17c0566dbbf5df0e5b80eabc43 /hw/spapr_rtas.c
parent8e01f355db4c7e54b0877a6d9508e83d0afbc4b6 (diff)
downloadfocaccia-qemu-c821a43c60e55fdfb8bc9c64696238e409d96192.tar.gz
focaccia-qemu-c821a43c60e55fdfb8bc9c64696238e409d96192.zip
pseries: Implement RTAS system-reboot call
This patch adds the PAPR defined RTAS system-reboot call to the pseries
machine emulation, providing the guest with a way to trigger a reboot.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/spapr_rtas.c')
-rw-r--r--hw/spapr_rtas.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c
index 09465853ba..480a4ae9e4 100644
--- a/hw/spapr_rtas.c
+++ b/hw/spapr_rtas.c
@@ -112,6 +112,19 @@ static void rtas_power_off(sPAPREnvironment *spapr,
     rtas_st(rets, 0, 0);
 }
 
+static void rtas_system_reboot(sPAPREnvironment *spapr,
+                               uint32_t token, uint32_t nargs,
+                               target_ulong args,
+                               uint32_t nret, target_ulong rets)
+{
+    if (nargs != 0 || nret != 1) {
+        rtas_st(rets, 0, -3);
+        return;
+    }
+    qemu_system_reset_request();
+    rtas_st(rets, 0, 0);
+}
+
 static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
                                          uint32_t token, uint32_t nargs,
                                          target_ulong args,
@@ -294,6 +307,7 @@ static void core_rtas_register_types(void)
     spapr_rtas_register("get-time-of-day", rtas_get_time_of_day);
     spapr_rtas_register("set-time-of-day", rtas_set_time_of_day);
     spapr_rtas_register("power-off", rtas_power_off);
+    spapr_rtas_register("system-reboot", rtas_system_reboot);
     spapr_rtas_register("query-cpu-stopped-state",
                         rtas_query_cpu_stopped_state);
     spapr_rtas_register("start-cpu", rtas_start_cpu);