ppc: spapr-rtas - implement os-term rtas call
PATCH v5 1/1 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 ibm,os-term when extended property of os-term is set. This makes sure that a return to the linux kernel is gauranteed.
---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: update spapr_register_rtas and qapi_event changes
v5: set ibm,extended-os-term as null encoded property
--- hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +9 -0
@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */
hw/ppc/spapr_rtas.c +15 -0
@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;
@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }type_init (core_rtas_register_types)
include/hw/ppc/spapr.h +0 -1
@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)
Signature · 1 line
1.8.3.1
Quoted 57 lines
Am 30.06.2014 um 10:35 schrieb Nikunj A Dadhania <[email protected]>:
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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property
---hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +0
-0@@ -277,6 +277,19 @@ static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu,rtas_st (rets,0 , ret); }
hw/ppc/spapr_rtas.c static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu, · line 288
Quoted 10 lines
hw/ppc/spapr_rtas.c +9
-0+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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort);
The guest doesn't pause. Since the guest will call os-term in a loop, this will also flood the event listener with lots and lots of panic messages.
Alex
Quoted 13 lines · Alexander Graf
hw/ppc/spapr_rtas.c static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu, · line 288
Quoted 11 lines
Am 30.06.2014 um 10:35 schrieb Nikunj A Dadhania <[email protected]>:
hw/ppc/spapr_rtas.c +9
-0+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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort);The guest doesn't pause.
I see the event reaching libvirt and a dump taken and the guest restarts.
Quoted 2 lines
Since the guest will call os-term in a loop, this will also flood the event listener with lots and lots of panic messages.
do {
status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL,
__pa(rtas_os_term_buf));
} while (rtas_busy_delay(status));So when status from the rtas call is success, the loop should exit.
Am I missing something?
Regards
Nikunj
Quoted 19 lines · Nikunj A Dadhania
Quoted 12 lines · Alexander Graf
hw/ppc/spapr_rtas.c static void rtas_ibm_set_system_parameter(PowerPCCPU *cpu, · line 288
Quoted 11 lines
Am 30.06.2014 um 10:35 schrieb Nikunj A Dadhania <[email protected]>:
hw/ppc/spapr_rtas.c +9
-0+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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort);The guest doesn't pause.
I see the event reaching libvirt and a dump taken and the guest restarts.
Quoted 2 lines
Since the guest will call os-term in a loop, this will also flood the event listener with lots and lots of panic messages.
Quoted 8 lines
do { status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL, __pa(rtas_os_term_buf)); } while (rtas_busy_delay(status));So when status from the rtas call is success, the loop should exit.
Am I missing something?
No, I think you're right. I'll queue it for 2.2.
Alex
Quoted 84 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property--- hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +15
-0@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }type_init (core_rtas_register_types)include/hw/ppc/spapr.h +0
-0
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 386
Quoted 6 lines
include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)
With the removal of RTAS_IBM_EXTENDED_OS_TERM doesn't RTAS_TOKEN_MAX need to be decremented to (RTAS_TOKEN_BASE + 0x20)?
-Tyrel
Quoted 90 lines · Tyrel Datwyler
Quoted 89 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property
---hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +15
-0@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }type_init (core_rtas_register_types)include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)
Quoted 4 lines
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 386
Quoted 1 line
include/hw/ppc/spapr.h +0
-0#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)With the removal of
RTAS_IBM_EXTENDED_OS_TERMdoesn'tRTAS_TOKEN_MAXneed to be decremented to (RTAS_TOKEN_BASE+0x20)?
Good catch. Fixed in my queue.
Alex
Quoted 92 lines · Alexander Graf
Quoted 90 lines · Tyrel Datwyler
Quoted 89 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property
---hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +15
-0@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }type_init (core_rtas_register_types)include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)
Quoted 4 lines
Quoted 4 lines
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 386
Quoted 1 line
include/hw/ppc/spapr.h +0
-0#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)With the removal of
RTAS_IBM_EXTENDED_OS_TERMdoesn'tRTAS_TOKEN_MAXneed to be decremented to (RTAS_TOKEN_BASE+0x20)?
You are right.
Quoted 1 line
Good catch. Fixed in my queue.
Thanks, Any reason we dont have that as enum?
Regards
Nikunj
Quoted 103 lines
Am 01.07.2014 um 05:20 schrieb Nikunj A Dadhania <[email protected]>:
Quoted 92 lines · Alexander Graf
Quoted 92 lines · Tyrel Datwyler
Quoted 91 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property
---hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +15
-0@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }type_init (core_rtas_register_types)include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)Quoted 4 lines
Quoted 4 lines
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 386
Quoted 1 line
include/hw/ppc/spapr.h +0
-0#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)With the removal of
RTAS_IBM_EXTENDED_OS_TERMdoesn'tRTAS_TOKEN_MAXneed to be decremented to (RTAS_TOKEN_BASE+0x20)?
Quoted 5 lines
You are right.
Quoted 1 line
Good catch. Fixed in my queue.
Thanks, Any reason we dont have that as enum?
We need to maintain number stability for live migration compatibility with older machine types. So we have to make 100% sure that removing (or adding) one entry does not have any guest visible impact.
This is a lot easier to guarantee with a lot of defines, as you'd have to touch multiple lines rather than only a single one to change unrelated entries. Hence it makes review easier.
Alex
Quoted 84 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property--- hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +15
-0@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }type_init (core_rtas_register_types)include/hw/ppc/spapr.h +0
-0
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 385
Quoted 4 lines
include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)
So we never ever going to implement this RTAS call? I'd keep the number.
Quoted 4 lines
include/hw/ppc/spapr.h +0
-0#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)
Signature · 1 line
Alexey
Quoted 79 lines · Alexey Kardashevskiy
Quoted 78 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>---
v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: updatespapr_register_rtasandqapi_eventchanges
v5: set ibm,extended-os-term as null encoded property--- hw/ppc/spapr.c | 9 +++++++++ hw/ppc/spapr_rtas.c | 15 +++++++++++++++ include/hw/ppc/spapr.h | 1 - 3 files changed, 24 insertions(+), 1 deletion(-)hw/ppc/spapr.c +9
-0@@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,_FDT ((fdt_property_cell (fdt,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX ))); +/* +* 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. Set this property. +*/ +_FDT ((fdt_property (fdt,"ibm,extended-os-term" ,NULL ,0 ))); +_FDT ((fdt_end_node (fdt)));/* interrupt controller */ hw/ppc/spapr_rtas.c +15
-0@@ -277,6 +277,19 @@ 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 ; + +qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_PAUSE , &error_abort); + +rtas_st (rets,0 , ret); +} + static struct rtas_call { const char *name; spapr_rtas_fn fn;@@ -404,6 +417,8 @@ 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 (RTAS_IBM_OS_TERM ,"ibm,os-term" , + rtas_ibm_os_term); }
Quoted 14 lines
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 385
Quoted 10 lines
hw/ppc/spapr_rtas.c +0
-0type_init (core_rtas_register_types)include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)So we never ever going to implement this RTAS call? I'd keep the number.
ah, it is in ppc-next-2.2 already. Never mind :)
Quoted 8 lines
Quoted 6 lines
include/hw/ppc/spapr.h +0
-0#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21)
Signature · 1 line
Alexey
Quoted 18 lines · Alexey Kardashevskiy
Quoted 17 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 ibm,os-term when extended property of os-term is set. This makes 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]>CC Tyrel Datwyler <[email protected]>Signed-off-by Nikunj A Dadhania <[email protected]>include/hw/ppc/spapr.h +0
-0
Quoted 8 lines
include/hw/ppc/spapr.h int spapr_allocate_irq_block(int num, bool lsi, bool msi); · line 385
Quoted 5 lines
include/hw/ppc/spapr.h +0
-1@@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, bool msi);#define RTAS_GET_SENSOR_STATE (RTAS_TOKEN_BASE + 0x1D)#define RTAS_IBM_CONFIGURE_CONNECTOR (RTAS_TOKEN_BASE + 0x1E)#define RTAS_IBM_OS_TERM (RTAS_TOKEN_BASE + 0x1F) -#define RTAS_IBM_EXTENDED_OS_TERM (RTAS_TOKEN_BASE + 0x20)So we never ever going to implement this RTAS call?
Yeah, as its an RTAS property an not a call.
Quoted 1 line
I'd keep the number.
Regards
Nikunj