Subject: [PATCH v4 0/2] Fallback to full coredump

Add support for full coredump as a fallback mechanism in
absence of minidump support.

Siddharth Gupta (2):
remoteproc: core: Export the rproc coredump APIs
remoteproc: qcom: Add full coredump fallback mechanism

drivers/remoteproc/qcom_common.c | 13 +++++++++++--
drivers/remoteproc/qcom_q6v5_pas.c | 1 +
drivers/remoteproc/remoteproc_coredump.c | 2 ++
drivers/remoteproc/remoteproc_internal.h | 4 ----
include/linux/remoteproc.h | 4 ++++
5 files changed, 18 insertions(+), 6 deletions(-)


base-commit: 7c855ef7137a67bcff0e039691b969428dd8ef6a
prerequisite-patch-id: e536336b8482ec63dac942663168e8437d59e250
prerequisite-patch-id: 3f021e6eb809f76cd989c6151437838cda16dd7d
prerequisite-patch-id: 78c3fd76f0fc0c6c016cd343afae65f60e6769dd
prerequisite-patch-id: 9157843370eb8a77d1c533a69a6ee061478dc11b
prerequisite-patch-id: 4ad66d124fd8370f9a443d726cb79e491cead691
prerequisite-patch-id: 226e1fb9cef4107698b0f15591aeca57025ff2d6
prerequisite-patch-id: a2fd45558397fc752b0e4f49305cdbe856747c30
prerequisite-patch-id: 45c6493f77babc82f66600b8914bfa46378e71e8
prerequisite-patch-id: d401dd88b3b36b67a0295a7b212e9a6902881930
prerequisite-patch-id: f494d0c370cae200c6af5bb3d6e784e3102b31b1
prerequisite-patch-id: c2192102ca8edd39defda07aa70fd484082adda8
prerequisite-patch-id: 2c4a3d89099cf154956088be6a30f1eeea131d8c
prerequisite-patch-id: 86ed20751124c24999c16289ba87d562c9000a31
prerequisite-patch-id: 1a8773faff744dafed185d8a55bb8f0840854220
prerequisite-patch-id: 9019e5c8c02d424787be016388c78fc612f0a94a
prerequisite-patch-id: c81d93897349887e70614cf628a8b72f6fedb52a
prerequisite-patch-id: 05e64f10cfd8ad329f583a2badde29a9424e4f0d
prerequisite-patch-id: 92276f31af93078364eac07142e45ef3cde3a1c9
prerequisite-patch-id: d40cb6cbde3f8e8385e7d79755a412d01994ec53
--
2.39.2



Subject: [PATCH v4 1/2] remoteproc: core: Export the rproc coredump APIs

From: Siddharth Gupta <[email protected]>

The remoteproc coredump APIs are currently only part of the internal
remoteproc header. This prevents the remoteproc platform drivers from
using these APIs when needed. This change moves the rproc_coredump()
and rproc_coredump_cleanup() APIs to the linux header and marks them
as exported symbols.

Signed-off-by: Siddharth Gupta <[email protected]>
Signed-off-by: Gokul krishna Krishnakumar <[email protected]>
---
drivers/remoteproc/remoteproc_coredump.c | 2 ++
drivers/remoteproc/remoteproc_internal.h | 4 ----
include/linux/remoteproc.h | 4 ++++
3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_coredump.c b/drivers/remoteproc/remoteproc_coredump.c
index 4b093420d98a..e8f1b580d1d9 100644
--- a/drivers/remoteproc/remoteproc_coredump.c
+++ b/drivers/remoteproc/remoteproc_coredump.c
@@ -32,6 +32,7 @@ void rproc_coredump_cleanup(struct rproc *rproc)
kfree(entry);
}
}
+EXPORT_SYMBOL(rproc_coredump_cleanup);

/**
* rproc_coredump_add_segment() - add segment of device memory to coredump
@@ -327,6 +328,7 @@ void rproc_coredump(struct rproc *rproc)
*/
wait_for_completion(&dump_state.dump_done);
}
+EXPORT_SYMBOL(rproc_coredump);

/**
* rproc_coredump_using_sections() - perform coredump using section headers
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
index d4dbb8d1d80c..f62a82d71dfa 100644
--- a/drivers/remoteproc/remoteproc_internal.h
+++ b/drivers/remoteproc/remoteproc_internal.h
@@ -76,10 +76,6 @@ extern struct class rproc_class;
int rproc_init_sysfs(void);
void rproc_exit_sysfs(void);

-/* from remoteproc_coredump.c */
-void rproc_coredump_cleanup(struct rproc *rproc);
-void rproc_coredump(struct rproc *rproc);
-
#ifdef CONFIG_REMOTEPROC_CDEV
void rproc_init_cdev(void);
void rproc_exit_cdev(void);
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index fe8978eb69f1..b4795698d8c2 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -690,6 +690,10 @@ int rproc_detach(struct rproc *rproc);
int rproc_set_firmware(struct rproc *rproc, const char *fw_name);
void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);
void *rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem);
+
+/* from remoteproc_coredump.c */
+void rproc_coredump_cleanup(struct rproc *rproc);
+void rproc_coredump(struct rproc *rproc);
void rproc_coredump_using_sections(struct rproc *rproc);
int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size);
int rproc_coredump_add_custom_segment(struct rproc *rproc,
--
2.39.2


Subject: [PATCH v4 2/2] remoteproc: qcom: Add full coredump fallback mechanism

From: Siddharth Gupta <[email protected]>

If a remoteproc's firmware does not support minidump but the driver
adds an ID, the minidump driver does not collect any coredumps when
the remoteproc crashes. This hinders the purpose of coredump
collection. This change adds a fallback mechanism in the event of a
crash.

Signed-off-by: Siddharth Gupta <[email protected]>
Signed-off-by: Gokul krishna Krishnakumar <[email protected]>
---
drivers/remoteproc/qcom_common.c | 13 +++++++++++--
drivers/remoteproc/qcom_q6v5_pas.c | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 7da3259be14a..280a5a821dca 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -173,12 +173,21 @@ void qcom_minidump(struct rproc *rproc, unsigned int minidump_id,
*/
if (subsystem->regions_baseptr == 0 ||
le32_to_cpu(subsystem->status) != 1 ||
- le32_to_cpu(subsystem->enabled) != MD_SS_ENABLED ||
- le32_to_cpu(subsystem->encryption_status) != MD_SS_ENCR_DONE) {
+ le32_to_cpu(subsystem->enabled) != MD_SS_ENABLED) {
+ return rproc_coredump(rproc);
+ }
+
+ if (le32_to_cpu(subsystem->encryption_status) != MD_SS_ENCR_DONE) {
dev_err(&rproc->dev, "Minidump not ready, skipping\n");
return;
}

+ /**
+ * Clear out the dump segments populated by parse_fw before
+ * re-populating them with minidump segments.
+ */
+ rproc_coredump_cleanup(rproc);
+
ret = qcom_add_minidump_segments(rproc, subsystem, rproc_dumpfn_t);
if (ret) {
dev_err(&rproc->dev, "Failed with error: %d while adding minidump entries\n", ret);
diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 27d3a6f8c92f..d065f99b4c32 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -442,6 +442,7 @@ static const struct rproc_ops adsp_minidump_ops = {
.start = adsp_start,
.stop = adsp_stop,
.da_to_va = adsp_da_to_va,
+ .parse_fw = qcom_register_dump_segments,
.load = adsp_load,
.panic = adsp_panic,
.coredump = adsp_minidump,
--
2.39.2


2023-02-24 20:00:19

by Trilok Soni

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] remoteproc: core: Export the rproc coredump APIs

On 2/24/2023 11:57 AM, Gokul krishna Krishnakumar wrote:
> From: Siddharth Gupta <[email protected]>
>
> The remoteproc coredump APIs are currently only part of the internal
> remoteproc header. This prevents the remoteproc platform drivers from
> using these APIs when needed. This change moves the rproc_coredump()
> and rproc_coredump_cleanup() APIs to the linux header and marks them
> as exported symbols.
>
> Signed-off-by: Siddharth Gupta <[email protected]>
> Signed-off-by: Gokul krishna Krishnakumar <[email protected]>
> ---
> drivers/remoteproc/remoteproc_coredump.c | 2 ++
> drivers/remoteproc/remoteproc_internal.h | 4 ----
> include/linux/remoteproc.h | 4 ++++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/remoteproc/remoteproc_coredump.c b/drivers/remoteproc/remoteproc_coredump.c
> index 4b093420d98a..e8f1b580d1d9 100644
> --- a/drivers/remoteproc/remoteproc_coredump.c
> +++ b/drivers/remoteproc/remoteproc_coredump.c
> @@ -32,6 +32,7 @@ void rproc_coredump_cleanup(struct rproc *rproc)
> kfree(entry);
> }
> }
> +EXPORT_SYMBOL(rproc_coredump_cleanup);

EXPORT_SYMBOL_GPL?

>
> /**
> * rproc_coredump_add_segment() - add segment of device memory to coredump
> @@ -327,6 +328,7 @@ void rproc_coredump(struct rproc *rproc)
> */
> wait_for_completion(&dump_state.dump_done);
> }
> +EXPORT_SYMBOL(rproc_coredump);

Same as above.