remoteproc: qcom: Add full coredump fallback mechanism
authorSiddharth Gupta <sidgup@codeaurora.org>
Fri, 24 Feb 2023 21:17:07 +0000 (13:17 -0800)
committerBjorn Andersson <andersson@kernel.org>
Sat, 15 Jul 2023 19:56:49 +0000 (12:56 -0700)
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 <sidgup@codeaurora.org>
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
Link: https://lore.kernel.org/r/20230224211707.30916-3-quic_gokukris@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/remoteproc/qcom_common.c
drivers/remoteproc/qcom_q6v5_pas.c

index a0d4238..4bbb47d 100644 (file)
@@ -168,12 +168,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);
index 0caedb0..d5b6206 100644 (file)
@@ -426,6 +426,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,