[PATCH qemu] spapr/rtas: Print message from "ibm,os-term"

Alexey Kardashevskiy posted 1 patch 6 years ago
Test docker-quick@centos7 failed
Test FreeBSD passed
Test docker-mingw@fedora failed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200203032044.118585-1-aik@ozlabs.ru
Maintainers: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_rtas.c | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH qemu] spapr/rtas: Print message from "ibm,os-term"
Posted by Alexey Kardashevskiy 6 years ago
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.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_rtas.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 883fe28465e6..656fdd221665 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -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);
-- 
2.17.1


Re: [PATCH qemu] spapr/rtas: Print message from "ibm,os-term"
Posted by Daniel Henrique Barboza 6 years ago

On 2/3/20 12:20 AM, Alexey Kardashevskiy wrote:
> 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.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>   hw/ppc/spapr_rtas.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 883fe28465e6..656fdd221665 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -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);
> 

Re: [PATCH qemu] spapr/rtas: Print message from "ibm,os-term"
Posted by David Gibson 6 years ago
On Mon, Feb 03, 2020 at 02:20:44PM +1100, Alexey Kardashevskiy wrote:
> 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.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Applied to ppc-for-5.0, thanks.

> ---
>  hw/ppc/spapr_rtas.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 883fe28465e6..656fdd221665 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -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);

-- 
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