From patchwork Fri Mar 14 16:32:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 3833971 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 8D1789F2BB for ; Fri, 14 Mar 2014 16:32:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B6B4201F9 for ; Fri, 14 Mar 2014 16:32:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E8802017A for ; Fri, 14 Mar 2014 16:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754824AbaCNQcK (ORCPT ); Fri, 14 Mar 2014 12:32:10 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:51138 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754743AbaCNQcJ (ORCPT ); Fri, 14 Mar 2014 12:32:09 -0400 Received: by mail-pd0-f176.google.com with SMTP id r10so2742751pdi.7 for ; Fri, 14 Mar 2014 09:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=KPhH9SgfNWFSAhuUlAjxF8xcV+n0trJa5D9+HUzzmqI=; b=Pahh7kChOtDrg9iUBNlOCkUlzBRrdqN84nNKZpAZlUUsNxKMn5QaX8H0udn2bjBY5t B5eS0Gy5qQZluW/vveG0nsVb7PRqS1PJkIpkt8+2HsC3ZRLCWBi071gKuitz9d230KEq 0wd8ZeolK4LYKybjJruEsvpBnMRnZqvdOmpZl7yD22WCRLuybVBPu4qpSyPUHEPRnhvN o79h03qb7yLly0N38DS8/uxuUfPKlRTpuNEdR89UEzv1GZyjyNaP29Cgh97CrV9CiQch PiA1BwpHBCBGxt5mIckqBxrXJsMnQ8Y1vWKru4xg4kUXaYhxY0OwMMzVNAKRAoy8qi5H EVLQ== X-Received: by 10.68.245.162 with SMTP id xp2mr9781993pbc.69.1394814728922; Fri, 14 Mar 2014 09:32:08 -0700 (PDT) Received: from [192.168.211.137] ([66.129.239.10]) by mx.google.com with ESMTPSA id it4sm18079269pbc.39.2014.03.14.09.32.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 09:32:08 -0700 (PDT) Message-ID: <53232F01.8040209@gmail.com> Date: Fri, 14 Mar 2014 09:32:01 -0700 From: Rajat Jain User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org CC: Rajat Jain , Guenter Roeck , Alex Williamson , Andrew Murray , Alexander Gordeev Subject: [PATCH] pci: Allow hotplug service drivers to operate in polling mode Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Today the PCIe port bus driver disables the Hot-plug service if the port device does not have the capability to generate interrupts. However, drivers may have a polling method that can be used in this case. In case of pciehp, user must be able to use the "pciehp_poll_mode" parameter to use polling method in such a case. Today it is not possible. This patch allows a hotplug service driver to decide whether or not it would like to continue in absense of interrupts. Also, the current hotplug service driver (pciehp) is changed to check that either IRQs are supported, or polling mode is to be used. Signed-off-by: Rajat Jain Signed-off-by: Rajat Jain Signed-off-by: Guenter Roeck --- drivers/pci/hotplug/pciehp_hpc.c | 8 ++++++++ drivers/pci/pcie/portdrv_core.c | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 1463412..65fc1ef 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -86,6 +86,14 @@ static inline int pciehp_request_irq(struct controller *ctrl) init_timer(&ctrl->poll_timer); start_int_poll_timer(ctrl, 10); return 0; + } else if (irq == -1) { + /* + * Bail out if there is neither a way to generate + * interrupts, nor polling is to be used. + */ + ctrl_err(ctrl, + "No way to generate IRQ. Use pciehp_poll_mode\n"); + return -1; } /* Installs the interrupt handler */ diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 986f8ea..e92cd34 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -379,10 +379,13 @@ int pcie_port_device_register(struct pci_dev *dev) /* * Initialize service irqs. Don't use service devices that * require interrupts if there is no way to generate them. + * However, some drivers (e.g. pciehp) may have a polling mode + * that can be used in absense of irqs. Allow them to determine + * if that is to be used. */ status = init_service_irqs(dev, irqs, capabilities); if (status) { - capabilities &= PCIE_PORT_SERVICE_VC; + capabilities &= PCIE_PORT_SERVICE_VC | PCIE_PORT_SERVICE_HP; if (!capabilities) goto error_disable; }