2020-04-23 00:39:28

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 0/4] rpmsg: Refactor Qualcomm glink_ssr

In order to allow for wider use of the SSR notifier in remoteproc's qcom_common
this series internalizes the notifier chain used by glink_ssr. To simplify the
Kconfig dependencies it also moves the glink_ssr implementation to rpmsg and
merges it with qcom_glink_native, as these do go hand in hand.

Bjorn Andersson (4):
remoteproc: qcom: Pass ssr_name to glink subdevice
soc: qcom: glink_ssr: Internalize ssr_notifiers
rpmsg: glink: Integrate glink_ssr in qcom_glink
arm64: defconfig: Remove QCOM_GLINK_SSR

arch/arm64/configs/defconfig | 1 -
drivers/remoteproc/qcom_common.c | 17 ++++++++++-
drivers/remoteproc/qcom_common.h | 5 +++-
drivers/remoteproc/qcom_q6v5_adsp.c | 2 +-
drivers/remoteproc/qcom_q6v5_mss.c | 2 +-
drivers/remoteproc/qcom_q6v5_pas.c | 2 +-
drivers/rpmsg/Kconfig | 6 ++--
drivers/rpmsg/Makefile | 3 +-
.../glink_ssr.c => rpmsg/qcom_glink_ssr.c} | 28 +++++++++++++------
drivers/soc/qcom/Kconfig | 9 ------
drivers/soc/qcom/Makefile | 1 -
include/linux/rpmsg/qcom_glink.h | 3 +-
12 files changed, 49 insertions(+), 30 deletions(-)
rename drivers/{soc/qcom/glink_ssr.c => rpmsg/qcom_glink_ssr.c} (83%)

--
2.24.0


2020-04-23 00:39:39

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 3/4] rpmsg: glink: Integrate glink_ssr in qcom_glink

In all but the very special case of a system with _only_ glink_rpm,
GLINK is dependent on glink_ssr, so move it to rpmsg and combine it with
qcom_glink_native in the new qcom_glink kernel module.

Signed-off-by: Bjorn Andersson <[email protected]>
---
drivers/rpmsg/Kconfig | 6 +++---
drivers/rpmsg/Makefile | 3 ++-
drivers/{soc/qcom/glink_ssr.c => rpmsg/qcom_glink_ssr.c} | 4 ----
drivers/soc/qcom/Kconfig | 9 ---------
drivers/soc/qcom/Makefile | 1 -
include/linux/rpmsg/qcom_glink.h | 7 +------
6 files changed, 6 insertions(+), 24 deletions(-)
rename drivers/{soc/qcom/glink_ssr.c => rpmsg/qcom_glink_ssr.c} (97%)

diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
index a9108ff563dc..f96716893c2a 100644
--- a/drivers/rpmsg/Kconfig
+++ b/drivers/rpmsg/Kconfig
@@ -24,13 +24,13 @@ config RPMSG_MTK_SCP
remote processors in MediaTek platforms.
This use IPI and IPC to communicate with remote processors.

-config RPMSG_QCOM_GLINK_NATIVE
+config RPMSG_QCOM_GLINK
tristate
select RPMSG

config RPMSG_QCOM_GLINK_RPM
tristate "Qualcomm RPM Glink driver"
- select RPMSG_QCOM_GLINK_NATIVE
+ select RPMSG_QCOM_GLINK
depends on HAS_IOMEM
depends on MAILBOX
help
@@ -40,7 +40,7 @@ config RPMSG_QCOM_GLINK_RPM

config RPMSG_QCOM_GLINK_SMEM
tristate "Qualcomm SMEM Glink driver"
- select RPMSG_QCOM_GLINK_NATIVE
+ select RPMSG_QCOM_GLINK
depends on MAILBOX
depends on QCOM_SMEM
help
diff --git a/drivers/rpmsg/Makefile b/drivers/rpmsg/Makefile
index ae92a7fb08f6..ffe932ef6050 100644
--- a/drivers/rpmsg/Makefile
+++ b/drivers/rpmsg/Makefile
@@ -2,8 +2,9 @@
obj-$(CONFIG_RPMSG) += rpmsg_core.o
obj-$(CONFIG_RPMSG_CHAR) += rpmsg_char.o
obj-$(CONFIG_RPMSG_MTK_SCP) += mtk_rpmsg.o
+qcom_glink-objs := qcom_glink_native.o qcom_glink_ssr.o
+obj-$(CONFIG_RPMSG_QCOM_GLINK) += qcom_glink.o
obj-$(CONFIG_RPMSG_QCOM_GLINK_RPM) += qcom_glink_rpm.o
-obj-$(CONFIG_RPMSG_QCOM_GLINK_NATIVE) += qcom_glink_native.o
obj-$(CONFIG_RPMSG_QCOM_GLINK_SMEM) += qcom_glink_smem.o
obj-$(CONFIG_RPMSG_QCOM_SMD) += qcom_smd.o
obj-$(CONFIG_RPMSG_VIRTIO) += virtio_rpmsg_bus.o
diff --git a/drivers/soc/qcom/glink_ssr.c b/drivers/rpmsg/qcom_glink_ssr.c
similarity index 97%
rename from drivers/soc/qcom/glink_ssr.c
rename to drivers/rpmsg/qcom_glink_ssr.c
index 847d79c935f1..dcd1ce616974 100644
--- a/drivers/soc/qcom/glink_ssr.c
+++ b/drivers/rpmsg/qcom_glink_ssr.c
@@ -164,7 +164,3 @@ static struct rpmsg_driver qcom_glink_ssr_driver = {
},
};
module_rpmsg_driver(qcom_glink_ssr_driver);
-
-MODULE_ALIAS("rpmsg:glink_ssr");
-MODULE_DESCRIPTION("Qualcomm GLINK SSR notifier");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 19332ea40234..5140bd82f1be 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -35,15 +35,6 @@ config QCOM_GENI_SE
driver is also used to manage the common aspects of multiple Serial
Engines present in the QUP.

-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 || COMPILE_TEST
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index 5d6b83dc58e8..e9cacc9ad401 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -3,7 +3,6 @@ CFLAGS_rpmh-rsc.o := -I$(src)
obj-$(CONFIG_QCOM_AOSS_QMP) += qcom_aoss.o
obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o
obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
-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_OCMEM) += ocmem.o
diff --git a/include/linux/rpmsg/qcom_glink.h b/include/linux/rpmsg/qcom_glink.h
index 09daa0acde2c..daded9fddf36 100644
--- a/include/linux/rpmsg/qcom_glink.h
+++ b/include/linux/rpmsg/qcom_glink.h
@@ -12,6 +12,7 @@ struct qcom_glink;
struct qcom_glink *qcom_glink_smem_register(struct device *parent,
struct device_node *node);
void qcom_glink_smem_unregister(struct qcom_glink *glink);
+void qcom_glink_ssr_notify(const char *ssr_name);

#else

@@ -23,12 +24,6 @@ qcom_glink_smem_register(struct device *parent,
}

static inline void qcom_glink_smem_unregister(struct qcom_glink *glink) {}
-
-#endif
-
-#if IS_ENABLED(CONFIG_RPMSG_QCOM_GLINK_SSR)
-void qcom_glink_ssr_notify(const char *ssr_name);
-#else
static inline void qcom_glink_ssr_notify(const char *ssr_name) {}
#endif

--
2.24.0

2020-04-23 00:39:45

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 4/4] arm64: defconfig: Remove QCOM_GLINK_SSR

Remove the QCOM_GLINK_SSR option from the arm64 defconfig, as the module
is assimilated by QCOM_GLINK - which is selected by other means.

Signed-off-by: Bjorn Andersson <[email protected]>
---
arch/arm64/configs/defconfig | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index f9eefb5940ca..f26a0b6ea0e8 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -838,7 +838,6 @@ CONFIG_FSL_MC_DPIO=y
CONFIG_IMX_SCU_SOC=y
CONFIG_QCOM_AOSS_QMP=y
CONFIG_QCOM_GENI_SE=y
-CONFIG_QCOM_GLINK_SSR=m
CONFIG_QCOM_RMTFS_MEM=m
CONFIG_QCOM_RPMH=y
CONFIG_QCOM_RPMHPD=y
--
2.24.0

2020-04-23 00:40:05

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 1/4] remoteproc: qcom: Pass ssr_name to glink subdevice

Pass ssr_name to glink subdevice in preparation for tying glink_ssr to
the glink subdevice, rather than having its own "ssr subdevice".

Signed-off-by: Bjorn Andersson <[email protected]>
---
drivers/remoteproc/qcom_common.c | 9 ++++++++-
drivers/remoteproc/qcom_common.h | 5 ++++-
drivers/remoteproc/qcom_q6v5_adsp.c | 2 +-
drivers/remoteproc/qcom_q6v5_mss.c | 2 +-
drivers/remoteproc/qcom_q6v5_pas.c | 2 +-
5 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 60650bcc8c67..ff26f2b68752 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -46,8 +46,10 @@ static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed)
* qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
* @rproc: rproc handle to parent the subdevice
* @glink: reference to a GLINK subdev context
+ * @ssr_name: identifier of the associated remoteproc for ssr notifications
*/
-void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
+void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
+ const char *ssr_name)
{
struct device *dev = &rproc->dev;

@@ -55,6 +57,10 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
if (!glink->node)
return;

+ glink->ssr_name = kstrdup_const(ssr_name, GFP_KERNEL);
+ if (!glink->ssr_name)
+ return;
+
glink->dev = dev;
glink->subdev.start = glink_subdev_start;
glink->subdev.stop = glink_subdev_stop;
@@ -74,6 +80,7 @@ void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glin
return;

rproc_remove_subdev(rproc, &glink->subdev);
+ kfree_const(glink->ssr_name);
of_node_put(glink->node);
}
EXPORT_SYMBOL_GPL(qcom_remove_glink_subdev);
diff --git a/drivers/remoteproc/qcom_common.h b/drivers/remoteproc/qcom_common.h
index 58de71e4781c..34e5188187dc 100644
--- a/drivers/remoteproc/qcom_common.h
+++ b/drivers/remoteproc/qcom_common.h
@@ -11,6 +11,8 @@ struct qcom_sysmon;
struct qcom_rproc_glink {
struct rproc_subdev subdev;

+ const char *ssr_name;
+
struct device *dev;
struct device_node *node;
struct qcom_glink *edge;
@@ -30,7 +32,8 @@ struct qcom_rproc_ssr {
const char *name;
};

-void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);
+void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
+ const char *ssr_name);
void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);

int qcom_register_dump_segments(struct rproc *rproc, const struct firmware *fw);
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index c60dabc6939e..d2a2574dcf35 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -461,7 +461,7 @@ static int adsp_probe(struct platform_device *pdev)
if (ret)
goto disable_pm;

- qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
+ qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name);
qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
adsp->sysmon = qcom_add_sysmon_subdev(rproc,
desc->sysmon_name,
diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
index 7af1d0c987e0..b5dd36775b77 100644
--- a/drivers/remoteproc/qcom_q6v5_mss.c
+++ b/drivers/remoteproc/qcom_q6v5_mss.c
@@ -1762,7 +1762,7 @@ static int q6v5_probe(struct platform_device *pdev)

qproc->mpss_perm = BIT(QCOM_SCM_VMID_HLOS);
qproc->mba_perm = BIT(QCOM_SCM_VMID_HLOS);
- qcom_add_glink_subdev(rproc, &qproc->glink_subdev);
+ qcom_add_glink_subdev(rproc, &qproc->glink_subdev, "mpss");
qcom_add_smd_subdev(rproc, &qproc->smd_subdev);
qcom_add_ssr_subdev(rproc, &qproc->ssr_subdev, "mpss");
qcom_add_ipa_notify_subdev(rproc, &qproc->ipa_notify_subdev);
diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 8ecc157f1ed1..fc6658b523b6 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -436,7 +436,7 @@ static int adsp_probe(struct platform_device *pdev)
if (ret)
goto detach_proxy_pds;

- qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
+ qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name);
qcom_add_smd_subdev(rproc, &adsp->smd_subdev);
qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
adsp->sysmon = qcom_add_sysmon_subdev(rproc,
--
2.24.0

2020-04-23 00:42:21

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 2/4] soc: qcom: glink_ssr: Internalize ssr_notifiers

Rather than carrying a special purpose blocking notifier for glink_ssr
in remoteproc's qcom_common.c, move it into glink_ssr so allow wider
reuse of the common one.

The rpmsg glink header file is used in preparation for the next patch.

Signed-off-by: Bjorn Andersson <[email protected]>
---
drivers/remoteproc/qcom_common.c | 8 ++++++++
drivers/soc/qcom/glink_ssr.c | 24 +++++++++++++++++++-----
include/linux/rpmsg/qcom_glink.h | 6 ++++++
3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index ff26f2b68752..9028cea2d81e 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -42,6 +42,13 @@ static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed)
glink->edge = NULL;
}

+static void glink_subdev_unprepare(struct rproc_subdev *subdev)
+{
+ struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
+
+ qcom_glink_ssr_notify(glink->ssr_name);
+}
+
/**
* qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
* @rproc: rproc handle to parent the subdevice
@@ -64,6 +71,7 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
glink->dev = dev;
glink->subdev.start = glink_subdev_start;
glink->subdev.stop = glink_subdev_stop;
+ glink->subdev.unprepare = glink_subdev_unprepare;

rproc_add_subdev(rproc, &glink->subdev);
}
diff --git a/drivers/soc/qcom/glink_ssr.c b/drivers/soc/qcom/glink_ssr.c
index d7babe3d67bc..847d79c935f1 100644
--- a/drivers/soc/qcom/glink_ssr.c
+++ b/drivers/soc/qcom/glink_ssr.c
@@ -54,6 +54,19 @@ struct glink_ssr {
struct completion completion;
};

+/* Notifier list for all registered glink_ssr instances */
+static BLOCKING_NOTIFIER_HEAD(ssr_notifiers);
+
+/**
+ * qcom_glink_ssr_notify() - notify GLINK SSR about stopped remoteproc
+ * @ssr_name: name of the remoteproc that has been stopped
+ */
+void qcom_glink_ssr_notify(const char *ssr_name)
+{
+ blocking_notifier_call_chain(&ssr_notifiers, 0, (void *)ssr_name);
+}
+EXPORT_SYMBOL_GPL(qcom_glink_ssr_notify);
+
static int qcom_glink_ssr_callback(struct rpmsg_device *rpdev,
void *data, int len, void *priv, u32 addr)
{
@@ -81,8 +94,9 @@ static int qcom_glink_ssr_callback(struct rpmsg_device *rpdev,
return 0;
}

-static int qcom_glink_ssr_notify(struct notifier_block *nb, unsigned long event,
- void *data)
+static int qcom_glink_ssr_notifier_call(struct notifier_block *nb,
+ unsigned long event,
+ void *data)
{
struct glink_ssr *ssr = container_of(nb, struct glink_ssr, nb);
struct do_cleanup_msg msg;
@@ -121,18 +135,18 @@ static int qcom_glink_ssr_probe(struct rpmsg_device *rpdev)

ssr->dev = &rpdev->dev;
ssr->ept = rpdev->ept;
- ssr->nb.notifier_call = qcom_glink_ssr_notify;
+ ssr->nb.notifier_call = qcom_glink_ssr_notifier_call;

dev_set_drvdata(&rpdev->dev, ssr);

- return qcom_register_ssr_notifier(&ssr->nb);
+ return blocking_notifier_chain_register(&ssr_notifiers, &ssr->nb);
}

static void qcom_glink_ssr_remove(struct rpmsg_device *rpdev)
{
struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev);

- qcom_unregister_ssr_notifier(&ssr->nb);
+ blocking_notifier_chain_unregister(&ssr_notifiers, &ssr->nb);
}

static const struct rpmsg_device_id qcom_glink_ssr_match[] = {
diff --git a/include/linux/rpmsg/qcom_glink.h b/include/linux/rpmsg/qcom_glink.h
index 96e26d94719f..09daa0acde2c 100644
--- a/include/linux/rpmsg/qcom_glink.h
+++ b/include/linux/rpmsg/qcom_glink.h
@@ -26,4 +26,10 @@ static inline void qcom_glink_smem_unregister(struct qcom_glink *glink) {}

#endif

+#if IS_ENABLED(CONFIG_RPMSG_QCOM_GLINK_SSR)
+void qcom_glink_ssr_notify(const char *ssr_name);
+#else
+static inline void qcom_glink_ssr_notify(const char *ssr_name) {}
+#endif
+
#endif
--
2.24.0

2020-04-24 01:05:17

by Chris Lew

[permalink] [raw]
Subject: Re: [PATCH 1/4] remoteproc: qcom: Pass ssr_name to glink subdevice



On 4/22/2020 5:37 PM, Bjorn Andersson wrote:
> Pass ssr_name to glink subdevice in preparation for tying glink_ssr to
> the glink subdevice, rather than having its own "ssr subdevice".
>
> Signed-off-by: Bjorn Andersson <[email protected]>

Acked-by: Chris Lew <[email protected]>

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

2020-04-24 01:07:19

by Chris Lew

[permalink] [raw]
Subject: Re: [PATCH 3/4] rpmsg: glink: Integrate glink_ssr in qcom_glink



On 4/22/2020 5:37 PM, Bjorn Andersson wrote:
> In all but the very special case of a system with _only_ glink_rpm,
> GLINK is dependent on glink_ssr, so move it to rpmsg and combine it with
> qcom_glink_native in the new qcom_glink kernel module.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
Acked-by: Chris Lew <[email protected]>

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

2020-04-24 01:07:52

by Chris Lew

[permalink] [raw]
Subject: Re: [PATCH 4/4] arm64: defconfig: Remove QCOM_GLINK_SSR



On 4/22/2020 5:37 PM, Bjorn Andersson wrote:
> Remove the QCOM_GLINK_SSR option from the arm64 defconfig, as the module
> is assimilated by QCOM_GLINK - which is selected by other means.
>
> Signed-off-by: Bjorn Andersson <[email protected]>

Acked-by: Chris Lew <[email protected]>

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

2020-04-24 01:08:04

by Chris Lew

[permalink] [raw]
Subject: Re: [PATCH 2/4] soc: qcom: glink_ssr: Internalize ssr_notifiers



On 4/22/2020 5:37 PM, Bjorn Andersson wrote:
> Rather than carrying a special purpose blocking notifier for glink_ssr
> in remoteproc's qcom_common.c, move it into glink_ssr so allow wider
> reuse of the common one.
>
> The rpmsg glink header file is used in preparation for the next patch.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
Acked-by: Chris Lew <[email protected]>

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

2020-05-01 15:45:13

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH 1/4] remoteproc: qcom: Pass ssr_name to glink subdevice

Good morning Bjorn,

On Wed, Apr 22, 2020 at 05:37:33PM -0700, Bjorn Andersson wrote:
> Pass ssr_name to glink subdevice in preparation for tying glink_ssr to
> the glink subdevice, rather than having its own "ssr subdevice".
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
> drivers/remoteproc/qcom_common.c | 9 ++++++++-
> drivers/remoteproc/qcom_common.h | 5 ++++-
> drivers/remoteproc/qcom_q6v5_adsp.c | 2 +-
> drivers/remoteproc/qcom_q6v5_mss.c | 2 +-
> drivers/remoteproc/qcom_q6v5_pas.c | 2 +-
> 5 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
> index 60650bcc8c67..ff26f2b68752 100644
> --- a/drivers/remoteproc/qcom_common.c
> +++ b/drivers/remoteproc/qcom_common.c
> @@ -46,8 +46,10 @@ static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed)
> * qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
> * @rproc: rproc handle to parent the subdevice
> * @glink: reference to a GLINK subdev context
> + * @ssr_name: identifier of the associated remoteproc for ssr notifications
> */
> -void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
> +void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
> + const char *ssr_name)
> {
> struct device *dev = &rproc->dev;
>
> @@ -55,6 +57,10 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
> if (!glink->node)
> return;
>
> + glink->ssr_name = kstrdup_const(ssr_name, GFP_KERNEL);
> + if (!glink->ssr_name)
> + return;
> +

In case or an error with the allocation of ->ssr_name an
of_node_put(glink->node) needs to be done. That way qcom_add_glink_subdev()
cleans up after itself if things go wrong. On the flip side the same
of_node_put() will be done when the driver is removed. So I'm ambivalent on
this one. With or without this change:

Acked-by: Mathieu Poirier <[email protected]>

> glink->dev = dev;
> glink->subdev.start = glink_subdev_start;
> glink->subdev.stop = glink_subdev_stop;
> @@ -74,6 +80,7 @@ void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glin
> return;
>
> rproc_remove_subdev(rproc, &glink->subdev);
> + kfree_const(glink->ssr_name);
> of_node_put(glink->node);
> }
> EXPORT_SYMBOL_GPL(qcom_remove_glink_subdev);
> diff --git a/drivers/remoteproc/qcom_common.h b/drivers/remoteproc/qcom_common.h
> index 58de71e4781c..34e5188187dc 100644
> --- a/drivers/remoteproc/qcom_common.h
> +++ b/drivers/remoteproc/qcom_common.h
> @@ -11,6 +11,8 @@ struct qcom_sysmon;
> struct qcom_rproc_glink {
> struct rproc_subdev subdev;
>
> + const char *ssr_name;
> +
> struct device *dev;
> struct device_node *node;
> struct qcom_glink *edge;
> @@ -30,7 +32,8 @@ struct qcom_rproc_ssr {
> const char *name;
> };
>
> -void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);
> +void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
> + const char *ssr_name);
> void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);
>
> int qcom_register_dump_segments(struct rproc *rproc, const struct firmware *fw);
> diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
> index c60dabc6939e..d2a2574dcf35 100644
> --- a/drivers/remoteproc/qcom_q6v5_adsp.c
> +++ b/drivers/remoteproc/qcom_q6v5_adsp.c
> @@ -461,7 +461,7 @@ static int adsp_probe(struct platform_device *pdev)
> if (ret)
> goto disable_pm;
>
> - qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
> + qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name);
> qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
> adsp->sysmon = qcom_add_sysmon_subdev(rproc,
> desc->sysmon_name,
> diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
> index 7af1d0c987e0..b5dd36775b77 100644
> --- a/drivers/remoteproc/qcom_q6v5_mss.c
> +++ b/drivers/remoteproc/qcom_q6v5_mss.c
> @@ -1762,7 +1762,7 @@ static int q6v5_probe(struct platform_device *pdev)
>
> qproc->mpss_perm = BIT(QCOM_SCM_VMID_HLOS);
> qproc->mba_perm = BIT(QCOM_SCM_VMID_HLOS);
> - qcom_add_glink_subdev(rproc, &qproc->glink_subdev);
> + qcom_add_glink_subdev(rproc, &qproc->glink_subdev, "mpss");
> qcom_add_smd_subdev(rproc, &qproc->smd_subdev);
> qcom_add_ssr_subdev(rproc, &qproc->ssr_subdev, "mpss");
> qcom_add_ipa_notify_subdev(rproc, &qproc->ipa_notify_subdev);
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 8ecc157f1ed1..fc6658b523b6 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -436,7 +436,7 @@ static int adsp_probe(struct platform_device *pdev)
> if (ret)
> goto detach_proxy_pds;
>
> - qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
> + qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name);
> qcom_add_smd_subdev(rproc, &adsp->smd_subdev);
> qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
> adsp->sysmon = qcom_add_sysmon_subdev(rproc,
> --
> 2.24.0
>

2020-05-01 17:38:50

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH 2/4] soc: qcom: glink_ssr: Internalize ssr_notifiers

On Wed, Apr 22, 2020 at 05:37:34PM -0700, Bjorn Andersson wrote:
> Rather than carrying a special purpose blocking notifier for glink_ssr
> in remoteproc's qcom_common.c, move it into glink_ssr so allow wider
> reuse of the common one.

After reading the changelog and the cover letter a few times along with thinking
about the content of the patch, I decude that glink_ssr devices using the
common ssr_notifiers in qcom_common.c was causing problems (having some details
on what those problems are would be useful).

As such this patch is introducing a new notifier, also called ssr_notifiers,
that only deals with glink ssr notification to narrow the nature of the
notifications that are sent and received. Is my understanding correct? Also,
how does that fit into what Siddharth was doing here[1]?

It would be nice if Siddharth could ack the patch before moving forward.

Thanks,
Mathieu

[1]. https://patchwork.kernel.org/patch/11481081/

>
> The rpmsg glink header file is used in preparation for the next patch.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---
> drivers/remoteproc/qcom_common.c | 8 ++++++++
> drivers/soc/qcom/glink_ssr.c | 24 +++++++++++++++++++-----
> include/linux/rpmsg/qcom_glink.h | 6 ++++++
> 3 files changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
> index ff26f2b68752..9028cea2d81e 100644
> --- a/drivers/remoteproc/qcom_common.c
> +++ b/drivers/remoteproc/qcom_common.c
> @@ -42,6 +42,13 @@ static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed)
> glink->edge = NULL;
> }
>
> +static void glink_subdev_unprepare(struct rproc_subdev *subdev)
> +{
> + struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
> +
> + qcom_glink_ssr_notify(glink->ssr_name);
> +}
> +
> /**
> * qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
> * @rproc: rproc handle to parent the subdevice
> @@ -64,6 +71,7 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
> glink->dev = dev;
> glink->subdev.start = glink_subdev_start;
> glink->subdev.stop = glink_subdev_stop;
> + glink->subdev.unprepare = glink_subdev_unprepare;
>
> rproc_add_subdev(rproc, &glink->subdev);
> }
> diff --git a/drivers/soc/qcom/glink_ssr.c b/drivers/soc/qcom/glink_ssr.c
> index d7babe3d67bc..847d79c935f1 100644
> --- a/drivers/soc/qcom/glink_ssr.c
> +++ b/drivers/soc/qcom/glink_ssr.c
> @@ -54,6 +54,19 @@ struct glink_ssr {
> struct completion completion;
> };
>
> +/* Notifier list for all registered glink_ssr instances */
> +static BLOCKING_NOTIFIER_HEAD(ssr_notifiers);
> +
> +/**
> + * qcom_glink_ssr_notify() - notify GLINK SSR about stopped remoteproc
> + * @ssr_name: name of the remoteproc that has been stopped
> + */
> +void qcom_glink_ssr_notify(const char *ssr_name)
> +{
> + blocking_notifier_call_chain(&ssr_notifiers, 0, (void *)ssr_name);
> +}
> +EXPORT_SYMBOL_GPL(qcom_glink_ssr_notify);
> +
> static int qcom_glink_ssr_callback(struct rpmsg_device *rpdev,
> void *data, int len, void *priv, u32 addr)
> {
> @@ -81,8 +94,9 @@ static int qcom_glink_ssr_callback(struct rpmsg_device *rpdev,
> return 0;
> }
>
> -static int qcom_glink_ssr_notify(struct notifier_block *nb, unsigned long event,
> - void *data)
> +static int qcom_glink_ssr_notifier_call(struct notifier_block *nb,
> + unsigned long event,
> + void *data)
> {
> struct glink_ssr *ssr = container_of(nb, struct glink_ssr, nb);
> struct do_cleanup_msg msg;
> @@ -121,18 +135,18 @@ static int qcom_glink_ssr_probe(struct rpmsg_device *rpdev)
>
> ssr->dev = &rpdev->dev;
> ssr->ept = rpdev->ept;
> - ssr->nb.notifier_call = qcom_glink_ssr_notify;
> + ssr->nb.notifier_call = qcom_glink_ssr_notifier_call;
>
> dev_set_drvdata(&rpdev->dev, ssr);
>
> - return qcom_register_ssr_notifier(&ssr->nb);
> + return blocking_notifier_chain_register(&ssr_notifiers, &ssr->nb);
> }
>
> static void qcom_glink_ssr_remove(struct rpmsg_device *rpdev)
> {
> struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev);
>
> - qcom_unregister_ssr_notifier(&ssr->nb);
> + blocking_notifier_chain_unregister(&ssr_notifiers, &ssr->nb);
> }
>
> static const struct rpmsg_device_id qcom_glink_ssr_match[] = {
> diff --git a/include/linux/rpmsg/qcom_glink.h b/include/linux/rpmsg/qcom_glink.h
> index 96e26d94719f..09daa0acde2c 100644
> --- a/include/linux/rpmsg/qcom_glink.h
> +++ b/include/linux/rpmsg/qcom_glink.h
> @@ -26,4 +26,10 @@ static inline void qcom_glink_smem_unregister(struct qcom_glink *glink) {}
>
> #endif
>
> +#if IS_ENABLED(CONFIG_RPMSG_QCOM_GLINK_SSR)
> +void qcom_glink_ssr_notify(const char *ssr_name);
> +#else
> +static inline void qcom_glink_ssr_notify(const char *ssr_name) {}
> +#endif
> +
> #endif
> --
> 2.24.0
>

2020-05-07 18:03:35

by Rishabh Bhatnagar

[permalink] [raw]
Subject: Re: [PATCH 1/4] remoteproc: qcom: Pass ssr_name to glink subdevice

On 2020-04-22 17:37, Bjorn Andersson wrote:
> Pass ssr_name to glink subdevice in preparation for tying glink_ssr to
> the glink subdevice, rather than having its own "ssr subdevice".
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---

Acked-by: Rishabh Bhatnagar <[email protected]>

> drivers/remoteproc/qcom_common.c | 9 ++++++++-
> drivers/remoteproc/qcom_common.h | 5 ++++-
> drivers/remoteproc/qcom_q6v5_adsp.c | 2 +-
> drivers/remoteproc/qcom_q6v5_mss.c | 2 +-
> drivers/remoteproc/qcom_q6v5_pas.c | 2 +-
> 5 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_common.c
> b/drivers/remoteproc/qcom_common.c
> index 60650bcc8c67..ff26f2b68752 100644
> --- a/drivers/remoteproc/qcom_common.c
> +++ b/drivers/remoteproc/qcom_common.c
> @@ -46,8 +46,10 @@ static void glink_subdev_stop(struct rproc_subdev
> *subdev, bool crashed)
> * qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
> * @rproc: rproc handle to parent the subdevice
> * @glink: reference to a GLINK subdev context
> + * @ssr_name: identifier of the associated remoteproc for ssr
> notifications
> */
> -void qcom_add_glink_subdev(struct rproc *rproc, struct
> qcom_rproc_glink *glink)
> +void qcom_add_glink_subdev(struct rproc *rproc, struct
> qcom_rproc_glink *glink,
> + const char *ssr_name)
> {
> struct device *dev = &rproc->dev;
>
> @@ -55,6 +57,10 @@ void qcom_add_glink_subdev(struct rproc *rproc,
> struct qcom_rproc_glink *glink)
> if (!glink->node)
> return;
>
> + glink->ssr_name = kstrdup_const(ssr_name, GFP_KERNEL);
> + if (!glink->ssr_name)
> + return;
> +
> glink->dev = dev;
> glink->subdev.start = glink_subdev_start;
> glink->subdev.stop = glink_subdev_stop;
> @@ -74,6 +80,7 @@ void qcom_remove_glink_subdev(struct rproc *rproc,
> struct qcom_rproc_glink *glin
> return;
>
> rproc_remove_subdev(rproc, &glink->subdev);
> + kfree_const(glink->ssr_name);
> of_node_put(glink->node);
> }
> EXPORT_SYMBOL_GPL(qcom_remove_glink_subdev);
> diff --git a/drivers/remoteproc/qcom_common.h
> b/drivers/remoteproc/qcom_common.h
> index 58de71e4781c..34e5188187dc 100644
> --- a/drivers/remoteproc/qcom_common.h
> +++ b/drivers/remoteproc/qcom_common.h
> @@ -11,6 +11,8 @@ struct qcom_sysmon;
> struct qcom_rproc_glink {
> struct rproc_subdev subdev;
>
> + const char *ssr_name;
> +
> struct device *dev;
> struct device_node *node;
> struct qcom_glink *edge;
> @@ -30,7 +32,8 @@ struct qcom_rproc_ssr {
> const char *name;
> };
>
> -void qcom_add_glink_subdev(struct rproc *rproc, struct
> qcom_rproc_glink *glink);
> +void qcom_add_glink_subdev(struct rproc *rproc, struct
> qcom_rproc_glink *glink,
> + const char *ssr_name);
> void qcom_remove_glink_subdev(struct rproc *rproc, struct
> qcom_rproc_glink *glink);
>
> int qcom_register_dump_segments(struct rproc *rproc, const struct
> firmware *fw);
> diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c
> b/drivers/remoteproc/qcom_q6v5_adsp.c
> index c60dabc6939e..d2a2574dcf35 100644
> --- a/drivers/remoteproc/qcom_q6v5_adsp.c
> +++ b/drivers/remoteproc/qcom_q6v5_adsp.c
> @@ -461,7 +461,7 @@ static int adsp_probe(struct platform_device *pdev)
> if (ret)
> goto disable_pm;
>
> - qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
> + qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name);
> qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
> adsp->sysmon = qcom_add_sysmon_subdev(rproc,
> desc->sysmon_name,
> diff --git a/drivers/remoteproc/qcom_q6v5_mss.c
> b/drivers/remoteproc/qcom_q6v5_mss.c
> index 7af1d0c987e0..b5dd36775b77 100644
> --- a/drivers/remoteproc/qcom_q6v5_mss.c
> +++ b/drivers/remoteproc/qcom_q6v5_mss.c
> @@ -1762,7 +1762,7 @@ static int q6v5_probe(struct platform_device
> *pdev)
>
> qproc->mpss_perm = BIT(QCOM_SCM_VMID_HLOS);
> qproc->mba_perm = BIT(QCOM_SCM_VMID_HLOS);
> - qcom_add_glink_subdev(rproc, &qproc->glink_subdev);
> + qcom_add_glink_subdev(rproc, &qproc->glink_subdev, "mpss");
> qcom_add_smd_subdev(rproc, &qproc->smd_subdev);
> qcom_add_ssr_subdev(rproc, &qproc->ssr_subdev, "mpss");
> qcom_add_ipa_notify_subdev(rproc, &qproc->ipa_notify_subdev);
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c
> b/drivers/remoteproc/qcom_q6v5_pas.c
> index 8ecc157f1ed1..fc6658b523b6 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -436,7 +436,7 @@ static int adsp_probe(struct platform_device *pdev)
> if (ret)
> goto detach_proxy_pds;
>
> - qcom_add_glink_subdev(rproc, &adsp->glink_subdev);
> + qcom_add_glink_subdev(rproc, &adsp->glink_subdev, desc->ssr_name);
> qcom_add_smd_subdev(rproc, &adsp->smd_subdev);
> qcom_add_ssr_subdev(rproc, &adsp->ssr_subdev, desc->ssr_name);
> adsp->sysmon = qcom_add_sysmon_subdev(rproc,

2020-05-07 18:04:47

by Rishabh Bhatnagar

[permalink] [raw]
Subject: Re: [PATCH 2/4] soc: qcom: glink_ssr: Internalize ssr_notifiers

On 2020-04-22 17:37, Bjorn Andersson wrote:
> Rather than carrying a special purpose blocking notifier for glink_ssr
> in remoteproc's qcom_common.c, move it into glink_ssr so allow wider
> reuse of the common one.
>
> The rpmsg glink header file is used in preparation for the next patch.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---

Acked-by: Rishabh Bhatnagar <[email protected]>

> drivers/remoteproc/qcom_common.c | 8 ++++++++
> drivers/soc/qcom/glink_ssr.c | 24 +++++++++++++++++++-----
> include/linux/rpmsg/qcom_glink.h | 6 ++++++
> 3 files changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_common.c
> b/drivers/remoteproc/qcom_common.c
> index ff26f2b68752..9028cea2d81e 100644
> --- a/drivers/remoteproc/qcom_common.c
> +++ b/drivers/remoteproc/qcom_common.c
> @@ -42,6 +42,13 @@ static void glink_subdev_stop(struct rproc_subdev
> *subdev, bool crashed)
> glink->edge = NULL;
> }
>
> +static void glink_subdev_unprepare(struct rproc_subdev *subdev)
> +{
> + struct qcom_rproc_glink *glink = to_glink_subdev(subdev);
> +
> + qcom_glink_ssr_notify(glink->ssr_name);
> +}
> +
> /**
> * qcom_add_glink_subdev() - try to add a GLINK subdevice to rproc
> * @rproc: rproc handle to parent the subdevice
> @@ -64,6 +71,7 @@ void qcom_add_glink_subdev(struct rproc *rproc,
> struct qcom_rproc_glink *glink,
> glink->dev = dev;
> glink->subdev.start = glink_subdev_start;
> glink->subdev.stop = glink_subdev_stop;
> + glink->subdev.unprepare = glink_subdev_unprepare;
>
> rproc_add_subdev(rproc, &glink->subdev);
> }
> diff --git a/drivers/soc/qcom/glink_ssr.c
> b/drivers/soc/qcom/glink_ssr.c
> index d7babe3d67bc..847d79c935f1 100644
> --- a/drivers/soc/qcom/glink_ssr.c
> +++ b/drivers/soc/qcom/glink_ssr.c
> @@ -54,6 +54,19 @@ struct glink_ssr {
> struct completion completion;
> };
>
> +/* Notifier list for all registered glink_ssr instances */
> +static BLOCKING_NOTIFIER_HEAD(ssr_notifiers);
> +
> +/**
> + * qcom_glink_ssr_notify() - notify GLINK SSR about stopped remoteproc
> + * @ssr_name: name of the remoteproc that has been stopped
> + */
> +void qcom_glink_ssr_notify(const char *ssr_name)
> +{
> + blocking_notifier_call_chain(&ssr_notifiers, 0, (void *)ssr_name);
> +}
> +EXPORT_SYMBOL_GPL(qcom_glink_ssr_notify);
> +
> static int qcom_glink_ssr_callback(struct rpmsg_device *rpdev,
> void *data, int len, void *priv, u32 addr)
> {
> @@ -81,8 +94,9 @@ static int qcom_glink_ssr_callback(struct
> rpmsg_device *rpdev,
> return 0;
> }
>
> -static int qcom_glink_ssr_notify(struct notifier_block *nb, unsigned
> long event,
> - void *data)
> +static int qcom_glink_ssr_notifier_call(struct notifier_block *nb,
> + unsigned long event,
> + void *data)
> {
> struct glink_ssr *ssr = container_of(nb, struct glink_ssr, nb);
> struct do_cleanup_msg msg;
> @@ -121,18 +135,18 @@ static int qcom_glink_ssr_probe(struct
> rpmsg_device *rpdev)
>
> ssr->dev = &rpdev->dev;
> ssr->ept = rpdev->ept;
> - ssr->nb.notifier_call = qcom_glink_ssr_notify;
> + ssr->nb.notifier_call = qcom_glink_ssr_notifier_call;
>
> dev_set_drvdata(&rpdev->dev, ssr);
>
> - return qcom_register_ssr_notifier(&ssr->nb);
> + return blocking_notifier_chain_register(&ssr_notifiers, &ssr->nb);
> }
>
> static void qcom_glink_ssr_remove(struct rpmsg_device *rpdev)
> {
> struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev);
>
> - qcom_unregister_ssr_notifier(&ssr->nb);
> + blocking_notifier_chain_unregister(&ssr_notifiers, &ssr->nb);
> }
>
> static const struct rpmsg_device_id qcom_glink_ssr_match[] = {
> diff --git a/include/linux/rpmsg/qcom_glink.h
> b/include/linux/rpmsg/qcom_glink.h
> index 96e26d94719f..09daa0acde2c 100644
> --- a/include/linux/rpmsg/qcom_glink.h
> +++ b/include/linux/rpmsg/qcom_glink.h
> @@ -26,4 +26,10 @@ static inline void
> qcom_glink_smem_unregister(struct qcom_glink *glink) {}
>
> #endif
>
> +#if IS_ENABLED(CONFIG_RPMSG_QCOM_GLINK_SSR)
> +void qcom_glink_ssr_notify(const char *ssr_name);
> +#else
> +static inline void qcom_glink_ssr_notify(const char *ssr_name) {}
> +#endif
> +
> #endif

2020-05-07 18:06:16

by Rishabh Bhatnagar

[permalink] [raw]
Subject: Re: [PATCH 4/4] arm64: defconfig: Remove QCOM_GLINK_SSR

On 2020-04-22 17:37, Bjorn Andersson wrote:
> Remove the QCOM_GLINK_SSR option from the arm64 defconfig, as the
> module
> is assimilated by QCOM_GLINK - which is selected by other means.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---

Acked-by: Rishabh Bhatnagar <[email protected]>

> arch/arm64/configs/defconfig | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/arm64/configs/defconfig
> b/arch/arm64/configs/defconfig
> index f9eefb5940ca..f26a0b6ea0e8 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -838,7 +838,6 @@ CONFIG_FSL_MC_DPIO=y
> CONFIG_IMX_SCU_SOC=y
> CONFIG_QCOM_AOSS_QMP=y
> CONFIG_QCOM_GENI_SE=y
> -CONFIG_QCOM_GLINK_SSR=m
> CONFIG_QCOM_RMTFS_MEM=m
> CONFIG_QCOM_RPMH=y
> CONFIG_QCOM_RPMHPD=y

2020-05-07 18:06:59

by Rishabh Bhatnagar

[permalink] [raw]
Subject: Re: [PATCH 3/4] rpmsg: glink: Integrate glink_ssr in qcom_glink

On 2020-04-22 17:37, Bjorn Andersson wrote:
> In all but the very special case of a system with _only_ glink_rpm,
> GLINK is dependent on glink_ssr, so move it to rpmsg and combine it
> with
> qcom_glink_native in the new qcom_glink kernel module.
>
> Signed-off-by: Bjorn Andersson <[email protected]>
> ---

Acked-by: Rishabh Bhatnagar <[email protected]>

> drivers/rpmsg/Kconfig | 6 +++---
> drivers/rpmsg/Makefile | 3 ++-
> drivers/{soc/qcom/glink_ssr.c => rpmsg/qcom_glink_ssr.c} | 4 ----
> drivers/soc/qcom/Kconfig | 9 ---------
> drivers/soc/qcom/Makefile | 1 -
> include/linux/rpmsg/qcom_glink.h | 7 +------
> 6 files changed, 6 insertions(+), 24 deletions(-)
> rename drivers/{soc/qcom/glink_ssr.c => rpmsg/qcom_glink_ssr.c} (97%)
>
> diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
> index a9108ff563dc..f96716893c2a 100644
> --- a/drivers/rpmsg/Kconfig
> +++ b/drivers/rpmsg/Kconfig
> @@ -24,13 +24,13 @@ config RPMSG_MTK_SCP
> remote processors in MediaTek platforms.
> This use IPI and IPC to communicate with remote processors.
>
> -config RPMSG_QCOM_GLINK_NATIVE
> +config RPMSG_QCOM_GLINK
> tristate
> select RPMSG
>
> config RPMSG_QCOM_GLINK_RPM
> tristate "Qualcomm RPM Glink driver"
> - select RPMSG_QCOM_GLINK_NATIVE
> + select RPMSG_QCOM_GLINK
> depends on HAS_IOMEM
> depends on MAILBOX
> help
> @@ -40,7 +40,7 @@ config RPMSG_QCOM_GLINK_RPM
>
> config RPMSG_QCOM_GLINK_SMEM
> tristate "Qualcomm SMEM Glink driver"
> - select RPMSG_QCOM_GLINK_NATIVE
> + select RPMSG_QCOM_GLINK
> depends on MAILBOX
> depends on QCOM_SMEM
> help
> diff --git a/drivers/rpmsg/Makefile b/drivers/rpmsg/Makefile
> index ae92a7fb08f6..ffe932ef6050 100644
> --- a/drivers/rpmsg/Makefile
> +++ b/drivers/rpmsg/Makefile
> @@ -2,8 +2,9 @@
> obj-$(CONFIG_RPMSG) += rpmsg_core.o
> obj-$(CONFIG_RPMSG_CHAR) += rpmsg_char.o
> obj-$(CONFIG_RPMSG_MTK_SCP) += mtk_rpmsg.o
> +qcom_glink-objs := qcom_glink_native.o qcom_glink_ssr.o
> +obj-$(CONFIG_RPMSG_QCOM_GLINK) += qcom_glink.o
> obj-$(CONFIG_RPMSG_QCOM_GLINK_RPM) += qcom_glink_rpm.o
> -obj-$(CONFIG_RPMSG_QCOM_GLINK_NATIVE) += qcom_glink_native.o
> obj-$(CONFIG_RPMSG_QCOM_GLINK_SMEM) += qcom_glink_smem.o
> obj-$(CONFIG_RPMSG_QCOM_SMD) += qcom_smd.o
> obj-$(CONFIG_RPMSG_VIRTIO) += virtio_rpmsg_bus.o
> diff --git a/drivers/soc/qcom/glink_ssr.c
> b/drivers/rpmsg/qcom_glink_ssr.c
> similarity index 97%
> rename from drivers/soc/qcom/glink_ssr.c
> rename to drivers/rpmsg/qcom_glink_ssr.c
> index 847d79c935f1..dcd1ce616974 100644
> --- a/drivers/soc/qcom/glink_ssr.c
> +++ b/drivers/rpmsg/qcom_glink_ssr.c
> @@ -164,7 +164,3 @@ static struct rpmsg_driver qcom_glink_ssr_driver =
> {
> },
> };
> module_rpmsg_driver(qcom_glink_ssr_driver);
> -
> -MODULE_ALIAS("rpmsg:glink_ssr");
> -MODULE_DESCRIPTION("Qualcomm GLINK SSR notifier");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index 19332ea40234..5140bd82f1be 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -35,15 +35,6 @@ config QCOM_GENI_SE
> driver is also used to manage the common aspects of multiple Serial
> Engines present in the QUP.
>
> -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 || COMPILE_TEST
> diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
> index 5d6b83dc58e8..e9cacc9ad401 100644
> --- a/drivers/soc/qcom/Makefile
> +++ b/drivers/soc/qcom/Makefile
> @@ -3,7 +3,6 @@ CFLAGS_rpmh-rsc.o := -I$(src)
> obj-$(CONFIG_QCOM_AOSS_QMP) += qcom_aoss.o
> obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o
> obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
> -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_OCMEM) += ocmem.o
> diff --git a/include/linux/rpmsg/qcom_glink.h
> b/include/linux/rpmsg/qcom_glink.h
> index 09daa0acde2c..daded9fddf36 100644
> --- a/include/linux/rpmsg/qcom_glink.h
> +++ b/include/linux/rpmsg/qcom_glink.h
> @@ -12,6 +12,7 @@ struct qcom_glink;
> struct qcom_glink *qcom_glink_smem_register(struct device *parent,
> struct device_node *node);
> void qcom_glink_smem_unregister(struct qcom_glink *glink);
> +void qcom_glink_ssr_notify(const char *ssr_name);
>
> #else
>
> @@ -23,12 +24,6 @@ qcom_glink_smem_register(struct device *parent,
> }
>
> static inline void qcom_glink_smem_unregister(struct qcom_glink
> *glink) {}
> -
> -#endif
> -
> -#if IS_ENABLED(CONFIG_RPMSG_QCOM_GLINK_SSR)
> -void qcom_glink_ssr_notify(const char *ssr_name);
> -#else
> static inline void qcom_glink_ssr_notify(const char *ssr_name) {}
> #endif