Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4732642iob; Sun, 8 May 2022 23:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSGi3xiHDIlDYVwat/B2jZcfjyXe9cl+dedbr4/u9AhlHmq547UCMfZIYJ1VYJI4rvqDT4 X-Received: by 2002:a17:902:cf0b:b0:151:9d28:f46f with SMTP id i11-20020a170902cf0b00b001519d28f46fmr14779494plg.53.1652078216786; Sun, 08 May 2022 23:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652078216; cv=none; d=google.com; s=arc-20160816; b=v5LDljyd5kuznATk8xqZ5pTaXx2TnQvRHcWioLOlFyeClIsoHyhJ/25Gl5iVna3DGz BWTewHYzGf4a+NB69hHQMLpvzaXNNPEF0YjdhDoViqA4NCRjGVw9E8fUwnkd2XN+38Sr SPKeu49Zab6fhNULhtfCOS5vNfi4SsbN7tFJU0xcUusZ/ViJ4MRvlvFF5qtOR9AOzkcl 0XDf+bkt8ysqewnsqjUOZRt++iR42KGiqEY3iEXuR6EzErNrz5JywAFJ0roInxiaugFN fX4VmMVW+JkBlZ872ri2ntf4Fx5YEoizUD8wugbwTLVBCg4wyPVnIi3kbR9U+sFsqw4V l0eQ== 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=whMDEuS8/uyVXE3W5FW86xjK9QlzuOQ17dSuTjLapMc=; b=jCJ4A2iagJuXHVymdtSdz4J/eDvgP22xTjZL/dATvswpdgSVOOV3IgrEFOKwKmIevg Y3oHJqILp7cD2bEeWwp0oqje7xo1D3Fog0ACEvexkwB4kt+AvzZIkpXg6u7q3JABatiy r5hN/IUDbUEEURcc8rrVF1LIA3Ydmy6HYELVz7jMn8ajC+RbbJCwNCuhxCZH6QTIUC+w 47MPHJbi5tU7bF+sTi/Shy53ldeU14o5q4oOrM5OgCRPWyUxMaQfH/hKEs6/7dgbWI5F ZaCnx3Wp5b/YIkIXiHyqMYzYcPziWaHPs65jdkj1VHmOo5oMlli0xg6kShwaHiDnKAwr syrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KVlI2CRP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p20-20020a170902ead400b00156b765043fsi9612645pld.389.2022.05.08.23.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:36:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KVlI2CRP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 640B814CA16; Sun, 8 May 2022 23:33:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353741AbiEDQwM (ORCPT + 99 others); Wed, 4 May 2022 12:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353629AbiEDQvx (ORCPT ); Wed, 4 May 2022 12:51:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DB072ED5A; Wed, 4 May 2022 09:48:16 -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 E3023B82554; Wed, 4 May 2022 16:48:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AEFFC385A4; Wed, 4 May 2022 16:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651682893; bh=C/gXfNrYbGLHuBQ+TwO+vWYrZdeXwcdlqQuLpZRmc6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KVlI2CRPwZ2tyCht13Lsv3z1TWSNFDNKudgLc1jHgAqiPsahgLQP8LmbA9V0Wsa6k P2vfGviWMwzH9queFs+imK0ZX5PWuVnvz105D18EwnC+BhmEyvFY571mji6ONOCLHs db27namMGf3vfDSeXAr0UAWYSt6nwAmMEWCSbX6A= 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.4 12/84] xhci: stop polling roothubs after shutdown Date: Wed, 4 May 2022 18:43:53 +0200 Message-Id: <20220504152928.618662308@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504152927.744120418@linuxfoundation.org> References: <20220504152927.744120418@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 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 @@ -779,6 +779,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 */