+ if (!data)
+ return;
+
+ memcpy(data, qproc->mba_region, MBA_LOG_SIZE);
+ dev_coredumpv(&rproc->dev, data, MBA_LOG_SIZE, GFP_KERNEL);
+}
+
static int q6v5proc_reset(struct q6v5 *qproc)
{
u32 val;
@@ -838,6 +856,7 @@ static int q6v5_mba_load(struct q6v5 *qproc)
{
int ret;
int xfermemop_ret;
+ bool mba_load_err = false;
qcom_q6v5_prepare(&qproc->q6v5);
@@ -931,7 +950,7 @@ static int q6v5_mba_load(struct q6v5 *qproc)
q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_q6);
q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_modem);
q6v5proc_halt_axi_port(qproc, qproc->halt_map, qproc->halt_nc);
-
+ mba_load_err = true;
reclaim_mba:
xfermemop_ret = q6v5_xfer_mem_ownership(qproc, &qproc->mba_perm,
true,
false, qproc->mba_phys,
@@ -939,6 +958,8 @@ static int q6v5_mba_load(struct q6v5 *qproc)
if (xfermemop_ret) {
dev_err(qproc->dev,
"Failed to reclaim mba buffer, system may become
unstable\n");
+ } else if (qproc->has_mba_logs & mba_load_err) {
+ q6v5_dump_mba_logs(qproc);
}
disable_active_clks:
@@ -968,7 +989,7 @@ static int q6v5_mba_load(struct q6v5 *qproc)
return ret;
}
-static void q6v5_mba_reclaim(struct q6v5 *qproc)
+static void q6v5_mba_reclaim(struct q6v5 *qproc, bool err_path)
{
int ret;
u32 val;
@@ -1006,6 +1027,9 @@ static void q6v5_mba_reclaim(struct q6v5 *qproc)
qproc->mba_size);
WARN_ON(ret);
+ if (qproc->has_mba_logs && err_path && !ret)
+ q6v5_dump_mba_logs(qproc);
+
ret = qcom_q6v5_unprepare(&qproc->q6v5);
if (ret) {
q6v5_pds_disable(qproc, qproc->proxy_pds,
@@ -1255,7 +1279,7 @@ static void qcom_q6v5_dump_segment(struct rproc
*rproc,
false, true,
qproc->mpss_phys,
qproc->mpss_size);
- q6v5_mba_reclaim(qproc);
+ q6v5_mba_reclaim(qproc, false);
}
}
}
@@ -1297,7 +1321,7 @@ static int q6v5_start(struct rproc *rproc)
return 0;
reclaim_mpss:
- q6v5_mba_reclaim(qproc);
+ q6v5_mba_reclaim(qproc, true);
return ret;
}
@@ -1313,7 +1337,7 @@ static int q6v5_stop(struct rproc *rproc)
if (ret == -ETIMEDOUT)
dev_err(qproc->dev, "timed out on wait\n");
- q6v5_mba_reclaim(qproc);
+ q6v5_mba_reclaim(qproc, false);
return 0;
}
@@ -1717,6 +1741,7 @@ static int q6v5_probe(struct platform_device
*pdev)
qproc->version = desc->version;
qproc->need_mem_protection = desc->need_mem_protection;
+ qproc->has_mba_logs = desc->has_mba_logs;
ret = qcom_q6v5_init(&qproc->q6v5, pdev, rproc,
MPSS_CRASH_REASON_SMEM,
qcom_msa_handover);
@@ -1808,6 +1833,7 @@ static const struct rproc_hexagon_res sc7180_mss
= {
},
.need_mem_protection = true,
.has_alt_reset = false,
+ .has_mba_logs = true,
.has_spare_reg = true,
.version = MSS_SC7180,
};
@@ -1843,6 +1869,7 @@ static const struct rproc_hexagon_res sdm845_mss
= {
},
.need_mem_protection = true,
.has_alt_reset = true,
+ .has_mba_logs = true,
.has_spare_reg = false,
.version = MSS_SDM845,
};
@@ -1870,6 +1897,7 @@ static const struct rproc_hexagon_res
msm8998_mss = {
},
.need_mem_protection = true,
.has_alt_reset = false,
+ .has_mba_logs = false,
.has_spare_reg = false,
.version = MSS_MSM8998,
};
@@ -1900,6 +1928,7 @@ static const struct rproc_hexagon_res
msm8996_mss = {
},
.need_mem_protection = true,
.has_alt_reset = false,
+ .has_mba_logs = false,
.has_spare_reg = false,
.version = MSS_MSM8996,
};
@@ -1933,6 +1962,7 @@ static const struct rproc_hexagon_res
msm8916_mss = {
},
.need_mem_protection = false,
.has_alt_reset = false,
+ .has_mba_logs = false,
.has_spare_reg = false,
.version = MSS_MSM8916,
};
@@ -1974,6 +2004,7 @@ static const struct rproc_hexagon_res
msm8974_mss = {
},
.need_mem_protection = false,
.has_alt_reset = false,
+ .has_mba_logs = false,
.has_spare_reg = false,
.version = MSS_MSM8974,
};
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum,
a Linux Foundation Collaborative Project