Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp881182pxb; Wed, 6 Apr 2022 03:05:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgHWuIywxnogZcRe4+77fH7YART4VwE1XzNjViiK50bHfNZ5Tn2O05jeZuaHu7VEcezDKI X-Received: by 2002:a17:902:a710:b0:156:5650:f94a with SMTP id w16-20020a170902a71000b001565650f94amr7675945plq.86.1649239530072; Wed, 06 Apr 2022 03:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649239530; cv=none; d=google.com; s=arc-20160816; b=tXnGwOiocf5deIPr3Q+5YyWDdA4L0KG/hCNJ+eICxnvFKNQiXeDbdM4zr/oy7BFDkW 5lFJ4h3eDhd4qsTCXma9y7pGWuQQi63xHEMPj2OCQ0uuT72E3dmbZfIYOl2cVWCOxwVM 3Tcl3a+tQNsFYpeeHx16v8kRpN6KU71ugBqqm3zyktHLGhYK6SDbvU9JkgrPIV6PuFXS P6ndOPvYFK0+sqz6aJdCF6LmKLfiKv/L33RYMPpc/o/53liqX2rn+JLDViOfVYjS0RDE zw8qARfiMraTHum8GOlhHlvOhUUpbSMRaI8XU/Fx16jTqs8Bxw78BTJP4l2VtSQ6o8kc Dkag== 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=mjUkI9TJ17Trihq5eaBoI1n5PGH67EOFboAT9kKaqkc=; b=cmUDItG2Y1X9yw1FeXsExlGAQPjV1HMfgb4uoknFJDOIR5Lm18wb5p12BgaJiRTez6 8sYP4fPfmyd16jzsbtB/31VSziiDCK9ed87Xt7NM6cmnjoVr1eO4couLbWggaQCu+OYu AIq6vtB3K+INU+HhZtKV7UHzuKWRlEwBYQhiAve4WXETDClgPrhlrwdsKxzXHMo13yfZ TTbpk6754IihKNudF5Ew7s68vxlxTjyICnZJ311BfkQrgA1vZw7vidlWeRsYLtfXb0Qb fuSqKYkm/7Q5pAo8tcWERSsOdjZ06WjhJ01hLN40jTnuUxLH69ttWynFK3X7gfsKtWVx ixWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XMsqnVXG; 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=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z16-20020a1709028f9000b00154abdc081csi13847947plo.192.2022.04.06.03.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:05:30 -0700 (PDT) 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=@intel.com header.s=Intel header.b=XMsqnVXG; 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=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C0EC413A99; Wed, 6 Apr 2022 01:24:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232417AbiDEXxn (ORCPT + 99 others); Tue, 5 Apr 2022 19:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455462AbiDEQAD (ORCPT ); Tue, 5 Apr 2022 12:00:03 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03D3C57485; Tue, 5 Apr 2022 08:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649171743; x=1680707743; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=3lIdhrvOWJSsLIjp6xNITFKNThnKqW6h1bviJyyMAjg=; b=XMsqnVXGGgjbW6EuHpdbyhCpKFuITO/nxpf3iEkNb6e+6NDE80pQECpw cZNO8EQGS6nPdT6oyYasZBtkuvRn2bYm/CaRVb0lHu2t/tM11hg5UoFSx 5UESQwr7rZnaXioNiarXLzKpcwkUINi569qkSGNha9xtXL7Ry2BSOt5Ps qFVlu3cdSRQrUj5Q5iI6eGRmBm/OBbKQHAt4xRpTDGmq+aTx9NU+dBSm1 CLh722SWKlXDr2PK+YgW53l4ASy2tQ/vr5Y1pveszMYif/8jzHOQWxlJW wRtjkHqA3FbWSTU9isMETkTGZawc1SYlVqGLVaUpTS7oGEwM5INF/n9N7 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10307"; a="260765093" X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="260765093" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 08:13:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="657974108" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.199]) ([10.237.72.199]) by orsmga004.jf.intel.com with ESMTP; 05 Apr 2022 08:13:39 -0700 Subject: Re: [PATCH] xhci: stop polling roothubs after shutdown To: Henry Lin , Mathias Nyman Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220401115916.104527-1-henryl@nvidia.com> From: Mathias Nyman Message-ID: Date: Tue, 5 Apr 2022 18:15:31 +0300 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: <20220401115916.104527-1-henryl@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 1.4.2022 14.59, Henry Lin wrote: > While rebooting, XHCI controller and its bus device will be shut down > in order by .shutdown callback. Stopping roothubs polling in > xhci_shutdown() can prevent XHCI driver from accessing port status > after its bus device shutdown. > > Take PCIe XHCI controller as example, if XHCI driver doesn't stop roothubs > polling, XHCI driver may access PCIe BAR register for port status after > parent PCIe root port driver is shutdown and cause PCIe bus error. > > Signed-off-by: Henry Lin > --- > drivers/usb/host/xhci.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index 2d378543bc3a..e7ae6766220e 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c > @@ -780,6 +780,14 @@ void xhci_shutdown(struct usb_hcd *hcd) > if (xhci->quirks & XHCI_SPURIOUS_REBOOT) > usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); > > + /* Don't poll the roothubs after shutdown. */ > + xhci_dbg(xhci, "%s: stopping usb%d port polling.\n", > + __func__, hcd->self.busnum); > + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); > + del_timer_sync(&hcd->rh_timer); > + clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); > + del_timer_sync(&xhci->shared_hcd->rh_timer); > + > spin_lock_irq(&xhci->lock); > xhci_halt(xhci); > /* Workaround for spurious wakeups at shutdown with HSW */ > Thanks, adding to queue -Mathias