Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3448006iob; Sat, 7 May 2022 05:31:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIAafJ+t2tGJ9m+paPCJQbG7rkyRw/d47K77aHwo6ToNE6pl1bcGy+5P/y6jH/EfPuw0yD X-Received: by 2002:a17:902:dacf:b0:15e:baec:a6de with SMTP id q15-20020a170902dacf00b0015ebaeca6demr8331105plx.32.1651926713390; Sat, 07 May 2022 05:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651926713; cv=none; d=google.com; s=arc-20160816; b=ro/Nace+8RL8d22pa0pZy87INPWTxUghNpqm4Tq3MEbiux9K70bQHpYYYjmleJBi+Q o9/L/vkmlMxKybQmG74B9vJqL7AXUV/dbrmZQTM9gygMEMlbpihSt80Qf/5Dp9B33Fdx 8kt0elXUgbqeZpfkjr+4665VjV4t+reowACzNv/9cVmGY85iO+2XRO1Drc6YTqkL2rJV ATvfP39IhIwm04SOjIEvMLgYBouQioUeaxOkNnKgUjQ/9klA5IjO79gkniMlbrbthndn CbwgW/lAEeIUcctR+HxTLVrYu8b6lgd9CgEuo1vvT3C/dliskBKEvk3MOsxnFFP1uTzk qa8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X2WG4tD5hBpL6FDEgH0jo9u1E+YIMJ8B6QvKvyOeoes=; b=0w0xMrjdG36hecb1kzGnXF7C2oEZ4+8dnyE8CZp5bw3CmG4A7NI5Gs0DJObqc83P3h jgk5erw372cV9vrG1dX7uqqpeXdOadnRS+5DQPxvMHrkg/QdqhekGt5YKS/GFAUuyRjj tmigBEm14RNc1Cx3DQbXGXJ4/ea15HDp2/WRGY28kRI0iqFEhGApBJBhvSyamc3yDvdz n+qPNTqB/ILtTEhNV1T8trOfXKBmmbM5teaGvHU6KaoM98mK+LdN9/U1d6Q2lRPt+NgL ZIZqmUVwsNHJkKrtFrw3HWULPX2pycIbm/UJCmjkP8QMLx8FT21/QkV91v2HGF5T7SZH PHDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xrDHOrKm; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a170902d50f00b00158da867027si5604130plg.624.2022.05.07.05.31.38; Sat, 07 May 2022 05:31:53 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=xrDHOrKm; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356498AbiEDRNt (ORCPT + 99 others); Wed, 4 May 2022 13:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348684AbiEDRDB (ORCPT ); Wed, 4 May 2022 13:03:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C65004D9C0; Wed, 4 May 2022 09:52:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40A65B82552; Wed, 4 May 2022 16:52:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C5EC385A5; Wed, 4 May 2022 16:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683153; bh=syvbfAMOEbim3F1NblPad85qNNOn39u3qZiZAyUDIdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xrDHOrKmhNfcs6GQ3jbAyzJP8ptitBYYkgEdfwlcjbuz6VwmLQ1juMnOGQx9FUt7y 7gMfyRYivN9z222k/grnACitmuxLhO2w7TsmeELcxHARg75d2kBn0FUQas4ls1jyES fmE/nYXCVoN7ka3vj6M/VTDWkaw0VlFZDKwHJ0QY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Henry Lin , Mathias Nyman Subject: [PATCH 5.15 010/177] xhci: stop polling roothubs after shutdown Date: Wed, 4 May 2022 18:43:23 +0200 Message-Id: <20220504153054.499542356@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Henry Lin commit dc92944a014cd6a6f6c94299aaa36164dd2c238a upstream. 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. [check shared hcd exist before stopping its roothub polling -Mathias] Cc: stable@vger.kernel.org Signed-off-by: Henry Lin Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220408134823.2527272-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -778,6 +778,17 @@ 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); + + if (xhci->shared_hcd) { + 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 */