Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6240474iob; Tue, 10 May 2022 13:42:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwbinJdRjN/kmBruTRm54kUObWPrGL1HiCFEkmSqHYdkp00aHoZGSiesJZY9PMdICnSmKa X-Received: by 2002:a05:6402:11cd:b0:427:bf42:44ef with SMTP id j13-20020a05640211cd00b00427bf4244efmr25855409edw.336.1652215344585; Tue, 10 May 2022 13:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652215344; cv=none; d=google.com; s=arc-20160816; b=eE9KOc9lxqwi+Est9Gs/bbvNnz+PkwL3xDr6RS1FMK8QuNcq157/Bu3Zv2tqWzYv4F sIowYZCtvwdv5gxR2sG4gC/dyAfW/gq1fCc71QidtnU/ESDw5H8u5ssWkG2zTdqGpzG5 x2Ln00yu21KrUWLoOSPONTnUEKLGoczK77srbImT3wvwZ30rQVKj4KzL30PB0UDAyjug IxeIw7qq7ce9Z95cMpjFyRXygkNmAgFPYj+B9lhfd3qwfWOtMqFT4SzFExagE7NUzro3 ZxToLauc86B0PRfbtiKJTpOLYc1DRJvJBHwvDUE/mWOcvRXOMAs0ShjCdJuD4xkXUcGX JHQg== 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=8U1tK4Tw38ljMwE8mwUfveIbrr2+Ea3kFWmTCgbvfBc=; b=eFFCynFZi5+sUJFWVugAfcu3kv7oCN04EEiySOg4nxM84LIfxS2kOIGbexZAUNg1eA c7xWElxyH+3R+ioUVXSWUei8ufXkDZQWIedcEAvMDJFVqc0E06/FTHFDrMvraFCH+Umu Rsl/802A7rezGD/i7ix6ChO5TsML8D4x4s95SXpAhvHrPQrSGY8C/kDAl7orhq+C5xeX kynQwZDuFUFaAbPfK43xbFeEt7CwcnZa3RuhrE1Cp6mQ7VypnMCa2LBuLAuG356ILkbc 2+ijwAsQNclPlpWZGVvY5hDmEjjzXL3NdMybn7/0I5zDt6XmyuYfxwU4xOfADUS2QED9 ziYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eeUYb86f; 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 qf8-20020a1709077f0800b006f469baffaesi521003ejc.16.2022.05.10.13.42.01; Tue, 10 May 2022 13:42:24 -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=eeUYb86f; 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 S244013AbiEJN1u (ORCPT + 99 others); Tue, 10 May 2022 09:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242950AbiEJNVM (ORCPT ); Tue, 10 May 2022 09:21:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36DA82C07FD; Tue, 10 May 2022 06:14:18 -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 DC191B81DA2; Tue, 10 May 2022 13:14:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35D7AC385A6; Tue, 10 May 2022 13:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652188455; bh=rv5YClglW/BeeR7VokaDgRvc3nal0GlKMs5Rdx/I3YE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeUYb86foMmTbeXxkUytl3ZppB7ApYITngdUmJh1arYHVecWAJqVH4oByA0hivrnP KhnMmoB1bqJrVOaYVOOcN7EC0OtorKr1+6dSutAinvd2rtyzcq9Sx23TG6R6OxkKRd qvRGVQtGZunjbqSEBKaESpsRIo6BkwwSAjHPEToc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Henry Lin , Mathias Nyman Subject: [PATCH 4.14 14/78] xhci: stop polling roothubs after shutdown Date: Tue, 10 May 2022 15:07:00 +0200 Message-Id: <20220510130732.955604657@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.522479698@linuxfoundation.org> References: <20220510130732.522479698@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,URIBL_BLOCKED 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 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 @@ -724,6 +724,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 */