From patchwork Wed Jan 21 17:09:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 5679641 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 405FCC058D for ; Wed, 21 Jan 2015 17:09:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48B6C20462 for ; Wed, 21 Jan 2015 17:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D1E020260 for ; Wed, 21 Jan 2015 17:09:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718AbbAURJb (ORCPT ); Wed, 21 Jan 2015 12:09:31 -0500 Received: from mail-oi0-f50.google.com ([209.85.218.50]:43772 "EHLO mail-oi0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbbAURJa (ORCPT ); Wed, 21 Jan 2015 12:09:30 -0500 Received: by mail-oi0-f50.google.com with SMTP id h136so4860635oig.9 for ; Wed, 21 Jan 2015 09:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=383T51NXyoKLIugtoopZkT4MHzblAV7Ma3Udj0c2BdI=; b=e6dKpDMPHvkIvzPbtPqABNMnVXVo/6wpxWhiYKAY4V1/GSjg0SpXpSLiF97r/eow2t K+GI0s82LBKAE/i8re31nORDuOfJqSWNIhqepqgoUHbdWuE/OM8XvqQbRGsQp6uXXosB z6yJmxQPS7NVFGM36SuHRcmiUGyYCpiX4y4OrGbUnrkleAsLfGu88DyCUYNJ+y3T+5IP mqVuVMCdbCePhCeE3brFP04McXWuU7bb9R6EMh3ayzmbsyhfc/d/O8P2KKKHKoxnURG+ dHthpRR1GQnY0ttBjOOqQ523uSwxyz9PtrCTp2X5dbkOYa9k62kGu5/0ZwGrYvtwrMyF mYsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=383T51NXyoKLIugtoopZkT4MHzblAV7Ma3Udj0c2BdI=; b=ha2DaIXaqTlT7bWdp4v5CB0hCcQ72f7+w5cvkDLdgzGa3JpzThKt+bF1wOdnQUGbNG s9O28XPSHeehV3gp4KDIrCzRAumnxqg12J9CFEcv7JUcXNuegBL3X+9pr9pfx4Ktz/45 IoocynnRmeO7qpj9Iz9sEk2bNAJqK078PXMwKGWiG0+jJgyEna1AtUU+RrI4qggGWboK bzYvgNy6tdWWzyHuqXYFSL5TY4grgKviUL1YKPjJuPBIZgIQOhrJJaGPbFnoVAYK/EG+ WMGxTCU6aKIAgDMwaGGub8duclDM/knlJX/QcwD5u+dpmIBe9KkjygKXWxXbIvx7/+8a MKCQ== X-Gm-Message-State: ALoCoQm9bLZh28ogrl5G8mFBI1Rw5LbArJXfOAAnu7sNdgSKEJ1LOfOulKAs+0x+QeEW5tEvLywv X-Received: by 10.182.103.232 with SMTP id fz8mr25858554obb.59.1421860170037; Wed, 21 Jan 2015 09:09:30 -0800 (PST) Received: from google.com ([69.71.1.1]) by mx.google.com with ESMTPSA id rv3sm9221393oeb.16.2015.01.21.09.09.28 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 21 Jan 2015 09:09:29 -0800 (PST) Date: Wed, 21 Jan 2015 11:09:27 -0600 From: Bjorn Helgaas To: Keith Busch Cc: linux-pci@vger.kernel.org, Rajat Jain Subject: Re: [PATCH] pci: Use hot-plug capable for testing presence on Message-ID: <20150121170927.GA13072@google.com> References: <1419275223-14602-1-git-send-email-keith.busch@intel.com> <20150116203330.GJ29776@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150116203330.GJ29776@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FSL_HELO_FAKE, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 On Fri, Jan 16, 2015 at 02:33:30PM -0600, Bjorn Helgaas wrote: > [+cc Rajat] > > On Mon, Dec 22, 2014 at 12:07:03PM -0700, Keith Busch wrote: > > The PCI-e Base specifically says Hot-Plug Surprise capability is for > > removal only, but pciehp checked this to determine if it should handle a > > slot event on device add. Lots of platform's pcie slots don't advertise > > support for surprise removal, but are perfectly capable of handling > > hot-add, so checking surprise removal is not appropriate. > > > > This patch checks the Hot-Plug Capable bit in the slot capabilities to > > determine if the detected presence on is a reliable event instead of > > Hot-Plug Surprise. > > > > Signed-off-by: Keith Busch > > This seems reasonable to me, and I applied it to pci/hotplug for v3.20. After our follow-up discussion, I replaced this patch with the following. If anybody objects, let me know. commit dc0c25c0ee9f92ba1872fdda9c2a0014611cf722 Author: Bjorn Helgaas Date: Wed Jan 21 10:28:07 2015 -0600 PCI: pciehp: Handle surprise add even if surprise removal isn't supported The PCIe spec (r3.0, sec 7.8.9) says Hot-Plug Surprise indicates support for surprise *removal*, but pciehp checked this to determine if it should handle presence detect interrupts for device *addition*. Allow surprise device addition even if the slot doesn't advertise support for surprise removal. Keith has a platform with slots for front-loading SFF devices. The slots do not have attention buttons and do not support surprise removal, but they do have presence detect. In that case, we still want to use presence detect for device addition. Keith's original patch handled surprise insertions only if Hot-Plug Capable is set. I think that test is superfluous because pciehp only claims slots that advertise Hot-Plug Capable (see get_port_device_capability()). Link: http://lkml.kernel.org/r/1419275223-14602-1-git-send-email-keith.busch@intel.com Based-on-patch-by: Keith Busch Signed-off-by: Bjorn Helgaas --- 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_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index ff32e85e1de6..f052e951b23e 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -532,8 +532,6 @@ static void interrupt_event_handler(struct work_struct *work) pciehp_green_led_off(p_slot); break; case INT_PRESENCE_ON: - if (!HP_SUPR_RM(ctrl)) - break; ctrl_dbg(ctrl, "Surprise Insertion\n"); handle_surprise_event(p_slot); break;