From patchwork Tue May 23 01:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 97692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1843669vqo; Mon, 22 May 2023 19:20:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4s/AeWF1n+eLlPUjPcZ5zIBpjvrHqGwsLRBSygwJI56O7VtKrNwEKeDiuSnwuuVkXj+n5N X-Received: by 2002:a17:902:778c:b0:1a6:81fc:b585 with SMTP id o12-20020a170902778c00b001a681fcb585mr10497990pll.41.1684808423323; Mon, 22 May 2023 19:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684808423; cv=none; d=google.com; s=arc-20160816; b=OZw9zIH2L8oPMqcWH5HBs57Xr6SoiWgQKvmCL3NYs5eKGOK8KzotA4HzKnqS329bBG CnRaWB6aOlsJHS6NEclwyZMsgVQDmA5qCCqS/jbX6zf+daG0fFjJxTVa4hdrf8hUBvCw x87IoR6ZALwaX+ujs2jPPcPWg5pYk7JZSWOQkidw5Aed+8MsQ67iUfhFyvV+YV69OKYW DX4XMfDFDWLDI7GrkeiuwjtOk9rZhFogwTpQ3YqA7BMStO0UcErAOxWp+0Y+Npak7q1N bUKVdKUBL0ox3hZQ6yr/9w1nrckGcpS/4oqc4l+0mwy42TWTSD96/Vn5Z2OTDkXB/KCm SQZQ== 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=Ey1EgpRgqfCZ7fGWleenHSbfL9l+8KmN7osRXKIPyJg=; b=OSPEa1cT4ySe8wD9/kIZIaS3O56fiXSE59sN9kx3uQ+I9lTcl7Wc9OBbJlwDtc3vUa DOSNo9sNTYOp6M3PqrlPeldEDyD9nWX9GwXuitWVToBoZikW7q1tKKtEWGSiqdIyWBOZ ODIE5fhSYZt+7Nmg9CZ/Zema2/weWRCBxOY7UvYeeypKoUICp2B634mU/QYH0umfcuAg m7E+7ymEi/SM4NMDeQaAGb753yCRmfXZxCVaKFEfi+sPpElcNhi4FvsowNfU28GuUclv UW0scRYAte93h4Sr8bIy2UioDTwsoNUy896GCKsZOM5FhZV3p5tBl1dgt2fCteszt1K+ eUIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=S6VULAJB; 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 a10-20020a170902ee8a00b001ac75cbde64si822020pld.622.2023.05.22.19.20.10; Mon, 22 May 2023 19:20:23 -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=S6VULAJB; 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 S232034AbjEWByd (ORCPT + 99 others); Mon, 22 May 2023 21:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjEWByc (ORCPT ); Mon, 22 May 2023 21:54:32 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9D9CD; Mon, 22 May 2023 18:54:30 -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 34N1d4k4006465; Tue, 23 May 2023 01:54:09 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=Ey1EgpRgqfCZ7fGWleenHSbfL9l+8KmN7osRXKIPyJg=; b=S6VULAJBPkZ42Amca48Qgg+rsB6ntNLA4mwDHLax5ljf2BA0dvB8N4hgOqyIkrFFnc7y ZSVJep35nWNblQqOqUc5ccYf8F3SXDywd/xKiWmpIC+puq83HewD7IfiZx8hqzJi1OkU c28FeQDR7tDTOBWriUaRfAskpBCyRq/Ntuy8eJChUsFkDBtRAnhF21ffGyB35NSakarm OTX2vDwEz1Hn+DMhZOMKCd/LKA9tU3w+bmysPy+6fErnHSqJ1eUbB5PRp8VWOFh/6U/K h0PCwGx+qpNnbfeKvpy/6e8OdiZiq2OKhqPNsnWt62Pc1bldem7JiOeyJalhEXrwBa56 2A== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qr8qr9c8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 May 2023 01:54:09 +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 34N1s8TD022919 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 May 2023 01:54:08 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; Mon, 22 May 2023 18:54:07 -0700 From: Wesley Cheng To: , CC: , , , Wesley Cheng Subject: [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed Date: Mon, 22 May 2023 18:53:54 -0700 Message-ID: <20230523015354.18497-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: nalasex01b.na.qualcomm.com (10.47.209.197) 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-GUID: JTnW8ZfG2c997hCDnqM-rPUD2oo_iEG4 X-Proofpoint-ORIG-GUID: JTnW8ZfG2c997hCDnqM-rPUD2oo_iEG4 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-22_18,2023-05-22_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1011 mlxlogscore=722 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305230013 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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?1766649677113675299?= X-GMAIL-MSGID: =?utf-8?q?1766649677113675299?= 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..2017ed3ae4a7 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);