From patchwork Mon Oct 27 13:22:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 39618 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 73F742118A for ; Mon, 27 Oct 2014 12:43:51 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf1330252lbi.6 for ; Mon, 27 Oct 2014 05:43:50 -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=gsOg0wTs/tLWIKl/A1StDDOwiZQfJMVHSNLGxwGFG9w=; b=jP5VEXQU0YcpWmO99QuHPcxNzsRND5CoZPMCZv2T6qmUMJHw7FJw8jmYzOf6uTdFEQ nV0c3ZtzmHkp6eU7tD424Qj2C1zEdFA8zgGVuZ5MrWeWXWqugvan82Id6im803i5V4I9 uLiULfMxiYjybyFDQHSALb9emIPzWeAb7tRMeKl5niBi+dS7bb85qmOrrgd5+s0eS2KP Z3LGdhO9ThLlmAJ0FyK4o/CtYWoykvcFtpoGBq5oqLu4MRB3XAVz2/PQ+8syqP31TauE JE++976nAp7S6UEhjkieAMUBVELrl3Dd/4Zbfsiarzkfczo7zyB26zZALg0SRmfDzqd3 2mRw== X-Gm-Message-State: ALoCoQkYZ919zYD3doKkaz/ia2QV+i0hdJmSIlq7cg3pywKFUaQf89az2M3+tk97vS0QJoVkgVbY X-Received: by 10.194.206.10 with SMTP id lk10mr603164wjc.3.1414413830237; Mon, 27 Oct 2014 05:43:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.4 with SMTP id ls4ls611742lac.37.gmail; Mon, 27 Oct 2014 05:43:50 -0700 (PDT) X-Received: by 10.112.77.129 with SMTP id s1mr23969975lbw.36.1414413830006; Mon, 27 Oct 2014 05:43:50 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id s10si19811701lal.38.2014.10.27.05.43.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 05:43:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id s18so5837676lam.9 for ; Mon, 27 Oct 2014 05:43:49 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr23457683lah.56.1414413829769; Mon, 27 Oct 2014 05:43:49 -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 c5csp281925lbz; Mon, 27 Oct 2014 05:43:48 -0700 (PDT) X-Received: by 10.70.87.201 with SMTP id ba9mr2911683pdb.124.1414413828148; Mon, 27 Oct 2014 05:43:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si6665941pde.245.2014.10.27.05.43.47 for ; Mon, 27 Oct 2014 05:43:48 -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 S1753040AbaJ0MmE (ORCPT + 26 others); Mon, 27 Oct 2014 08:42:04 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:28068 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751993AbaJ0Mlm (ORCPT ); Mon, 27 Oct 2014 08:41:42 -0400 Received: from 172.24.2.119 (EHLO szxeml404-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CBJ49232; Mon, 27 Oct 2014 20:41:30 +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:18 +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 03/16] x86/xen/MSI: Use MSI controller framework to configure MSI/MSI-X irq Date: Mon, 27 Oct 2014 21:22:09 +0800 Message-ID: <1414416142-31239-4-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 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.50 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 CC: David Vrabel CC: Konrad Rzeszutek Wilk --- arch/x86/pci/xen.c | 45 +++++++++++++++++++++++++++------------------ 1 files changed, 27 insertions(+), 18 deletions(-) diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c index 466b978..83d8d50 100644 --- a/arch/x86/pci/xen.c +++ b/arch/x86/pci/xen.c @@ -157,7 +157,8 @@ static int acpi_register_gsi_xen(struct device *dev, u32 gsi, struct xen_pci_frontend_ops *xen_pci_frontend; EXPORT_SYMBOL_GPL(xen_pci_frontend); -static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) +static int xen_setup_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev, int nvec, int type) { int irq, ret, i; struct msi_desc *msidesc; @@ -219,7 +220,8 @@ static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq, msg->data = XEN_PIRQ_MSI_DATA; } -static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) +static int xen_hvm_setup_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev, int nvec, int type) { int irq, pirq; struct msi_desc *msidesc; @@ -267,7 +269,8 @@ error: #ifdef CONFIG_XEN_DOM0 static bool __read_mostly pci_seg_supported = true; -static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) +static int xen_initdom_setup_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev, int nvec, int type) { int ret = 0; struct msi_desc *msidesc; @@ -349,7 +352,8 @@ out: return ret; } -static void xen_initdom_restore_msi_irqs(struct pci_dev *dev) +static void xen_initdom_restore_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev) { int ret = 0; @@ -376,7 +380,13 @@ static void xen_initdom_restore_msi_irqs(struct pci_dev *dev) } #endif -static void xen_teardown_msi_irqs(struct pci_dev *dev) +static void xen_teardown_msi_irq(struct msi_controller *ctrl, unsigned int irq) +{ + xen_destroy_irq(irq); +} + +static void xen_teardown_msi_irqs(struct msi_controller *ctrl, + struct pci_dev *dev) { struct msi_desc *msidesc; @@ -390,11 +400,7 @@ static void xen_teardown_msi_irqs(struct pci_dev *dev) default_teardown_msi_irqs(dev); } -static void xen_teardown_msi_irq(unsigned int irq) -{ - xen_destroy_irq(irq); -} - +struct msi_controller xen_msi_ctrl; #endif int __init pci_xen_init(void) @@ -415,9 +421,10 @@ int __init pci_xen_init(void) #endif #ifdef CONFIG_PCI_MSI - x86_msi.setup_msi_irqs = xen_setup_msi_irqs; - x86_msi.teardown_msi_irq = xen_teardown_msi_irq; - x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs; + xen_msi_ctrl.setup_irqs = xen_setup_msi_irqs; + xen_msi_ctrl.teardown_irq = xen_teardown_msi_irq; + xen_msi_ctrl.teardown_irqs = xen_teardown_msi_irqs; + x86_msi_ctrl = &xen_msi_ctrl; pci_msi_ignore_mask = 1; #endif return 0; @@ -437,8 +444,9 @@ int __init pci_xen_hvm_init(void) #endif #ifdef CONFIG_PCI_MSI - x86_msi.setup_msi_irqs = xen_hvm_setup_msi_irqs; - x86_msi.teardown_msi_irq = xen_teardown_msi_irq; + xen_msi_ctrl.setup_irqs = xen_hvm_setup_msi_irqs; + xen_msi_ctrl.teardown_irq = xen_teardown_msi_irq; + x86_msi_ctrl = &xen_msi_ctrl; #endif return 0; } @@ -495,9 +503,10 @@ int __init pci_xen_initial_domain(void) int irq; #ifdef CONFIG_PCI_MSI - x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs; - x86_msi.teardown_msi_irq = xen_teardown_msi_irq; - x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs; + xen_msi_ctrl.setup_irqs = xen_initdom_setup_msi_irqs; + xen_msi_ctrl.teardown_irq = xen_teardown_msi_irq; + xen_msi_ctrl.restore_irqs = xen_initdom_restore_msi_irqs; + x86_msi_ctrl = &xen_msi_ctrl; pci_msi_ignore_mask = 1; #endif xen_setup_acpi_sci();