Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2814400pxb; Thu, 10 Feb 2022 06:14:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZsG7HBbVt9htTMnkudv5U5oJ4ncVNzaGUcHlTemrv6Hwd9yTmFf7nXtCxgVbHHiCAseqh X-Received: by 2002:a17:907:3f0d:: with SMTP id hq13mr6653753ejc.358.1644502444139; Thu, 10 Feb 2022 06:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644502444; cv=none; d=google.com; s=arc-20160816; b=jhxLeLkeLIJ1tyQJnqwoXc4qE33m9YziyVPDL0V5w3+jzRTwRf44G+wJBSD+N/XWy6 j0JCPQhAWXk7uA0Eg9S8PIo6fFNFRtIihDOlKLGxLJAHqm7NBkI1jrRSqjdOadsh/zNe 7pgBj28bpkgfQHys16iI86Gx2S7al9oUuPa9EvDN940Kqs0hFp/UOzlzD9M1nXpJKs09 rMxNtKworOOkDqnzK8QecS1TZo6L95hU1eQ44g+FF0t8sjRsFOQT9j6Ki0PqijhV4Dzw SpTOMQjd8K6bL6nofqXMxHyvkBCDSXdCDs1w1Q5/8Z/H4SbC2mo8A0rPpmUZWbvGT/2c PMSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=FgTW6HoxtC5QWqkktoA16bjpi0GdoEkJMfcAUxhdAkY=; b=R4QCGzEP747t4VaJm4dnyNwEv+8DU5Y/8Wj3uWWlkA4BNhl5KrUoyCpNdxqHahkjfZ t9KgIsimahBzvo1TW2w2A+oUGS68jklhmuU2jCtz1VgeIsjMbKAiaXzO+SzAK2CL2ogF nhn1PshuQw5xsfdLL3LqXOq6hUHhxWbpBKH6YxMvxLwISK65o7BHwcQjFICbVavQFUBG OjbZ8pnRgh9bJGg4/wLj/gHuNWUm8wl0eTHBUSG4g7MNpvsPn/eTQo20FfERJVVCvUfG FSaeVgazEqe5iMfeLdVvTDpJPHPPf53jxP0RVoSfy9yLOe0uwOK+OKkKRd6SEVajm9Yw B/ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hsk4vnZB; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr11si3938075ejc.237.2022.02.10.06.13.38; Thu, 10 Feb 2022 06:14:04 -0800 (PST) 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=@intel.com header.s=Intel header.b=Hsk4vnZB; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240559AbiBJLIQ (ORCPT + 99 others); Thu, 10 Feb 2022 06:08:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240561AbiBJLIO (ORCPT ); Thu, 10 Feb 2022 06:08:14 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A301B78; Thu, 10 Feb 2022 03:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644491295; x=1676027295; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=P0TWt16Fd1z8nwCSFNxZK6KaUzghbPYOvC3LHm0T8yE=; b=Hsk4vnZBgjdFizdFnClUA57o7+Lr06IGqG6+NygcEBZ+mK86KhBFT1+B pmQjn3APxdyupI6VpEaj/Sb3kcRDIqj3239IQE+TvL2F9cw/gznUWlVQL VVoBF4VMkpqNYgHPSra8TzW4hXO8FLiY0TsfPBElmxjnNShl0eavm9sHU l7zIToGlenvsOEWQO9TuBXtk1KbjvDA10biMuO15PmwCRdOW8F1aEnO86 FvN1jpKyMcIvn//ffNYkGLCzYTk1frmkFejlW6tKtSgdHihls6+Y0yuUv U1Imnn+zLGF5LZ3PWvD9+YYfYTs4pICRsvZLuuCPMI8GjuVt5aqPuz7VN Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10253"; a="249673732" X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="249673732" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 03:08:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,358,1635231600"; d="scan'208";a="568615790" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.199]) ([10.237.72.199]) by orsmga001.jf.intel.com with ESMTP; 10 Feb 2022 03:08:12 -0800 Subject: Re: [PATCH v6] xhci: re-initialize the HC during resume if HCE was set To: Puma Hsu Cc: mathias.nyman@intel.com, Greg KH , Sergey Shtylyov , Albert Wang , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20220129093036.488231-1-pumahsu@google.com> <413ce7e5-1c35-c3d0-a89e-a3c7f03b4db7@linux.intel.com> From: Mathias Nyman Message-ID: <86bd1bef-2f07-8dee-a125-be208903204e@linux.intel.com> Date: Thu, 10 Feb 2022 13:09:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 8.2.2022 9.11, Puma Hsu wrote: > On Thu, Feb 3, 2022 at 3:11 AM Mathias Nyman > wrote: >> >> On 29.1.2022 11.30, Puma Hsu wrote: >>> 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. >>> v6: Fix the missing declaration for str. >>> >>> drivers/usb/host/xhci.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c >>> index dc357cabb265..6f1198068004 100644 >>> --- a/drivers/usb/host/xhci.c >>> +++ b/drivers/usb/host/xhci.c >>> @@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) >>> int retval = 0; >>> bool comp_timer_running = false; >>> bool pending_portevent = false; >>> + char str[XHCI_MSG_MAX]; >>> >>> if (!hcd->state) >>> return 0; >>> @@ -1146,8 +1147,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))) { >>> >> >> Ended up modifying this patch a bit more than I first intended, >> - don't print warning in hibernation case, only error. >> - maybe using a lot of stack for a debug string isn't really needed. >> - make sure we read the usbsts register before checking for the HCE bit. >> >> Does the below work for you? If yes, and you agree I'll apply it instead > > Hi Mathias, > Yes, your patch works for me, thanks! > Will you submit a new patch? or should I update to a new version? > Thanks. I'll submit it Thanks -Mathias