Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1114067imm; Wed, 1 Aug 2018 10:24:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcNpkB+v1RjNacbaC1tGY/3nK3wk1DCD/EwM3eRShQcV40FuJBYHTH2r3Mg84v0D8FyyEtn X-Received: by 2002:a63:ce43:: with SMTP id r3-v6mr25267500pgi.439.1533144278033; Wed, 01 Aug 2018 10:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144278; cv=none; d=google.com; s=arc-20160816; b=Dom18SxQpIauDZ/XgFKqQuT5rd5STdwjHJnIYWnAYjR/GkcoP+WLg9YEjSAEqNJyn3 kKHOerO/cMi2KME00PULpbpQJjFLVJosdiqLdHces4fnx6pN/VBnTDXH9Z/1sygOjFyD QJBUiDlb5cUPA3gaNF2Tt6AvtN3cuPCgIHO3+/YnusxzBgLAE9AwWQPoevR3UXz7IjQY bLZkXNj4NN/ToDcfLa+l0uGozIK1iibZIErlTRYC+rn1YYW98722evbiw+0TSOQWXMkT ia6Supeb1DZzrKxAvpv3kaiYUPVES5frs+/umnxU7FhpwSG9WLs0pWO3aJTYXqMEY0+b jVSg== 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=2ieYPPkyKG/gzobBA2SAcrVh/nNwhg+DFBuaVzXU4jo=; b=IQhj+Apf9PF9d6If5ib1fWuy/bYJMoP1hV+0UwFM7leH6aHMlBGYLE+6TtzXzYFy4k YRFhMmWqoH5wu6g/r00wTUi2poxW+stIADeikBzJLP0PQVcyIS19VJf5xl39DCqlUEFd 8jwPeGKo3WgbYBdfqHZu/deeTdR27LcmssDOp4/nwW3D7hcPuZr2huv9AqNE7QLm5uoE leOskl8+UbVIA4jUkicxRmKnZZ7E0qPxAX8nV8Vx7Y2oo4mXcbSevWm/D3gmqhvwOI14 CNNMRvnhjKhEUFTrqGNcnYLbr1925evQH0aDCi1GAVsIzIAxFh36rC69kesa8hM1I604 wfQQ== 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 v129-v6si18347489pfc.330.2018.08.01.10.24.23; Wed, 01 Aug 2018 10:24:37 -0700 (PDT) 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 S2406349AbeHATJs (ORCPT + 99 others); Wed, 1 Aug 2018 15:09:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50840 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405274AbeHATJr (ORCPT ); Wed, 1 Aug 2018 15:09:47 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9DFF5CC9; Wed, 1 Aug 2018 17:23:04 +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 , Sudip Mukherjee Subject: [PATCH 4.14 223/246] PCI: pciehp: Assume NoCompl+ for Thunderbolt ports Date: Wed, 1 Aug 2018 18:52:13 +0200 Message-Id: <20180801165022.375944531@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@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.14-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: Sudip Mukherjee 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 @@ -863,6 +863,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);