Skip to content

Commit

Permalink
ppc: spapr-rtas - implement os-term rtas call
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[agraf: reduce RTAS_TOKEN_MAX]
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
nikunjad authored and agraf committed Sep 8, 2014
1 parent 277c7a4 commit 2e14072
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
9 changes: 9 additions & 0 deletions hw/ppc/spapr.c
Expand Up @@ -502,6 +502,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 */
Expand Down
15 changes: 15 additions & 0 deletions hw/ppc/spapr_rtas.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
3 changes: 1 addition & 2 deletions include/hw/ppc/spapr.h
Expand Up @@ -382,9 +382,8 @@ 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)
#define RTAS_TOKEN_MAX (RTAS_TOKEN_BASE + 0x20)

/* RTAS ibm,get-system-parameter token values */
#define RTAS_SYSPARM_SPLPAR_CHARACTERISTICS 20
Expand Down

0 comments on commit 2e14072

Please sign in to comment.