From patchwork Mon Oct 27 13:22:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 39624 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97DF62118A for ; Mon, 27 Oct 2014 12:46:12 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ex7sf2880421wid.8 for ; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=EXcDwGWaisnBo1rnYhFJ8dC5+ks/CEbeiOZZh5fxBdY=; b=H8ZPtV1gQmaKlPTfrYSKZOhKGzlPFl/Voreb34RoONEwInW80S/6sQHiB2WqxSD1d3 8Tpzf8ojkcHphKmQN1AFU9ylg7wnXvF4Pi/FQ6yZJORvf1K4jig88TbgoQ7Fq+dUsjLy KlMOnuFuFd18Qi/N+d7EQHwmuy84ntG2BfVumaWh9VK1HNQZb7PA8E+58Bmxjs0jGdJm x7MVkOeUiRMJa+tUa2U1bW57tO4ir0QzuL+6wKe+f1o+LFsQZOyKp993nAj5R7rfqtz7 qAeYDqT/bq8E9l7pPaiRkGnB/fyCogZDmQn2uExRUJOKRihhWvBAVcYYJGHqu5iN+HJ8 AaFA== X-Gm-Message-State: ALoCoQl2PL1NFvgQLkDy7PrTmaEGPqjEKNMNlLBfEgbtyoIKNDfJqOdM7vDLIposm28WzPA5hPKN X-Received: by 10.112.170.167 with SMTP id an7mr5512061lbc.4.1414413971765; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.229 with SMTP id h5ls732522lam.4.gmail; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) X-Received: by 10.112.54.162 with SMTP id k2mr23319566lbp.63.1414413971616; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id f7si19794875laa.67.2014.10.27.05.46.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 05:46:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id q1so2593101lam.38 for ; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr23230060lbw.66.1414413971365; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp282291lbz; Mon, 27 Oct 2014 05:46:10 -0700 (PDT) X-Received: by 10.224.5.130 with SMTP id 2mr33015981qav.77.1414413967913; Mon, 27 Oct 2014 05:46:07 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id v38si20488158qgd.86.2014.10.27.05.46.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 27 Oct 2014 05:46:07 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xijew-0000pQ-Oo; Mon, 27 Oct 2014 12:44:30 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xijev-0000of-9v for xen-devel@lists.xenproject.org; Mon, 27 Oct 2014 12:44:29 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 93/67-02699-C2E3E445; Mon, 27 Oct 2014 12:44:28 +0000 X-Env-Sender: wangyijing@huawei.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1414413863!12801678!1 X-Originating-IP: [119.145.14.65] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NSA9PiA3NzQ2Mw==\n X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26707 invoked from network); 27 Oct 2014 12:44:27 -0000 Received: from szxga02-in.huawei.com (HELO szxga02-in.huawei.com) (119.145.14.65) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 27 Oct 2014 12:44:27 -0000 Received: from 172.24.2.119 (EHLO szxeml404-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CBJ49245; Mon, 27 Oct 2014 20:41:38 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml404-hub.china.huawei.com (10.82.67.59) with Microsoft SMTP Server id 14.3.158.1; Mon, 27 Oct 2014 20:41:28 +0800 From: Yijing Wang To: Bjorn Helgaas Date: Mon, 27 Oct 2014 21:22:16 +0800 Message-ID: <1414416142-31239-11-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1414416142-31239-1-git-send-email-wangyijing@huawei.com> References: <1414416142-31239-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org, Xinwei Hu , Yijing Wang , Thierry Reding , sparclinux@vger.kernel.org, linux-s390@vger.kernel.org, Russell King , Michael Ellerman , Joerg Roedel , x86@kernel.org, Sebastian Ott , Benjamin Herrenschmidt , xen-devel@lists.xenproject.org, Chris Metcalf , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Tony Luck , Sergei Shtylyov , linux-kernel@vger.kernel.org, Ralf Baechle , iommu@lists.linux-foundation.org, David Vrabel , Wuyun , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , Lucas Stach Subject: [Xen-devel] [PATCH 10/16] Powerpc/MSI: Use MSI controller framework to configure MSI/MSI-X irq X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangyijing@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Use MSI controller framework instead of arch MSI functions to configure MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework. Signed-off-by: Yijing Wang Acked-by: Michael Ellerman --- arch/powerpc/include/asm/pci-bridge.h | 8 ++++++++ arch/powerpc/kernel/msi.c | 19 +++++++++++++++++-- arch/powerpc/kernel/pci-common.c | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 4ca90a3..f7d09d0 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -32,6 +32,10 @@ struct pci_controller { int self_busno; struct resource busn; +#ifdef CONFIG_PCI_MSI + struct msi_controller *msi_ctrl; +#endif + void __iomem *io_base_virt; #ifdef CONFIG_PPC64 void *io_base_alloc; @@ -94,6 +98,10 @@ struct pci_controller { void *private_data; }; +#ifdef CONFIG_PCI_MSI +extern struct msi_controller ppc_msi_ctrl; +#endif + /* These are used for config access before all the PCI probing has been done. */ extern int early_read_config_byte(struct pci_controller *hose, int bus, diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c index 71bd161..64a16f3 100644 --- a/arch/powerpc/kernel/msi.c +++ b/arch/powerpc/kernel/msi.c @@ -13,7 +13,15 @@ #include -int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) +struct msi_controller *pcibios_msi_controller(struct pci_bus *bus) +{ + struct pci_controller *hose = bus->sysdata; + + return hose->msi_ctrl; +} + +static int ppc_setup_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev, int nvec, int type) { if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) { pr_debug("msi: Platform doesn't provide MSI callbacks.\n"); @@ -27,7 +35,13 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) return ppc_md.setup_msi_irqs(dev, nvec, type); } -void arch_teardown_msi_irqs(struct pci_dev *dev) +static void ppc_teardown_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev) { ppc_md.teardown_msi_irqs(dev); } + +struct msi_controller ppc_msi_ctrl = { + .setup_irqs = ppc_setup_msi_irqs, + .teardown_irqs = ppc_teardown_msi_irqs, +}; diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index e5dad9a..c3f28c5 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1597,6 +1597,9 @@ void pcibios_scan_phb(struct pci_controller *hose) /* Wire up PHB bus resources */ pcibios_setup_phb_resources(hose, &resources); +#ifdef CONFIG_PCI_MSI + hose->msi_ctrl = &ppc_msi_ctrl; +#endif hose->busn.start = hose->first_busno; hose->busn.end = hose->last_busno; hose->busn.flags = IORESOURCE_BUS;