Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3093993rwb; Mon, 15 Aug 2022 17:59:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5lhdc64PSVNDfhUTRZ4afFXDiPx8f7f/16cY/GfFub7/0LRHcJ4KRuh4C+mmZykCGxJhj7 X-Received: by 2002:a05:6402:3485:b0:43d:7fe0:74d1 with SMTP id v5-20020a056402348500b0043d7fe074d1mr16625403edc.413.1660611550070; Mon, 15 Aug 2022 17:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611550; cv=none; d=google.com; s=arc-20160816; b=0ZGHSI+mfYh2fnyKEEG2IrswlE8vt2uhdPMjvmNzzFoYGCGrYcVzm3f+himGsNHkmq kgPvvhrFUAfHGJMphxNCO7v/wvNLjJhXbap6e5LFNjPIpHIORX5fecPI8rbteE9ZjDld MrkxGqAj2h8JCURvDj8PTKEJ5llLHEoiwAfYx1Z3teQjP5T6SnyKC+NM3NjbYxCnb1iO ZrEEmzrmWedBAgrLZ0Z49x7LUfTF1W707Mi21MVmSBGX1b5m2Ye+MaxR+2dnvY/lCB3M CqiO0vSgClUBvS/6X88HPfs7dvP8eb6FfxKdlWnXkH6NRsTks5eFFDdthHWtrHe91fV0 mH2g== 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=yC5JkSdezbOeI+UgUBHAKHk85sMQdB+HW1ChNwx2rf4U5hKsZ3WCJsDTcmkgzlo81p Xa74HEKefViP3rboxRyhwgUcTaFVGublO2cmsN94VCjE2NFecvFs42J+3T7gE5ichenk fTUysF42ddsCiHTWtM16S5i7jdEEoGgy2E+WAFTtgt8xyNEZrEmwRDqOTPIwRAUxbzTw Ao9Eg66A8/Es5ptnrmFhOMkBL/tMI/KCK9FzCewj7G3BoiJSOWHC792YMtAnxEWqkFsM pz6A+LpMoXO8sMaBHj8vsGlXlf9Q2UDp3UQ5Sjrj8Qw+qQkPmaAO0v/KdG/VZrVAAktX XVqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xjcJ9CeA; 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 l22-20020a170906795600b0072b4addd854si8726523ejo.292.2022.08.15.17.58.43; Mon, 15 Aug 2022 17:59:10 -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=xjcJ9CeA; 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 S233092AbiHPAsh (ORCPT + 99 others); Mon, 15 Aug 2022 20:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345757AbiHPApm (ORCPT ); Mon, 15 Aug 2022 20:45:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60384193564; Mon, 15 Aug 2022 13:41:29 -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 DBBED61233; Mon, 15 Aug 2022 20:41:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9A11C433D6; Mon, 15 Aug 2022 20:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596088; bh=0uKQ4XlDoVmec3sjjPuLPu/Rai684n2yPKBqpnW4JQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xjcJ9CeAzU3auZTeip9qPMck9oh5mvzRkO6MJ1HE2fstcHijO3YDmtI7yerYCX1Wv gHlC6hL5OcGW1KBOkxr3gW+wxCY4WzP6T7Yd4DT53sCzgX+p87GyZ5NJU50LXuEhwE UH6gB3BJujNHkHhuws/Uow4jEgWC6/acKdnxEg8Y= 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.19 0968/1157] remoteproc: sysmon: Wait for SSCTL service to come up Date: Mon, 15 Aug 2022 20:05:24 +0200 Message-Id: <20220815180518.404555643@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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