Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1098624ybb; Wed, 8 Apr 2020 16:38:12 -0700 (PDT) X-Google-Smtp-Source: APiQypLm/F9509xINz1ndAI6OhX1HmJ3QqPti3vHdL+ecv8Ulr9+peueha6d7T6zf54Ifsclad51 X-Received: by 2002:a9d:12a6:: with SMTP id g35mr7557854otg.333.1586389092035; Wed, 08 Apr 2020 16:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586389092; cv=none; d=google.com; s=arc-20160816; b=hZfEE9IpwgQr60eH/3DufkcLBSJbCR1xs9E3gkg3MU8DZPKPzc7f7pEGEpKyfAw9SJ sq725/mvLD5Rxwp59kRgKNDT75gmwHKZPKuIgPpMkSMuh6NMdfnh+uxbbxC3PeLG84ii KHt7s5b72xB299e3GnKFqS9cWUSDuXh/doHWBDU2hSKcpZJSJy6DN3TUC1MGCUT0oSwB WqvVclTTAoUmdvr9YFmQ2+pGQSQEMWbVG0hQ8SxG4VP/H/y2dFCH0FxrQgwdOoWr3itR FhWKHxw3C58IxhPxTfDmeOdV+QBqsHOGSWIp3mt/mGCnStqSN85IYub2k7QCDcCRIo/4 f37A== 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=CKqAD+S3Af/npJ/Tpw6OWygjoWc1na7g3PguX7Jr2Ng=; b=eMN7lQe6GZDxKWeB0B+t0SjDmDb5Dz61DpytrdzPVjOh7/Wsp1slaC4U/aaSVpvvNE EvR9lRbgIiCssoGZ887LC3oSBDI8gwShec9OYpvfOcqGOLswSmjPhnol6CHHhyBCxA/G QXvZU8kGPtEovaxGxsLIlxcyc+KUHzzG+bxetqLAw5LjmQnfyQWLkRgN20y/ZqoPOOhX 61aiJ4gtm2bH4WTTkBsQLjim9hY5RDMDgeu8TmgQuwYdV6zlHe6xvlJoOhCymJ3AzDjT rhyID5QqWgxbTjhEizpLjE5JN5dZBcJ/vBgf3bCQ2YDyCB9wXjXgyXUwT+IPZLdL6pDu 3+Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="WYFZu/7D"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u64si2797824oig.238.2020.04.08.16.37.58; Wed, 08 Apr 2020 16:38:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="WYFZu/7D"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbgDHXhR (ORCPT + 99 others); Wed, 8 Apr 2020 19:37:17 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:44145 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgDHXhM (ORCPT ); Wed, 8 Apr 2020 19:37:12 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586389032; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=CKqAD+S3Af/npJ/Tpw6OWygjoWc1na7g3PguX7Jr2Ng=; b=WYFZu/7DniCSL0WIm2GTt6ZkRji6VisfhmPClJqtgACvKLcn54w4gFX8qLP6+8T5xSVo6Btj fptfwXlAlOoFu40Sfw+yWZfC/Pw34ozO2BXhfX51F5x+aSftXQ+9bpFqOx4hNEPkgFICrLar OWqlHZs+mP2XlYxcqVwD8zICEXU= X-Mailgun-Sending-Ip: 104.130.122.26 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 5e8e601e.7f9554ffdb20-smtp-out-n03; Wed, 08 Apr 2020 23:37:02 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id CAA19C4478F; Wed, 8 Apr 2020 23:37:02 +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 sidgup-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: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id A9D20C44792; Wed, 8 Apr 2020 23:37:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A9D20C44792 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=sidgup@codeaurora.org From: Siddharth Gupta To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com Cc: Siddharth Gupta , 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: [PATCH v2 3/6] remoteproc: sysmon: Inform current rproc about all active rprocs Date: Wed, 8 Apr 2020 16:36:40 -0700 Message-Id: <1586389003-26675-4-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586389003-26675-1-git-send-email-sidgup@codeaurora.org> References: <1586389003-26675-1-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 Clients/services running on a remoteproc that booted up might need to be aware of the state of already running remoteprocs. When a remoteproc boots up (fresh or after recovery) it is not aware of the remoteprocs that booted before it, i.e., the system state is incomplete. So to keep track of it we send sysmon on behalf of all 'ONLINE' remoteprocs. Signed-off-by: Siddharth Gupta --- drivers/remoteproc/qcom_sysmon.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index 851664e..8d8996d 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -453,10 +453,20 @@ static int sysmon_prepare(struct rproc_subdev *subdev) return 0; } +/** + * sysmon_start() - start callback for the sysmon remoteproc subdevice + * @subdev: instance of the sysmon subdevice + * + * Inform all the listners of sysmon notifications that the rproc associated + * to @subdev has booted up. The rproc that booted up also needs to know + * which rprocs are already up and running, so send start notifications + * on behalf of all the online rprocs. + */ static int sysmon_start(struct rproc_subdev *subdev) { struct qcom_sysmon *sysmon = container_of(subdev, struct qcom_sysmon, subdev); + struct qcom_sysmon *target; struct sysmon_event event = { .subsys_name = sysmon->name, .ssr_event = SSCTL_SSR_EVENT_AFTER_POWERUP @@ -464,6 +474,21 @@ static int sysmon_start(struct rproc_subdev *subdev) blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); + mutex_lock(&sysmon_lock); + list_for_each_entry(target, &sysmon_list, node) { + if (target == sysmon || + target->rproc->state != RPROC_RUNNING) + continue; + + event.subsys_name = target->name; + + if (sysmon->ssctl_version == 2) + ssctl_send_event(sysmon, &event); + else if (sysmon->ept) + sysmon_send_event(sysmon, &event); + } + mutex_unlock(&sysmon_lock); + return 0; } -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project