From patchwork Mon Oct 27 13:22:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 39617 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D3E52118A for ; Mon, 27 Oct 2014 12:42:38 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf1035408lab.3 for ; Mon, 27 Oct 2014 05:42:36 -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:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=6FtkdjR9KsmWLki7jFfBk3UQONc5s8XMf56PmfmP3/s=; b=VFSiV7bhbMkBa6UXWHk17RKwed7FCuB/iD6I5yZqzzJ87x8u1MvAoq83aKo9s9KGOg +YnrJpNxb4RkXXKhkWpZQVoBs0jK3SM1EEd7dEsCkPLkDj1j0PofPvm2uYytGRadzBXv yTHmHtu74zYZL1kUDwD7zllODCZzYn9+jxguRg42/hCYc6p+OHKn/78mWN1glVh+dmCo 5am6lhwnEqhfC6Yfm19e7+zawPkz7EGujjwNiyx+D3OpajsHnc72OasHwMWix3FrjXg+ qnHWrLWriqcysawUlHdVlkkfMoGBtjU/3bAx+TgqihlGQP7rJOL+fLvMRIb+ZmA8JgCf sfXA== X-Gm-Message-State: ALoCoQlt/18qa1te0pP8uf8t4c9ucBoZzhBBk6kRHZHWUPAgEqHkMvO5drnG5mQrRxGjp6eOgIrn X-Received: by 10.180.182.164 with SMTP id ef4mr3851386wic.0.1414413756739; Mon, 27 Oct 2014 05:42:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.229 with SMTP id h5ls732190lam.4.gmail; Mon, 27 Oct 2014 05:42:36 -0700 (PDT) X-Received: by 10.152.20.132 with SMTP id n4mr23716409lae.50.1414413756551; Mon, 27 Oct 2014 05:42:36 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id sf5si19804283lbb.46.2014.10.27.05.42.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 05:42:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id hs14so5783946lab.17 for ; Mon, 27 Oct 2014 05:42:36 -0700 (PDT) X-Received: by 10.112.14.69 with SMTP id n5mr23368198lbc.34.1414413756438; Mon, 27 Oct 2014 05:42:36 -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 c5csp281726lbz; Mon, 27 Oct 2014 05:42:35 -0700 (PDT) X-Received: by 10.70.118.138 with SMTP id km10mr24249470pdb.65.1414413754745; Mon, 27 Oct 2014 05:42:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by7si10386594pab.179.2014.10.27.05.42.34 for ; Mon, 27 Oct 2014 05:42:34 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753104AbaJ0MmK (ORCPT + 26 others); Mon, 27 Oct 2014 08:42:10 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:28141 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752625AbaJ0Mlm (ORCPT ); Mon, 27 Oct 2014 08:41:42 -0400 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 CBJ49246; Mon, 27 Oct 2014 20:41:39 +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:32 +0800 From: Yijing Wang To: Bjorn Helgaas CC: , , Xinwei Hu , Wuyun , , Russell King , , Thomas Gleixner , Konrad Rzeszutek Wilk , , Joerg Roedel , , , "Benjamin Herrenschmidt" , , , Sebastian Ott , "Tony Luck" , , "David S. Miller" , , Chris Metcalf , Ralf Baechle , Lucas Stach , David Vrabel , "Sergei Shtylyov" , Michael Ellerman , Thierry Reding , "Thomas Petazzoni" , Yijing Wang Subject: [PATCH 13/16] IA64/MSI: Use MSI controller framework to configure MSI/MSI-X irq Date: Mon, 27 Oct 2014 21:22:19 +0800 Message-ID: <1414416142-31239-14-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.44 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-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- arch/ia64/include/asm/pci.h | 3 ++- arch/ia64/kernel/msi_ia64.c | 24 ++++++++++++++++++------ arch/ia64/pci/pci.c | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h index 52af5ed..805bbc3 100644 --- a/arch/ia64/include/asm/pci.h +++ b/arch/ia64/include/asm/pci.h @@ -93,7 +93,7 @@ struct pci_controller { void *iommu; int segment; int node; /* nearest node with memory or NUMA_NO_NODE for global allocation */ - + struct msi_controller *msi_ctrl; void *platform_data; }; @@ -101,6 +101,7 @@ struct pci_controller { #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata) #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment) +extern struct msi_controller ia64_msi_ctrl; extern struct pci_ops pci_root_ops; static inline int pci_proc_domain(struct pci_bus *bus) diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c index 8c3730c..b92b8e2 100644 --- a/arch/ia64/kernel/msi_ia64.c +++ b/arch/ia64/kernel/msi_ia64.c @@ -42,7 +42,7 @@ static int ia64_set_msi_irq_affinity(struct irq_data *idata, } #endif /* CONFIG_SMP */ -int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) +int __ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) { struct msi_msg msg; unsigned long dest_phys_id; @@ -77,7 +77,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) return 0; } -void ia64_teardown_msi_irq(unsigned int irq) +void __ia64_teardown_msi_irq(unsigned int irq) { destroy_irq(irq); } @@ -111,23 +111,35 @@ static struct irq_chip ia64_msi_chip = { .irq_retrigger = ia64_msi_retrigger_irq, }; +struct msi_controller *pcibios_msi_controller(struct pci_bus *bus) +{ + struct pci_controller *ctrl = bus->sysdata; + + return ctrl->msi_ctrl; +} -int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) +static int ia64_setup_msi_irq(struct msi_controller *ctrl, + struct pci_dev *pdev, struct msi_desc *desc) { if (platform_setup_msi_irq) return platform_setup_msi_irq(pdev, desc); - return ia64_setup_msi_irq(pdev, desc); + return __ia64_setup_msi_irq(pdev, desc); } -void arch_teardown_msi_irq(unsigned int irq) +static void ia64_teardown_msi_irq(struct msi_controller *ctrl, unsigned int irq) { if (platform_teardown_msi_irq) return platform_teardown_msi_irq(irq); - return ia64_teardown_msi_irq(irq); + return __ia64_teardown_msi_irq(irq); } +struct msi_controller ia64_msi_ctrl = { + .setup_irq = ia64_setup_msi_irq, + .teardown_irq = ia64_teardown_msi_irq, +}; + #ifdef CONFIG_INTEL_IOMMU #ifdef CONFIG_SMP static int dmar_msi_set_affinity(struct irq_data *data, diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 291a582..875f46a 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -437,6 +437,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) controller->companion = device; controller->node = acpi_get_node(device->handle); + controller->msi_ctrl = &ia64_msi_ctrl; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) {