Qualcomm GLINK SSR support
cover Qualcomm GLINK SSR support
This adds the common Qualcomm helpers to tie in subsystem restart notifications with the ADSP and Modem PILs and then adds a driver for the "glink_ssr" channel to propagate these notifications.
This is needed on GLINK RPM enabled platforms to have the RPM reset the state of the communication channels to the peripherals, allowing them to be restarted without the RPM crashing due stale FIFO data.
Bjorn Andersson (2):
remoteproc: qcom: Add support for SSR notifications
soc: qcom: GLINK SSR notifier
drivers/remoteproc/qcom_adsp_pil.c | 6 ++ drivers/remoteproc/qcom_common.c | 71 +++++++++++++++ drivers/remoteproc/qcom_common.h | 10 +++ drivers/remoteproc/qcom_q6v5_pil.c | 3 + drivers/soc/qcom/Kconfig | 9 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/glink_ssr.c | 164 ++++++++++++++++++++++++++++++++++ include/linux/remoteproc/qcom_rproc.h | 22 +++++ 8 files changed, 286 insertions(+) create mode 100644 drivers/soc/qcom/glink_ssr.c create mode 100644 include/linux/remoteproc/qcom_rproc.h
Signature · 1 line
2.12.0
PATCH 1/2 remoteproc: qcom: Add support for SSR notifications
This adds the remoteproc part of subsystem restart, which is responsible for emitting notifications to other processors in the system about a dying remoteproc instance.
These notifications are propagated to the various communication systems in the various remote processors to shut down communication links that was left in a dangling state as the remoteproc was stopped (or crashed).
--- drivers/remoteproc/qcom_adsp_pil.c | 6 +++ drivers/remoteproc/qcom_common.c | 71 +++++++++++++++++++++++++++++++++++ drivers/remoteproc/qcom_common.h | 10 +++++ drivers/remoteproc/qcom_q6v5_pil.c | 3 ++ include/linux/remoteproc/qcom_rproc.h | 22 +++++++++++ 5 files changed, 112 insertions(+) create mode 100644 include/linux/remoteproc/qcom_rproc.h
drivers/remoteproc/qcom_adsp_pil.c +6 -0
@@ -38,6 +38,7 @@ struct adsp_data {const char *firmware_name;int pas_id;bool has_aggre2_clk; +const char *ssr_name; };struct qcom_adsp {
@@ -72,6 +73,7 @@ struct qcom_adsp {size_t mem_size;struct qcom_rproc_subdev smd_subdev; +struct qcom_rproc_ssr ssr_subdev; };static int adsp_load (struct rproc *rproc,const struct firmware *fw)
@@ -402,6 +404,7 @@ static int adsp_probe(struct platform_device *pdev) }qcom_add_smd_subdev (rproc, &adsp->smd_subdev); +qcom_add_ssr_subdev (rproc, &adsp->ssr_subdev, desc->ssr_name); ret =rproc_add (rproc);if (ret)
@@ -423,6 +426,7 @@ static int adsp_remove(struct platform_device *pdev)rproc_del (adsp->rproc);qcom_remove_smd_subdev (adsp->rproc, &adsp->smd_subdev); +qcom_remove_ssr_subdev (adsp->rproc, &adsp->ssr_subdev);rproc_free (adsp->rproc);return 0 ;
@@ -433,6 +437,7 @@ static const struct adsp_data adsp_resource_init = { .firmware_name = "adsp.mdt", .pas_id = 1, .has_aggre2_clk = false, + .ssr_name = "lpass", };static const struct adsp_data slpi_resource_init = {
@@ -440,6 +445,7 @@ static const struct adsp_data slpi_resource_init = { .firmware_name = "slpi.mdt", .pas_id = 12, .has_aggre2_clk = true, + .ssr_name = "dsps", };static const struct of_device_id adsp_of_match[] = {
drivers/remoteproc/qcom_common.c +71 -0
88 lines not on this page · raw message
drivers/remoteproc/qcom_common.h +10 -0
@@ -12,6 +12,12 @@ struct qcom_rproc_subdev {struct qcom_smd_edge *edge; }; +struct qcom_rproc_ssr { +struct rproc_subdev subdev; + +const char *name; +}; +struct resource_table *qcom_mdt_find_rsc_table (struct rproc *rproc,const struct firmware *fw,int *tablesz);
@@ -19,4 +25,8 @@ struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc,void qcom_add_smd_subdev (struct rproc *rproc,struct qcom_rproc_subdev *smd);void qcom_remove_smd_subdev (struct rproc *rproc,struct qcom_rproc_subdev *smd); +void qcom_add_ssr_subdev (struct rproc *rproc,struct qcom_rproc_ssr *ssr, +const char *ssr_name); +void qcom_remove_ssr_subdev (struct rproc *rproc,struct qcom_rproc_ssr *ssr); +#endif
drivers/remoteproc/qcom_q6v5_pil.c +3 -0
@@ -153,6 +153,7 @@ struct q6v5 {size_t mpss_size;struct qcom_rproc_subdev smd_subdev; +struct qcom_rproc_ssr ssr_subdev; }; static int q6v5_regulator_init(struct device *dev, struct reg_info *regs,
@@ -1038,6 +1039,7 @@ static int q6v5_probe(struct platform_device *pdev) }qcom_add_smd_subdev (rproc, &qproc->smd_subdev); +qcom_add_ssr_subdev (rproc, &qproc->ssr_subdev,"mpss" ); ret =rproc_add (rproc);if (ret)
@@ -1058,6 +1060,7 @@ static int q6v5_remove(struct platform_device *pdev)rproc_del (qproc->rproc);qcom_remove_smd_subdev (qproc->rproc, &qproc->smd_subdev); +qcom_remove_ssr_subdev (qproc->rproc, &qproc->ssr_subdev);rproc_free (qproc->rproc);return 0 ;
include/linux/remoteproc/qcom_rproc.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef __QCOM_RPROC_H__ +#define __QCOM_RPROC_H__ + +struct notifier_block ; + +#if IS_ENABLED (CONFIG_QCOM_RPROC_COMMON ) + +int qcom_register_ssr_notifier (struct notifier_block *nb); +void qcom_unregister_ssr_notifier (struct notifier_block *nb); + +#else + +static inline int qcom_register_ssr_notifier (struct notifier_block *nb) +{ +return 0 ; +} + +static inline void qcom_unregister_ssr_notifier (struct notifier_block *nb) {} + +#endif + +#endif
Signature · 1 line
2.12.0
PATCH 2/2 soc: qcom: GLINK SSR notifier
In reply to Bjorn AnderssonThis driver register as a subsystem restart notifier and will send out notifications to remote processors that has opened the "glink_ssr" GLINK channel.
This mechanism is used to signal any GLINK participants that a 3rd party is gone and that the communication state has to be reset; i.e. that read and write pointers of the GLINK FIFOs are stale.
--- drivers/soc/qcom/Kconfig | 9 +++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/glink_ssr.c | 164 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 drivers/soc/qcom/glink_ssr.c
drivers/soc/qcom/Kconfig +9 -0
@@ -1,6 +1,15 @@ # # QCOM Soc drivers # +config QCOM_GLINK_SSR + tristate "Qualcomm Glink SSR driver" + depends on RPMSG + depends on QCOM_RPROC_COMMON + help + Say y here to enable GLINK SSR support. The GLINK SSR driver + implements the SSR protocol for notifying the remote processor about + neighboring subsystems going up or down. + config QCOM_GSBI tristate "QCOM General Serial Bus Interface" depends on ARCH_QCOM
drivers/soc/qcom/Makefile +1 -0
@@ -1,3 +1,4 @@ +obj-$(CONFIG_QCOM_GLINK_SSR) += glink_ssr.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o obj-$(CONFIG_QCOM_PM) += spm.o
drivers/soc/qcom/glink_ssr.c new file +164 -0
164 lines not on this page · raw message
Signature · 1 line
2.12.0
Re: [PATCH 2/2] soc: qcom: GLINK SSR notifier
Quoted 9 lines · Bjorn Andersson
This driver register as a subsystem restart notifier and will send out notifications to remote processors that has opened the "
glink_ssr" GLINK channel.This mechanism is used to signal any GLINK participants that a 3rd party is gone and that the communication state has to be reset; i.e. that read and write pointers of the GLINK FIFOs are stale.
Signed-off-by Bjorn Andersson <[email protected]>
Looks pretty straightforward.