[PATCH 1/3] remoteproc: core: Add coredump to remoteproc ops
From: Gurbir Arora
Date: Fri Aug 07 2020 - 19:32:29 EST
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.
Signed-off-by: Rishabh Bhatnagar <rishabhb@xxxxxxxxxxxxxx>
Signed-off-by: Siddharth Gupta <sidgup@xxxxxxxxxxxxxx>
Signed-off-by: Gurbir Arora <gurbaror@xxxxxxxxxxxxxx>
---
drivers/remoteproc/remoteproc_core.c | 6 +++++-
include/linux/remoteproc.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 7f90eee..283ecb6 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1681,7 +1681,7 @@ int rproc_trigger_recovery(struct rproc *rproc)
goto unlock_mutex;
/* generate coredump */
- rproc_coredump(rproc);
+ rproc->ops->coredump(rproc);
/* load firmware */
ret = request_firmware(&firmware_p, rproc->firmware, dev);
@@ -2113,6 +2113,10 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops)
rproc->ops->sanity_check = rproc_elf_sanity_check;
rproc->ops->get_boot_addr = rproc_elf_get_boot_addr;
+ /* Default to rproc_coredump if no coredump functions is specified */
+ if (!rproc->ops->coredump)
+ rproc->ops->coredump = rproc_coredump;
+
return 0;
}
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 2fa68bf..0ed1a2b 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -392,6 +392,7 @@ struct rproc_ops {
int (*load)(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);
+ void (*coredump)(struct rproc *rproc);
unsigned long (*panic)(struct rproc *rproc);
};
--
1.9.1