Re: [PATCH v6 1/2] remoteproc: qcom: Add per subsystem SSR notification

From: Jon Hunter
Date: Mon Jul 13 2020 - 12:26:49 EST



On 24/06/2020 03:23, Rishabh Bhatnagar wrote:
> Currently there is a single notification chain which is called whenever any
> remoteproc shuts down. This leads to all the listeners being notified, and
> is not an optimal design as kernel drivers might only be interested in
> listening to notifications from a particular remoteproc. Create a global
> list of remoteproc notification info data structures. This will hold the
> name and notifier_list information for a particular remoteproc. The API
> to register for notifications will use name argument to retrieve the
> notification info data structure and the notifier block will be added to
> that data structure's notification chain. Also move from blocking notifier
> to srcu notifer based implementation to support dynamic notifier head
> creation.
>
> Signed-off-by: Siddharth Gupta <sidgup@xxxxxxxxxxxxxx>
> Signed-off-by: Rishabh Bhatnagar <rishabhb@xxxxxxxxxxxxxx>
> ---
> drivers/remoteproc/qcom_common.c | 90 ++++++++++++++++++++++++++++++-----
> drivers/remoteproc/qcom_common.h | 5 +-
> include/linux/remoteproc/qcom_rproc.h | 20 ++++++--
> 3 files changed, 95 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
> index 9028cea..7a7384c 100644
> --- a/drivers/remoteproc/qcom_common.c
> +++ b/drivers/remoteproc/qcom_common.c
> @@ -12,6 +12,7 @@
> #include <linux/module.h>
> #include <linux/notifier.h>
> #include <linux/remoteproc.h>
> +#include <linux/remoteproc/qcom_rproc.h>
> #include <linux/rpmsg/qcom_glink.h>
> #include <linux/rpmsg/qcom_smd.h>
> #include <linux/soc/qcom/mdt_loader.h>
> @@ -23,7 +24,14 @@
> #define to_smd_subdev(d) container_of(d, struct qcom_rproc_subdev, subdev)
> #define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev)
>
> -static BLOCKING_NOTIFIER_HEAD(ssr_notifiers);
> +struct qcom_ssr_subsystem {
> + const char *name;
> + struct srcu_notifier_head notifier_list;
> + struct list_head list;
> +};
> +
> +static LIST_HEAD(qcom_ssr_subsystem_list);
> +static DEFINE_MUTEX(qcom_ssr_subsys_lock);
>
> static int glink_subdev_start(struct rproc_subdev *subdev)
> {
> @@ -189,37 +197,83 @@ void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd)
> }
> EXPORT_SYMBOL_GPL(qcom_remove_smd_subdev);
>
> +static struct qcom_ssr_subsystem *qcom_ssr_get_subsys(const char *name)
> +{
> + struct qcom_ssr_subsystem *info;
> +
> + mutex_lock(&qcom_ssr_subsys_lock);
> + /* Match in the global qcom_ssr_subsystem_list with name */
> + list_for_each_entry(info, &qcom_ssr_subsystem_list, list)
> + if (!strcmp(info->name, name))
> + goto out;
> +
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (!info) {
> + info = ERR_PTR(-ENOMEM);
> + goto out;
> + }


The above appears to be breaking the ARM64 build on the latest -next
when building the modules ...

CC [M] drivers/remoteproc/qcom_common.o
drivers/remoteproc/qcom_common.c: In function 'qcom_ssr_get_subsys':
remoteproc/qcom_common.c:210:9: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
info = kzalloc(sizeof(*info), GFP_KERNEL);
^~~~~~~
drivers/remoteproc/qcom_common.c:210:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
info = kzalloc(sizeof(*info), GFP_KERNEL);

Cheers
Jon

--
nvpublic