From patchwork Fri Feb 17 06:12:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 729009 X-Patchwork-Delegate: bhelgaas@google.com 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 3vPjPp6kqNz9s85 for ; Fri, 17 Feb 2017 17:13:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755575AbdBQGNR (ORCPT ); Fri, 17 Feb 2017 01:13:17 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:19700 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755570AbdBQGNQ (ORCPT ); Fri, 17 Feb 2017 01:13:16 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v1H6DARc026286 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Feb 2017 06:13:10 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v1H6D9uB030732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 17 Feb 2017 06:13:10 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v1H6D989000842; Fri, 17 Feb 2017 06:13:09 GMT Received: from localhost.localdomain (/10.159.154.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 16 Feb 2017 22:13:08 -0800 From: Yinghai Lu To: Bjorn Helgaas Cc: Mika Westerberg , Keith Busch , Mayurkumar Patel , Ashok Raj , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH] PCI, pciehp: Don't handle PDC for cards with attention button Date: Thu, 16 Feb 2017 22:12:47 -0800 Message-Id: <20170217061247.5591-1-yinghai@kernel.org> X-Mailer: git-send-email 2.8.3 X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On one system during power off slot, find card get power on right away. # echo 0 > /sys/bus/pci/slots/1/power pci_hotplug: power_write_file: power = 0 pciehp 0000:16:00.0:pcie004: pciehp_get_power_status: SLOTCTRL a8 value read 11f1 pciehp 0000:16:00.0:pcie004: pciehp_unconfigure_device: domain:bus:dev = 0000:17:00 pci 0000:17:00.0: PME# disabled pci 0000:17:00.0: freeing pci_dev info pciehp 0000:16:00.0:pcie004: pending interrupts 0x0010 from Slot Status pciehp 0000:16:00.0:pcie004: pciehp_power_off_slot: SLOTCTRL a8 write cmd 400 pciehp 0000:16:00.0:pcie004: pending interrupts 0x0108 from Slot Status pciehp 0000:16:00.0:pcie004: Slot(1): Link Down pciehp 0000:16:00.0:pcie004: Slot(1): Link Down event ignored; already powering off pciehp 0000:16:00.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300 pciehp 0000:16:00.0:pcie004: pending interrupts 0x0018 from Slot Status <====== pciehp 0000:16:00.0:pcie004: Slot(1): Card present pciehp 0000:16:00.0:pcie004: pciehp_get_power_status: SLOTCTRL a8 value read 17f1 pciehp 0000:16:00.0:pcie004: pending interrupts 0x0010 from Slot Status pciehp 0000:16:00.0:pcie004: pciehp_power_on_slot: SLOTCTRL a8 write cmd 0 pciehp 0000:16:00.0:pcie004: pciehp_green_led_blink: SLOTCTRL a8 write cmd 200 pciehp 0000:16:00.0:pcie004: pending interrupts 0x0010 from Slot Status pciehp 0000:16:00.0:pcie004: pciehp_check_link_active: lnk_status = f103 pciehp 0000:16:00.0:pcie004: pending interrupts 0x0108 from Slot Status pciehp 0000:16:00.0:pcie004: Slot(1): Link Up ... Somehow PDC bit get set, and during handling interrupt that is caused by CC, that PDC also get handled, and the card get powered on again. In pcie_enable_notification(), we already only enable notification for PDC when attention button is not there. So we can safely add checking in pciehp_isr() to skip that PDC handling. Signed-off-by: Yinghai Lu --- drivers/pci/hotplug/pciehp_hpc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c =================================================================== --- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c +++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c @@ -618,8 +618,9 @@ static irqreturn_t pciehp_isr(int irq, v present = !!(status & PCI_EXP_SLTSTA_PDS); ctrl_info(ctrl, "Slot(%s): Card %spresent\n", slot_name(slot), present ? "" : "not "); - pciehp_queue_interrupt_event(slot, present ? INT_PRESENCE_ON : - INT_PRESENCE_OFF); + if (!ATTN_BUTTN(ctrl)) + pciehp_queue_interrupt_event(slot, present ? + INT_PRESENCE_ON : INT_PRESENCE_OFF); } /* Check Power Fault Detected */