ppc: spapr-rtas - implement os-term rtas call
PATCH v3 1/3 ppc: spapr-rtas - implement os-term rtas call
PAPR compliant guest calls this in absence of kdump. This finally reaches the guest and can be handled according to the policies set by higher level tools(like taking dump) for further analysis by tools like crash.
Linux kernel calls this only when the extended version of os,term is implemented to make sure that a return to the linux kernel is gauranteed.
---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
--- hw/ppc/spapr_rtas.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
hw/ppc/spapr_rtas.c +41 -0
@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h"
@@ -277,6 +279,41 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); + +rtas_st (rets,0 , ret); +} + +/* +* According to PAPR, rtas ibm,os-term, does not gaurantee a return +* back to the guest cpu. +* +* While an additional ibm,extended-os-term property indicates that +* rtas call return will always occur. Below function implements a +* place holder for the same. +*/ +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =RTAS_OUT_NOT_SUPPORTED ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
@@ -404,6 +441,10 @@ static void core_rtas_register_types(void)spapr_rtas_register (RTAS_IBM_SET_SYSTEM_PARAMETER ,"ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , + rtas_ibm_os_term); +spapr_rtas_register ("ibm,extended-os-term" , + rtas_ibm_ext_os_term); }type_init (core_rtas_register_types)
Signature · 1 line
1.8.3.1
Quoted 77 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. This finally reaches the guest and can be handled according to the policies set by higher level tools(like taking dump) for further analysis by tools like crash.
Linux kernel calls this only when the extended version of os,term is implemented to make sure that a return to the linux kernel is gauranteed.
CC Benjamin Herrenschmidt <[email protected]>CC Anton Blanchard <[email protected]>CC Alexander Graf <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments--- hw/ppc/spapr_rtas.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)hw/ppc/spapr_rtas.c +37
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -277,6 +279,41 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =0 ; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); + +rtas_st (rets,0 , ret); +} + +/* +* According to PAPR, rtas ibm,os-term, does not gaurantee a return +* back to the guest cpu. +* +* While an additional ibm,extended-os-term property indicates that +* rtas call return will always occur. Below function implements a +* place holder for the same. +*/ +static void rtas_ibm_ext_os_term (PowerPCCPU *cpu, +sPAPREnvironment *spapr, +uint32_t token,uint32_t nargs, +target_ulong args, +uint32_t nret,target_ulong rets) +{ +target_ulong ret =RTAS_OUT_NOT_SUPPORTED ; + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 445
Quoted 5 lines
hw/ppc/spapr_rtas.c +2
-0@@ -404,6 +441,10 @@ static void core_rtas_register_types(void)spapr_rtas_register (RTAS_IBM_SET_SYSTEM_PARAMETER ,"ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , + rtas_ibm_os_term);
This just won't compile, spapr_rtas_register() takes 3 parameters now. Tokens for "ibm,os-term" and "ibm,extended-os-term" are already defined, just use them.
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 450
Quoted 6 lines
hw/ppc/spapr_rtas.c +2
-0+spapr_rtas_register ("ibm,extended-os-term" , + rtas_ibm_ext_os_term); }type_init (core_rtas_register_types)
ps. please (please) do not use my ibm's email in public :)
Signature · 5 lines
Alexey Kardashevskiy IBM OzLabs, LTC Team e-mail: [email protected] notes: Alexey Kardashevskiy/Australia/IBM
Quoted 14 lines · Alexey Kardashevskiy
Quoted 13 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. This finally reaches the guest and can be handled according to the policies set by higher level tools(like taking dump) for further analysis by tools like crash.
Linux kernel calls this only when the extended version of os,term is implemented to make sure that a return to the linux kernel is gauranteed.
CC Benjamin Herrenschmidt <[email protected]>CC Anton Blanchard <[email protected]>CC Alexander Graf <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>
Quoted 12 lines
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 445
Quoted 9 lines
static struct rtas_call { const char *name; spapr_rtas_fn fn;hw/ppc/spapr_rtas.c +2
-0@@ -404,6 +441,10 @@ static void core_rtas_register_types(void)spapr_rtas_register (RTAS_IBM_SET_SYSTEM_PARAMETER ,"ibm,set-system-parameter" , rtas_ibm_set_system_parameter); +spapr_rtas_register ("ibm,os-term" , + rtas_ibm_os_term);This just won't compile,
spapr_rtas_register()takes 3 parameters now.
duh, i missed that update :(
Resending
Quoted 9 lines
Tokens for "ibm,os-term" and "ibm,extended-os-term" are already defined, just use them.
Quoted 4 lines
hw/ppc/spapr_rtas.c +2
-0+spapr_rtas_register ("ibm,extended-os-term" , + rtas_ibm_ext_os_term); }
Quoted 5 lines
hw/ppc/spapr_rtas.c static void core_rtas_register_types(void) · line 450
Quoted 2 lines
hw/ppc/spapr_rtas.c +0
-0type_init (core_rtas_register_types)ps. please (please) do not use my ibm's email in public :)
Sure.
Regards
Nikunj
Quoted 40 lines · Nikunj A Dadhania
PAPR compliant guest calls this in absence of kdump. This finally reaches the guest and can be handled according to the policies set by higher level tools(like taking dump) for further analysis by tools like crash.
Linux kernel calls this only when the extended version of os,term is implemented to make sure that a return to the linux kernel is gauranteed.
CC Benjamin Herrenschmidt <[email protected]>CC Anton Blanchard <[email protected]>CC Alexander Graf <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments--- hw/ppc/spapr_rtas.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)hw/ppc/spapr_rtas.c +4
-0@@ -29,6 +29,8 @@#include "sysemu/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "qapi/qmp/qjson.h" +#include "monitor/monitor.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -277,6 +279,41 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); } +static void rtas_ibm_os_term(PowerPCCPU *cpu, + sPAPREnvironment *spapr,
hw/ppc/spapr_rtas.c static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu, · line 293
Quoted 10 lines
hw/ppc/spapr_rtas.c +10
-0+ uint32_t token, uint32_t nargs, + target_ulong args, + uint32_t nret, target_ulong rets) +{ + target_ulong ret = 0; +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data);
Even the above has got changed, and newer api: qapi_event_send_guest_panicked
Regards
Nikunj