From patchwork Thu Jul 12 10:02:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengzhou Liu X-Patchwork-Id: 1188261 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2882040B20 for ; Thu, 12 Jul 2012 10:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753453Ab2GLKXm (ORCPT ); Thu, 12 Jul 2012 06:23:42 -0400 Received: from ch1ehsobe001.messaging.microsoft.com ([216.32.181.181]:46437 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578Ab2GLKXl (ORCPT ); Thu, 12 Jul 2012 06:23:41 -0400 Received: from mail64-ch1-R.bigfish.com (10.43.68.242) by CH1EHSOBE013.bigfish.com (10.43.70.63) with Microsoft SMTP Server id 14.1.225.23; Thu, 12 Jul 2012 10:23:39 +0000 Received: from mail64-ch1 (localhost [127.0.0.1]) by mail64-ch1-R.bigfish.com (Postfix) with ESMTP id 8B9EC2E0054; Thu, 12 Jul 2012 10:23:39 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839he5bhf0ah107ah) Received: from mail64-ch1 (localhost.localdomain [127.0.0.1]) by mail64-ch1 (MessageSwitch) id 1342088616618489_16531; Thu, 12 Jul 2012 10:23:36 +0000 (UTC) Received: from CH1EHSMHS012.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.233]) by mail64-ch1.bigfish.com (Postfix) with ESMTP id 89A98401F1; Thu, 12 Jul 2012 10:23:36 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS012.bigfish.com (10.43.70.12) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 12 Jul 2012 10:23:35 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.298.5; Thu, 12 Jul 2012 05:23:35 -0500 Received: from localhost.localdomain (rock.ap.freescale.net [10.193.20.106]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q6CANV05029240; Thu, 12 Jul 2012 03:23:32 -0700 From: Shengzhou Liu To: , CC: , Shengzhou Liu Subject: [PATCH][upstream] PCI: Add PCI_DEV_FLAGS_USE_NON_MSI_INTX_IRQ to enable non MSI/INTx interrupt Date: Thu, 12 Jul 2012 18:02:22 +0800 Message-ID: <1342087342-14748-1-git-send-email-Shengzhou.Liu@freescale.com> X-Mailer: git-send-email 1.6.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On some platforms, in RC mode, root port has neither MSI/MSI-X nor INTx interrupt generated, which are available only in EP mode on those platform. In this case, we try to use other interrupt for port service driver to have AER, Hot-plug, etc, services to work. (i.e. there is the shared error interrupt on platform P1010/P3041/P4080 etc) Signed-off-by: Shengzhou Liu --- drivers/pci/pcie/portdrv_core.c | 10 ++++++++-- drivers/pci/quirks.c | 12 ++++++++++++ include/linux/pci.h | 5 +++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 75915b3..837ad15 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -212,8 +212,14 @@ static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) if (!pcie_port_enable_msix(dev, irqs, mask)) return 0; - /* We're not going to use MSI-X, so try MSI and fall back to INTx */ - if (!pci_enable_msi(dev) || dev->pin) + /* + * We're not going to use MSI-X, so try MSI and fall back to INTx. + * Eventually, if neither MSI/MSI-X nor INTx available, try other + * interrupt. (On some platforms, root port doesn't support generating + * MSI/MSI-X/INTx in RC mode) + */ + if (!pci_enable_msi(dev) || dev->pin || ((dev->dev_flags & + PCI_DEV_FLAGS_USE_NON_MSI_INTX_IRQ) && dev->irq)) irq = dev->irq; no_msi: diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 2a75216..df54e2f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2640,6 +2640,18 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1083, quirk_msi_intx_disable_bug); #endif /* CONFIG_PCI_MSI */ +/* + * Under some circumstances, root port has neither MSI/MSI-X nor INTx generated, + * so try other interrupt if supported. + */ +static void __devinit quirk_enable_non_msi_intx_interrupt(struct pci_dev *dev) +{ + dev->dev_flags |= PCI_DEV_FLAGS_USE_NON_MSI_INTX_IRQ; +} + +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, + quirk_enable_non_msi_intx_interrupt); + /* Allow manual resource allocation for PCI hotplug bridges * via pci=hpmemsize=nnM and pci=hpiosize=nnM parameters. For * some PCI-PCI hotplug bridges, like PLX 6254 (former HINT HB6), diff --git a/include/linux/pci.h b/include/linux/pci.h index d8c379d..f051a66 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -176,6 +176,11 @@ enum pci_dev_flags { PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, /* Provide indication device is assigned by a Virtual Machine Manager */ PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, + /* + * Use other interrupt (i.e. system shared interrupt) when MSI/MSI-X + * and INTx are not supported in RC mode on some platforms. + */ + PCI_DEV_FLAGS_USE_NON_MSI_INTX_IRQ = (__force pci_dev_flags_t) 8, }; enum pci_irq_reroute_variant {