Skip to content

Commit 568b13b

Browse files
Richard Mainaandersson
authored andcommitted
remoteproc: qcom_q6v5_pas: Add hwspinlock bust on stop
When remoteproc goes down unexpectedly this results in a state where any acquired hwspinlocks will remain locked possibly resulting in deadlock. In order to ensure all locks are freed we include a call to qcom_smem_bust_hwspin_lock_by_host() during remoteproc shutdown. For qcom_q6v5_pas remoteprocs, each remoteproc has an assigned smem host_id. Remoteproc can pass this id to smem to try and bust the lock on remoteproc stop. This edge case only occurs with q6v5_pas watchdog crashes. The error fatal case has handling to clear the hwspinlock before the error fatal interrupt is triggered. Signed-off-by: Richard Maina <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Chris Lew <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 2e3f0d6 commit 568b13b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/remoteproc/qcom_q6v5_pas.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct adsp_data {
5252
const char *ssr_name;
5353
const char *sysmon_name;
5454
int ssctl_id;
55+
unsigned int smem_host_id;
5556

5657
int region_assign_idx;
5758
int region_assign_count;
@@ -81,6 +82,7 @@ struct qcom_adsp {
8182
int lite_pas_id;
8283
unsigned int minidump_id;
8384
int crash_reason_smem;
85+
unsigned int smem_host_id;
8486
bool decrypt_shutdown;
8587
const char *info_name;
8688

@@ -399,6 +401,9 @@ static int adsp_stop(struct rproc *rproc)
399401
if (handover)
400402
qcom_pas_handover(&adsp->q6v5);
401403

404+
if (adsp->smem_host_id)
405+
ret = qcom_smem_bust_hwspin_lock_by_host(adsp->smem_host_id);
406+
402407
return ret;
403408
}
404409

@@ -727,6 +732,7 @@ static int adsp_probe(struct platform_device *pdev)
727732
adsp->pas_id = desc->pas_id;
728733
adsp->lite_pas_id = desc->lite_pas_id;
729734
adsp->info_name = desc->sysmon_name;
735+
adsp->smem_host_id = desc->smem_host_id;
730736
adsp->decrypt_shutdown = desc->decrypt_shutdown;
731737
adsp->region_assign_idx = desc->region_assign_idx;
732738
adsp->region_assign_count = min_t(int, MAX_ASSIGN_COUNT, desc->region_assign_count);
@@ -1196,6 +1202,7 @@ static const struct adsp_data sm8550_adsp_resource = {
11961202
.ssr_name = "lpass",
11971203
.sysmon_name = "adsp",
11981204
.ssctl_id = 0x14,
1205+
.smem_host_id = 2,
11991206
};
12001207

12011208
static const struct adsp_data sm8550_cdsp_resource = {
@@ -1216,6 +1223,7 @@ static const struct adsp_data sm8550_cdsp_resource = {
12161223
.ssr_name = "cdsp",
12171224
.sysmon_name = "cdsp",
12181225
.ssctl_id = 0x17,
1226+
.smem_host_id = 5,
12191227
};
12201228

12211229
static const struct adsp_data sm8550_mpss_resource = {
@@ -1236,6 +1244,7 @@ static const struct adsp_data sm8550_mpss_resource = {
12361244
.ssr_name = "mpss",
12371245
.sysmon_name = "modem",
12381246
.ssctl_id = 0x12,
1247+
.smem_host_id = 1,
12391248
.region_assign_idx = 2,
12401249
.region_assign_count = 1,
12411250
.region_assign_vmid = QCOM_SCM_VMID_MSS_MSA,
@@ -1275,6 +1284,7 @@ static const struct adsp_data sm8650_cdsp_resource = {
12751284
.ssr_name = "cdsp",
12761285
.sysmon_name = "cdsp",
12771286
.ssctl_id = 0x17,
1287+
.smem_host_id = 5,
12781288
.region_assign_idx = 2,
12791289
.region_assign_count = 1,
12801290
.region_assign_shared = true,
@@ -1299,6 +1309,7 @@ static const struct adsp_data sm8650_mpss_resource = {
12991309
.ssr_name = "mpss",
13001310
.sysmon_name = "modem",
13011311
.ssctl_id = 0x12,
1312+
.smem_host_id = 1,
13021313
.region_assign_idx = 2,
13031314
.region_assign_count = 3,
13041315
.region_assign_vmid = QCOM_SCM_VMID_MSS_MSA,

0 commit comments

Comments
 (0)