Commit adf60a87 authored by Siddharth Gupta's avatar Siddharth Gupta Committed by Bjorn Andersson

remoteproc: core: Add ops to enable custom coredump functionality

Each remoteproc might have different requirements for coredumps and might
want to choose the type of dumps it wants to collect. This change allows
remoteproc drivers to specify their own custom dump function to be executed
in place of rproc_coredump. If the coredump op is not specified by the
remoteproc driver it will be set to rproc_coredump by default.
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarSiddharth Gupta <sidgup@codeaurora.org>
Link: https://lore.kernel.org/r/1605819935-10726-2-git-send-email-sidgup@codeaurora.orgSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 0a441514
...@@ -1704,7 +1704,7 @@ int rproc_trigger_recovery(struct rproc *rproc) ...@@ -1704,7 +1704,7 @@ int rproc_trigger_recovery(struct rproc *rproc)
goto unlock_mutex; goto unlock_mutex;
/* generate coredump */ /* generate coredump */
rproc_coredump(rproc); rproc->ops->coredump(rproc);
/* load firmware */ /* load firmware */
ret = request_firmware(&firmware_p, rproc->firmware, dev); ret = request_firmware(&firmware_p, rproc->firmware, dev);
...@@ -2189,6 +2189,10 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops) ...@@ -2189,6 +2189,10 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops)
if (!rproc->ops) if (!rproc->ops)
return -ENOMEM; return -ENOMEM;
/* Default to rproc_coredump if no coredump function is specified */
if (!rproc->ops->coredump)
rproc->ops->coredump = rproc_coredump;
if (rproc->ops->load) if (rproc->ops->load)
return 0; return 0;
......
...@@ -375,6 +375,7 @@ enum rsc_handling_status { ...@@ -375,6 +375,7 @@ enum rsc_handling_status {
* @get_boot_addr: get boot address to entry point specified in firmware * @get_boot_addr: get boot address to entry point specified in firmware
* @panic: optional callback to react to system panic, core will delay * @panic: optional callback to react to system panic, core will delay
* panic at least the returned number of milliseconds * panic at least the returned number of milliseconds
* @coredump: collect firmware dump after the subsystem is shutdown
*/ */
struct rproc_ops { struct rproc_ops {
int (*prepare)(struct rproc *rproc); int (*prepare)(struct rproc *rproc);
...@@ -393,6 +394,7 @@ struct rproc_ops { ...@@ -393,6 +394,7 @@ struct rproc_ops {
int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
unsigned long (*panic)(struct rproc *rproc); unsigned long (*panic)(struct rproc *rproc);
void (*coredump)(struct rproc *rproc);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment