Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3198170ybt; Mon, 22 Jun 2020 18:08:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA9GdSHpcX6mNOvZmPJMntuC0ScY5pKu366vfs4qlohua08xBkzESPfcS7CBOeFuN4UuJ9 X-Received: by 2002:a50:fe0d:: with SMTP id f13mr20106770edt.204.1592874488051; Mon, 22 Jun 2020 18:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592874488; cv=none; d=google.com; s=arc-20160816; b=UvVfMnAOtJBI+OvGiczN72IEU3bsjXNCjiZ3VnVVkNuyJy0Km2+1KF1RlTUnA95sCx j/VbXYDQvbSE2qRr2wXKuTiZpzgh7A5tMkYb45LbILyKLGdnDMvM8t4UDNE51PZ1Wwy4 M+VD81ptr7FXnEv5imRfTLKqddPZ+u9qbXVfPcQI6/88aZwvGrDyEm18xAhZOOIpHE17 vdW5ph7oikDxKOGt4Uc859SzdoQG8u8XBueRemhOQzQwPELsQpPiy4hBPaLxAY5/R7f8 gWDiV4LIzdZ09V4GHmsoO8N1k731/CkMsVbRFzWzA5GxazkHyOLKbMvag5S5KhAqUd8/ hXzw== 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=l7HyIkJnxBsinObpa2Z9vSuHV/rwoV3wrn30vlRTkoE=; b=v+9Wy6mNGLcdgb159jHDqNUg49mr0g6vuCCsrqHvWP5MS6o68w6RwW10S+Xmmj/DYr nnarSgjUPWU5qIl8lOjh3DJy/kAPT9BCU5mzoIpzuFd4gI/1LmBDdUQzhfMjWiw2MXTe u59Z5CGYNEjoJTr4/hJtVo2lsaVcS1MlHR18mBB8Uj9xobls4o7vD6/gWAzDyPuPMG/d zoeZBdgJpFEzcwiwdW+5RZaCoYx9fFBJqD4cODduH5UHEQsw0NZM2QywjTXzq+ly3zSm IRnXNVzfV9OWPx4sHzB/E8vEQRSsZ4HBH5fW8700FcUHpd/RQDi+vMqA9NSEMGciryiW SqyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="rfHNya/j"; 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 gj16si10750073ejb.373.2020.06.22.18.07.45; Mon, 22 Jun 2020 18:08:08 -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="rfHNya/j"; 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 S1732509AbgFWBFV (ORCPT + 99 others); Mon, 22 Jun 2020 21:05:21 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:49855 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732496AbgFWBFU (ORCPT ); Mon, 22 Jun 2020 21:05:20 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1592874319; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=l7HyIkJnxBsinObpa2Z9vSuHV/rwoV3wrn30vlRTkoE=; b=rfHNya/jx3SeiQEABqZsikrXYO8pDyYLwvHEMiC8eJAR2ji63cE4m7wRtGdpDBgVD1IdD2LH hjIbPSOhqSyUzazh6B2Opi3FcdEtzSBSE1H3vyuCfbMGSILwEENSSTIJR7442bQ2J+6+wZXx L7g3hSWpORXVfhL61eT/0DF1kY4= X-Mailgun-Sending-Ip: 104.130.122.29 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-n03.prod.us-west-2.postgun.com with SMTP id 5ef1553ee144dd5115acc32f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 23 Jun 2020 01:05:02 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E50BAC433CB; Tue, 23 Jun 2020 01:05:01 +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, URIBL_BLOCKED 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 E32AFC43391; Tue, 23 Jun 2020 01:05:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E32AFC43391 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 v5 2/2] remoteproc: qcom: Add notification types to SSR Date: Mon, 22 Jun 2020 18:04:31 -0700 Message-Id: <1592874271-26697-3-git-send-email-rishabhb@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592874271-26697-1-git-send-email-rishabhb@codeaurora.org> References: <1592874271-26697-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 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; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project