From patchwork Tue Oct 11 19:39:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 680868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3stn9g0PtDz9ryn for ; Wed, 12 Oct 2016 06:29:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966AbcJKT3H (ORCPT ); Tue, 11 Oct 2016 15:29:07 -0400 Received: from mga04.intel.com ([192.55.52.120]:19510 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751939AbcJKT3H (ORCPT ); Tue, 11 Oct 2016 15:29:07 -0400 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP; 11 Oct 2016 12:28:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,330,1473145200"; d="scan'208";a="19024421" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.96]) by orsmga004.jf.intel.com with ESMTP; 11 Oct 2016 12:28:08 -0700 From: Keith Busch To: linux-pci@vger.kernel.org, Bjorn Helgaas Cc: Jon Derrick , Keith Busch Subject: [PATCH] pci: Don't set power fault if controller not present Date: Tue, 11 Oct 2016 15:39:07 -0400 Message-Id: <1476214747-10428-1-git-send-email-keith.busch@intel.com> X-Mailer: git-send-email 2.5.5 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The pciehp control only clears the saved power fault detected if power controller control is present, but there is no requirement that the capability exist in order to observe power faults. This means a hot-added device in a slot that had experienced a power fault at some point would never be able to add a new device since the power fault detected would be on permanently. This patch sets the sticky field only if there is a chance it can be cleared later. Signed-off-by: Keith Busch --- drivers/pci/hotplug/pciehp_hpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index b57fc6d..b083e1c 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -631,7 +631,8 @@ static irqreturn_t pciehp_isr(int irq, void *dev_id) /* Check Power Fault Detected */ if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) { - ctrl->power_fault_detected = 1; + if (POWER_CTRL(ctrl)) + ctrl->power_fault_detected = 1; ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(slot)); pciehp_queue_interrupt_event(slot, INT_POWER_FAULT); }