Skip to contentSkip to conversation

spapr/rtas: Print message from "ibm,os-term"

PATCH Applied Alexey Kardashevskiy 3 participants 3 messages Feb 3, 2020 – Feb 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr/rtas: Print message from "ibm,os-term"

The "ibm,os-term" RTAS call has a single parameter which is a pointer to a message from the guest kernel about the termination cause; this prints it.

---
 hw/ppc/spapr_rtas.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/ppc/spapr_rtas.c +7 -0
index 883fe28465e6..656fdd221665 100644
@@ -345,6 +345,13 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
+    target_ulong msgaddr = rtas_ld(args, 0);
+    char msg[512];
+
+    cpu_physical_memory_read(msgaddr, msg, sizeof(msg) - 1);
+    msg[sizeof(msg) - 1] = 0;
+
+    error_report("OS terminated: %s", msg);
     qemu_system_guest_panicked(NULL);
 
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alexey Kardashevskiy

The "ibm,os-term" RTAS call has a single parameter which is a pointer to a message from the guest kernel about the termination cause; this prints it.

---
  hw/ppc/spapr_rtas.c | 7 +++++++
  1 file changed, 7 insertions(+)
Quoted 19 lines
hw/ppc/spapr_rtas.c +7 -0
index 883fe28465e6..656fdd221665 100644
@@ -345,6 +345,13 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                              target_ulong args,
                              uint32_t nret, target_ulong rets)
  {
+    target_ulong msgaddr = rtas_ld(args, 0);
+    char msg[512];
+
+    cpu_physical_memory_read(msgaddr, msg, sizeof(msg) - 1);
+    msg[sizeof(msg) - 1] = 0;
+
+    error_report("OS terminated: %s", msg);
      qemu_system_guest_panicked(NULL);
 
      rtas_st(rets, 0, RTAS_OUT_SUCCESS);
Applied
#2 lore raw
In reply to Alexey Kardashevskiy
Quoted 5 lines · Alexey Kardashevskiy

The "ibm,os-term" RTAS call has a single parameter which is a pointer to a message from the guest kernel about the termination cause; this prints it.

Applied to ppc-for-5.0, thanks.

Quoted 22 lines
---
 hw/ppc/spapr_rtas.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/ppc/spapr_rtas.c +7 -0
index 883fe28465e6..656fdd221665 100644
@@ -345,6 +345,13 @@ static void rtas_ibm_os_term(PowerPCCPU *cpu,
                             target_ulong args,
                             uint32_t nret, target_ulong rets)
 {
+    target_ulong msgaddr = rtas_ld(args, 0);
+    char msg[512];
+
+    cpu_physical_memory_read(msgaddr, msg, sizeof(msg) - 1);
+    msg[sizeof(msg) - 1] = 0;
+
+    error_report("OS terminated: %s", msg);
     qemu_system_guest_panicked(NULL);
 
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson