From patchwork Wed Oct 15 03:07:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 38736 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DAFCE20973 for ; Wed, 15 Oct 2014 02:26:51 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf140526lbg.5 for ; Tue, 14 Oct 2014 19:26:50 -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=2/spyeMljd8l0bYZ9YOhhlb18fiuJM7GnmINQ6BpvC0=; b=CGCSoqJhpbVs0XNGzPnAJzfGQuMUiaQERJ+ss76t9H+eCqb21cdLh8jHqkPY6xyRUz hxSATX+O5R+E4za9ie6Mztfwow5N4W+MIuDY4oSJ001FFuMqa8bLmJfI+stID+nfojG9 /N/Dfx98uIxgjDHr8XIO+XQOFylgnslgjifUBWlTOToeGl8o6wEzqHo0Feebyt5jSmQN vg8Qocm3ewj+oKjmlYwSUtWXNewsDk07A5elh4cW9w0Krco/SAQ4mT6kOSx6OHTsiXhj g0WheXA11GJCzY5nrrhzotUrKqNaq+HXmovZJuPy6kcwKJ6r+DSo7X1DQePrskk/ewYh ziuw== X-Gm-Message-State: ALoCoQmwKgiqEu+eVTQzcdMVvVr0l2XP8/96/YJyRvJ/CT7NIP5qk5siBBFV/Gxv0kqfI0MvAjeu X-Received: by 10.152.4.165 with SMTP id l5mr1190485lal.4.1413340010304; Tue, 14 Oct 2014 19:26:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.8 with SMTP id lk8ls8192lac.17.gmail; Tue, 14 Oct 2014 19:26:49 -0700 (PDT) X-Received: by 10.152.22.194 with SMTP id g2mr9087749laf.33.1413340009832; Tue, 14 Oct 2014 19:26:49 -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 i8si28535583lai.129.2014.10.14.19.26.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 19:26:49 -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 ge10so255245lab.10 for ; Tue, 14 Oct 2014 19:26:49 -0700 (PDT) X-Received: by 10.112.56.171 with SMTP id b11mr9046744lbq.65.1413340009695; Tue, 14 Oct 2014 19:26:49 -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 c5csp517342lbz; Tue, 14 Oct 2014 19:26:48 -0700 (PDT) X-Received: by 10.68.68.173 with SMTP id x13mr9062612pbt.57.1413340007898; Tue, 14 Oct 2014 19:26:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jd10si3248272pbd.32.2014.10.14.19.26.47 for ; Tue, 14 Oct 2014 19:26:47 -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 S932879AbaJOC0o (ORCPT + 27 others); Tue, 14 Oct 2014 22:26:44 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:13813 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932819AbaJOC01 (ORCPT ); Tue, 14 Oct 2014 22:26:27 -0400 Received: from 172.24.2.119 (EHLO szxeml412-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CCW43225; Wed, 15 Oct 2014 10:26:08 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml412-hub.china.huawei.com (10.82.67.91) with Microsoft SMTP Server id 14.3.158.1; Wed, 15 Oct 2014 10:25:58 +0800 From: Yijing Wang To: Bjorn Helgaas CC: , , Xinwei Hu , Wuyun , , Russell King , , , , , Arnd Bergmann , 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" , Liviu Dudau , Yijing Wang Subject: [PATCH v3 24/27] IA64/MSI: Use MSI chip framework to configure MSI/MSI-X irq Date: Wed, 15 Oct 2014 11:07:12 +0800 Message-ID: <1413342435-7876-25-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1413342435-7876-1-git-send-email-wangyijing@huawei.com> References: <1413342435-7876-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.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-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use MSI chip 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 | 10 ++++++++++ arch/ia64/kernel/msi_ia64.c | 14 ++++++++++---- arch/ia64/pci/pci.c | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h index 52af5ed..907dcba 100644 --- a/arch/ia64/include/asm/pci.h +++ b/arch/ia64/include/asm/pci.h @@ -94,6 +94,7 @@ struct pci_controller { int segment; int node; /* nearest node with memory or NUMA_NO_NODE for global allocation */ + struct msi_chip *msi_chip; void *platform_data; }; @@ -101,6 +102,15 @@ struct pci_controller { #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata) #define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment) +extern struct msi_chip chip; + +static inline struct msi_chip *pci_msi_chip(struct pci_bus *bus) +{ + struct pci_controller *ctrl = bus->sysdata; + + return ctrl->msi_chip; +} + 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..401fc98 100644 --- a/arch/ia64/kernel/msi_ia64.c +++ b/arch/ia64/kernel/msi_ia64.c @@ -112,15 +112,16 @@ static struct irq_chip ia64_msi_chip = { }; -int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) +static int arch_ia64_setup_msi_irq(struct msi_chip *chip, + struct pci_dev *dev, struct msi_desc *desc) { if (platform_setup_msi_irq) - return platform_setup_msi_irq(pdev, desc); + return platform_setup_msi_irq(dev, desc); - return ia64_setup_msi_irq(pdev, desc); + return ia64_setup_msi_irq(dev, desc); } -void arch_teardown_msi_irq(unsigned int irq) +static void arch_ia64_teardown_msi_irq(struct msi_chip *chip, unsigned int irq) { if (platform_teardown_msi_irq) return platform_teardown_msi_irq(irq); @@ -128,6 +129,11 @@ void arch_teardown_msi_irq(unsigned int irq) return ia64_teardown_msi_irq(irq); } +struct msi_chip chip = { + .setup_irq = arch_ia64_setup_msi_irq, + .teardown_irq = arch_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..299b67d 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_chip = &chip; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) {