Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4636875ybz; Tue, 28 Apr 2020 15:22:58 -0700 (PDT) X-Google-Smtp-Source: APiQypIl/cCFipjoZNOch/rAAs5q9r2Ghluf7U9S3LMbsJF+xrm1nY8TeMP+DobMq6+OBIy86etw X-Received: by 2002:a17:906:138c:: with SMTP id f12mr27343550ejc.35.1588112578345; Tue, 28 Apr 2020 15:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588112578; cv=none; d=google.com; s=arc-20160816; b=t78RJsg6KsIdBIQ+Ucw0fkVaeM3sHQ9Z6WKEgYXRX61MIZ8c5bd5I3d0C4NBt2Tfte gYToEpDmQUnZoYvFhom4hKYdbpxszdBmQI8SLCWdJ3N+cOmgVDNWD5V5vJWsQPYnWthv 89/G3a/oyR74x/4RPSiYZG4TCZYa9rplP31O+WE2HcfRtIuJASDOFoRBETtxSQkPmxiZ 5/eb3g78YSxpwoXj7KMl0PykFcNqU4x7roJthsl//dZ/s4zeZSrtp+MF3G7qtkmS2cI4 SsyM5gf5DoU0Q22GH3FGnhgv32sGD2HueT41p8yaljSgYAizxs+AsUhu7uTnImI3Uw3K LO2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=/oDvchi+lsIgrnwnrgDaZ6FiJ5AHvT7Z1ttGX9bYM2c=; b=wMcByzh3JyWmiQPexIJEWUPA4pMJjF7rd9kqp872Th+mec8c/7M3uKtwtL6Hsn1hI8 aI9F0/5jis/HWEih29MBvhoehgMtaUSGUAsxgkY3rQMRE4nm13LkoEO+x13cRp7Zp4sv bnEvLFoXv/lVaNQT0a93dLshMDhPIus5x8pF/8G8kXO7lE8iwW3VZbZREBsTPqX3TOSy pP2FS4HCW+F6v7joUYT92tuGjengzESrDMIL0yOKQrphMmq97FSbDjDPliKV3gGgPBQY cAe08lswVnedhzivJxKwFwaEZfzWKiHrI7rHfNUTU0T5QQ7uPKbu/uEgZyD/J577SYqQ a9gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=viNPGZpV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d24si2315429edy.387.2020.04.28.15.22.34; Tue, 28 Apr 2020 15:22:58 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=viNPGZpV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbgD1WSp (ORCPT + 99 others); Tue, 28 Apr 2020 18:18:45 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:53283 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbgD1WSn (ORCPT ); Tue, 28 Apr 2020 18:18:43 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588112322; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=/oDvchi+lsIgrnwnrgDaZ6FiJ5AHvT7Z1ttGX9bYM2c=; b=viNPGZpV6+0+plAhh1rBzI55i8tQeUItVKs34lc6XqPYYaWvlbZU5CM4inntU9ImsE5ctYkB 6VXqtX9xdp0wUVe82QG8Y7ITulBRK3cSC0r86kvVYCMaXhmJ/7cKyNVnY8c/QEiXh/iWHGYh hMjPAwJrZF+eWwJGDS/+rRVIg1A= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea8abb8.7f19c84bad88-smtp-out-n04; Tue, 28 Apr 2020 22:18:32 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C98A2C433BA; Tue, 28 Apr 2020 22:18:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from rishabhb-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rishabhb) by smtp.codeaurora.org (Postfix) with ESMTPSA id B08ABC432C2; Tue, 28 Apr 2020 22:18:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B08ABC432C2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rishabhb@codeaurora.org From: Rishabh Bhatnagar To: linux-remoteproc@vger.kernel.org, bjorn.andersson@linaro.org Cc: ohad@wizery.com, linux-kernel@vger.kernel.org, tsoni@codeaurora.org, psodagud@codeaurora.org, sidgup@codeaurora.org, Rishabh Bhatnagar Subject: [PATCH v3 2/2] remoteproc: qcom: Add notification types to SSR Date: Tue, 28 Apr 2020 15:16:09 -0700 Message-Id: <1588112169-29447-3-git-send-email-rishabhb@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1588112169-29447-1-git-send-email-rishabhb@codeaurora.org> References: <1588112169-29447-1-git-send-email-rishabhb@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 7cd17be..0d91cf3 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -197,7 +197,7 @@ struct rproc_notif_info *find_notif_info(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. */ void *qcom_register_ssr_notifier(const char *name, struct notifier_block *nb) { @@ -239,6 +239,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 rproc_notif_data data = { + .name = ssr->info->name, + .crashed = false, + }; + + srcu_notifier_call_chain(&ssr->info->notifier_list, + RPROC_BEFORE_POWERUP, &data); + return 0; +} + +static int ssr_notify_start(struct rproc_subdev *subdev) +{ + struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); + struct rproc_notif_data data = { + .name = ssr->info->name, + .crashed = false, + }; + + srcu_notifier_call_chain(&ssr->info->notifier_list, + RPROC_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 rproc_notif_data data = { + .name = ssr->info->name, + .crashed = crashed, + }; + + srcu_notifier_call_chain(&ssr->info->notifier_list, + RPROC_BEFORE_SHUTDOWN, &data); +} + static void ssr_notify_unprepare(struct rproc_subdev *subdev) { struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); @@ -247,7 +285,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, + RPROC_AFTER_SHUTDOWN, &data); } @@ -282,6 +321,9 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr, } mutex_unlock(&rproc_notif_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 3dc65c0..567c1f9 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 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 { + RPROC_BEFORE_SHUTDOWN, + RPROC_AFTER_SHUTDOWN, + RPROC_BEFORE_POWERUP, + RPROC_AFTER_POWERUP, +}; + struct rproc_notif_data { const char *name; bool crashed; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project