Received: from eggs.gnu.org ([2001:4830:134:3::10]:36891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1qKp-0001Hc-Ip for qemu-devel@nongnu.org; Tue, 01 Jul 2014 01:10:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1qKk-0000QH-2n for qemu-devel@nongnu.org; Tue, 01 Jul 2014 01:10:27 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) From: Alexander Graf In-Reply-To: <87a98t4vf0.fsf@abhimanyu.in.ibm.com> Date: Tue, 1 Jul 2014 07:10:15 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <66709ACB-7226-4B9F-8093-1355F4AF059A@suse.de> References: <1404117329-7899-1-git-send-email-nikunj@linux.vnet.ibm.com> <53B1870F.9090308@gmail.com> <1A032098-A6FB-4189-86A0-9CA6456038FA@suse.de> <87a98t4vf0.fsf@abhimanyu.in.ibm.com> Subject: Re: [Qemu-devel] [PATCH v5] ppc: spapr-rtas - implement os-term rtas call List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: Benjamin Herrenschmidt , "aik@ozlabs.ru" , Tyrel Datwyler , "qemu-devel@nongnu.org" , "qemu-ppc@nongnu.org" , Anton Blanchard > Am 01.07.2014 um 05:20 schrieb Nikunj A Dadhania : >=20 > Alexander Graf writes: >=20 >>> On 30.06.2014, at 17:49, Tyrel Datwyler = wrote: >>>=20 >>>> On 06/30/2014 01:35 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. >>>>=20 >>>> 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. >>>>=20 >>>> CC: Benjamin Herrenschmidt >>>> CC: Anton Blanchard >>>> CC: Alexander Graf >>>> CC: Tyrel Datwyler >>>> Signed-off-by: Nikunj A Dadhania >>>>=20 >>>> --- >>>>=20 >>>> 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(-) >>>>=20 >>>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c >>>> index 307c58d..e6c9014 100644 >>>> --- a/hw/ppc/spapr.c >>>> +++ b/hw/ppc/spapr.c >>>> @@ -520,6 +520,15 @@ static void *spapr_create_fdt_skel(hwaddr initrd_b= ase, >>>>=20 >>>> _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MA= X))); >>>>=20 >>>> + /* >>>> + * According to PAPR, rtas ibm,os-term, does not gaurantee a retur= n >>>> + * back to the guest cpu. >>>> + * >>>> + * While an additional ibm,extended-os-term property indicates tha= t >>>> + * rtas call return will always occur. Set this property. >>>> + */ >>>> + _FDT((fdt_property(fdt, "ibm,extended-os-term", NULL, 0))); >>>> + >>>> _FDT((fdt_end_node(fdt))); >>>>=20 >>>> /* interrupt controller */ >>>> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c >>>> index 9ba1ba6..2ec2a8e 100644 >>>> --- a/hw/ppc/spapr_rtas.c >>>> +++ b/hw/ppc/spapr_rtas.c >>>> @@ -277,6 +277,19 @@ static void rtas_ibm_set_system_parameter(PowerPCC= PU *cpu, >>>> rtas_st(rets, 0, ret); >>>> } >>>>=20 >>>> +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 =3D 0; >>>> + >>>> + qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_ab= ort); >>>> + >>>> + 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); >>>> } >>>>=20 >>>> type_init(core_rtas_register_types) >>>> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h >>>> index bbba51a..4e96381 100644 >>>> --- a/include/hw/ppc/spapr.h >>>> +++ b/include/hw/ppc/spapr.h >>>> @@ -382,7 +382,6 @@ int spapr_allocate_irq_block(int num, bool lsi, boo= l 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 + 0x2= 0) >>>>=20 >>>> #define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x21= ) >>>=20 >>> With the removal of RTAS_IBM_EXTENDED_OS_TERM doesn't RTAS_TOKEN_MAX >>> need to be decremented to (RTAS_TOKEN_BASE + 0x20)? >=20 > You are right. >=20 >> Good catch. Fixed in my queue. >=20 > Thanks, Any reason we dont have that as enum? We need to maintain number stability for live migration compatibility with o= lder machine types. So we have to make 100% sure that removing (or adding) o= ne 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 to= uch multiple lines rather than only a single one to change unrelated entries= . Hence it makes review easier. Alex