Received: by 10.223.185.116 with SMTP id b49csp1022363wrg; Wed, 21 Feb 2018 10:43:22 -0800 (PST) X-Google-Smtp-Source: AH8x225Bh4Tn3mMkI+H6HrM65ZMXImpoE81yf+bx6MfzWGB9V1eKEJh7x7WPUKOVo2Ti4y1B6UC8 X-Received: by 10.98.39.197 with SMTP id n188mr4214095pfn.58.1519238602169; Wed, 21 Feb 2018 10:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238602; cv=none; d=google.com; s=arc-20160816; b=r+euZ9WZnGSH1v/dfuS6eBHtfp17+XeszPEtPAXm9yqasJMAhgSVzpHcMLOSGqVZBJ zgbsEFWbY6LqRO2Zzoj0E+f77GfJ1Yzi7tlvACAXYEQ42rZ6H4NAp2KE0OZWAJLMC8sK ji5FS6n1dOI4Dth9eXOwS4iVpsqXXusHrCFZ+tCoPQ81KSul5WZy0jH79dCFH/ushbX7 zhgC2wZVkDW57gm3jK60EplnFIoCsnPK4Xi6VxCWTpmd50cMbbqxvKUDdgFjTz52HNtI 97GSaWxkbsOQnYU/ysyHlF0DFJmSQb1GIX/yv/Y5HNpGGcMmWg72PAFaQ3T545NT9YA1 wdXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6MW8nKrSIhrb0r8U3a9J89FdhDMFVKDTQu8A7WCp2Ok=; b=drCHZa1gB1UWMkqDgkn5mYZmxa7rvPe4uL7pAq/dL/6flLS7B7aMaUbcxz3AhnJudT T8bYLQG8hR2VyKyjtQ5kpBOi/kOGyKdktaw8ZpvXrVxFAKavF1rbOGsIvR+VlgK3TINH JfqTjT820NzbefyWthYPeYub8mLu/2yjlGqncuqujBJ5T3UxazIrrnDi1Hpi5M6jhlQM A8VNw4aD83gXacg6GAGejA+ZlSvLS2l+FdCQu1V4fadnpQePTMgZfLLyFa/BWgZuPqp3 F1D1y7tUHdw8RR/63rb3+s0JaLnGxIKuXsxLXNcPvpvr9kyxlccYqyPi0/xI8rlNMHlK L5sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si1353790pgn.122.2018.02.21.10.43.08; Wed, 21 Feb 2018 10:43:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965837AbeBUN1n (ORCPT + 99 others); Wed, 21 Feb 2018 08:27:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44488 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936299AbeBUNLM (ORCPT ); Wed, 21 Feb 2018 08:11:12 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 26201122D; Wed, 21 Feb 2018 13:10:55 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , Lukas Wunner , Bjorn Helgaas , Sinan Kaya , Yehezkel Bernat , Michael Jamet , Andreas Noever Subject: [PATCH 4.15 117/163] PCI: pciehp: Assume NoCompl+ for Thunderbolt ports Date: Wed, 21 Feb 2018 13:49:06 +0100 Message-Id: <20180221124536.606429707@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lukas Wunner commit 493fb50e958c1c6deef7feff0b8c3855def78d75 upstream. Certain Thunderbolt 1 controllers claim to support Command Completed events (value of 0b in the No Command Completed Support field of the Slot Capabilities register) but in reality they neither set the Command Completed bit in the Slot Status register nor signal a Command Completed interrupt: 8086:1513 CV82524 [Light Ridge 4C 2010] 8086:151a DSL2310 [Eagle Ridge 2C 2011] 8086:151b CVL2510 [Light Peak 2C 2010] 8086:1547 DSL3510 [Cactus Ridge 4C 2012] 8086:1548 DSL3310 [Cactus Ridge 2C 2012] 8086:1549 DSL2210 [Port Ridge 1C 2011] All known newer chips (Redwood Ridge and onwards) set No Command Completed Support, indicating that they do not support Command Completed events. The user-visible impact is that after unplugging such a device, 2 seconds elapse until pciehp is unbound. That's because on ->remove, pcie_write_cmd() is called via pcie_disable_notification() and every call to pcie_write_cmd() takes 2 seconds (1 second for each invocation of pcie_wait_cmd()): [ 337.942727] pciehp 0000:0a:00.0:pcie204: Timeout on hotplug command 0x1038 (issued 21176 msec ago) [ 340.014735] pciehp 0000:0a:00.0:pcie204: Timeout on hotplug command 0x0000 (issued 2072 msec ago) That by itself has always been unpleasant, but the situation has become worse with commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown"): Now pciehp is unbound on ->shutdown. Because Thunderbolt controllers typically have 4 hotplug ports, every reboot and shutdown is now delayed by 8 seconds, plus another 2 seconds for every attached Thunderbolt 1 device. Thunderbolt hotplug slots are not physical slots that one inserts cards into, but rather logical hotplug slots implemented in silicon. Devices appear beyond those logical slots once a PCI tunnel is established on top of the Thunderbolt Converged I/O switch. One would expect commands written to the Slot Control register to be executed immediately by the silicon, so for simplicity we always assume NoCompl+ for Thunderbolt ports. Fixes: cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown") Tested-by: Mika Westerberg Signed-off-by: Lukas Wunner Signed-off-by: Bjorn Helgaas Reviewed-by: Mika Westerberg Cc: stable@vger.kernel.org # v4.12+ Cc: Sinan Kaya Cc: Yehezkel Bernat Cc: Michael Jamet Cc: Andreas Noever Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/pciehp_hpc.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -848,6 +848,13 @@ struct controller *pcie_init(struct pcie if (pdev->hotplug_user_indicators) slot_cap &= ~(PCI_EXP_SLTCAP_AIP | PCI_EXP_SLTCAP_PIP); + /* + * We assume no Thunderbolt controllers support Command Complete events, + * but some controllers falsely claim they do. + */ + if (pdev->is_thunderbolt) + slot_cap |= PCI_EXP_SLTCAP_NCCS; + ctrl->slot_cap = slot_cap; mutex_init(&ctrl->ctrl_lock); init_waitqueue_head(&ctrl->queue);