qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4] ppc: spapr-rtas - implement os-term rtas call
@ 2014-06-27  7:37 Nikunj A Dadhania
  2014-06-27 19:29 ` [Qemu-devel] [Qemu-ppc] " Tyrel Datwyler
  0 siblings, 1 reply; 3+ messages in thread
From: Nikunj A Dadhania @ 2014-06-27  7:37 UTC (permalink / raw)
  To: qemu-devel, agraf
  Cc: aik, Benjamin Herrenschmidt, qemu-ppc, Anton Blanchard, nikunj

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 <benh@au1.ibm.com>
CC: Anton Blanchard <anton@samba.org>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

---

v2: rebase to ppcnext
v3: Do not stop the VM, and update comments
v4: update spapr_register_rtas and qapi_event changes
---
 hw/ppc/spapr_rtas.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 9ba1ba6..b11de41 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -277,6 +277,38 @@ 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);
+}
+
+/*
+ * 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 +436,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(RTAS_IBM_OS_TERM, "ibm,os-term",
+                        rtas_ibm_os_term);
+    spapr_rtas_register(RTAS_IBM_EXTENDED_OS_TERM, "ibm,extended-os-term",
+                        rtas_ibm_ext_os_term);
 }
 
 type_init(core_rtas_register_types)
-- 
1.8.3.1

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH v4] ppc: spapr-rtas - implement os-term rtas call
  2014-06-27  7:37 [Qemu-devel] [PATCH v4] ppc: spapr-rtas - implement os-term rtas call Nikunj A Dadhania
@ 2014-06-27 19:29 ` Tyrel Datwyler
  2014-06-30  5:05   ` Nikunj A Dadhania
  0 siblings, 1 reply; 3+ messages in thread
From: Tyrel Datwyler @ 2014-06-27 19:29 UTC (permalink / raw)
  To: Nikunj A Dadhania, qemu-devel, agraf; +Cc: Benjamin Herrenschmidt, qemu-ppc

On 06/27/2014 12:37 AM, Nikunj A Dadhania wrote:
> 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 <benh@au1.ibm.com>
> CC: Anton Blanchard <anton@samba.org>
> CC: Alexander Graf <agraf@suse.de>
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> 
> ---
> 
> v2: rebase to ppcnext
> v3: Do not stop the VM, and update comments
> v4: update spapr_register_rtas and qapi_event changes
> ---
>  hw/ppc/spapr_rtas.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 9ba1ba6..b11de41 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -277,6 +277,38 @@ 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);
> +}
> +
> +/*
> + * 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.
> + */

PAPR defines ibm,extended-os-term as a null encoded property not a rtas
function. It should be added to the device tree in the
spapr_create_fdt_skel function under the "rtas" node. The following
should suffice.

_FDT((fdt_property(fdt, "ibm,extended-os-term", NULL, 0)));

-Tyrel

> +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 +436,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(RTAS_IBM_OS_TERM, "ibm,os-term",
> +                        rtas_ibm_os_term);
> +    spapr_rtas_register(RTAS_IBM_EXTENDED_OS_TERM, "ibm,extended-os-term",
> +                        rtas_ibm_ext_os_term);
>  }
>  
>  type_init(core_rtas_register_types)
> 

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH v4] ppc: spapr-rtas - implement os-term rtas call
  2014-06-27 19:29 ` [Qemu-devel] [Qemu-ppc] " Tyrel Datwyler
@ 2014-06-30  5:05   ` Nikunj A Dadhania
  0 siblings, 0 replies; 3+ messages in thread
From: Nikunj A Dadhania @ 2014-06-30  5:05 UTC (permalink / raw)
  To: Tyrel Datwyler, qemu-devel, agraf; +Cc: Benjamin Herrenschmidt, qemu-ppc

Tyrel Datwyler <turtle.in.the.kernel@gmail.com> writes:

> On 06/27/2014 12:37 AM, Nikunj A Dadhania wrote:
>> 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 <benh@au1.ibm.com>
>> CC: Anton Blanchard <anton@samba.org>
>> CC: Alexander Graf <agraf@suse.de>
>> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> 
>> ---
>> 
>> v2: rebase to ppcnext
>> v3: Do not stop the VM, and update comments
>> v4: update spapr_register_rtas and qapi_event changes
>> ---
>>  hw/ppc/spapr_rtas.c | 36 ++++++++++++++++++++++++++++++++++++
>>  1 file changed, 36 insertions(+)
>> 
>> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
>> index 9ba1ba6..b11de41 100644
>> --- a/hw/ppc/spapr_rtas.c
>> +++ b/hw/ppc/spapr_rtas.c
>> @@ -277,6 +277,38 @@ 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);
>> +}
>> +
>> +/*
>> + * 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.
>> + */
>
> PAPR defines ibm,extended-os-term as a null encoded property not a rtas
> function. It should be added to the device tree in the
> spapr_create_fdt_skel function under the "rtas" node. The following
> should suffice.
>
> _FDT((fdt_property(fdt, "ibm,extended-os-term", NULL, 0)));
>

Sure, I can do that, much better.

Regards
Nikunj

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

end of thread, other threads:[~2014-06-30  5:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-27  7:37 [Qemu-devel] [PATCH v4] ppc: spapr-rtas - implement os-term rtas call Nikunj A Dadhania
2014-06-27 19:29 ` [Qemu-devel] [Qemu-ppc] " Tyrel Datwyler
2014-06-30  5:05   ` Nikunj A Dadhania

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).