Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1298563ybz; Wed, 22 Apr 2020 17:59:16 -0700 (PDT) X-Google-Smtp-Source: APiQypJXmZZV3p9kDrGeZ2qff+8ta9A6F8xJIwN7BuMistQ9ov/CM98Cy3UCxifghLQlCyrxc2x4 X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr917565edy.182.1587603556082; Wed, 22 Apr 2020 17:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587603556; cv=none; d=google.com; s=arc-20160816; b=eZgGb4roE3HHN0DTbY+UdFmUjC4cmNtk1pI4i0VUYyQ1tOohAiZv3RUpCWL5Yuji8y A2R2N2hLkkhcA5qWImRXz+XSm8Aomzr4aJXMIs20Ii15X2S9ZJhk/JhoxIAKsuFKs6aK yj/xuGiKZ14z008Bg2OX4kbQ+WsuFevvaDDow3TfStJISCqH6i8my4MFNSLbxdetmH2O qCyOuCY9328cA+Oz86iKCc/o/ViUYcOcaF8L36RgUJzQGb7m6RYZEiwtgU56B4K4XFXb adFd+R8XrgxPeAfjRo38esS+n0iL+KctnfVmVl0Fqe6NBbDBz57p0tbD9VzZS3FcaETy ax/g== 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=a2tyd36y2uEBXJHo8BrX3WP4rk+2WUCthbbsOwyGFY8=; b=TegEDbNNQeXIfMtwu4cOnNuTodQE8XGDuigT3MGdHnrFxCGX2StJ7iRdmW/epYQREt osES69+gSbo+esZHuWtpWY4LQcQeY099514Pkgn+QOoWso6+kEulg8q3CuaKTNe1j/uY 5cQu6ACyNAheq1zVywuZHHsm6EJ4TwcfHrJ/3Q2x1MGvMEWVoqtgp091kBk2m+6ccIgB BtH+CGQTTQk1o5UelEaxFuNtufbgt0tlgtMeIrUyeg965V+yvLruFt0mpygWMBqL46ZV G7BMRSfs8D6ShPzA+7AOurxNBWDzy2UpNhjM3SX9uF7W3X40XuWktLWXZulMFJjQKok9 7OQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EXGLr7yo; 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 g4si396263edu.287.2020.04.22.17.58.53; Wed, 22 Apr 2020 17:59:16 -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=EXGLr7yo; 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 S1726112AbgDWA57 (ORCPT + 99 others); Wed, 22 Apr 2020 20:57:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726021AbgDWA57 (ORCPT ); Wed, 22 Apr 2020 20:57:59 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D128C03C1AD for ; Wed, 22 Apr 2020 17:57:57 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id y25so2056907pfn.5 for ; Wed, 22 Apr 2020 17:57:57 -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=a2tyd36y2uEBXJHo8BrX3WP4rk+2WUCthbbsOwyGFY8=; b=EXGLr7yotOZFeroLTaEgBQfGyx14dknJdBBakeNlJDnAwWBkNBeA1CgC7AZbOeP4FI 3ACr7TeXBbbakI5rFdHMzkhlcAaG4DSDD2B2Cl3lomfTy8pEk3DUwKF9zgryzo94/7o6 yuA2iwOhAeX3bKjX0Zwxctg8SndS+ausQrK4Ku1ERNJ6L5ZJ3lCTwEulyu9RfPLwjo3U G+Z6xli2Zj9edg8QHoCbJZARqAJziifFlskh4j50QURMTF9BufULYkXDUzE5Qd1FMLjT QwW7pqDva60he7Vmc8oBV9xH+aZOANh2anG9OcjhyMbCybCHxkslkdc9byWz4lr5dA5S CgRA== 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=a2tyd36y2uEBXJHo8BrX3WP4rk+2WUCthbbsOwyGFY8=; b=kVQ9BFcWFy61q1dBhkckcQIwJ7UtyhOZb1k2eL0D6F1n+1ii2mWfeocThRahUaBUQ/ LMQqRzWp16chiFFUatp433bzs2k+/F3LbnwRFCGHf0QARuDyyWVCQpYGLYZep/8uXnT5 KAUrMF6Wl40A54NhxNH/bugRyRqHIXgv7G7mzo1sJ6gPZk69YItvLViznIbq2mpg2ObW 4Aq/iRNlJA2ZkmYVDrw3lUHuJLFLjGdKS0OXaKvAuR6MBUzXPwsYcRBp9UfqyczO08fu ddsc8tPYLcMWhtSvOPY93b2SDeheniPDr9k8fFb4ZXvGuWdJtpzHbtfKbG2L34mXVXfy Av7g== X-Gm-Message-State: AGi0PuZgKxj68tyvY3jKuVFYtuaLuKHLfP7tviuC70dyLqCSGuSCJdPJ cv7L6RfusJ2i911sz7dPTX6YGA== X-Received: by 2002:a63:3502:: with SMTP id c2mr1644084pga.276.1587603476606; Wed, 22 Apr 2020 17:57:56 -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 a200sm699680pfa.201.2020.04.22.17.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 17:57:55 -0700 (PDT) Date: Wed, 22 Apr 2020 17:58:23 -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 6/6] remoteproc: qcom: Add notification types to SSR Message-ID: <20200423005823.GN1868936@builder.lan> References: <1586389003-26675-1-git-send-email-sidgup@codeaurora.org> <1586389003-26675-7-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-7-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: > The SSR subdevice only adds callback for the unprepare event. Add callbacks > for unprepare, 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 > --- > drivers/remoteproc/qcom_common.c | 39 +++++++++++++++++++++++++++++++++++---- > include/linux/remoteproc.h | 15 +++++++++++++++ > 2 files changed, 50 insertions(+), 4 deletions(-) > > diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c > index 56b0c3e..06611f2 100644 > --- a/drivers/remoteproc/qcom_common.c > +++ b/drivers/remoteproc/qcom_common.c > @@ -183,9 +183,9 @@ EXPORT_SYMBOL_GPL(qcom_remove_smd_subdev); > * > * Returns pointer to srcu notifier head on success, ERR_PTR on failure. > * > - * This registers the @notify function as handler for restart notifications. As > - * remote processors are stopped this function will be called, with the rproc > - * pointer passed as a parameter. > + * This registers the @notify function as handler for powerup/shutdown > + * notifications. This function will be invoked inside the callbacks registered > + * for the ssr subdevice, with the rproc pointer passed as a parameter. > */ > void *qcom_register_ssr_notifier(struct rproc *rproc, struct notifier_block *nb) > { > @@ -227,11 +227,39 @@ 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); > + > + srcu_notifier_call_chain(ssr->rproc_notif_list, > + RPROC_BEFORE_POWERUP, (void *)ssr->name); > + return 0; > +} > + > +static int ssr_notify_start(struct rproc_subdev *subdev) > +{ > + struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > + > + srcu_notifier_call_chain(ssr->rproc_notif_list, > + RPROC_AFTER_POWERUP, (void *)ssr->name); > + return 0; > +} > + > +static void ssr_notify_stop(struct rproc_subdev *subdev, bool crashed) > +{ > + struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > + > + srcu_notifier_call_chain(ssr->rproc_notif_list, > + RPROC_BEFORE_SHUTDOWN, (void *)ssr->name); > +} > + > + > static void ssr_notify_unprepare(struct rproc_subdev *subdev) > { > struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); > > - srcu_notifier_call_chain(ssr->rproc_notif_list, 0, (void *)ssr->name); > + srcu_notifier_call_chain(ssr->rproc_notif_list, > + RPROC_AFTER_SHUTDOWN, (void *)ssr->name); > } > > /** > @@ -248,6 +276,9 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr, > { > ssr->name = ssr_name; > ssr->subdev.name = kstrdup("ssr_notifs", GFP_KERNEL); > + ssr->subdev.prepare = ssr_notify_prepare; > + ssr->subdev.start = ssr_notify_start; > + ssr->subdev.stop = ssr_notify_stop; > ssr->subdev.unprepare = ssr_notify_unprepare; > ssr->rproc_notif_list = kzalloc(sizeof(struct srcu_notifier_head), > GFP_KERNEL); > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index 687e1eb..facadb07 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -452,6 +452,21 @@ struct rproc_dump_segment { > }; > > /** > + * enum rproc_notif_type - Different stages of remoteproc notifications > + * @RPROC_BEFORE_SHUTDOWN: unprepare stage of remoteproc > + * @RPROC_AFTER_SHUTDOWN: stop stage of remoteproc > + * @RPROC_BEFORE_POWERUP: prepare stage of remoteproc > + * @RPROC_AFTER_POWERUP: start stage of remoteproc > + */ > +enum rproc_notif_type { As these are tied to the API defined in qcom_rproc.h, I think it better belong there. > + RPROC_BEFORE_SHUTDOWN, > + RPROC_AFTER_SHUTDOWN, > + RPROC_BEFORE_POWERUP, > + RPROC_AFTER_POWERUP, > + RPROC_MAX Please omit the MAX, unless you have a specific purpose for it. Regards, Bjorn > +}; > + > +/** > * struct rproc - represents a physical remote processor device > * @node: list node of this rproc object > * @domain: iommu domain > -- > Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project