From patchwork Thu Aug 1 13:25:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 2837002 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 6FB169F9C8 for ; Thu, 1 Aug 2013 13:25:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46B18202B1 for ; Thu, 1 Aug 2013 13:25:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CB49202C4 for ; Thu, 1 Aug 2013 13:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754125Ab3HANZb (ORCPT ); Thu, 1 Aug 2013 09:25:31 -0400 Received: from up.free-electrons.com ([94.23.35.102]:53495 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751551Ab3HANZ1 (ORCPT ); Thu, 1 Aug 2013 09:25:27 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id D5035104E; Thu, 1 Aug 2013 15:25:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id 143F07A4; Thu, 1 Aug 2013 15:25:26 +0200 (CEST) From: Thomas Petazzoni To: Bjorn Helgaas , linux-pci@vger.kernel.org, Russell King , Grant Likely , Rob Herring , Thomas Gleixner , Jason Cooper , Andrew Lunn , Gregory Clement Cc: Ezequiel Garcia , linux-arm-kernel@lists.infradead.org, Maen Suleiman , Lior Amsalem , Thierry Reding Subject: [PATCHv6 06/13] irqdomain: add support to associate an irq_domain with a msi_chip Date: Thu, 1 Aug 2013 15:25:09 +0200 Message-Id: <1375363516-2620-7-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375363516-2620-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1375363516-2620-1-git-send-email-thomas.petazzoni@free-electrons.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Message Signaled Interrupts are a PCI-specific mechanism that allows PCI devices to notify interrupts to the CPU using in-band messages. The PCI subsystem represents an MSI-capable interrupt controller as an msi_chip structure, and this patch improves the irqdomain subsystem with a new pointer associating an irq_domain with the corresponding msi_chip. The irq_domain structure gains a pointer to a msi_chip structure, and a new helper function irq_domain_add_msi() is added to help in allocating, initializing and registering an irq_domain for a MSI-type interrupt controller. Signed-off-by: Thomas Petazzoni --- include/linux/irqdomain.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 7113941..b0504ff 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -38,6 +38,7 @@ struct device_node; struct irq_domain; struct of_device_id; +struct msi_chip; /* Number of irqs reserved for a legacy isa controller */ #define NUM_ISA_INTERRUPTS 16 @@ -101,6 +102,7 @@ struct irq_domain { /* Optional data */ struct device_node *of_node; struct irq_domain_chip_generic *gc; + struct msi_chip *msi_chip; /* reverse map data. The linear map gets appended to the irq_domain */ irq_hw_number_t hwirq_max; @@ -177,6 +179,22 @@ static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node __irq_domain_register(d); return d; } +static inline struct irq_domain *irq_domain_add_msi(struct device_node *of_node, + unsigned int size, + const struct irq_domain_ops *ops, + struct msi_chip *msi_chip, + void *host_data) +{ + struct irq_domain *d; + d = __irq_domain_alloc(of_node, size, size, 0, ops, host_data); + if (d) { + d->msi_chip = msi_chip; + __irq_domain_register(d); + } + + return d; +} + extern void irq_domain_remove(struct irq_domain *host);