From patchwork Thu May 25 17:51:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 99148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp556761vqr; Thu, 25 May 2023 11:03:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5p0uT1P0irkz6VMatyHVHao/Nm1Puawyiys0Y1vbqWoyOwhA0JyeHnjPH+BD/AM1pyHQHJ X-Received: by 2002:a05:6a20:a126:b0:10c:c407:92e5 with SMTP id q38-20020a056a20a12600b0010cc40792e5mr10638481pzk.22.1685037813146; Thu, 25 May 2023 11:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685037813; cv=none; d=google.com; s=arc-20160816; b=tSiXU2EfLkwOMOKIZ7sGU2twn55bhWYOwD4gt69xhyAE4J4R6Vd+nItFexV1A2Z2e8 JuckB9fziF9AUZvtlUouGT0n2WYGkFg6/vJlpDo/mdKU6mK8GjlRAGao8EM9jnfSTZNI iCbpWukrLbPuNJVPiV0/5K10Be8SGf2sUEaldmaR+k6B2QzFcwE/0MfX0fz150uBFsYC B6MIkGbkSeMtfXIf3uBQt8tvIIF/ww66qE3PpILvFdsMc1eSa1Tso657OhucYbdoy8CS /UH7WyJdaVXwSggGyRAnGN49HswGsDqStqhm6ugeyx6ypfIjt/r0UAmlLFsZhDJiHa66 voBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=XYphsjpFQZ8qoW0HxD5fU0fwEGPiJV9LRkSsjbqnP9k=; b=f0CqcUEsjDbkiKehc20rSz6mxjpZdr/r5RyYna9ejn3dTk2s7ImbNBWS5ikwaaSTfR cDSPF6RyX6e3bJmaGqNxid2YLOGCqymqdhvdEkRNfV/CCZAgKO8TfS54SJTUZQJgDOFQ 4G4uxJtwlSM2uaGyDckktGfJ9B6kFKS1JwyMN4gL5ZD1MlPd/t4E5BvaCD48f1zyBIiu OISAREVSxKNBn+WL3+JYvezwEGIuF3w/sVWix0i5Tw4f1SNdrHbQWL1zYtFuI5xeAaVe KyDUI0lAALildlDFPkWepoYAd1gFL1ocLRE3eZIlTQCzacPnilPtl6uOV5xum3PYaP0O gYUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GaEeyjzs; 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 r3-20020a632b03000000b005342409bdcasi1574049pgr.723.2023.05.25.11.03.20; Thu, 25 May 2023 11:03:33 -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=GaEeyjzs; 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 S233944AbjEYRve (ORCPT + 99 others); Thu, 25 May 2023 13:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjEYRvc (ORCPT ); Thu, 25 May 2023 13:51:32 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF10B6; Thu, 25 May 2023 10:51:31 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34PFAZhA013006; Thu, 25 May 2023 17:51:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=XYphsjpFQZ8qoW0HxD5fU0fwEGPiJV9LRkSsjbqnP9k=; b=GaEeyjzs6puh5Yx5kX6VrUsch3+XCch8JrpnvjV9zkj3gPnTCiCkpT7NEczCfu32uXwt APSEVBqA829LkpIDnfmBg37hZ2cpGbxe059a4y7ume28fJwG7SOpQ8hAnT41jGmxiWZJ OCRxFvVBg24kgTJrbA+EB59u/XcA21DABtC74q+IrWyy/r9uQOY4wFFjbBAsLqG50+BC rDdZqYyoFQYUini/TVuKP7FgbWrMiGV1Y9Hz0+Sa2YV5iMhLcB8I87cuy81Oh2KUDWp7 vXF/rSs0RTsce7gZKPT3kb0CSQVsBI86mpOJa2S/0IR8TmqKwhkXPxswKjAIh6zMUMse vQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qsqgytprr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 17:51:27 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34PHpHId022223 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 17:51:17 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Thu, 25 May 2023 10:51:17 -0700 From: Wesley Cheng To: , CC: , , , Wesley Cheng Subject: [PATCH v2] usb: host: xhci: Do not re-initialize the XHCI HC if being removed Date: Thu, 25 May 2023 10:51:02 -0700 Message-ID: <20230525175102.22887-1-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: _Qf6dyDIvSF3Hhrte1nPrB-j0w3MzGD2 X-Proofpoint-GUID: _Qf6dyDIvSF3Hhrte1nPrB-j0w3MzGD2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_09,2023-05-25_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 malwarescore=0 impostorscore=0 mlxscore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 bulkscore=0 mlxlogscore=708 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305250149 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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?1766890209663325265?= X-GMAIL-MSGID: =?utf-8?q?1766890209663325265?= During XHCI resume, if there was a host controller error detected the routine will attempt to re-initialize the XHCI HC, so that it can return back to an operational state. If the XHCI host controller is being removed, this sequence would be already handled within the XHCI halt path, leading to a duplicate set of reg ops/calls. In addition, since the XHCI bus is being removed, the overhead added in restarting the HCD is unnecessary. Check for the XHC state before setting the reinit_xhc parameter, which is responsible for triggering the restart. Signed-off-by: Wesley Cheng --- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b81313ffeb76..02a30b883bde 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1028,7 +1028,8 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg) temp = readl(&xhci->op_regs->status); /* re-initialize the HC on Restore Error, or Host Controller Error */ - if (temp & (STS_SRE | STS_HCE)) { + if ((temp & (STS_SRE | STS_HCE)) && + !(xhci->xhc_state & XHCI_STATE_REMOVING)) { reinit_xhc = true; if (!xhci->broken_suspend) xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);