From patchwork Wed Oct 15 03:07:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 38737 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42BA620973 for ; Wed, 15 Oct 2014 02:27:16 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id h11sf265835wiw.11 for ; Tue, 14 Oct 2014 19:27:15 -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=mt6C8yJkIN4EEQxbv8HlBPd5+VavABsGoM713g8Q8ss=; b=BMU6hY03eHbNeRLtkLdvymMr9Bv+gjJXgDOFMFlNjl/9CEwm58wjzvgOnN/TnptPMh m5ArPTc+ipU5zBStI7Dvcdz4myQjZ6h/WvCTmlulxrGNaTVuu7/n8aJoQfSo2NAzYOFW vVhNOupZeTAxTKHWyAYfeN9Z71QsaJxgRL2VvfZFtjjobiB2MTQ6+/ZbTaf3vF7bVBvT JXcGlqP0ot4XYT7roTafJIn8I9Hixx+Yo53u5azH+Gea0gjICgn0+qhyGTnqVoRpKxJw NJx3Lof2BmcrUHOUDQwo5FfiJNnmqisCq0SEfku8piUAcVaa8YD6DO5cTK0ilnu3Os6p eOkA== X-Gm-Message-State: ALoCoQlKLwpschHkNz6YM3npTIc9NpnoTDAqPoGNQO5SGT8RVwRmwpNEDnVDPQLeoLvFDPi2/lje X-Received: by 10.112.62.226 with SMTP id b2mr1522886lbs.0.1413340035455; Tue, 14 Oct 2014 19:27:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.108 with SMTP id lf12ls7251lac.48.gmail; Tue, 14 Oct 2014 19:27:14 -0700 (PDT) X-Received: by 10.152.5.201 with SMTP id u9mr9239799lau.24.1413340034795; Tue, 14 Oct 2014 19:27:14 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by mx.google.com with ESMTPS id qe5si28772420lbb.6.2014.10.14.19.27.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 19:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id u10so258524lbd.1 for ; Tue, 14 Oct 2014 19:27:14 -0700 (PDT) X-Received: by 10.152.28.227 with SMTP id e3mr9319784lah.54.1413340034361; Tue, 14 Oct 2014 19:27:14 -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 c5csp517377lbz; Tue, 14 Oct 2014 19:27:13 -0700 (PDT) X-Received: by 10.66.180.166 with SMTP id dp6mr8824420pac.101.1413340032819; Tue, 14 Oct 2014 19:27:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wu4si12653866pbc.19.2014.10.14.19.27.12 for ; Tue, 14 Oct 2014 19:27:12 -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 S932902AbaJOC1I (ORCPT + 27 others); Tue, 14 Oct 2014 22:27:08 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:13815 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932820AbaJOC00 (ORCPT ); Tue, 14 Oct 2014 22:26:26 -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 CCW43228; 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:26:00 +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 25/27] Sparc/MSI: Use MSI chip framework to configure MSI/MSI-X irq Date: Wed, 15 Oct 2014 11:07:13 +0800 Message-ID: <1413342435-7876-26-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.217.170 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 Acked-by: David S. Miller --- arch/sparc/kernel/pci.c | 14 ++++++++++++-- arch/sparc/kernel/pci_impl.h | 12 ++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index b36365f..a46a148 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_chip = &sparc_msi_chip; +#endif pci_add_resource_offset(&resources, &pbm->io_space, pbm->io_space.start); pci_add_resource_offset(&resources, &pbm->mem_space, @@ -905,7 +908,8 @@ 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) +static int sparc_setup_msi_irq(struct msi_chip *chip, + struct pci_dev *pdev, struct msi_desc *desc) { struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; unsigned int irq; @@ -916,7 +920,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_chip *chip, unsigned int irq) { struct msi_desc *entry = irq_get_msi_desc(irq); struct pci_dev *pdev = entry->dev; @@ -925,6 +929,12 @@ void arch_teardown_msi_irq(unsigned int irq) if (pbm->teardown_msi_irq) pbm->teardown_msi_irq(irq, pdev); } + +struct msi_chip sparc_msi_chip = { + .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..073bb4e 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_chip sparc_msi_chip; #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_chip *msi_chip; 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); @@ -153,6 +156,15 @@ struct pci_pbm_info { int numa_node; }; +#ifdef CONFIG_PCI_MSI +static inline struct msi_chip *pci_msi_chip(struct pci_bus *bus) +{ + struct pci_pbm_info *pbm = bus->sysdata; + + return pbm->msi_chip; +} +#endif + extern struct pci_pbm_info *pci_pbm_root; extern int pci_num_pbms;