Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FA81C433EF for ; Tue, 7 Dec 2021 23:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238397AbhLGXpR (ORCPT ); Tue, 7 Dec 2021 18:45:17 -0500 Received: from m43-7.mailgun.net ([69.72.43.7]:38024 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238356AbhLGXpQ (ORCPT ); Tue, 7 Dec 2021 18:45:16 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1638920505; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=DKZYj2D2ozIike5afQtrah0cMUGtTdAKUDAOIu8jYCg=; b=H4Qk6yngVWJ4uOB8/ir/mN8N9m8O8uBwEfCGHtNjeB2tGQH7MF0U12oA+slqTInRuHJ4qPb2 tBcH2nNOJHsWmhCwJb1x0mQyLFdZRGzBUZEzc4M/9RwBiFdmNq0KKS0e1+6oIQFgU9+qIaap wSU8Ei5jZV/FRA2U9gqmpl62CAo= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 61aff1384fca5da46df1b36c (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 07 Dec 2021 23:41:44 GMT Sender: hemantk=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B3D60C43616; Tue, 7 Dec 2021 23:41:44 +0000 (UTC) Received: from [10.110.103.130] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hemantk) by smtp.codeaurora.org (Postfix) with ESMTPSA id C55B2C4338F; Tue, 7 Dec 2021 23:41:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org C55B2C4338F 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=fail smtp.mailfrom=codeaurora.org Subject: Re: [PATCH] bus: mhi: core: Add support for forced PM resume To: Manivannan Sadhasivam , mhi@lists.linux.dev Cc: bbhatt@codeaurora.org, loic.poulain@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, kvalo@codeaurora.org, stable@vger.kernel.org, Pengyu Ma References: <20211206161059.107007-1-manivannan.sadhasivam@linaro.org> From: Hemant Kumar Message-ID: <7eb05d7c-ddda-5ec1-73a0-e696d2b5a236@codeaurora.org> Date: Tue, 7 Dec 2021 15:41:42 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211206161059.107007-1-manivannan.sadhasivam@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Mani, On 12/6/2021 8:10 AM, Manivannan Sadhasivam wrote: > From: Loic Poulain > > For whatever reason, some devices like QCA6390, WCN6855 using ath11k > are not in M3 state during PM resume, but still functional. The > mhi_pm_resume should then not fail in those cases, and let the higher > level device specific stack continue resuming process. > > Add a new parameter to mhi_pm_resume, to force resuming, whatever the > current MHI state is. This fixes a regression with non functional > ath11k WiFi after suspend/resume cycle on some machines. > > Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=214179 > > Cc: stable@vger.kernel.org #5.13 > Fixes: 020d3b26c07a ("bus: mhi: Early MHI resume failure in non M3 state") > Reported-by: Kalle Valo > Reported-by: Pengyu Ma > Signed-off-by: Loic Poulain > [mani: Added comment, bug report, added reported-by tags and CCed stable] > Signed-off-by: Manivannan Sadhasivam > --- > drivers/bus/mhi/core/pm.c | 10 +++++++--- > drivers/bus/mhi/pci_generic.c | 2 +- > drivers/net/wireless/ath/ath11k/mhi.c | 6 +++++- > include/linux/mhi.h | 3 ++- > 4 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c > index 7464f5d09973..4ddd266e042e 100644 > --- a/drivers/bus/mhi/core/pm.c > +++ b/drivers/bus/mhi/core/pm.c > @@ -881,7 +881,7 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl) > } > EXPORT_SYMBOL_GPL(mhi_pm_suspend); > > -int mhi_pm_resume(struct mhi_controller *mhi_cntrl) > +int mhi_pm_resume(struct mhi_controller *mhi_cntrl, bool force) > { > struct mhi_chan *itr, *tmp; > struct device *dev = &mhi_cntrl->mhi_dev->dev; > @@ -898,8 +898,12 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl) > if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) > return -EIO; > > - if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) > - return -EINVAL; > + if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) { in case if mhi_get_mhi_state(mhi_cntrl) returns SYS_ERR (assuming while doing this check SYS_ERR is set) do we still want to continue pm resume when force is true? Just want to make sure SYS_ERR handling with and without this change remains the same or atleast does not cause any regression with this change. or if we need to continue pm resume only for MHI_STATE_RESET when MHI_STATE_M3 is not set? > + dev_warn(dev, "Resuming from non M3 state (%s)\n", > + TO_MHI_STATE_STR(mhi_get_mhi_state(mhi_cntrl))); > + if (!force) > + return -EINVAL; > + } > [..] Thanks, Hemant -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project