From patchwork Tue Aug 12 07:26:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 35242 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D9E2F203C5 for ; Tue, 12 Aug 2014 07:08:43 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id h136sf38003097oig.8 for ; Tue, 12 Aug 2014 00:08:43 -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=+61erxGeXqXbXMEMBdkgGmKavAbFFVnSK4OlJJNmkXI=; b=YE/aoNXC55m/IeP5ap2/5xI7kuKFQUGlEioKM+rxmEGtSxKuFmT7noSm8Qht2bZVS8 LxuhgGPuRG+oZc4d1TZv+phNHbXXsA40Z+5UYeY349vPnHkwYhky/wOtGuFJM6O+TkW7 H1euv8hUf9qnwZNkKEHr4vodigdgKwsxXVqxDsD9Wj+2qKq070jYrhhAHjC1xeNqwQQe xFVU8M+zRyDgsalRC/9RVeNyUBsJYov7MtkPPSD8ygSwPA4LPooQ0Uf5LAvJRfqGJtsT kfrVihhrEpe4RBupPuOVkzL9AaHjWj0jf0gNPWP/L4FY1O9drNB4rHOULL1oN+tSAMPK +84g== X-Gm-Message-State: ALoCoQmY2sfwzOu3sXuMIp130NhVZVotomxBl5pTsFr3ccnezGZMWwjDK1hu/n8rVgjo7SSqo5Lb X-Received: by 10.182.135.194 with SMTP id pu2mr1490674obb.35.1407827323440; Tue, 12 Aug 2014 00:08:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.247 with SMTP id h110ls7698qgf.66.gmail; Tue, 12 Aug 2014 00:08:43 -0700 (PDT) X-Received: by 10.52.106.198 with SMTP id gw6mr22133551vdb.23.1407827323349; Tue, 12 Aug 2014 00:08:43 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id yw7si7750690vdb.63.2014.08.12.00.08.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 00:08:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so12813409vcb.35 for ; Tue, 12 Aug 2014 00:08:43 -0700 (PDT) X-Received: by 10.52.245.66 with SMTP id xm2mr22053471vdc.36.1407827323245; Tue, 12 Aug 2014 00:08:43 -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.221.37.5 with SMTP id tc5csp224825vcb; Tue, 12 Aug 2014 00:08:42 -0700 (PDT) X-Received: by 10.70.119.2 with SMTP id kq2mr2683117pdb.66.1407827322190; Tue, 12 Aug 2014 00:08:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fo3si15340920pbb.76.2014.08.12.00.08.41 for ; Tue, 12 Aug 2014 00:08:42 -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 S1752981AbaHLHDC (ORCPT + 26 others); Tue, 12 Aug 2014 03:03:02 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:64736 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750699AbaHLHC5 (ORCPT ); Tue, 12 Aug 2014 03:02:57 -0400 Received: from 172.24.2.119 (EHLO szxeml421-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id ASY16057; Tue, 12 Aug 2014 15:02:40 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Tue, 12 Aug 2014 15:02:33 +0800 From: Yijing Wang To: Bjorn Helgaas CC: , Xinwei Hu , Wuyun , , Marc Zyngier , , Russell King , , , "Arnd Bergmann" , Thomas Gleixner , "H. Peter Anvin" , Konrad Rzeszutek Wilk , , Joerg Roedel , , , "Benjamin Herrenschmidt" , , , Sebastian Ott , "Tony Luck" , , "David S. Miller" , , Chris Metcalf , Yijing Wang Subject: [RFC PATCH 07/20] x86/MSI: Use msi_chip instead of arch func to configure MSI/MSI-X Date: Tue, 12 Aug 2014 15:26:00 +0800 Message-ID: <1407828373-24322-8-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1407828373-24322-1-git-send-email-wangyijing@huawei.com> References: <1407828373-24322-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.53E9BC13.0082,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: 29901a774a85544d3193390c049337ac 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.220.176 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 a new struct msi_chip apic_msi_chip instead of weak arch functions to configure MSI/MSI-X in x86. Signed-off-by: Yijing Wang --- arch/x86/include/asm/pci.h | 1 + arch/x86/kernel/apic/io_apic.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 0892ea0..878a06d 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -101,6 +101,7 @@ void native_teardown_msi_irq(unsigned int irq); void native_restore_msi_irqs(struct pci_dev *dev); int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, unsigned int irq_base, unsigned int irq_offset); +extern struct msi_chip *x86_msi_chip; #else #define native_setup_msi_irqs NULL #define native_teardown_msi_irq NULL diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 2609dcd..eb8ab7c 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -3077,24 +3077,25 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, return 0; } -int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) +int native_setup_msi_irqs(struct device *dev, int nvec, int type) { struct msi_desc *msidesc; unsigned int irq; int node, ret; + struct pci_dev *pdev = to_pci_dev(dev); /* Multiple MSI vectors only supported with interrupt remapping */ if (type == PCI_CAP_ID_MSI && nvec > 1) return 1; - node = dev_to_node(&dev->dev); + node = dev_to_node(dev); - list_for_each_entry(msidesc, &dev->msi_list, list) { + list_for_each_entry(msidesc, &pdev->msi_list, list) { irq = irq_alloc_hwirq(node); if (!irq) return -ENOSPC; - ret = setup_msi_irq(dev, msidesc, irq, 0); + ret = setup_msi_irq(pdev, msidesc, irq, 0); if (ret < 0) { irq_free_hwirq(irq); return ret; @@ -3214,6 +3215,17 @@ int default_setup_hpet_msi(unsigned int irq, unsigned int id) } #endif +struct msi_chip apic_msi_chip = { + .setup_irqs = native_setup_msi_irqs, + .teardown_irq = native_teardown_msi_irq, +}; + +struct msi_chip *arch_get_match_msi_chip(struct device *dev) +{ + return x86_msi_chip; +} + +struct msi_chip *x86_msi_chip = &apic_msi_chip; #endif /* CONFIG_PCI_MSI */ /* * Hypertransport interrupt support