Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6013545pxb; Mon, 14 Feb 2022 13:08:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxXUzdxtUC96X+xU2yMmr3Oh1mNWbaiXhtpSE8ny8PXOT9wYZProC1fl27YLArbL8C/40r X-Received: by 2002:a17:903:228e:: with SMTP id b14mr735983plh.38.1644872914147; Mon, 14 Feb 2022 13:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644872914; cv=none; d=google.com; s=arc-20160816; b=0vCrj/sbHMMwEg8RKv1jTgTQrLJCr5+UdU8asci/wxq3jxH516uGUz5568ETbTOLyq ukZlKw/uE73n1jn/eKU8cOJlfey8ela3k8peQx4fK5h9p25CNhrQCZ+yB2atTtGFXVbB caEQX4GwQdc841455HR0dsHQbY1NnyKR7g9vjD9IuQVkGPHsBVRSUiClW0pZGzINajOL 6vWB1wI8pHbbg7liKjlzEyydRZ1qVKIxk6CyZT7YB9p9IOkndo0L8wvMld/AyCXecYhj xYQiHfjQMwbr+KRfiDEwzinBFYncoisnbhVl8A229TwkL6TCljNUZfr8qZ006UFTEVvz ITpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MW9gwIUptsYLqIzS86VeUTXVM3BIYMlecniPn+jF7iU=; b=m7pk2UYspKJsivD+860POhhjtxtGP3gYeuMYIL8zxctOK4/nuMHqihi1Ej2aS51z+F nnXQkjJ8TXpm3VM7CUPW8RLJUovyIEz7NEX5ITYV+sxAm5bAdJnyTj5eVq6yv91kfoye CqkownDJdDhoKXjWglGFw3DHrJFkCrf5V75Kj5frgGXc8kMoKDByQxzh5HqDSUc+Da7G dvu0I5Oz8utgrlnC+S0eR4IBRel/EkWYJDW6X+akH006M3e9bmSuFQNZowbY0FuQ5Jga 9IUMvklofqlI/l8b7AkR1ly1mY+dhOUX9gS4S8EvZDYqR74fyp+VqRrzqswdFJCV8co7 3NiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=IhyHrgbN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w27si3599355pfj.235.2022.02.14.13.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:08:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=IhyHrgbN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A9D7B1928F1; Mon, 14 Feb 2022 12:28:51 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353084AbiBNMVG (ORCPT + 99 others); Mon, 14 Feb 2022 07:21:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242410AbiBNMVF (ORCPT ); Mon, 14 Feb 2022 07:21:05 -0500 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C834926D; Mon, 14 Feb 2022 04:20:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1644841258; x=1676377258; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=MW9gwIUptsYLqIzS86VeUTXVM3BIYMlecniPn+jF7iU=; b=IhyHrgbNd+6q3h9SB71owo7p7xlks/JUpnQKi+xdAPaTia/wR3LrLoRU ViUq3eGTbaCS5xICTMz3DMsi85YFRQTktbVvaSGnXjWTB4VVsty+hn0Wh isQD0tZhmNVAD5e6KYHeaIIkqrpcdkfMboRiJHiZkxb2cZEiNqVu5Uy/v E=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 14 Feb 2022 04:20:57 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2022 04:20:56 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Mon, 14 Feb 2022 04:20:56 -0800 Received: from quicinc.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Mon, 14 Feb 2022 04:20:53 -0800 From: Pavankumar Kondeti To: Greg Kroah-Hartman , Mathias Nyman CC: , , , Jung Daehwan , Pavankumar Kondeti Subject: [PATCH v2] xhci: reduce xhci_handshake timeout in xhci_reset Date: Mon, 14 Feb 2022 17:50:16 +0530 Message-ID: <1644841216-1468-1-git-send-email-quic_pkondeti@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1644836663-29220-1-git-send-email-quic_pkondeti@quicinc.com> References: <1644836663-29220-1-git-send-email-quic_pkondeti@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Daehwan Jung xhci_reset() is called with interrupts disabled. Waiting 10 seconds for controller reset and controller ready operations can be fatal to the system when controller is timed out. Reduce the timeout to 1 second and print a error message when the time out happens. Fixes: 22ceac191211 ("xhci: Increase reset timeout for Renesas 720201 host.") Signed-off-by: Daehwan Jung Signed-off-by: Pavankumar Kondeti --- v2: - Add error print statements in the code that change log refers to drivers/usb/host/xhci.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index dc357ca..bb9ea3f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -196,9 +196,11 @@ int xhci_reset(struct xhci_hcd *xhci) udelay(1000); ret = xhci_handshake(&xhci->op_regs->command, - CMD_RESET, 0, 10 * 1000 * 1000); - if (ret) + CMD_RESET, 0, 1 * 1000 * 1000); + if (ret) { + xhci_err(xhci, "Host controller reset timed out\n"); return ret; + } if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL) usb_asmedia_modifyflowcontrol(to_pci_dev(xhci_to_hcd(xhci)->self.controller)); @@ -210,7 +212,11 @@ int xhci_reset(struct xhci_hcd *xhci) * than status until the "Controller Not Ready" flag is cleared. */ ret = xhci_handshake(&xhci->op_regs->status, - STS_CNR, 0, 10 * 1000 * 1000); + STS_CNR, 0, 1 * 1000 * 1000); + if (ret) { + xhci_err(xhci, "Host controller is not ready within timeout\n"); + return ret; + } xhci->usb2_rhub.bus_state.port_c_suspend = 0; xhci->usb2_rhub.bus_state.suspended_ports = 0; -- 2.7.4