Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1738905ybt; Thu, 18 Jun 2020 16:18:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBC7vYqAMaOXizSc4pImFXcFwyfmKwHXz28qo1Nf4a5OOx7zDXHCVEQgukcXQE+aAj5gc2 X-Received: by 2002:a17:906:d963:: with SMTP id rp3mr1054340ejb.326.1592522324165; Thu, 18 Jun 2020 16:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592522324; cv=none; d=google.com; s=arc-20160816; b=zJzSeS8+XJ2T7bPyXq3nwqa4MBoY8l98CvhHOqCuKFHdX/vvemPmosl8GrQmpfYT28 7TVojCn7+yZsSGtYdNGS56nmzxkZm9Bn1vKUO33s2rAhclIoTAjtHxM7mPxcP96JD2ZE Zc27tmRwEy3/gxAfJZTSev9EKb8Keg25qUhnus/c2TmA8XfEvrGUYgmhHZ+jLBmDb6ku MZgZ2q5e8DXX8nGlPvEkK1kKbffk50vcX7uVXGRVdRsG1aDJwJka2foVwSfXDDbvjwi9 mRS3v48RmEr0ECDdLBfarF5jOIeN2icFW4oUaVVWpv4/549XNy2+2D2vLafTZZMGjm0e ei3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=WWegyLOphUdUq2xMzuao7on0U+YW/ae33XwIxQCwUhM=; b=hdaLbN6lNOJQV34mtodhW+7uME8YJpjUqCoelP4+ENL+jxtwcMJBjS0gIx6kFd0cuJ LQ+8BggausrO6kDbkguLKsHdLS3cZqpkbShvVWA5ebNFAWESQCX7CUge0wqeyxjGq/68 VKt2t0o34rKaZ4ELOwGe8lJ65va/UcjuCRIZTydaia/bLoR4fBo3fAZX8RkMuolyb4z1 DTO47vak69PJ7Mrg0klYAD/t27uCqh5d++Zje9adYlh82hxjvXAyC9qZP2BAxi8jORVN QXgsiLxwzx3f+LrFOPaJC6uN6cvlwL1VcO3FnM0ytA9U9cFUNr+Xwn/jVokKRlUSOmXr pf8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=Lu3YAJ2T; 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=ieee.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi27si3079537edb.232.2020.06.18.16.18.21; Thu, 18 Jun 2020 16:18:44 -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=@ieee.org header.s=google header.b=Lu3YAJ2T; 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=ieee.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730423AbgFRXAk (ORCPT + 99 others); Thu, 18 Jun 2020 19:00:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730280AbgFRXAg (ORCPT ); Thu, 18 Jun 2020 19:00:36 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02E6C06174E for ; Thu, 18 Jun 2020 16:00:36 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id m81so9225038ioa.1 for ; Thu, 18 Jun 2020 16:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WWegyLOphUdUq2xMzuao7on0U+YW/ae33XwIxQCwUhM=; b=Lu3YAJ2Tj3Z8rdEUDrzl1hkWBmyhBLIXG0haNA5uDuo58/nFlzD0rebF/jhUdU5k9d p3TtBODyabnZLauFmVG+PAVTnYHbU3X8umC5yic5wRY226pPFlrWYuaC12y+iAKfzX+8 hzCcM4UQu2Pdc3TNMNjqtNpFOtsiN5S/LeIUY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WWegyLOphUdUq2xMzuao7on0U+YW/ae33XwIxQCwUhM=; b=IPtF7CDlFDPYwGu84cabL33CkW1166MQXUl49X507GyUtlyGVCXnx/NreUqyrT+4Oj JiMnw0QnFwlK5BtUkwYGuUH28MFya/2LZXnTN5QsHEPG7AfElk5CVONhb+SkYNSFx0Ha LFW8v1Ua5hQXX0IryVy1swxPE73yqTCDE/n8BUvafgr82ffP3bOYYIxqfCSPZ/vjfy0w nJRvZMZly9asTnj47O95WqhMKRv2NWnibzlYHNzaWYG301w5oU2Sbc4VT/gg5AMGBvrK gIriO2uVTgzV9kLj+unjXWdbkYTyaKSxhu+WcMa9C9Dw+FYdqUtqtgGg3taX/jkHdsTo gnLw== X-Gm-Message-State: AOAM530LpBC6i1r37cxysG6s4qwRXnJovGxeHDDc8KgeJrgdhuL86rkP kTO0g19+LH8/dqUX8v1QIHOHnA== X-Received: by 2002:a05:6602:2e05:: with SMTP id o5mr1185592iow.28.1592521235677; Thu, 18 Jun 2020 16:00:35 -0700 (PDT) Received: from [172.22.22.4] (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.googlemail.com with ESMTPSA id m18sm2199101ilj.11.2020.06.18.16.00.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2020 16:00:35 -0700 (PDT) Subject: Re: [PATCH v4 2/2] remoteproc: qcom: Add notification types to SSR To: Rishabh Bhatnagar , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: bjorn.andersson@linaro.org, tsoni@codeaurora.org, psodagud@codeaurora.org, sidgup@codeaurora.org References: <1590636883-30866-1-git-send-email-rishabhb@codeaurora.org> <1590636883-30866-3-git-send-email-rishabhb@codeaurora.org> From: Alex Elder Message-ID: Date: Thu, 18 Jun 2020 18:00:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1590636883-30866-3-git-send-email-rishabhb@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/27/20 10:34 PM, Rishabh Bhatnagar wrote: > From: Siddharth Gupta > > The SSR subdevice only adds callback for the unprepare event. Add callbacks > for unprepare, start and prepare events. The client driver for a particular for prepare, start, and stop events > remoteproc might be interested in knowing the status of the remoteproc > while undergoing SSR, not just when the remoteproc has finished shutting > down. > > Signed-off-by: Siddharth Gupta > Signed-off-by: Rishabh Bhatnagar > --- > drivers/remoteproc/qcom_common.c | 46 +++++++++++++++++++++++++++++++++-- > include/linux/remoteproc/qcom_rproc.h | 14 +++++++++++ > 2 files changed, 58 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c > index 61ff2dd..5c5a1eb 100644 > --- a/drivers/remoteproc/qcom_common.c > +++ b/drivers/remoteproc/qcom_common.c > @@ -228,7 +228,7 @@ struct qcom_ssr_subsystem *qcom_ssr_get_subsys(const char *name) > * > * This registers the @nb notifier block as part the notifier chain for a > * remoteproc associated with @name. The notifier block's callback > - * will be invoked when the particular remote processor is stopped. > + * will be invoked when the particular remote processor is started/stopped. Maybe something more like: will be invoked when an SSR event occurs for the named remote processor. > */ > void *qcom_register_ssr_notifier(const char *name, struct notifier_block *nb) > { > @@ -258,6 +258,44 @@ int qcom_unregister_ssr_notifier(void *notify, struct notifier_block *nb) > } > EXPORT_SYMBOL_GPL(qcom_unregister_ssr_notifier); > > +static int ssr_notify_prepare(struct rproc_subdev *subdev) > +{ > + struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > + struct qcom_ssr_notif_data data = { > + .name = ssr->info->name, > + .crashed = false, > + }; > + > + srcu_notifier_call_chain(&ssr->info->notifier_list, > + QCOM_SSR_BEFORE_POWERUP, &data); > + return 0; > +} > + > +static int ssr_notify_start(struct rproc_subdev *subdev) > +{ > + struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > + struct qcom_ssr_notif_data data = { > + .name = ssr->info->name, > + .crashed = false, > + }; > + > + srcu_notifier_call_chain(&ssr->info->notifier_list, > + QCOM_SSR_AFTER_POWERUP, &data); > + return 0; > +} > + > +static void ssr_notify_stop(struct rproc_subdev *subdev, bool crashed) > +{ > + struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > + struct qcom_ssr_notif_data data = { > + .name = ssr->info->name, > + .crashed = crashed, > + }; > + > + srcu_notifier_call_chain(&ssr->info->notifier_list, > + QCOM_SSR_BEFORE_SHUTDOWN, &data); > +} > + > static void ssr_notify_unprepare(struct rproc_subdev *subdev) > { > struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > @@ -266,7 +304,8 @@ static void ssr_notify_unprepare(struct rproc_subdev *subdev) > .crashed = false, > }; > > - srcu_notifier_call_chain(&ssr->info->notifier_list, 0, &data); > + srcu_notifier_call_chain(&ssr->info->notifier_list, > + QCOM_SSR_AFTER_SHUTDOWN, &data); > } > > > @@ -294,6 +333,9 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr, > > mutex_unlock(&qcom_ssr_subsys_lock); > ssr->info = info; > + ssr->subdev.prepare = ssr_notify_prepare; > + ssr->subdev.start = ssr_notify_start; > + ssr->subdev.stop = ssr_notify_stop; > ssr->subdev.unprepare = ssr_notify_unprepare; > > rproc_add_subdev(rproc, &ssr->subdev); > diff --git a/include/linux/remoteproc/qcom_rproc.h b/include/linux/remoteproc/qcom_rproc.h > index 58422b1..a558183 100644 > --- a/include/linux/remoteproc/qcom_rproc.h > +++ b/include/linux/remoteproc/qcom_rproc.h > @@ -5,6 +5,20 @@ > > #if IS_ENABLED(CONFIG_QCOM_RPROC_COMMON) > > +/** > + * enum qcom_ssr_notif_type - Different stages of remoteproc notifications > + * @QCOM_SSR_BEFORE_SHUTDOWN: unprepare stage of remoteproc > + * @QCOM_SSR_AFTER_SHUTDOWN: stop stage of remoteproc > + * @QCOM_SSR_BEFORE_POWERUP: prepare stage of remoteproc > + * @QCOM_SSR_AFTER_POWERUP: start stage of remoteproc I think your explanations of these symbols are less clear than the symbol names themselves... In any case, I wouldn't refer to these as "stages of notifications" but instead something more like startup/shutdown related events for a remote processor. I personally might have ordered them differently too: So maybe more like: BEFORE_POWERUP Remoteproc about to start (prepare) AFTER_POWERUP Remoteproc is running (start) BEFORE_SHUTDOWN Remoteproc crashed, or shutting down (stop) AFTER_SHUTDOWN Remoteproc is down (unprepare) -Alex > + */ > +enum qcom_ssr_notif_type { > + QCOM_SSR_BEFORE_SHUTDOWN, > + QCOM_SSR_AFTER_SHUTDOWN, > + QCOM_SSR_BEFORE_POWERUP, > + QCOM_SSR_AFTER_POWERUP, > +}; > + > struct qcom_ssr_notif_data { > const char *name; > bool crashed; >