Skip to content

Commit

Permalink
hdata: Create /ibm, opal/dump device tree node
Browse files Browse the repository at this point in the history
We use MPIPL system parameter to detect whether MPIPL is supported or not.
If its supported create new device tree node (/ibm,opal/dump) to pass all
dump related information to kernel. This patch creates new node and populates
below properties:
  - compatible   - dump version (ibm,opal-dump)
  - fw-load-area - Memory used by OPAL to load kernel/initrd from PNOR
                   (KERNEL_LOAD_BASE & INITRAMFS_LOAD_BASE).
                   This is the temporary memory used by OPAL during boot.
		   Later Linux kernel is free to use this memory. During
		   MPIPL boot also OPAL will overwrite this memory.

		   OPAL will advertise these memory details to kernel.
		   If kernel is using these memory and needs these memory
		   content for proper dump creation, then it has to reserve
		   destination memory to preserve these memory ranges.
		   Also kernel should pass this detail during registration.
		   During MPIPL firmware will take care of preserving memory
		   and post MPIPL kernel can create proper dump.

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 ed7110e commit 0cadc98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hdata/spira.c
Expand Up @@ -928,6 +928,23 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams)
dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size);
}

static void add_opal_dump_node(void)
{
u64 fw_load_area[4];
struct dt_node *node;

opal_node = dt_new_check(dt_root, "ibm,opal");
node = dt_new(opal_node, "dump");
assert(node);
dt_add_property_string(node, "compatible", "ibm,opal-dump");

fw_load_area[0] = cpu_to_be64((u64)KERNEL_LOAD_BASE);
fw_load_area[1] = cpu_to_be64(KERNEL_LOAD_SIZE);
fw_load_area[2] = cpu_to_be64((u64)INITRAMFS_LOAD_BASE);
fw_load_area[3] = cpu_to_be64(INITRAMFS_LOAD_SIZE);
dt_add_property(node, "fw-load-area", fw_load_area, sizeof(fw_load_area));
}

static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
{
const struct iplparams_sysparams *p;
Expand Down Expand Up @@ -1015,6 +1032,10 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
if (sys_attributes & SYS_ATTR_RISK_LEVEL)
dt_add_property(node, "elevated-risk-level", NULL, 0);

/* Populate OPAL dump node */
if (sys_attributes & SYS_ATTR_MPIPL_SUPPORTED)
add_opal_dump_node();

if (version >= 0x60 && proc_gen >= proc_gen_p9)
dt_init_secureboot_node(p);
}
Expand Down
1 change: 1 addition & 0 deletions hdata/spira.h
Expand Up @@ -351,6 +351,7 @@ struct iplparams_sysparams {
__be32 sys_eco_mode;
#define SYS_ATTR_MULTIPLE_TPM PPC_BIT32(0)
#define SYS_ATTR_RISK_LEVEL PPC_BIT32(3)
#define SYS_ATTR_MPIPL_SUPPORTED PPC_BIT32(4)
__be32 sys_attributes;
__be32 mem_scrubbing;
__be16 cur_spl_value;
Expand Down

0 comments on commit 0cadc98

Please sign in to comment.