Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3328006ybz; Mon, 20 Apr 2020 00:06:29 -0700 (PDT) X-Google-Smtp-Source: APiQypLjyS8WZ7WTDj6T/bpiklHGPLV5QTyEmWCqPBFM/5D04huMhJUoT1aEwoU6YOrYt0uabDPC X-Received: by 2002:a50:d552:: with SMTP id f18mr13446602edj.341.1587366388916; Mon, 20 Apr 2020 00:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587366388; cv=none; d=google.com; s=arc-20160816; b=TdnlMrinEoa6cBiUXzq+YTxwFc8FN0wEo+Ym/8P5y6Y/dlOwbvaj4cjXAibDs5Jfy2 1eoermrVsShE+L2eiYeQP3ELL6sG//i9YNGTXbMvoclptS2tYjTSU+ppVOd3U+kV4g36 aeDPjU31jwdl2NvGr/EyqIkGMLzo8mrD0UTsXtUmOWLTQXR9bBI2bsI1F460KRP7LXIb ty/aP0q/qIEUSZsJqFjZJfI4HMVlEirIubCRQJLzw175fJpfBEyVlQjPBR2t10JVbxhS E8ZSdst+N4fAuUYnRzOX8mcuCbYFs2rSZS8ch1gRl/6jH4IYTqWcNmbdLFBFIRgU8pDX d0Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=s11JGkMo64bkJfoSlJ3gamPmjiZWAtO5TwTvV1WpWbE=; b=Xdb9xwvxi20YFReJC9MS65jCZTGhjVUaS+5Nzv0yS5wUVYnr8ysUzHxmy13APoaJ6a b4V54kQz1O4lWan2AXZsTTaZw77ON/WxvfCdL25fJKZjalhuuvJJv73QRTD/tec5MNXO z2XaiG+s6tbxkiZfFrV6X+lqHCc5eKHbmNz3OXesKvn8fB8+ref+B5b5Mt64xJXiYIOL f2kEsfeZIoGkpuCljVm7HRvaMA59SzwoHxErFd+740zkWocdBMmLSgFGPFwzddl5axLL xB2qPox9wjcdnW6ucouED3GoKY1vJhz1oIiTusWUC6hCrsDg/fvz1PNVbP1jgz1U5oXK XegQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qPMKe74A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si7416ejs.456.2020.04.20.00.06.05; Mon, 20 Apr 2020 00:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qPMKe74A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726164AbgDTHEq (ORCPT + 99 others); Mon, 20 Apr 2020 03:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726023AbgDTHEq (ORCPT ); Mon, 20 Apr 2020 03:04:46 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2EE0C061A0C for ; Mon, 20 Apr 2020 00:04:45 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id p8so4602947pgi.5 for ; Mon, 20 Apr 2020 00:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=s11JGkMo64bkJfoSlJ3gamPmjiZWAtO5TwTvV1WpWbE=; b=qPMKe74Axz3iuvAgEm5PUFr0JEzorHbSLpp+t8fsBt4zWIqblwuGPlrPdfbH6ynq+v k6BnEAr7JShE83PlTATp+w5cvsu+xYZ/tiNArEksPm3hswP5df/tqzSxdiOv84S4QsHb f9ytGiOWi2JvmqB9UnEjQJpi122Ewhr+DANygi5JPA2tmijZEM6/c8sIFmxgU4zO4inX 1rnYKlj3GulChVuLX1GF9DOpMB2e3GJ+/LNoGikipve+CdFGffqdFwVlnlR+t2QnaY7B pT01gl9peG3qmgQkMCHHq0Lpa9csFASI87dKS8dfaYkXbX/+RJzg45FBbCGqpYIEm5TU 3gaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=s11JGkMo64bkJfoSlJ3gamPmjiZWAtO5TwTvV1WpWbE=; b=RjaTdO1Wz12Tw8Kfd4Ri9G75Ff8JX6FWqXuH/csoCCsvtt4Hr2WTM7TSOzwlltxAyt oJFIDEg3McszyHb2a5/xr46T5j5DQ9FvTXcSF4ScH8Qttl1lGBSbYkEBESHUSdSbK0NG KmEs1/E1Pq3ah7552DJqXcJmRl/Y8m0neXE5wtPFC2VAt9lK9BNrV/CyVLvXV6Y3ShE0 XJgRFzZlTANGJ/SdfJripbwVHsPqCZ7zfzJQRJWskGt2PyPer5ovewg6JMYM3TPScrvm 2h+/HgjuaMYFUdFu7r3v1gBWcftVRBjPFAUNviFrFYb910DN5pFpBh2glqx+iqfYOjP8 wR+g== X-Gm-Message-State: AGi0PuZdinsRHAji0tRbHq6175rm2dWZsNkQ+vtnHHspe5QC27dsznd2 STgfsB8hzwFzg54EVI5R+KojK/oVQWU= X-Received: by 2002:a05:6a00:2cb:: with SMTP id b11mr15087011pft.42.1587366285066; Mon, 20 Apr 2020 00:04:45 -0700 (PDT) Received: from builder.lan (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id a22sm159630pfg.169.2020.04.20.00.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 00:04:44 -0700 (PDT) Date: Mon, 20 Apr 2020 00:05:07 -0700 From: Bjorn Andersson To: Siddharth Gupta Cc: agross@kernel.org, ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, psodagud@codeaurora.org, rishabhb@codeaurora.org Subject: Re: [PATCH v2 1/6] remoteproc: sysmon: Add ability to send type of notification Message-ID: <20200420070507.GD1868936@builder.lan> References: <1586389003-26675-1-git-send-email-sidgup@codeaurora.org> <1586389003-26675-2-git-send-email-sidgup@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1586389003-26675-2-git-send-email-sidgup@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 08 Apr 16:36 PDT 2020, Siddharth Gupta wrote: > Current implementation of the sysmon driver does not support adding > notifications for other remoteproc events - prepare, start, unprepare. > Clients on the remoteproc side might be interested in knowing when a > remoteproc boots up. This change adds the ability to send the notification > type along with the name. For example, audio DSP is interested in knowing > when modem has crashed so that it can perform cleanup and wait for modem to > boot up before it starts processing data again. > > Signed-off-by: Siddharth Gupta Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/remoteproc/qcom_sysmon.c | 54 +++++++++++++++++++++++++++------------- > 1 file changed, 37 insertions(+), 17 deletions(-) > > diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c > index faf3822..1366050 100644 > --- a/drivers/remoteproc/qcom_sysmon.c > +++ b/drivers/remoteproc/qcom_sysmon.c > @@ -46,6 +46,25 @@ struct qcom_sysmon { > struct sockaddr_qrtr ssctl; > }; > > +enum { > + SSCTL_SSR_EVENT_BEFORE_POWERUP, > + SSCTL_SSR_EVENT_AFTER_POWERUP, > + SSCTL_SSR_EVENT_BEFORE_SHUTDOWN, > + SSCTL_SSR_EVENT_AFTER_SHUTDOWN, > +}; > + > +static const char * const sysmon_state_string[] = { > + [SSCTL_SSR_EVENT_BEFORE_POWERUP] = "before_powerup", > + [SSCTL_SSR_EVENT_AFTER_POWERUP] = "after_powerup", > + [SSCTL_SSR_EVENT_BEFORE_SHUTDOWN] = "before_shutdown", > + [SSCTL_SSR_EVENT_AFTER_SHUTDOWN] = "after_shutdown", > +}; > + > +struct sysmon_event { > + const char *subsys_name; > + u32 ssr_event; > +}; > + > static DEFINE_MUTEX(sysmon_lock); > static LIST_HEAD(sysmon_list); > > @@ -54,13 +73,15 @@ static LIST_HEAD(sysmon_list); > * @sysmon: sysmon context > * @name: other remote's name > */ > -static void sysmon_send_event(struct qcom_sysmon *sysmon, const char *name) > +static void sysmon_send_event(struct qcom_sysmon *sysmon, > + const struct sysmon_event *event) > { > char req[50]; > int len; > int ret; > > - len = snprintf(req, sizeof(req), "ssr:%s:before_shutdown", name); > + len = snprintf(req, sizeof(req), "ssr:%s:%s", event->subsys_name, > + sysmon_state_string[event->ssr_event]); > if (len >= sizeof(req)) > return; > > @@ -149,13 +170,6 @@ static int sysmon_callback(struct rpmsg_device *rpdev, void *data, int count, > #define SSCTL_SUBSYS_NAME_LENGTH 15 > > enum { > - SSCTL_SSR_EVENT_BEFORE_POWERUP, > - SSCTL_SSR_EVENT_AFTER_POWERUP, > - SSCTL_SSR_EVENT_BEFORE_SHUTDOWN, > - SSCTL_SSR_EVENT_AFTER_SHUTDOWN, > -}; > - > -enum { > SSCTL_SSR_EVENT_FORCED, > SSCTL_SSR_EVENT_GRACEFUL, > }; > @@ -331,7 +345,8 @@ static void ssctl_request_shutdown(struct qcom_sysmon *sysmon) > * @sysmon: sysmon context > * @name: other remote's name > */ > -static void ssctl_send_event(struct qcom_sysmon *sysmon, const char *name) > +static void ssctl_send_event(struct qcom_sysmon *sysmon, > + const struct sysmon_event *event) > { > struct ssctl_subsys_event_resp resp; > struct ssctl_subsys_event_req req; > @@ -346,9 +361,9 @@ static void ssctl_send_event(struct qcom_sysmon *sysmon, const char *name) > } > > memset(&req, 0, sizeof(req)); > - strlcpy(req.subsys_name, name, sizeof(req.subsys_name)); > + strlcpy(req.subsys_name, event->subsys_name, sizeof(req.subsys_name)); > req.subsys_name_len = strlen(req.subsys_name); > - req.event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN; > + req.event = event->ssr_event; > req.evt_driven_valid = true; > req.evt_driven = SSCTL_SSR_EVENT_FORCED; > > @@ -432,8 +447,12 @@ static int sysmon_start(struct rproc_subdev *subdev) > static void sysmon_stop(struct rproc_subdev *subdev, bool crashed) > { > struct qcom_sysmon *sysmon = container_of(subdev, struct qcom_sysmon, subdev); > + struct sysmon_event event = { > + .subsys_name = sysmon->name, > + .ssr_event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN > + }; > > - blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)sysmon->name); > + blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); > > /* Don't request graceful shutdown if we've crashed */ > if (crashed) > @@ -456,19 +475,20 @@ static int sysmon_notify(struct notifier_block *nb, unsigned long event, > { > struct qcom_sysmon *sysmon = container_of(nb, struct qcom_sysmon, nb); > struct rproc *rproc = sysmon->rproc; > - const char *ssr_name = data; > + struct sysmon_event *sysmon_event = data; > > /* Skip non-running rprocs and the originating instance */ > - if (rproc->state != RPROC_RUNNING || !strcmp(data, sysmon->name)) { > + if (rproc->state != RPROC_RUNNING || > + !strcmp(sysmon_event->subsys_name, sysmon->name)) { > dev_dbg(sysmon->dev, "not notifying %s\n", sysmon->name); > return NOTIFY_DONE; > } > > /* Only SSCTL version 2 supports SSR events */ > if (sysmon->ssctl_version == 2) > - ssctl_send_event(sysmon, ssr_name); > + ssctl_send_event(sysmon, sysmon_event); > else if (sysmon->ept) > - sysmon_send_event(sysmon, ssr_name); > + sysmon_send_event(sysmon, sysmon_event); > > return NOTIFY_DONE; > } > -- > Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project