From patchwork Fri Nov 7 22:54:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 5255651 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 099639F2F1 for ; Fri, 7 Nov 2014 22:55:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48D212012B for ; Fri, 7 Nov 2014 22:55:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B5EF20121 for ; Fri, 7 Nov 2014 22:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753142AbaKGWyr (ORCPT ); Fri, 7 Nov 2014 17:54:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39440 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753070AbaKGWyq (ORCPT ); Fri, 7 Nov 2014 17:54:46 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA7MsgN4024210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 7 Nov 2014 17:54:42 -0500 Received: from gimli.home ([10.3.113.6]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA7MsfcV019137; Fri, 7 Nov 2014 17:54:41 -0500 From: Alex Williamson Subject: [PATCH] PCI: pciehp: Flush slot control prior to reset To: linux-pci@vger.kernel.org, bhelgaas@google.com Cc: linux-kernel@vger.kernel.org, rajatxjain@gmail.com, yinghai@kernel.org Date: Fri, 07 Nov 2014 15:54:41 -0700 Message-ID: <20141107225359.1937.61243.stgit@gimli.home> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since 3461a068661c we don't automatically do a pcie_wait_cmd() for as part of pcie_write_cmd(), it needs to be called explicitly or triggered by the next pcie_write_cmd(). However, when we do a secondary bus reset and we're using pcie_write_cmd() to make sure that we don't see that bus reset as a hotplug event, we really want to make sure the update is complete. Testing on an old Lenovo S20 system, which sets surprise hotplug for some slots, this failure to flush results in a link down event seen by the hotplug controller when we issue the bus reset and returns us to the undesireable behavior of removing and re-adding the device. Force a flush by adding an explicit call to pcie_wait_cmd(). Signed-off-by: Alex Williamson Cc: stable@vger.kernel.org [3.17] --- drivers/pci/hotplug/pciehp_hpc.c | 1 + 1 file changed, 1 insertion(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 0ebf754..e540966 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -660,6 +660,7 @@ int pciehp_reset_slot(struct slot *slot, int probe) pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, 0); if (pciehp_poll_mode) del_timer_sync(&ctrl->poll_timer); + pcie_wait_cmd(ctrl); pci_reset_bridge_secondary_bus(ctrl->pcie->port);