From patchwork Mon Oct 27 13:22:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 39625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EF6BB2118A for ; Mon, 27 Oct 2014 12:46:14 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf497739eek.1 for ; Mon, 27 Oct 2014 05:46:14 -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=s80491iX4LFT9x8de24yzzr9SCCJW5gQHn6IFeKy5nQ=; b=ksWdrBbXXptJ/ylMvOWssaMKoYYkWMrkK6H0xZAubcUjFSfzbw4pBQWSNG8LwNagxr Nd1V4nNvhgJioDEiI/4YnIvQ6MwNJstenhqxbG+EdCEDrLdwd6xX3P8P/o53upaAwoVl 9+mKA+jnNmXVEvaZ3ncwFBsx99/46RZfSvIJT0hEHSnIVCeSI2jD+spIz2chFDMaguho pSYb9n7mc9mZrB1irbFAETUovxG295FaCvh6Dsk3306l9CPA7h1O64/BRozITSfMc1nY /aXJXSK80BFRn86MIMTcVZc5754clhjI5+k7QggrJUgxutz5xDfTH3bqFpjXl9zUAm/8 1WwA== X-Gm-Message-State: ALoCoQlAnYkDO9m07d0uji2b0p45LJjp4ErDlhFtuyQylHffPJRAzrE43GmJuHSinpn00UPmh8t6 X-Received: by 10.194.118.197 with SMTP id ko5mr5428253wjb.2.1414413974100; Mon, 27 Oct 2014 05:46:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.67 with SMTP id lu3ls335100lac.50.gmail; Mon, 27 Oct 2014 05:46:13 -0700 (PDT) X-Received: by 10.112.77.129 with SMTP id s1mr23986086lbw.36.1414413973910; Mon, 27 Oct 2014 05:46:13 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id ui10si19806236lbb.62.2014.10.27.05.46.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 05:46:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gi9so5675688lab.5 for ; Mon, 27 Oct 2014 05:46:12 -0700 (PDT) X-Received: by 10.152.5.38 with SMTP id p6mr23255425lap.44.1414413972567; Mon, 27 Oct 2014 05:46:12 -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 c5csp282295lbz; Mon, 27 Oct 2014 05:46:11 -0700 (PDT) X-Received: by 10.70.95.135 with SMTP id dk7mr1546139pdb.161.1414413969821; Mon, 27 Oct 2014 05:46:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fr3si10480269pbd.34.2014.10.27.05.46.08 for ; Mon, 27 Oct 2014 05:46:09 -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 S1753369AbaJ0MqE (ORCPT + 26 others); Mon, 27 Oct 2014 08:46:04 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:39253 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbaJ0Ml4 (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 AWE51663; 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:34 +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 14/16] Sparc/MSI: Use MSI controller framework to configure MSI/MSI-X irq Date: Mon, 27 Oct 2014 21:22:20 +0800 Message-ID: <1414416142-31239-15-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.01B5, 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: 8debd7afe062d8fd3bb2c2ddb4253d31 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.46 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 Acked-by: David S. Miller --- arch/sparc/kernel/pci.c | 20 ++++++++++++++++++-- arch/sparc/kernel/pci_impl.h | 3 +++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index b36365f..c691a10 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -656,6 +656,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, printk("PCI: Scanning PBM %s\n", node->full_name); +#ifdef CONFIG_PCI_MSI + pbm->msi_ctrl = &sparc_msi_ctrl; +#endif pci_add_resource_offset(&resources, &pbm->io_space, pbm->io_space.start); pci_add_resource_offset(&resources, &pbm->mem_space, @@ -905,7 +908,15 @@ int pci_domain_nr(struct pci_bus *pbus) EXPORT_SYMBOL(pci_domain_nr); #ifdef CONFIG_PCI_MSI -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_pbm_info *pbm = bus->sysdata; + + return pbm->msi_ctrl; +} + +static int sparc_setup_msi_irq(struct msi_controller *ctrl, + struct pci_dev *pdev, struct msi_desc *desc) { struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; unsigned int irq; @@ -916,7 +927,7 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) return pbm->setup_msi_irq(&irq, pdev, desc); } -void arch_teardown_msi_irq(unsigned int irq) +static void sparc_teardown_msi_irq(struct msi_controller *ctrl, unsigned int irq) { struct msi_desc *entry = irq_get_msi_desc(irq); struct pci_dev *pdev = entry->dev; @@ -925,6 +936,11 @@ void arch_teardown_msi_irq(unsigned int irq) if (pbm->teardown_msi_irq) pbm->teardown_msi_irq(irq, pdev); } + +struct msi_controller sparc_msi_ctrl = { + .setup_irq = sparc_setup_msi_irq, + .teardown_irq = sparc_teardown_msi_irq, +}; #endif /* !(CONFIG_PCI_MSI) */ static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit) diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h index 75803c7..e02642d 100644 --- a/arch/sparc/kernel/pci_impl.h +++ b/arch/sparc/kernel/pci_impl.h @@ -55,6 +55,8 @@ struct sparc64_msiq_cookie { struct pci_pbm_info *pbm; unsigned long msiqid; }; + +extern struct msi_controller sparc_msi_ctrl; #endif struct pci_pbm_info { @@ -132,6 +134,7 @@ struct pci_pbm_info { void *msi_queues; unsigned long *msi_bitmap; unsigned int *msi_irq_table; + struct msi_controller *msi_ctrl; int (*setup_msi_irq)(unsigned int *irq_p, struct pci_dev *pdev, struct msi_desc *entry); void (*teardown_msi_irq)(unsigned int irq, struct pci_dev *pdev);