From patchwork Wed Oct 9 08:09:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 3007591 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BBBC4BF924 for ; Wed, 9 Oct 2013 08:10:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9933A20144 for ; Wed, 9 Oct 2013 08:10:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8D2B2012F for ; Wed, 9 Oct 2013 08:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753673Ab3JIIKP (ORCPT ); Wed, 9 Oct 2013 04:10:15 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:29612 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751798Ab3JIIKM (ORCPT ); Wed, 9 Oct 2013 04:10:12 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MUE008M36NMIWK0@mailout1.samsung.com>; Wed, 09 Oct 2013 17:09:22 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.50]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 68.36.29948.23F05525; Wed, 09 Oct 2013 17:09:22 +0900 (KST) X-AuditID: cbfee691-b7f4a6d0000074fc-fd-52550f328915 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 97.DA.05832.13F05525; Wed, 09 Oct 2013 17:09:22 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MUE009BY6NLFR60@mmp2.samsung.com>; Wed, 09 Oct 2013 17:09:21 +0900 (KST) From: Jingoo Han To: 'Bjorn Helgaas' Cc: 'Kishon Vijay Abraham I' , linux-pci@vger.kernel.org, linux-samsung-soc@vger.kernel.org, 'Kukjin Kim' , 'Pratyush Anand' , 'Mohit KUMAR' , 'Siva Reddy Kallam' , 'SRIKANTH TUMKUR SHIVANAND' , 'Arnd Bergmann' , 'Sean Cross' , 'Thierry Reding' , 'Thomas Petazzoni' , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, 'Jingoo Han' Subject: [PATCH] PCI: designware: Add irq_create_mapping() Date: Wed, 09 Oct 2013 17:09:21 +0900 Message-id: <000401cec4c6$dc415180$94c3f480$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac7Extwbs09DEKhMT+CyRFEgzGK6CA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42I5/e+Zka4Rf2iQwYV7vBZ/Jx1jt1jSlGHx 8pCmxfwj51gtLi+8xGrRu+Aqm8WFpz1sFpd3zWGzODvvOJvFjPP7mCw2Tv3FaNF+SdliRdNW Roufu+axWDx90MRk0Xj0AatF65MHjA6CHr9/TWL0eLLpIqPHzll32T0WbCr1+L5wPrtH35ZV jB5Pf+xl9jh+YzuTx+dNcgGcUVw2Kak5mWWpRfp2CVwZ0w88YS74KlBxtP0OawPjX94uRk4O CQETiUmv17BD2GISF+6tZ+ti5OIQEljGKLHz6QkmmKKVd1tYIRLTGSXaP69jhHB+MUo0HFoL VsUmoCbx5cthsFEiApoSs1dsYQIpYha4wyLxe98MoHYODmE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yREFCXePRXF2KV nsSCAzeYIUpEJPa9eMc4gVFgFpJJs5BMmoVk0iwkLQsYWVYxiqYWJBcUJ6XnGukVJ+YWl+al 6yXn525iBCecZ9I7GFc1WBxiFOBgVOLhfcAfEiTEmlhWXJl7iFGCg1lJhPcwZ2iQEG9KYmVV alF+fFFpTmrxIcZkoEcnMkuJJucDk2FeSbyhsYmZkaWRmYWRibk5acJK4rwHW60DhQTSE0tS s1NTC1KLYLYwcXBKNTBKW7BZnf+XfuPqRKeE4pCnb86dmVBlZ13J3qyz4+raHW639JSLZ17I aK+oONK+8Qlf+F1hbaPLltO77u7NCSviyJn66c/xK3MSZE6zTngdu+629Ed338613le+FE5/ 7relxSXV4O66oweNHT1YNxaZbd/28trCgvlfJbkZEyaL3s5h4RBMTr+rxFKckWioxVxUnAgA XOhJ9nwDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Without irq_create_mapping(), the correct irq number cannot be provided. In this case, it makes problem such as NULL deference. Thus, irq_create_mapping() should be added for MSI. Signed-off-by: Jingoo Han Cc: Kishon Vijay Abraham I --- Tested on Exynos5440. drivers/pci/host/pcie-designware.c | 10 ++++------ drivers/pci/host/pcie-designware.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 8963017..e536bb6 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -237,6 +237,8 @@ static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) } } + pp->msi_irq_start = irq_create_mapping(pp->irq_domain, 0); + irq = (pp->msi_irq_start + pos0); if ((irq + no_irqs) > (pp->msi_irq_start + MAX_MSI_IRQS-1)) @@ -372,8 +374,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) struct of_pci_range_parser parser; u32 val; - struct irq_domain *irq_domain; - if (of_pci_range_parser_init(&parser, np)) { dev_err(pp->dev, "missing ranges property\n"); return -EINVAL; @@ -441,15 +441,13 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } if (IS_ENABLED(CONFIG_PCI_MSI)) { - irq_domain = irq_domain_add_linear(pp->dev->of_node, + pp->irq_domain = irq_domain_add_linear(pp->dev->of_node, MAX_MSI_IRQS, &msi_domain_ops, &dw_pcie_msi_chip); - if (!irq_domain) { + if (!pp->irq_domain) { dev_err(pp->dev, "irq domain init failed\n"); return -ENXIO; } - - pp->msi_irq_start = irq_find_mapping(irq_domain, 0); } if (pp->ops->host_init) diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index faccbbf..240fc11 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h @@ -50,6 +50,7 @@ struct pcie_port { int msi_irq_start; unsigned long msi_data; DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); + struct irq_domain *irq_domain; }; struct pcie_host_ops {