mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kvm tools: powerpc: Implement "system-reboot" RTAS call
@ 2013-08-13  5:48 Michael Ellerman
  2013-08-13  6:43 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2013-08-13  5:48 UTC (permalink / raw)
  To: penberg; +Cc: kvm, linux-kernel

On some powerpc systems, reboot is implemented by an RTAS call by the
name of "system-reboot". Currently we don't implement it in kvmtool,
which means instead the guest prints an error and spins.

This is particularly annoying because when the guest kernel panics it
will try to reboot, and end up spinning in the guest.

We can't implement reboot properly, ie. causing a reboot, but it's still
preferable to implement it as halt rather than not implementing it at
all.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 tools/kvm/powerpc/spapr_rtas.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/kvm/powerpc/spapr_rtas.c b/tools/kvm/powerpc/spapr_rtas.c
index f3c8fa3..43e5310 100644
--- a/tools/kvm/powerpc/spapr_rtas.c
+++ b/tools/kvm/powerpc/spapr_rtas.c
@@ -121,6 +121,19 @@ static void rtas_power_off(struct kvm_cpu *vcpu,
 	kvm_cpu__reboot(vcpu->kvm);
 }
 
+static void rtas_system_reboot(struct kvm_cpu *vcpu,
+                           uint32_t token, uint32_t nargs, target_ulong args,
+                           uint32_t nret, target_ulong rets)
+{
+	if (nargs != 0 || nret != 1) {
+		rtas_st(vcpu->kvm, rets, 0, -3);
+		return;
+	}
+
+	/* NB this actually halts the VM */
+	kvm_cpu__reboot(vcpu->kvm);
+}
+
 static void rtas_query_cpu_stopped_state(struct kvm_cpu *vcpu,
                                          uint32_t token, uint32_t nargs,
                                          target_ulong args,
@@ -221,6 +234,7 @@ void register_core_rtas(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);
-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm tools: powerpc: Implement "system-reboot" RTAS call
  2013-08-13  5:48 [PATCH] kvm tools: powerpc: Implement "system-reboot" RTAS call Michael Ellerman
@ 2013-08-13  6:43 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2013-08-13  6:43 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: KVM General, LKML

On Tue, Aug 13, 2013 at 8:48 AM, Michael Ellerman
<michael@ellerman.id.au> wrote:
> On some powerpc systems, reboot is implemented by an RTAS call by the
> name of "system-reboot". Currently we don't implement it in kvmtool,
> which means instead the guest prints an error and spins.
>
> This is particularly annoying because when the guest kernel panics it
> will try to reboot, and end up spinning in the guest.
>
> We can't implement reboot properly, ie. causing a reboot, but it's still
> preferable to implement it as halt rather than not implementing it at
> all.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Applied, thanks Michael!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-13  6:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13  5:48 [PATCH] kvm tools: powerpc: Implement "system-reboot" RTAS call Michael Ellerman
2013-08-13  6:43 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®