Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp717285ybz; Wed, 15 Apr 2020 17:24:09 -0700 (PDT) X-Google-Smtp-Source: APiQypJhyWOyWZxGcTrsdY1Zy+OPiCGTKl84VYLPTEEfjCjIC17thnbnD3332mnTMhW0OMcWe4us X-Received: by 2002:a05:6402:64d:: with SMTP id u13mr26691598edx.254.1586996649340; Wed, 15 Apr 2020 17:24:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586996649; cv=none; d=google.com; s=arc-20160816; b=IiVQHbzQbCRnJXHa8kWRbex6+fyI7MBaX/HGIQ3ccBRiNLUAT7mPdcSTvo8rrY5kcn auSKE1WyySNugmRzZlAXH8KLY/Of6HDLTkBV0taleaUMJr4vJc26Js8iirn8zb5Hymfq s9xRt42V3sm2UKdal2WF3gENTsgGwhHVYGaY5E0QmgVhx6yJLCR74L2PxSHRJAeOpCG6 LZXCW/cx2hQkIwZKOHb3NWWw02bP3RjytK2D1oLmP/UzZije/O/qauoLxMEh7ziE74+i 0rHz10zsdMMCHX9fJkrR0zSfkfQ1CtH3873m1RM/8/LiPuJlxM7haAdkS9e3TfLHZWd7 Nlzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=m6PMuu9ZsS6NKtR16/PWLHb99bJA87GDVdw4d6eRXPY=; b=YfUpupe8o1NfLzVZFoQQ1ULyNi8WxQlkcd8I2puPbVcJ4UuAZKHfIKOL4qgEfR24bv Yscp5RKjUlsHXpeTv0TAnA8e2LlC2ACEK/V0o6b+UiW/azGVpH1Yn5Y6G2m7wD5vvIJQ 9Xefq5FW/JX/pJ2/F47Kd0ixBTDvAOFXmEWo70pTma7/5gQKAAdUHd0lZC2AqtqmC2Cg 5o9bGlQ+vcK8GP5LKPvOzcDORzk/Vm1ScQvnXOmTxe1wODJdO78xXBthay0XApXXTuN+ 3qqe5Te2Oi5Z3i44wdpf3R/4Ki3V96KxTt5mQhQ9RICBeAYDH75YcBQZrloaalX+6gM3 ZJ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HKSPf7lm; 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 c24si11256162eds.119.2020.04.15.17.23.46; Wed, 15 Apr 2020 17:24:09 -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=HKSPf7lm; 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 S2410648AbgDORDa (ORCPT + 99 others); Wed, 15 Apr 2020 13:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410641AbgDORDZ (ORCPT ); Wed, 15 Apr 2020 13:03:25 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD6AC061A0E for ; Wed, 15 Apr 2020 10:03:25 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id m16so229172pls.4 for ; Wed, 15 Apr 2020 10:03:25 -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:user-agent; bh=m6PMuu9ZsS6NKtR16/PWLHb99bJA87GDVdw4d6eRXPY=; b=HKSPf7lmr8NSMJcjHmO2pqRhkkrTmImEL+4X6XIQY9QRmUGA4hW7Uj/9dFs1YXDSRx /fTKYfb4c0oYumCypTp/AaQ0EFPXmlklNCsS9sVb/LqMpR4gp/NANGZPNjJH9vpDtz2A kGVCelbrykLtVDiIiqDex1PHfJdb6csVsNihDZaHM5VG+iTXvqigzbL76SNwXn5Xt3/S 6nn0eMyqkjcaMt8savZffyVNFojppS5Yism8i+BUgUuE79L/eTgpg7GEp9gP1tUAlzG6 c2KqKv9n3/ZgNy4cR2unLhvObX92gb3Yn6yAY/7P89r6vqsIbljynj1vGXGK13rApEmC 5rMA== 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:user-agent; bh=m6PMuu9ZsS6NKtR16/PWLHb99bJA87GDVdw4d6eRXPY=; b=IHeJo/TezpyPrvHIGvfakPmY3R+//pCzV1VxVhjJknpLeQissoJdvP7I33tllKt8kX yLZ7YSibBSdE4yoljHzX9Fud4Nlv922dE+UG7XWNhx+EBXO9q7r6+rHHAH5VDG7Qyjbo CHZ0JiOuOx6UYuO3MvEIONq1xZ5LmWbPF1gNRhumWtF9ZbxIkURx91KSGna4WpkHIkI9 bB4KYlEbKG9brgEVClTaQRhGp+BMWPE8vOjlO5HRi7MQeUoOaMD6gSEohJnQxxGE0Nkj cW9EuYEgGsDSti9g46Sdwky02cDDm6XZvEoZHUu2bQk3jwa2HwxjKE+SXT4diM0TblQw QeVQ== X-Gm-Message-State: AGi0Pua2ATgoa7U7FORjMoJ02p2yvV+L895QJBsqkVL5ozKp3DRnWK5x XMaLUmIIMSkbiK9cmH22wBOiHw== X-Received: by 2002:a17:902:b60d:: with SMTP id b13mr6049074pls.324.1586970204964; Wed, 15 Apr 2020 10:03:24 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 17sm9258175pgg.76.2020.04.15.10.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 10:03:24 -0700 (PDT) Date: Wed, 15 Apr 2020 11:03:22 -0600 From: Mathieu Poirier To: Siddharth Gupta Cc: agross@kernel.org, bjorn.andersson@linaro.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: <20200415170322.GA16583@xps15> 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> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 08, 2020 at 04:36:38PM -0700, 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 Acked-by: Mathieu Poirier > --- > 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