Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp41568ybt; Tue, 23 Jun 2020 14:48:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfZFOFwTnaMCWCjFZ763ZZTeMfX1pxK5iLsOAQxYDeNWyv7ODAq48HrtkJoMTZ35CbVwKJ X-Received: by 2002:a17:907:209b:: with SMTP id pv27mr16010147ejb.501.1592948913841; Tue, 23 Jun 2020 14:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592948913; cv=none; d=google.com; s=arc-20160816; b=rZM5Z07pWLn5vlSwuEMhQePw7NTn9jTp3junzR45qqYrYOv+9vEyYcyOTUKtG7s+P9 li0ylX/TsfvOUXz1dluxKXEa4p0ehu/RrjTu/smPT1ThML/pt+PSWlqSBUspvdXu6nmT fB/qKB+8HTuhPymvdbgz00HkCM/obYUcyIdBs4CvEEBlnBDwLOIEWeE8/02fOtJOad13 hBwnLoCILwzvjYXjb3WKVLA/DUiLzIGD4f7svfaE6OJkugnyHq9uoc5gwAI8UQyxUk5A tWrQIZr8o+VSeiqGTrTiRAJ/vZIKLEyOxjDx8yKkn8Goy+2fKkosLOo5o7fL1O8EiLNE 1v8A== 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=HZHJ+lW7xSmoSfHRie1OqWIcs5GILHV56xiQdBcP6dA=; b=S/u5Quum0U1sp49uskT56W8OLZTCaNMeNp7NYoBSaL1Ns3bClz60u4SHvg7vWfzCnB biDtXNkr+sRlByCUBJ5B3fHMA9uXDvqCOKR+xluax9KTQCIJvPfZG0Qz39C3Qew/Qm9q W29dDW1wOchPvZ9L3Wd7z8m5zwnuOycFctknMKCHr0XXZS6IDGnZmYmNrXOBBB46w3fN nTledlsc945nnACJdBYF/rgZONZEFlyDHQo0Xuwz4xgFWmhKuv/XWKntlejVZnY/URLF k1vEzg0xC5lKP2fpPFoq3Cw6cW6t+W/z8g5XfUfCzVXpHgDQbnkyVP4C9hmR6kkiqzoG gTKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b=QMMrg5tm; 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 c1si11077037edr.485.2020.06.23.14.48.10; Tue, 23 Jun 2020 14:48:33 -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=QMMrg5tm; 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 S2388717AbgFWVqD (ORCPT + 99 others); Tue, 23 Jun 2020 17:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388292AbgFWVqA (ORCPT ); Tue, 23 Jun 2020 17:46:00 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4415C061573 for ; Tue, 23 Jun 2020 14:46:00 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id h4so17922976ior.5 for ; Tue, 23 Jun 2020 14:46:00 -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=HZHJ+lW7xSmoSfHRie1OqWIcs5GILHV56xiQdBcP6dA=; b=QMMrg5tm407Cx/Zn/FOuyZluu+7AZrT7m38I06iMLSPIVG9onoUXSdfOc2VJ2+lwul TjtyN0Vn4UKtjhazoIQNzIi30yJ8ro9l5B2meWFnOiFSTBZFXyhsC8Mk1+JIxz10RbAe L55t/JcBfT0TJHQTJixOekpAVQ6/nOVO+B35g= 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=HZHJ+lW7xSmoSfHRie1OqWIcs5GILHV56xiQdBcP6dA=; b=d1/s+FG7W54TCI6enkL+veMSvIrb1xO6/6TJBv5GZ8CLkiI67M0lMAwF64AyfiACdl LPeA2RcnGd5X1hA93gQuR5049DgevAtJF8eeSs0Ow07CiUc2WZ9gLvdi8ZdF20EsokPe 0nSMjkHM2ql7xBy6aRu8vJ/NcFA1Jt8us4aYswv2JTSSLflbZHm2AEPPZNyythN14qhO AnTTKjNXaDSzDyflvBGKdlIlKyIXUY3zY9b96CGrMFaTEf3El3/1hTpwxbF1NaL/N4LH +k/J0nnso+vpHPiLi3u36Gvs6RIrRnKLg3obXe/ktC3Vte2A/PybzGUO8MHGkw4zx6Be ucgw== X-Gm-Message-State: AOAM532NGtp1rOGE8WdKdstRqTzG3wLNn+WRxNv4fL1enWpx35RZKJKt s+V7pfKwCkzhnTiw2uC19EX+VGsIFF4= X-Received: by 2002:a02:6641:: with SMTP id l1mr26525746jaf.23.1592948760185; Tue, 23 Jun 2020 14:46:00 -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 t1sm10529100iob.16.2020.06.23.14.45.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jun 2020 14:45:59 -0700 (PDT) Subject: Re: [PATCH v5 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: <1592874271-26697-1-git-send-email-rishabhb@codeaurora.org> <1592874271-26697-3-git-send-email-rishabhb@codeaurora.org> From: Alex Elder Message-ID: <08c5deed-0ed5-0e75-2c2e-4a508515be0a@ieee.org> Date: Tue, 23 Jun 2020 16:45:58 -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: <1592874271-26697-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 6/22/20 8:04 PM, Rishabh Bhatnagar wrote: > The SSR subdevice only adds callback for the unprepare event. Add callbacks > for prepare, start and prepare events. The client driver for a particular > 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 This looks good to me. Reviewed-by: Alex Elder > --- > drivers/remoteproc/qcom_common.c | 44 ++++++++++++++++++++++++++++++++++- > include/linux/remoteproc/qcom_rproc.h | 16 +++++++++++++ > 2 files changed, 59 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c > index 658f2ca..0848bf1 100644 > --- a/drivers/remoteproc/qcom_common.c > +++ b/drivers/remoteproc/qcom_common.c > @@ -262,6 +262,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); > @@ -270,7 +308,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, > } > > 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..83ac8e8 100644 > --- a/include/linux/remoteproc/qcom_rproc.h > +++ b/include/linux/remoteproc/qcom_rproc.h > @@ -5,6 +5,22 @@ struct notifier_block; > > #if IS_ENABLED(CONFIG_QCOM_RPROC_COMMON) > > +/** > + * enum qcom_ssr_notif_type - Startup/Shutdown events related to a remoteproc > + * processor. > + * > + * @QCOM_SSR_BEFORE_POWERUP: Remoteproc about to start (prepare stage) > + * @QCOM_SSR_AFTER_POWERUP: Remoteproc is running (start stage) > + * @QCOM_SSR_BEFORE_SHUTDOWN: Remoteproc crashed or shutting down (stop stage) > + * @QCOM_SSR_AFTER_SHUTDOWN: Remoteproc is down (unprepare stage) > + */ > +enum qcom_ssr_notif_type { > + QCOM_SSR_BEFORE_POWERUP, > + QCOM_SSR_AFTER_POWERUP, > + QCOM_SSR_BEFORE_SHUTDOWN, > + QCOM_SSR_AFTER_SHUTDOWN, > +}; > + > struct qcom_ssr_notif_data { > const char *name; > bool crashed; >