Message ID | 156327680307.27462.16414477591782848444.stgit@hbathini.in.ibm.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | Add FADump support on PowerNV platform | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch next (f5c20693d8edcd665f1159dc941b9e7f87c17647) |
snowpatch_ozlabs/apply_patch | fail | Failed to apply to any branch |
On 2019-07-16 17:03:23 Tue, Hari Bathini wrote: > Make OPAL calls to register and un-register with firmware for MPIPL. > > Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> > --- > arch/powerpc/platforms/powernv/opal-fadump.c | 71 +++++++++++++++++++++++++- > 1 file changed, 69 insertions(+), 2 deletions(-) > [...] > @@ -88,12 +104,63 @@ static int opal_fadump_setup_kernel_metadata(struct fw_dump *fadump_conf) > > static int opal_fadump_register_fadump(struct fw_dump *fadump_conf) > { > - return -EIO; > + int i, err = -EIO; > + s64 rc; > + > + for (i = 0; i < opal_fdm->region_cnt; i++) { > + rc = opal_mpipl_update(OPAL_MPIPL_ADD_RANGE, > + opal_fdm->rgn[i].src, > + opal_fdm->rgn[i].dest, > + opal_fdm->rgn[i].size); > + if (rc != OPAL_SUCCESS) You may want to remove ranges which has been added so far on error and reset opal_fdm->registered_regions. > + break; > + > + opal_fdm->registered_regions++; > + } > + > + switch (rc) { > + case OPAL_SUCCESS: > + pr_info("Registration is successful!\n"); > + fadump_conf->dump_registered = 1; > + err = 0; > + break; > + case OPAL_UNSUPPORTED: > + pr_err("Support not available.\n"); > + fadump_conf->fadump_supported = 0; > + fadump_conf->fadump_enabled = 0; > + break; > + case OPAL_INTERNAL_ERROR: > + pr_err("Failed to register. Hardware Error(%lld).\n", rc); > + break; > + case OPAL_PARAMETER: > + pr_err("Failed to register. Parameter Error(%lld).\n", rc); > + break; > + case OPAL_PERMISSION: You may want to remove this check. With latest opal mpipl patches opal_mpipl_update() no more returns OPAL_PERMISSION. Even if opal does, we can not say fadump already registered just by looking at return status of single entry addition. Thanks, -Mahesh. > + pr_err("Already registered!\n"); > + fadump_conf->dump_registered = 1; > + err = -EEXIST; > + break; > + default: > + pr_err("Failed to register. Unknown Error(%lld).\n", rc); > + break; > + } > + > + return err; > }
On 13/08/19 8:04 PM, Mahesh J Salgaonkar wrote: > On 2019-07-16 17:03:23 Tue, Hari Bathini wrote: >> Make OPAL calls to register and un-register with firmware for MPIPL. >> >> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> >> --- >> arch/powerpc/platforms/powernv/opal-fadump.c | 71 +++++++++++++++++++++++++- >> 1 file changed, 69 insertions(+), 2 deletions(-) >> > [...] >> @@ -88,12 +104,63 @@ static int opal_fadump_setup_kernel_metadata(struct fw_dump *fadump_conf) >> >> static int opal_fadump_register_fadump(struct fw_dump *fadump_conf) >> { >> - return -EIO; >> + int i, err = -EIO; >> + s64 rc; >> + >> + for (i = 0; i < opal_fdm->region_cnt; i++) { >> + rc = opal_mpipl_update(OPAL_MPIPL_ADD_RANGE, >> + opal_fdm->rgn[i].src, >> + opal_fdm->rgn[i].dest, >> + opal_fdm->rgn[i].size); >> + if (rc != OPAL_SUCCESS) > > You may want to remove ranges which has been added so far on error and reset > opal_fdm->registered_regions. Thanks for catching this, Mahesh. Will update.. > >> + break; >> + >> + opal_fdm->registered_regions++; >> + } >> + >> + switch (rc) { >> + case OPAL_SUCCESS: >> + pr_info("Registration is successful!\n"); >> + fadump_conf->dump_registered = 1; >> + err = 0; >> + break; >> + case OPAL_UNSUPPORTED: >> + pr_err("Support not available.\n"); >> + fadump_conf->fadump_supported = 0; >> + fadump_conf->fadump_enabled = 0; >> + break; >> + case OPAL_INTERNAL_ERROR: >> + pr_err("Failed to register. Hardware Error(%lld).\n", rc); >> + break; >> + case OPAL_PARAMETER: >> + pr_err("Failed to register. Parameter Error(%lld).\n", rc); >> + break; >> + case OPAL_PERMISSION: > > You may want to remove this check. With latest opal mpipl patches > opal_mpipl_update() no more returns OPAL_PERMISSION. > > Even if opal does, we can not say fadump already registered just by > looking at return status of single entry addition. Sure. Thanks Hari
diff --git a/arch/powerpc/platforms/powernv/opal-fadump.c b/arch/powerpc/platforms/powernv/opal-fadump.c index 4b8504e..2179126 100644 --- a/arch/powerpc/platforms/powernv/opal-fadump.c +++ b/arch/powerpc/platforms/powernv/opal-fadump.c @@ -27,6 +27,20 @@ static struct opal_fadump_mem_struct *opal_fdm; +static void opal_fadump_update_config(struct fw_dump *fadump_conf, + const struct opal_fadump_mem_struct *fdm) +{ + /* + * The destination address of the first boot memory region is the + * destination address of boot memory regions. + */ + fadump_conf->boot_mem_dest_addr = fdm->rgn[0].dest; + pr_debug("Destination address of boot memory regions: %#016lx\n", + fadump_conf->boot_mem_dest_addr); + + fadump_conf->fadumphdr_addr = fdm->fadumphdr_addr; +} + static ulong opal_fadump_init_mem_struct(struct fw_dump *fadump_conf) { ulong addr = fadump_conf->reserve_dump_area_start; @@ -47,6 +61,8 @@ static ulong opal_fadump_init_mem_struct(struct fw_dump *fadump_conf) opal_fdm->fadumphdr_addr = (opal_fdm->rgn[0].dest + fadump_conf->boot_memory_size); + opal_fadump_update_config(fadump_conf, opal_fdm); + return addr; } @@ -88,12 +104,63 @@ static int opal_fadump_setup_kernel_metadata(struct fw_dump *fadump_conf) static int opal_fadump_register_fadump(struct fw_dump *fadump_conf) { - return -EIO; + int i, err = -EIO; + s64 rc; + + for (i = 0; i < opal_fdm->region_cnt; i++) { + rc = opal_mpipl_update(OPAL_MPIPL_ADD_RANGE, + opal_fdm->rgn[i].src, + opal_fdm->rgn[i].dest, + opal_fdm->rgn[i].size); + if (rc != OPAL_SUCCESS) + break; + + opal_fdm->registered_regions++; + } + + switch (rc) { + case OPAL_SUCCESS: + pr_info("Registration is successful!\n"); + fadump_conf->dump_registered = 1; + err = 0; + break; + case OPAL_UNSUPPORTED: + pr_err("Support not available.\n"); + fadump_conf->fadump_supported = 0; + fadump_conf->fadump_enabled = 0; + break; + case OPAL_INTERNAL_ERROR: + pr_err("Failed to register. Hardware Error(%lld).\n", rc); + break; + case OPAL_PARAMETER: + pr_err("Failed to register. Parameter Error(%lld).\n", rc); + break; + case OPAL_PERMISSION: + pr_err("Already registered!\n"); + fadump_conf->dump_registered = 1; + err = -EEXIST; + break; + default: + pr_err("Failed to register. Unknown Error(%lld).\n", rc); + break; + } + + return err; } static int opal_fadump_unregister_fadump(struct fw_dump *fadump_conf) { - return -EIO; + s64 rc; + + rc = opal_mpipl_update(OPAL_MPIPL_REMOVE_ALL, 0, 0, 0); + if (rc) { + pr_err("Failed to un-register - unexpected Error(%lld).\n", rc); + return -EIO; + } + + opal_fdm->registered_regions = 0; + fadump_conf->dump_registered = 0; + return 0; } static int opal_fadump_invalidate_fadump(struct fw_dump *fadump_conf)
Make OPAL calls to register and un-register with firmware for MPIPL. Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> --- arch/powerpc/platforms/powernv/opal-fadump.c | 71 +++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-)