From patchwork Fri May 12 02:05:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiang Yu X-Patchwork-Id: 92919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4801051vqo; Thu, 11 May 2023 19:23:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40MqDmqkTgQv+NyLtPmFCrU2EdYHvNd8j/cnXnbnuv31LsgihZAC2ShO+4uxYhnF4YPSZu X-Received: by 2002:a17:903:25d5:b0:1ac:a661:a4bd with SMTP id jc21-20020a17090325d500b001aca661a4bdmr10944044plb.20.1683858200414; Thu, 11 May 2023 19:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683858200; cv=none; d=google.com; s=arc-20160816; b=u3ORTFBfG2Z1nELEpso6bVNkDlrnNJw0UJADMp9IuAbUvZvxWvBTu0pSSDxuqKGEYl wjFrfCX9aNmXwSvfOWVr9bdUyzMoHrv5l0ksqFPazkEYSCfnX8oUQEAXk564PmSFibtG 5tOJ+xaFEBREzXG/RjXm2KJDL7/RLWYCOQdt2qA50/T6bNaxODIevfOG6+yziFt6no+i b39LoxDMUvFyOM9MCIwnbXzY0MKqGrX7tf8LqE1g2eAROmMePwEv5TkVez/+siPz6nK0 hAgMRjMHKq8sHhy7KNavvtSW/B3ymY0C+bMuKI8BcWPHWsVHF2e1rYFl7P0iGvk+W6wg hrGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=k268/CPTFl1nHE3gNz6WaABtB2MSV6qC7WdFBYW5Wmc=; b=pBRxG1AWIcEhP/Jh+VpBLsEF7HoTl6ALFBI/Gs+Qtb8UHZo1wJdUYsnaj97RpzjG5P 3rjMfsd+CYsr05M3g/PM1VBuLEXqdSvkPuR0dAGo+OiqweWopuTytn3DJkXbx8XY+Vqr 4IG7ZREMdhUMuKnz2Eb//NPubhO/Bxinq0XVZgXDEJn3yMDaNP/47ejch48XYBaNbxm1 l/adLsMMY1b6Kr91/5wEcHL9EBu1uzO91DBNei98Jt8pAEK2QCfllyQJsJKniOtB/aW1 E6UkgMzSCnX6A1g1AM1tAc/PnMCpvB3UllPtr8ycJKkfNs0g1aBBh9arySSs47vk/eMt +bTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UmYMKTL+; 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=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v3-20020a170902b7c300b001a9b29b6758si7872093plz.511.2023.05.11.19.23.08; Thu, 11 May 2023 19:23:20 -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=@quicinc.com header.s=qcppdkim1 header.b=UmYMKTL+; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239682AbjELCGR (ORCPT + 99 others); Thu, 11 May 2023 22:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbjELCGP (ORCPT ); Thu, 11 May 2023 22:06:15 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 563321993; Thu, 11 May 2023 19:06:14 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34C1Q4Re024747; Fri, 12 May 2023 02:06:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id; s=qcppdkim1; bh=k268/CPTFl1nHE3gNz6WaABtB2MSV6qC7WdFBYW5Wmc=; b=UmYMKTL+J3O5MGdI8gcoN0D5NBD+BGCr5H5ovkiHYGwuHtaEEuqCSAWwgDQEo5rvYhnZ ku4sGLjbhpaR/Z+WbFCVq5R3SqNxx3ZitLKfxNRIyihtwEZKHS1tDm4h48Bnvx+Tq46d ammL9bJBk5FwLyoU6AMN/5YJNixbZWxnuFA4kJcYyurEUQNoxH4Bo4MyMR6K/ZcZvcJK ox6sBBkhUGYXlAplapUHHb7JH3dqSfmcBtbyYAcrFPFwvy1fNr3kRJA58CDXvrxBsF2E I63TMKmb4uZx2nsyK0ie3520k68wW4ane5SUXkg3bcuPLTvnVKZmytvaml7NlyoslBtK gA== Received: from aptaippmta01.qualcomm.com (tpe-colo-wan-fw-bordernet.qualcomm.com [103.229.16.4]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qgpfk2xs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 May 2023 02:06:03 +0000 Received: from pps.filterd (APTAIPPMTA01.qualcomm.com [127.0.0.1]) by APTAIPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 34C261xp015509; Fri, 12 May 2023 02:06:01 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APTAIPPMTA01.qualcomm.com (PPS) with ESMTP id 3qdfyku37s-1; Fri, 12 May 2023 02:06:01 +0000 Received: from APTAIPPMTA01.qualcomm.com (APTAIPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34C261sY015503; Fri, 12 May 2023 02:06:01 GMT Received: from cbsp-sh-gv.qualcomm.com (CBSP-SH-gv.ap.qualcomm.com [10.231.249.68]) by APTAIPPMTA01.qualcomm.com (PPS) with ESMTP id 34C2610O015476; Fri, 12 May 2023 02:06:01 +0000 Received: by cbsp-sh-gv.qualcomm.com (Postfix, from userid 4098150) id 550E94235; Fri, 12 May 2023 10:06:00 +0800 (CST) From: Qiang Yu To: mani@kernel.org, quic_jhugo@quicinc.com Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, quic_mrana@quicinc.com, Qiang Yu Subject: [PATCH v3] bus: mhi: host: Skip MHI reset if device is in RDDM Date: Fri, 12 May 2023 10:05:58 +0800 Message-Id: <1683857158-9804-1-git-send-email-quic_qianyu@quicinc.com> X-Mailer: git-send-email 2.7.4 X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: z8hE2GqBr6jpQ3gq92NqITSfmrwAOYkl X-Proofpoint-GUID: z8hE2GqBr6jpQ3gq92NqITSfmrwAOYkl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-11_19,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 mlxscore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305120017 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765653296460104924?= X-GMAIL-MSGID: =?utf-8?q?1765653296460104924?= In RDDM EE, device can not process MHI reset issued by host. In case of MHI power off, host is issuing MHI reset and polls for it to get cleared until it times out. Since this timeout can not be avoided in case of RDDM, skip the MHI reset in this scenarios. Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions") Signed-off-by: Qiang Yu Reviewed-by: Jeffrey Hugo --- v1->v2: use ~75 columns in commit text, add Fixes tag v2->v3: update Fixes tag drivers/bus/mhi/host/pm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c index 0834590..8a4362d 100644 --- a/drivers/bus/mhi/host/pm.c +++ b/drivers/bus/mhi/host/pm.c @@ -470,6 +470,10 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl) /* Trigger MHI RESET so that the device will not access host memory */ if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) { + /* Skip MHI RESET if in RDDM state */ + if (mhi_cntrl->rddm_image && mhi_get_exec_env(mhi_cntrl) == MHI_EE_RDDM) + goto skip_mhi_reset; + dev_dbg(dev, "Triggering MHI Reset in device\n"); mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET); @@ -495,6 +499,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl) } } +skip_mhi_reset: dev_dbg(dev, "Waiting for all pending event ring processing to complete\n"); mhi_event = mhi_cntrl->mhi_event;