Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp198663ybt; Tue, 23 Jun 2020 19:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWJYMo5bTP9OBuqy/7PLnTTPEaAxlzMmc5k8PlHrw0RVJ+47LMJ1rbUDqQrWkI3sFo8Ft/ X-Received: by 2002:a05:6402:22b0:: with SMTP id cx16mr17517570edb.48.1592965600079; Tue, 23 Jun 2020 19:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592965600; cv=none; d=google.com; s=arc-20160816; b=aCFnnbMKz32825q44j0zWujQXpn80F3Cuc2YxITUWYqskC/FViS8Na2PbJHuzfLFDU 0m/+lInSYDFUSj02wGOdkR6Nb1HzqLoi6y1rRar8nZQdE68l02gdIZv9LpMDBCMVM9bZ O9Wh+vNruT2wIWRZXYRUDbT3VYpiupsd9XL7qRYVM7LE8koMmTMoXO3OiITcFUNmiqeh K7ZNthUhrx9fS1+SKv48JyAZWbC0Gvpl5clyo98HgcCoTVbVjZwn7jnqELbleh6Qj+bZ bS9ZyAt3ABsjevDdRWFAngTfxItnKwoIOftGH47Z8FRM3bibE0mCATYNcyAVgZENgE7W r0IQ== 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=yKqRxzK5CgSW8RmcYWIU6RCr/r6LK8FTWdS99NGEJHw=; b=OyLYAiKRTpGm/X9W/1fBxJVfca0M/5Bbsfe8uPjsl/ZEDo2fC4+ZGSBmq1R0WxdkBu 0PzFRd2ul6RQRLQL87OuTnoE6fZYs43NiFZ8aLwmOUK0z2h7gSPxyq/TleACDscwCECy ux71l2onmRGnt/5I2ng0FobI83ePkvLw5HI4NSwiYZF/3ppNZwDJIoEppFX6M6T0ybSw AERWk1fkcAYhuDecQbtfOd91mTq26GTE/i+nBNpoPIywxN9F/TiLArJVpo8SN2ODeLG9 N6cwfUdHcNKn/cY81sdMJ7dj+ZK2TE/rCvtLfJB3zXmX0jRRPCGXc5JIMp39NLK77DoF hRDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=BKYvQqVY; 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 y19si11646563edm.387.2020.06.23.19.26.17; Tue, 23 Jun 2020 19:26:40 -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=BKYvQqVY; 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 S2388230AbgFXCZ1 (ORCPT + 99 others); Tue, 23 Jun 2020 22:25:27 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:35027 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387790AbgFXCZZ (ORCPT ); Tue, 23 Jun 2020 22:25:25 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1592965524; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=yKqRxzK5CgSW8RmcYWIU6RCr/r6LK8FTWdS99NGEJHw=; b=BKYvQqVY/2i7VuwvrWhc/CWvFdPO9n4lnNhqZ6KYPpquf8/p7FkvlfLlIp3edgoDrumMQUs9 Pnji+ZGsj9eSbsQzy+O91VSxJgCePy8Jxp3Ixwad3i+kTPMJoLtWHbGBNhP2CrlXiADItrvp +fW2svB3D7SJrsagFGhMibOHaA8= X-Mailgun-Sending-Ip: 69.72.43.7 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 smtp-out-n15.prod.us-west-2.postgun.com with SMTP id 5ef2b980117610c7ff5431fc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 24 Jun 2020 02:25:04 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B63D8C433C6; Wed, 24 Jun 2020 02:25:04 +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 77B97C43395; Wed, 24 Jun 2020 02:25:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 77B97C43395 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, linux-kernel@vger.kernel.org Cc: bjorn.andersson@linaro.org, tsoni@codeaurora.org, psodagud@codeaurora.org, sidgup@codeaurora.org, elder@ieee.org, Rishabh Bhatnagar Subject: [PATCH v6 2/2] remoteproc: qcom: Add notification types to SSR Date: Tue, 23 Jun 2020 19:23:28 -0700 Message-Id: <1592965408-16908-3-git-send-email-rishabhb@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592965408-16908-1-git-send-email-rishabhb@codeaurora.org> References: <1592965408-16908-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 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 --- 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 7a7384c..7ec4597 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -265,6 +265,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_notify_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_notify_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_notify_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); @@ -273,7 +311,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); } /** @@ -298,6 +337,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 2a1d6d0..6470516 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_notify_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_notify_type { + QCOM_SSR_BEFORE_POWERUP, + QCOM_SSR_AFTER_POWERUP, + QCOM_SSR_BEFORE_SHUTDOWN, + QCOM_SSR_AFTER_SHUTDOWN, +}; + struct qcom_ssr_notify_data { const char *name; bool crashed; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project