From patchwork Thu Sep 25 03:14:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 37896 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6685620063 for ; Thu, 25 Sep 2014 02:54:36 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id s18sf5967918lam.9 for ; Wed, 24 Sep 2014 19:54:35 -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:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=5oh5Pjp4DB8baccHrbCYpqtlYuDBdf7IWM7WE/ZhVfU=; b=J+WjdZ81xzcxMXumgRftwmv8nkScxwRJQTO3UfSRtoVpwAWyScwpRyWh45WKTAuzJs LG9854/a2dhjnaK1vJEjx8y33i+sehrsrBrvE351z2lEiyvcHuwCobwRIJsr51oJ5h3m Ask6bj5Nvm7xyn5/liTcEOUfq7jHupxRRniK5UZ4oMySqLSWezh6krdGEW327Xhypy24 LJVaN7pdytVyUZl/g7kPy6mYIgLkdsxtMeNbifyqcg3uQSt0HOX+hO3obk5U2Ju8t5t8 ONRox3MccLleK8adoxrxFggXpgtRwVvpCTGLQurx+0cukRkKkaFJfDhRKH68CzPASXNF ZYVw== X-Gm-Message-State: ALoCoQluTJ3BMFmPbR2g1hzKsHsvILKe0YghoLREXByNt5f811IcFHYIN4OPN51PIDQm33rON0rv X-Received: by 10.180.24.225 with SMTP id x1mr2087289wif.2.1411613675163; Wed, 24 Sep 2014 19:54:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.225 with SMTP id w1ls248390lag.2.gmail; Wed, 24 Sep 2014 19:54:34 -0700 (PDT) X-Received: by 10.152.29.129 with SMTP id k1mr10059692lah.81.1411613674870; Wed, 24 Sep 2014 19:54:34 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id q5si1101816laq.60.2014.09.24.19.54.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 19:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gi9so1510642lab.3 for ; Wed, 24 Sep 2014 19:54:34 -0700 (PDT) X-Received: by 10.152.45.42 with SMTP id j10mr117462lam.91.1411613674812; Wed, 24 Sep 2014 19:54:34 -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 of9csp683448lbb; Wed, 24 Sep 2014 19:54:34 -0700 (PDT) X-Received: by 10.220.74.195 with SMTP id v3mr8884077vcj.23.1411613673657; Wed, 24 Sep 2014 19:54:33 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p9si502629vct.65.2014.09.24.19.54.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Sep 2014 19:54:33 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XWzBI-0004TS-Fp; Thu, 25 Sep 2014 02:53:20 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XWzBH-0004TG-Cp for xen-devel@lists.xenproject.org; Thu, 25 Sep 2014 02:53:19 +0000 Received: from [85.158.143.35:49038] by server-3.bemta-4.messagelabs.com id 9C/40-06192-E9383245; Thu, 25 Sep 2014 02:53:18 +0000 X-Env-Sender: wangyijing@huawei.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1411613593!13067717!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32057 invoked from network); 25 Sep 2014 02:53:17 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-9.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 25 Sep 2014 02:53:17 -0000 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 AUU79113; 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:29 +0800 From: Yijing Wang To: Bjorn Helgaas Date: Thu, 25 Sep 2014 11:14:17 +0800 Message-ID: <1411614872-4009-8-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.0A020205.542382FF.00C0, 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: f03f4d276105395a2d8ef970737e7cb2 Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-pci@vger.kernel.org, Bharat.Bhushan@freescale.com, Yijing Wang , Thierry Reding , sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Russell King , Michael Ellerman , Joerg Roedel , x86@kernel.org, Sebastian Ott , Benjamin Herrenschmidt , xen-devel@lists.xenproject.org, arnab.basu@freescale.com, Arnd Bergmann , Chris Metcalf , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Xinwei Hu , Tony Luck , Sergei Shtylyov , linux-kernel@vger.kernel.org, Ralf Baechle , iommu@lists.linux-foundation.org, David Vrabel , Wuyun , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , Lucas Stach Subject: [Xen-devel] [PATCH v2 07/22] PCI/MSI: Refactor struct msi_chip to make it become more common X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.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.44 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-Archive: Now there are a lot of __weak arch functions in MSI code. These functions make MSI driver complex. Thierry Reding Introduced a new MSI chip framework to configure MSI/MSI-X irq in ARM. Use the new MSI chip framework to refactor all other platform MSI arch code to eliminate weak arch MSI functions. This patch add .restore_irq() and .setup_irqs() to make it become more common. Signed-off-by: Yijing Wang Reviewed-by: Lucas Stach --- drivers/pci/msi.c | 15 +++++++++++++++ include/linux/msi.h | 3 +++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 3acbe65..d10edee 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -64,6 +64,11 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { struct msi_desc *entry; int ret; + struct msi_chip *chip; + + chip = arch_find_msi_chip(dev); + if (chip && chip->setup_irqs) + return chip->setup_irqs(dev, nvec, type); /* * If an architecture wants to support multiple MSI, it needs to @@ -106,6 +111,11 @@ void default_teardown_msi_irqs(struct pci_dev *dev) void __weak arch_teardown_msi_irqs(struct pci_dev *dev) { + struct msi_chip *chip = arch_find_msi_chip(dev); + + if (chip && chip->teardown_irqs) + return chip->teardown_irqs(dev); + return default_teardown_msi_irqs(dev); } @@ -129,6 +139,11 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq) void __weak arch_restore_msi_irqs(struct pci_dev *dev) { + struct msi_chip *chip = arch_find_msi_chip(dev); + + if (chip && chip->restore_irqs) + return chip->restore_irqs(dev); + return default_restore_msi_irqs(dev); } diff --git a/include/linux/msi.h b/include/linux/msi.h index 6fdc5c6..4cf1f31 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -69,7 +69,10 @@ struct msi_chip { struct list_head list; int (*setup_irq)(struct pci_dev *dev, struct msi_desc *desc); + int (*setup_irqs)(struct pci_dev *dev, int nvec, int type); void (*teardown_irq)(unsigned int irq); + void (*teardown_irqs)(struct pci_dev *dev); + void (*restore_irqs)(struct pci_dev *dev); }; #endif /* LINUX_MSI_H */