Skip to content

Commit

Permalink
MPIPL: Prepare architected registers data tag
Browse files Browse the repository at this point in the history
Post MPIPL kernel needs saved CPU register details to create vmcore/opalcore.
This patch prepares CPU register data tag and add it to tags list.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
[oliver: rebased]
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
Vasant Hegde authored and oohal committed Aug 15, 2019
1 parent fa5cb00 commit 4ddf114
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions core/opal-dump.c
Expand Up @@ -51,6 +51,7 @@ static struct mpipl_metadata *mpipl_metadata;

/* Dump metadata area */
static struct opal_mpipl_fadump *opal_mpipl_data;
static struct opal_mpipl_fadump *opal_mpipl_cpu_data;

/*
* Number of tags passed by OPAL to kernel after MPIPL boot.
Expand Down Expand Up @@ -402,6 +403,41 @@ static inline void post_mpipl_get_preserved_tags(void)
opal_mpipl_tags[OPAL_MPIPL_TAG_BOOT_MEM] = mpipl_metadata->boot_mem_size;
}

static void post_mpipl_arch_regs_data(void)
{
struct proc_dump_area *proc_dump = (void *)(PROC_DUMP_AREA_BASE);

if (proc_dump->dest_addr == 0) {
prlog(PR_DEBUG, "Invalid CPU registers destination address\n");
return;
}

if (proc_dump->act_size == 0) {
prlog(PR_DEBUG, "Invalid CPU registers destination size\n");
return;
}

opal_mpipl_cpu_data = zalloc(sizeof(struct opal_mpipl_fadump) +
sizeof(struct opal_mpipl_region));
if (!opal_mpipl_cpu_data) {
prlog(PR_ERR, "Failed to allocate memory\n");
return;
}

/* Fill CPU register details */
opal_mpipl_cpu_data->version = OPAL_MPIPL_VERSION;
opal_mpipl_cpu_data->cpu_data_version = proc_dump->version;
opal_mpipl_cpu_data->cpu_data_size = proc_dump->thread_size;
opal_mpipl_cpu_data->region_cnt = cpu_to_be32(1);

opal_mpipl_cpu_data->region[0].src = proc_dump->dest_addr & ~(HRMOR_BIT);
opal_mpipl_cpu_data->region[0].dest = proc_dump->dest_addr & ~(HRMOR_BIT);
opal_mpipl_cpu_data->region[0].size = proc_dump->act_size;

/* Update tag */
opal_mpipl_tags[OPAL_MPIPL_TAG_CPU] = (u64)opal_mpipl_cpu_data;
}

static void post_mpipl_get_opal_data(void)
{
struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE);
Expand Down Expand Up @@ -485,6 +521,7 @@ void opal_mpipl_init(void)
if (dt_find_property(dump_node, "mpipl-boot")) {
post_mpipl_get_preserved_tags();
post_mpipl_get_opal_data();
post_mpipl_arch_regs_data();
}

/* Clear OPAL metadata area */
Expand Down

0 comments on commit 4ddf114

Please sign in to comment.