Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3362193pxu; Tue, 15 Dec 2020 05:23:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQFfv2kMnvYnm61hTB196TPFwMh39MEMAxQ6NxseIjRotiM3YReFMm8YKYNqn/7lsicWFC X-Received: by 2002:a50:8e0e:: with SMTP id 14mr13848365edw.171.1608038620414; Tue, 15 Dec 2020 05:23:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608038620; cv=none; d=google.com; s=arc-20160816; b=L9CmD6E0OTTfAMdWmT2uo8f+KjLzqbq1UGII0LvsNKujZWX0pKsrPIiWUW4EphZSsb gHjW3GPxNSHl9TkuIkrqee0PVB1yNtF8WPzVVYmFeANXkzoUg3Bq/BNdhVnMxRGua5Ng 7xvYg36y2K2PDo7WLuOtV4ls91QXbpBgVYJAq3NGPZgU15sye5H8cYigTO9DAr8iQW9l 4TtF3++/OBFF7LjQ7yxOtvtDN68WRpwD/L31V29Ou0nFab5YhYjdWXt+UuJI3tuVkTFj Ohhl/jlmXwVigHLtw6cBhZjOoV6V4iCatMIPZZLtXZ2QH4/Muh30n0cJMg3yr+TYM5PB QJFA== 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:ironport-sdr :ironport-sdr; bh=MiVtXcihvFziDg/F6F9FGs+4wbHocQcTiu3Y0uf+mn8=; b=q80ukUI6MJB+mCP8eGhcNpWbLR/fiTGdtHUEJEL0+Y7QONnxOi6+RGICIPjYtE7Kev DlL1BkvI+vnMfoDMs9NqYYpot6Rj/dm5dnB/crv/9ceGvsc7BGVg5CDOp3ggNu8KlJZk Acxyk/LfAz8x98h6wTtsdesH67X7mGfFMMuVMUmQR6D26KNWht6T+JAnbVBgYZZvGi9u R4byWjIb2RkphJoBQmtJ8Tn92bscaPgc3Rjfya+/2ImSot7+5OMz2RgjAHYtyg6T49Ei 60/asFwp0VNidfoSyebcE8g0EGuHg84CvMBhAS9DdMoL355m+dK5fOC5ql/KncDNZT75 Se/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si793807edw.476.2020.12.15.05.23.17; Tue, 15 Dec 2020 05:23:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727282AbgLONVG (ORCPT + 99 others); Tue, 15 Dec 2020 08:21:06 -0500 Received: from mga03.intel.com ([134.134.136.65]:21857 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726431AbgLONVD (ORCPT ); Tue, 15 Dec 2020 08:21:03 -0500 IronPort-SDR: PQrBzB5z7mlpB+e/YBxznJFyZ3krR+/9Aj01hmEXoJTOUXX4bHpx6Hf76/gPNi6XEmi9Zj63BJ MIjDFg3glqHA== X-IronPort-AV: E=McAfee;i="6000,8403,9835"; a="174983530" X-IronPort-AV: E=Sophos;i="5.78,421,1599548400"; d="scan'208";a="174983530" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2020 05:20:20 -0800 IronPort-SDR: dBtNgZkVJFbGNgvyaqbW9BHLS7xzgSLyrRvZT9PTD25l132ycU4QQLAFqmxkhgOSPtEFYRedUr qGHUfjMKw0GA== X-IronPort-AV: E=Sophos;i="5.78,421,1599548400"; d="scan'208";a="368214715" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2020 05:20:16 -0800 From: Chen Yu To: Mathias Nyman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Muchowski, MaciejX" , "Paczynski, Lukasz" , Chen Yu Subject: [PATCH] xhci: Introduce max wait timeout in xhci_handshake() Date: Tue, 15 Dec 2020 21:22:40 +0800 Message-Id: <20201215132240.4094-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The time to finish a xhci_handshake() is platform specific and sometimes during suspend resume test the followng errors were encountered: [53455.418330] ACPI: Waking up from system sleep state S4 [66838.490856] xhci_hcd 0000:00:14.0: xHCI dying, ignoring interrupt. Shouldn't IRQs be disabled? After changing the poll time granularity from 1 usec to 20 usec in xhci_handshake() this issue was not reproduced. While tuning on the poll time granularity might be painful on different platforms, it is applicable to introduce a module parameter to allow the xhci driver to wait for at max 16 ms. Reported-by: "Muchowski, MaciejX" Signed-off-by: Chen Yu --- drivers/usb/host/xhci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d4a8d0efbbc4..b8be9f3cc987 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -38,6 +38,10 @@ static unsigned long long quirks; module_param(quirks, ullong, S_IRUGO); MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); +static int wait_handshake; +module_param(wait_handshake, int, 0644); +MODULE_PARM_DESC(wait_handshake, "Force wait for completion of handshake"); + static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) { struct xhci_segment *seg = ring->first_seg; @@ -74,7 +78,7 @@ int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) ret = readl_poll_timeout_atomic(ptr, result, (result & mask) == done || result == U32_MAX, - 1, usec); + 1, wait_handshake ? XHCI_MAX_HALT_USEC : usec); if (result == U32_MAX) /* card removed */ return -ENODEV; -- 2.17.1