From patchwork Thu Sep 25 03:14:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 37893 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42BDD20063 for ; Thu, 25 Sep 2014 02:54:18 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ho1sf4150812wib.8 for ; Wed, 24 Sep 2014 19:54:17 -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=OwxVYTksLcCDT15qvXajafLiBgYERccuXus3nJGV1Rg=; b=Fzul3yLK+AIqCTRxjjdKnwRNU4ndvuW5qYK8QQ9lRZXN4huMdBxMADo29hgxd4Ta0U U1tznRjYcavr9pLRHEWlnSU9VLseAfPC/XyfKlkYcSqWqGJ1X48hilhJzCrZmVRIIype S79ckj2CLna4yv2moWi06GeJFkUwsiY5GFUFDMZpj7POLtkPPBUUHALqF+Qlg/jnjf+O 1Ci1tEwF6ZxD0fcakAa+uz3tSpIoLCsF1m4fWnqjTP2nzJpLUlKsQICT+PdYv0IM8B7s +tA9OK3c4w9AzrdT1g24UYoFNs8bENnuEF1R9z+R668YCyhUmxuxmOWfgENp4N150enp oLlQ== X-Gm-Message-State: ALoCoQmgE77Cl7gnErjlXrVRvkVkSUhn5eaYsHBhSRmNJRIrB5VFU/Yt3jP7vCPsU7JAeNw+lr4k X-Received: by 10.194.87.35 with SMTP id u3mr1609664wjz.3.1411613657419; Wed, 24 Sep 2014 19:54:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.132 with SMTP id ay4ls221173lab.46.gmail; Wed, 24 Sep 2014 19:54:16 -0700 (PDT) X-Received: by 10.112.144.228 with SMTP id sp4mr9865594lbb.54.1411613656970; Wed, 24 Sep 2014 19:54:16 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx.google.com with ESMTPS id g1si1077851lam.75.2014.09.24.19.54.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 19:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id q1so107437lam.21 for ; Wed, 24 Sep 2014 19:54:16 -0700 (PDT) X-Received: by 10.152.8.9 with SMTP id n9mr10353052laa.2.1411613656869; Wed, 24 Sep 2014 19:54:16 -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.130.169 with SMTP id of9csp683426lbb; Wed, 24 Sep 2014 19:54:16 -0700 (PDT) X-Received: by 10.68.242.161 with SMTP id wr1mr897465pbc.167.1411613655345; Wed, 24 Sep 2014 19:54:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id on3si1344470pbc.29.2014.09.24.19.54.13 for ; Wed, 24 Sep 2014 19:54:15 -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 S1752749AbaIYCu5 (ORCPT + 27 others); Wed, 24 Sep 2014 22:50:57 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:61830 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751301AbaIYCut (ORCPT ); Wed, 24 Sep 2014 22:50:49 -0400 Received: from 172.24.2.119 (EHLO szxeml409-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AUU79112; Thu, 25 Sep 2014 10:50:39 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml409-hub.china.huawei.com (10.82.67.136) with Microsoft SMTP Server id 14.3.158.1; Thu, 25 Sep 2014 10:50:28 +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" , Yijing Wang Subject: [PATCH v2 06/22] PCI/MSI: Introduce weak arch_find_msi_chip() to find MSI chip Date: Thu, 25 Sep 2014 11:14:16 +0800 Message-ID: <1411614872-4009-7-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1411614872-4009-1-git-send-email-wangyijing@huawei.com> References: <1411614872-4009-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.0A020206.542382FF.0090, 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: 079da15a8780c72d4e5415871c966941 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.48 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: , Introduce weak arch_find_msi_chip() to find the match msi_chip. Currently, MSI chip associates pci bus to msi_chip. Because in ARM platform, there may be more than one MSI controller in system. Associate pci bus to msi_chip help pci device to find the match msi_chip and setup MSI/MSI-X irq correctly. But in other platform, like in x86. we only need one MSI chip, because all device use the same MSI address/data and irq etc. So it's no need to associate pci bus to MSI chip, just use a arch function, arch_find_msi_chip() to return the MSI chip for simplicity. The default weak arch_find_msi_chip() used in ARM platform, find the MSI chip by pci bus. Signed-off-by: Yijing Wang --- drivers/pci/msi.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 5f8f3af..3acbe65 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -29,9 +29,14 @@ static int pci_msi_enable = 1; /* Arch hooks */ +struct msi_chip * __weak arch_find_msi_chip(struct pci_dev *dev) +{ + return dev->bus->msi; +} + int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) { - struct msi_chip *chip = dev->bus->msi; + struct msi_chip *chip = arch_find_msi_chip(dev); int err; if (!chip || !chip->setup_irq)