Skip to content

Commit 1fb82ee

Browse files
committed
remoteproc: qcom: Introduce sysmon
The sysmon client communicates either via a dedicated SMD/GLINK channel or via QMI encoded messages over IPCROUTER with remote processors in order to perform graceful shutdown and inform about other remote processors shutting down. Acked-By: Chris Lew <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 880f5b3 commit 1fb82ee

File tree

7 files changed

+637
-0
lines changed

7 files changed

+637
-0
lines changed

drivers/remoteproc/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ config QCOM_ADSP_PIL
9191
depends on QCOM_SMEM
9292
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
9393
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
94+
depends on QCOM_SYSMON || QCOM_SYSMON=n
9495
select MFD_SYSCON
9596
select QCOM_MDT_LOADER
9697
select QCOM_RPROC_COMMON
@@ -108,19 +109,35 @@ config QCOM_Q6V5_PIL
108109
depends on QCOM_SMEM
109110
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
110111
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
112+
depends on QCOM_SYSMON || QCOM_SYSMON=n
111113
select MFD_SYSCON
112114
select QCOM_RPROC_COMMON
113115
select QCOM_SCM
114116
help
115117
Say y here to support the Qualcomm Peripherial Image Loader for the
116118
Hexagon V5 based remote processors.
117119

120+
config QCOM_SYSMON
121+
tristate "Qualcomm sysmon driver"
122+
depends on RPMSG
123+
depends on ARCH_QCOM
124+
select QCOM_QMI_HELPERS
125+
help
126+
The sysmon driver implements a sysmon QMI client and a handler for
127+
the sys_mon SMD and GLINK channel, which are used for graceful
128+
shutdown, retrieving failure information and propagating information
129+
about other subsystems being shut down.
130+
131+
Say y here if your system runs firmware on any other subsystems, e.g.
132+
modem or DSP.
133+
118134
config QCOM_WCNSS_PIL
119135
tristate "Qualcomm WCNSS Peripheral Image Loader"
120136
depends on OF && ARCH_QCOM
121137
depends on RPMSG_QCOM_SMD || (COMPILE_TEST && RPMSG_QCOM_SMD=n)
122138
depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
123139
depends on QCOM_SMEM
140+
depends on QCOM_SYSMON || QCOM_SYSMON=n
124141
select QCOM_MDT_LOADER
125142
select QCOM_RPROC_COMMON
126143
select QCOM_SCM

drivers/remoteproc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ obj-$(CONFIG_KEYSTONE_REMOTEPROC) += keystone_remoteproc.o
1717
obj-$(CONFIG_QCOM_ADSP_PIL) += qcom_adsp_pil.o
1818
obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o
1919
obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o
20+
obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o
2021
obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o
2122
qcom_wcnss_pil-y += qcom_wcnss.o
2223
qcom_wcnss_pil-y += qcom_wcnss_iris.o

drivers/remoteproc/qcom_adsp_pil.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ struct adsp_data {
3838
const char *firmware_name;
3939
int pas_id;
4040
bool has_aggre2_clk;
41+
4142
const char *ssr_name;
43+
const char *sysmon_name;
44+
int ssctl_id;
4245
};
4346

4447
struct qcom_adsp {
@@ -75,6 +78,7 @@ struct qcom_adsp {
7578
struct qcom_rproc_glink glink_subdev;
7679
struct qcom_rproc_subdev smd_subdev;
7780
struct qcom_rproc_ssr ssr_subdev;
81+
struct qcom_sysmon *sysmon;
7882
};
7983

8084
static int adsp_load(struct rproc *rproc, const struct firmware *fw)
@@ -398,6 +402,9 @@ static int adsp_probe(struct platform_device *pdev)
398402
qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
399403
qcom_add_smd_subdev(rproc, &adsp->smd_subdev);
400404
qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
405+
adsp->sysmon = qcom_add_sysmon_subdev(rproc,
406+
desc->sysmon_name,
407+
desc->ssctl_id);
401408

402409
ret = rproc_add(rproc);
403410
if (ret)
@@ -419,6 +426,7 @@ static int adsp_remove(struct platform_device *pdev)
419426
rproc_del(adsp->rproc);
420427

421428
qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev);
429+
qcom_remove_sysmon_subdev(adsp->sysmon);
422430
qcom_remove_smd_subdev(adsp->rproc, &adsp->smd_subdev);
423431
qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
424432
rproc_free(adsp->rproc);
@@ -432,6 +440,8 @@ static const struct adsp_data adsp_resource_init = {
432440
.pas_id = 1,
433441
.has_aggre2_clk = false,
434442
.ssr_name = "lpass",
443+
.sysmon_name = "adsp",
444+
.ssctl_id = 0x14,
435445
};
436446

437447
static const struct adsp_data slpi_resource_init = {
@@ -440,6 +450,8 @@ static const struct adsp_data slpi_resource_init = {
440450
.pas_id = 12,
441451
.has_aggre2_clk = true,
442452
.ssr_name = "dsps",
453+
.sysmon_name = "slpi",
454+
.ssctl_id = 0x16,
443455
};
444456

445457
static const struct of_device_id adsp_of_match[] = {

drivers/remoteproc/qcom_common.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#include <linux/remoteproc.h>
66
#include "remoteproc_internal.h"
7+
#include <linux/soc/qcom/qmi.h>
8+
9+
struct qcom_sysmon;
710

811
struct qcom_rproc_glink {
912
struct rproc_subdev subdev;
@@ -39,4 +42,22 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr,
3942
const char *ssr_name);
4043
void qcom_remove_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr);
4144

45+
#if IS_ENABLED(CONFIG_QCOM_SYSMON)
46+
struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
47+
const char *name,
48+
int ssctl_instance);
49+
void qcom_remove_sysmon_subdev(struct qcom_sysmon *sysmon);
50+
#else
51+
static inline struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
52+
const char *name,
53+
int ssctl_instance)
54+
{
55+
return NULL;
56+
}
57+
58+
static inline void qcom_remove_sysmon_subdev(struct qcom_sysmon *sysmon)
59+
{
60+
}
61+
#endif
62+
4263
#endif

drivers/remoteproc/qcom_q6v5_pil.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct q6v5 {
168168

169169
struct qcom_rproc_subdev smd_subdev;
170170
struct qcom_rproc_ssr ssr_subdev;
171+
struct qcom_sysmon *sysmon;
171172
bool need_mem_protection;
172173
int mpss_perm;
173174
int mba_perm;
@@ -1209,6 +1210,7 @@ static int q6v5_probe(struct platform_device *pdev)
12091210
qproc->mba_perm = BIT(QCOM_SCM_VMID_HLOS);
12101211
qcom_add_smd_subdev(rproc, &qproc->smd_subdev);
12111212
qcom_add_ssr_subdev(rproc, &qproc->ssr_subdev, "mpss");
1213+
qproc->sysmon = qcom_add_sysmon_subdev(rproc, "modem", 0x12);
12121214

12131215
ret = rproc_add(rproc);
12141216
if (ret)
@@ -1228,6 +1230,7 @@ static int q6v5_remove(struct platform_device *pdev)
12281230

12291231
rproc_del(qproc->rproc);
12301232

1233+
qcom_remove_sysmon_subdev(qproc->sysmon);
12311234
qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev);
12321235
qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev);
12331236
rproc_free(qproc->rproc);

0 commit comments

Comments
 (0)