Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3026133rwb; Mon, 15 Aug 2022 16:24:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7zV0goAkxwPcoNEX4uokCzANfmaD4gnP4mMYsGbUqxWT3PHNUxH7ZWszXuGQFweKliBrHC X-Received: by 2002:a17:902:a584:b0:16f:8663:6c68 with SMTP id az4-20020a170902a58400b0016f86636c68mr19229857plb.144.1660605851726; Mon, 15 Aug 2022 16:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605851; cv=none; d=google.com; s=arc-20160816; b=LqYmK2afVsrrALVU/BZXAFBvTNcFPhZ/yODtte9rMA6GMarR6lyWRK63d0GcmM9PBV cc44lYAc5hL9KzR4yu8wJOGCk3hpXRD9nxZRixFu3m6+wea2Ca+9ICiQU00aeYOIzSFu FlPU6AMbJ5WfJKgmDxP6IltVkMyF09pr62T0oZCfEVSm30C7C7VgZO/rxnKBqEXiDt6z O+VSmUSgvCPcRh4+dh4kt6zyofv1fqJkSt0svmIvjy0pBW83urUAnNQmVaN3okRvFf+7 1Qawt9mqPZ6BpnCUt5FAr7elIF2otuksgaBYinXJxSlmD69ZSGCzBEq+as32vQWOkX8n PhcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3AAvg0TsmO/DxVfu+8F1cQ79NxGVfbckL2hIdLeAvk0=; b=q7Gfz13g5gzbAtzStttqc1nIk09VEhM5sYxQ0dlYKu8x/6rAE7TSlqPh3E2q+ntXVb +M2Qo0B+3oWQZAJg7ZxV3fYv+Whb9hgzcsvg74uLks0bBaQLRT/2Hz3dwBLdvY39GQI4 VW4F5+u5XVJ57gnQXUvnZl+iznzBn+wiAlCcrObDjECvBF+S4UNEbb0zzvMLHOmD8pV9 kVDy5N0czF6nsagxcDq04Sfswub6qLZ2rlVCeNka0w/NVcp4A/MQ6CA3R0kdgpSkAljc MYFoKeimJMUTFKsfr2lWj0nTAxC5nAlJGibcALtKSWlhZzNTInYnBz+aiYJMQZk/Eplc UnoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uElSEXc4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a17090ad81400b001efa8c6d942si110009pjv.189.2022.08.15.16.24.01; Mon, 15 Aug 2022 16:24:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uElSEXc4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351628AbiHOWp7 (ORCPT + 99 others); Mon, 15 Aug 2022 18:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350430AbiHOWmh (ORCPT ); Mon, 15 Aug 2022 18:42:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5CDA74346; Mon, 15 Aug 2022 12:52:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 038A261206; Mon, 15 Aug 2022 19:52:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F224AC433D6; Mon, 15 Aug 2022 19:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593135; bh=0uKQ4XlDoVmec3sjjPuLPu/Rai684n2yPKBqpnW4JQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uElSEXc4s1UrVFjTMkhUubkm/L2ipAZDJdCdXvO8dw/V6yDNzekjt8sAbym5Xknke fwH9Pp+aEjQTgM9iJRKIi72D98fOEGtMUhVNd6rhVyVkzQWg7Q7FU0OBBiKgGHZACc kZCMN2CfpZV1rufJPKosVQEU7mhQ+QJCYYQ1S/mE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Sibi Sankar , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0892/1095] remoteproc: sysmon: Wait for SSCTL service to come up Date: Mon, 15 Aug 2022 20:04:51 +0200 Message-Id: <20220815180506.232156171@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sibi Sankar [ Upstream commit 47c04e00eff86a81cd357c3feed04c86089bcb85 ] The SSCTL service comes up after a finite time when the remote Q6 comes out of reset. Any graceful shutdowns requested during this period will be a NOP and abrupt tearing down of the glink channel might lead to pending transactions on the remote Q6 side and will ultimately lead to a fatal error. Fix this by waiting for the SSCTL service when a graceful shutdown is requested. Fixes: 1fb82ee806d1 ("remoteproc: qcom: Introduce sysmon") Reviewed-by: Matthias Kaehlcke Signed-off-by: Sibi Sankar Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1657022900-2049-7-git-send-email-quic_sibis@quicinc.com Signed-off-by: Sasha Levin --- drivers/remoteproc/qcom_sysmon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index 9fca81492863..a9f04dd83ab6 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -41,6 +41,7 @@ struct qcom_sysmon { struct completion comp; struct completion ind_comp; struct completion shutdown_comp; + struct completion ssctl_comp; struct mutex lock; bool ssr_ack; @@ -445,6 +446,8 @@ static int ssctl_new_server(struct qmi_handle *qmi, struct qmi_service *svc) svc->priv = sysmon; + complete(&sysmon->ssctl_comp); + return 0; } @@ -501,6 +504,7 @@ static int sysmon_start(struct rproc_subdev *subdev) .ssr_event = SSCTL_SSR_EVENT_AFTER_POWERUP }; + reinit_completion(&sysmon->ssctl_comp); mutex_lock(&sysmon->state_lock); sysmon->state = SSCTL_SSR_EVENT_AFTER_POWERUP; blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); @@ -545,6 +549,11 @@ static void sysmon_stop(struct rproc_subdev *subdev, bool crashed) if (crashed) return; + if (sysmon->ssctl_instance) { + if (!wait_for_completion_timeout(&sysmon->ssctl_comp, HZ / 2)) + dev_err(sysmon->dev, "timeout waiting for ssctl service\n"); + } + if (sysmon->ssctl_version) sysmon->shutdown_acked = ssctl_request_shutdown(sysmon); else if (sysmon->ept) @@ -631,6 +640,7 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc, init_completion(&sysmon->comp); init_completion(&sysmon->ind_comp); init_completion(&sysmon->shutdown_comp); + init_completion(&sysmon->ssctl_comp); mutex_init(&sysmon->lock); mutex_init(&sysmon->state_lock); -- 2.35.1