From patchwork Mon Oct 27 13:22:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 39621 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F09F32118A for ; Mon, 27 Oct 2014 12:45:32 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf4043358lbv.8 for ; Mon, 27 Oct 2014 05:45:31 -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=kIQoms4wQ10TCMT2DRQVDQxUsKzNuCl4nnWKVBmMrb8=; b=EUCkzDe3XZE0rwt4s4ny48YKmnRYA0hR4lEKzt6Szk5zFtKX0Z7UdyLULFjHD0Enpo y7dpWMJ7omjQxBcipiqcFN/UJH3xm2kNB9R4kyhiFF/JYzUQdBUNA0p0m9psKGX0dloG MoBS/mfBx8z2eJGFf/jds2lMp2jJrJNf3UYoig75/C9dYheoIcygW0FbB3jcqA6fSRrE V1l0hP98QeId0O79JkiqIqJXPMQVcy1JsqI3sEZtebpQP5TdsK6a0djMCaY+PkBzG1m0 ABUqZYZo5VhnUZV8vfZJCxr8wtEu7CUOUMBG4l/4HjkN6yx+XE4BvFg2SQLc06v2pQ2o OvJw== X-Gm-Message-State: ALoCoQlX4SwyobVmHhQpRrjwErduCHGPwNgul9zdBHCVousMu4xEf58W7hG+9c7UHhYwh2RcbSpc X-Received: by 10.194.242.36 with SMTP id wn4mr339269wjc.4.1414413931655; Mon, 27 Oct 2014 05:45:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.142 with SMTP id j14ls516866laa.5.gmail; Mon, 27 Oct 2014 05:45:31 -0700 (PDT) X-Received: by 10.152.37.104 with SMTP id x8mr14762449laj.74.1414413930682; Mon, 27 Oct 2014 05:45:30 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id ba3si19761992lbc.92.2014.10.27.05.45.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 05:45:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id u10so5531706lbd.6 for ; Mon, 27 Oct 2014 05:45:30 -0700 (PDT) X-Received: by 10.152.116.102 with SMTP id jv6mr23527771lab.40.1414413930338; Mon, 27 Oct 2014 05:45:30 -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 c5csp282193lbz; Mon, 27 Oct 2014 05:45:29 -0700 (PDT) X-Received: by 10.70.38.109 with SMTP id f13mr9825112pdk.132.1414413928759; Mon, 27 Oct 2014 05:45:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gk11si10392095pbd.142.2014.10.27.05.45.28 for ; Mon, 27 Oct 2014 05:45:28 -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 S1753352AbaJ0MpY (ORCPT + 26 others); Mon, 27 Oct 2014 08:45:24 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:39252 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752930AbaJ0Ml4 (ORCPT ); Mon, 27 Oct 2014 08:41:56 -0400 Received: from 172.24.2.119 (EHLO szxeml404-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AWE51676; Mon, 27 Oct 2014 20:41:52 +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:35 +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 15/16] tile/MSI: Use MSI controller framework to configure MSI/MSI-X irq Date: Mon, 27 Oct 2014 21:22:21 +0800 Message-ID: <1414416142-31239-16-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 X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.544E3D91.01B0, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a79e6222ac16149ce64752b2f173711a 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.217.175 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/tile/include/asm/pci.h | 2 ++ arch/tile/kernel/pci_gx.c | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h index dfedd7a..3ebd66b 100644 --- a/arch/tile/include/asm/pci.h +++ b/arch/tile/include/asm/pci.h @@ -152,6 +152,7 @@ struct pci_controller { int pio_io_index; /* PIO region index for I/O space access */ #endif + struct msi_controller *msi_ctrl; /* * Mem-Map regions for all the memory controllers so that Linux can * map all of its physical memory space to the PCI bus. @@ -179,6 +180,7 @@ struct pci_controller { int irq_intx_table[4]; }; +extern struct msi_controller tilegx_msi_ctrl; extern struct pci_controller pci_controllers[TILEGX_NUM_TRIO * TILEGX_TRIO_PCIES]; extern gxio_trio_context_t trio_contexts[TILEGX_NUM_TRIO]; extern int num_trio_shims; diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c index e39f9c5..6bf5a24 100644 --- a/arch/tile/kernel/pci_gx.c +++ b/arch/tile/kernel/pci_gx.c @@ -887,6 +887,7 @@ int __init pcibios_init(void) controller->mem_offset); pci_add_resource(&resources, &controller->io_space); controller->first_busno = next_busno; + controller->msi_ctrl = &tilegx_msi_ctrl; bus = pci_scan_root_bus(NULL, next_busno, controller->ops, controller, &resources); controller->root_bus = bus; @@ -1485,7 +1486,15 @@ static struct irq_chip tilegx_msi_chip = { /* TBD: support set_affinity. */ }; -int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) +struct msi_controller *pcibios_msi_controller(struct pci_bus *bus) +{ + struct pci_controller *controller = bus->sysdata; + + return controller->msi_ctrl; +} + +static int tile_setup_msi_irq(struct msi_controller *ctrl, + struct pci_dev *pdev, struct msi_desc *desc) { struct pci_controller *controller; gxio_trio_context_t *trio_context; @@ -1604,7 +1613,12 @@ is_64_failure: return ret; } -void arch_teardown_msi_irq(unsigned int irq) +static void tile_teardown_msi_irq(struct msi_controller *ctrl, unsigned int irq) { irq_free_hwirq(irq); } + +struct msi_controller tilegx_msi_ctrl = { + .setup_irq = tile_setup_msi_irq, + .teardown_irq = tile_teardown_msi_irq, +};