Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1055462pxb; Fri, 21 Jan 2022 08:58:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiBXzEFnI+KcKJf0LGvicIYq7rtyND9tz4aWO/jxrc2WzlT2CEnch9ebMMgFzC4YvTn+TL X-Received: by 2002:a63:1053:: with SMTP id 19mr3552464pgq.478.1642784307924; Fri, 21 Jan 2022 08:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642784307; cv=none; d=google.com; s=arc-20160816; b=ZoTWTAWUEA3vhHIGJoVqmrh18mn/KJh4yatRPSpLK2yyGd8/6InZtffhtzCAtH99P2 rFFgZpVUNrHNIO/YkmIWb38UsrklhdzCmf/i9h8PvbXqoNNJNUAH/vWI3xX5HBCw2AkB 2m2KQLBvbNQNR6sOd6bhf5Vc4YDTz7ZFxO5XmY9ZZ5K0jzLPB51jk2WwkwZ4TNALq5T2 mVIGF7NY9ws+Iq1DUVn23LhDwZIDo+F0qTMNgcVYzFHUn8TyQ2/fcS/zw9sT/mkx6OBF tJueUpMeCkHj58BordjwblLG7ldWztziN5EucJrE/RJXCXbafYrfr7UqFG1hoU3E4GqD 832g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=8U2NSEHKCUQ9Z36JnWsd++SgPVSc/KZrscz58kGHWbs=; b=r3o1skj8KGa79ho5ofriv5aN73y1OuMS1RHjOEAp/9YVoeqsQ9ROTV4EUsJBNG+0lC 963h2a/D5AjaUReDK3iIxOZnsqKzeBke7T404PEQvfFDBW6IOvqP1LKuy0CXom6lRHy7 hh2Gze2S5DNNgbZk5VxfL3xOohUDiOLuC4E9t5moctE2JO7w30PhVt9EoR0Z2tUqFDDE N7ei1bqzGWICo5mQI6UjzByqzi1MnRB+JOHAupcyixBA7/fIqqH4qRKfpRUCIjoQocmG 2HKk6WAgMrsD+8htqWdNdeLhZS3Of2DKnxIk7mo+X5M38jOxCOVXMTv2ZleG7FfmAX2O ricA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IRSqYBoU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si7767904plg.418.2022.01.21.08.58.15; Fri, 21 Jan 2022 08:58:27 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=IRSqYBoU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351809AbiASGk2 (ORCPT + 99 others); Wed, 19 Jan 2022 01:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351814AbiASGkY (ORCPT ); Wed, 19 Jan 2022 01:40:24 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC58C06173E for ; Tue, 18 Jan 2022 22:40:24 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id z15-20020a25bb0f000000b00613388c7d99so3000413ybg.8 for ; Tue, 18 Jan 2022 22:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=8U2NSEHKCUQ9Z36JnWsd++SgPVSc/KZrscz58kGHWbs=; b=IRSqYBoUeD7Ry93C2zrCYgsanGN31qieUkxi0BeTfinOsX6JpBzwbaqcpcyFqxF53p 06IewAyfME4FVUIdzowKMLV3t2g/Cwb/7vvspipBtDa08Iq2QWPR35ESj7ELH41wavef 8AUmVblRGqkDAX2TFq7SOtmQlaT5Hsvio/ujx+P2MIaj9JP0mwvlOv1Hsopjv0wTZnBd VGwB36GqnKnDVk6CjP/cUFqA7xp8pkQDhQXzWGICjpLYnvPaL5vSsUai3jKXDlvUzrPV FbT5s9+u+NTQTFk17dRIYQgZ1P57mx2pT45LmKZs+TbWJ1/02J8BmNuIHY3duTLMgLWT tGDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=8U2NSEHKCUQ9Z36JnWsd++SgPVSc/KZrscz58kGHWbs=; b=QugUccD5+6qauvKcF/Dg5DIBLAsVBdf18WhqbGR7uk/KHUlMcjyRNdJ8WW2I0mb8Oh EmNHXEfOOzz+7n3i2PWz8haAHoyJHOlEYncFtesBb7t0TS8AxNtU1yKUJlEz5btcZyhz qjY36s/06DSmYqRRsgNhFEraN9uDJLLGWMHDN8O1sb9wLl2NW0qZUAdJuM1UQg9Wjs/1 s49x+Ct5ndA5SFVYWdoSw7/BTsuSJFxyrt/PRmZb0pQY9y26asxrdpI91xUt7dBRXGpE VqeWbcsCVMIlqrFkI89FcHBKrWdVvNUORcjzcTLOeT8UcjKfaZqE2ZMg8m0SZ/FNvlSw +Dcg== X-Gm-Message-State: AOAM5333kDDyUfR/sca0k1Caa2ohVuoRrYHxEtFcIxZd7VhcP4eljhww /jWrfXMAJT/Qzj5Sgvvb9FaCceIs7Qfi X-Received: from pumahsu.ntc.corp.google.com ([2401:fa00:fc:202:726e:776:90fe:956c]) (user=pumahsu job=sendgmr) by 2002:a25:b599:: with SMTP id q25mr17915493ybj.274.1642574423209; Tue, 18 Jan 2022 22:40:23 -0800 (PST) Date: Wed, 19 Jan 2022 14:40:13 +0800 Message-Id: <20220119064013.1381172-1-pumahsu@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog Subject: [PATCH v5] xhci: re-initialize the HC during resume if HCE was set From: Puma Hsu To: mathias.nyman@intel.com, gregkh@linuxfoundation.org Cc: s.shtylyov@omp.ru, albertccwang@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Puma Hsu , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When HCE(Host Controller Error) is set, it means an internal error condition has been detected. Software needs to re-initialize the HC, so add this check in xhci resume. Cc: stable@vger.kernel.org Signed-off-by: Puma Hsu --- v2: Follow Sergey Shtylyov 's comment. v3: Add stable@vger.kernel.org for stable release. v4: Refine the commit message. v5: Add a debug log. Follow Mathias Nyman 's comment. drivers/usb/host/xhci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index dc357cabb265..41f594f0f73f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1146,8 +1146,10 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) temp = readl(&xhci->op_regs->status); } - /* If restore operation fails, re-initialize the HC during resume */ - if ((temp & STS_SRE) || hibernated) { + /* If restore operation fails or HC error is detected, re-initialize the HC during resume */ + if ((temp & (STS_SRE | STS_HCE)) || hibernated) { + xhci_warn(xhci, "re-initialize HC during resume, USBSTS:%s\n", + xhci_decode_usbsts(str, temp)); if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !(xhci_all_ports_seen_u0(xhci))) { -- 2.34.1.703.g22d0c6ccf7-goog