From patchwork Sat Jul 26 03:08:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 34332 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 287DD235AB for ; Sat, 26 Jul 2014 02:45:36 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lf10sf35034344pab.1 for ; Fri, 25 Jul 2014 19:45: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: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=nYD3Bsma+iXzquNS/yrd/Ojup5/BbYrHJ92XemKFiC4=; b=F5JUo87/L5uBN9z4P+LZbh63AkMcb3Aib0bLsODf6iBs1hmIKPyM1qD8ld2RuzTVud lPJek8e5VvdqgezmbvAXYLEW/+7Xa8T4wsS3YWuJcVTudJCe/jQgzyyMjRIETVwGHxt0 jaQ+Y0/d+YZT89BooNTtU5wdgXAMIz5p7y5S9hwbn9QarQp86b3IUu+V1zDdGFvHHw1x FDysH3UB5tWjPheYi0zspbw1kFu0ZcZp22YADyPca6mrw0HtHoRiuz1KH0Waw3CtPXA+ Wq6IhKW+/z8eyPqZyJnsBKrc62y9KPV82362QkS4e6pt0TVT83JEbVl1wVZszQgE8vcJ pDog== X-Gm-Message-State: ALoCoQn5tig4b6d+VqZTuayilLw9cAgAaDZndPMCNht8rvPyW7qmSbf66+qxEMTxz/PwyWj8WNV/ X-Received: by 10.68.236.129 with SMTP id uu1mr9843838pbc.1.1406342735461; Fri, 25 Jul 2014 19:45:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.198 with SMTP id h64ls1405407qgf.66.gmail; Fri, 25 Jul 2014 19:45:35 -0700 (PDT) X-Received: by 10.140.40.165 with SMTP id x34mr32486532qgx.23.1406342735247; Fri, 25 Jul 2014 19:45:35 -0700 (PDT) Received: from mail-qg0-f42.google.com (mail-qg0-f42.google.com [209.85.192.42]) by mx.google.com with ESMTPS id s59si19231433qge.98.2014.07.25.19.45.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Jul 2014 19:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.192.42 as permitted sender) client-ip=209.85.192.42; Received: by mail-qg0-f42.google.com with SMTP id j5so5964928qga.15 for ; Fri, 25 Jul 2014 19:45:35 -0700 (PDT) X-Received: by 10.224.60.137 with SMTP id p9mr34572000qah.70.1406342735121; Fri, 25 Jul 2014 19:45:35 -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.96.16.166 with SMTP id h6csp70397qdd; Fri, 25 Jul 2014 19:45:34 -0700 (PDT) X-Received: by 10.68.191.34 with SMTP id gv2mr23037868pbc.13.1406342734254; Fri, 25 Jul 2014 19:45:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ul9si10965432pbc.40.2014.07.25.19.45.33 for ; Fri, 25 Jul 2014 19:45:34 -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 S1761087AbaGZCoO (ORCPT + 15 others); Fri, 25 Jul 2014 22:44:14 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:45751 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754093AbaGZCnv (ORCPT ); Fri, 25 Jul 2014 22:43:51 -0400 Received: from 172.24.2.119 (EHLO szxeml419-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BZG09042; Sat, 26 Jul 2014 10:43:48 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml419-hub.china.huawei.com (10.82.67.158) with Microsoft SMTP Server id 14.3.158.1; Sat, 26 Jul 2014 10:43:35 +0800 From: Yijing Wang To: CC: Xinwei Hu , Wuyun , "Bjorn Helgaas" , , , "James E.J. Bottomley" , "Marc Zyngier" , , Russell King , , , , Hanjun Guo , Yijing Wang Subject: [RFC PATCH 08/11] PCI/MSI: Introduce new struct msi_irqs and struct msi_ops Date: Sat, 26 Jul 2014 11:08:45 +0800 Message-ID: <1406344128-27055-9-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1406344128-27055-1-git-send-email-wangyijing@huawei.com> References: <1406344128-27055-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.192.42 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: , Currently, MSI driver is bonding with PCI everywhere. Now introduce a new struct msi_irqs to manage all MSI related informations in a MSI support device. In addition, we introduce struct msi_ops to hook all device specific MSI operations. Then MSI driver can be decoupled with PCI. Signed-off-by: Yijing Wang --- include/linux/msi.h | 30 +++++++++++++++++++++++++++++- include/linux/pci.h | 7 +------ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/include/linux/msi.h b/include/linux/msi.h index 3ad8416..5a672d3 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -10,6 +10,34 @@ struct msi_msg { u32 data; /* 16 bits of msi message data */ }; +struct msi_ops; + +struct msi_irqs { + u8 msi_enabled:1; + u8 msix_enabled:1; + int node; + struct list_head msi_list; + void *data; + struct msi_ops *ops; +}; + +struct msix_entry { + u32 vector; /* kernel uses to write allocated vector */ + u16 entry; /* driver uses to specify entry, OS writes */ +}; + +struct msi_ops { + void (*msi_set_enable)(struct msi_irqs *msi, int enable, int type); + struct msi_desc *(*msi_setup_entry)(struct msi_irqs *msi); + int (*msix_setup_entries)(struct msi_irqs *msi, void __iomem *base, + struct msix_entry *entries, int nvec); + u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag); + u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag); + void (*msi_read_message)(struct msi_desc *desc, struct msi_msg *msg); + void (*msi_write_message)(struct msi_desc *desc, struct msi_msg *msg); + void (*msi_set_intx)(struct msi_irqs *msi, int enable); +}; + /* Helper functions */ struct irq_data; struct msi_desc; @@ -42,7 +70,7 @@ struct msi_desc { void __iomem *mask_base; u8 mask_pos; }; - struct pci_dev *dev; + struct msi_irqs *msi; /* Last set MSI message */ struct msi_msg msg; diff --git a/include/linux/pci.h b/include/linux/pci.h index c6c01ae..c7bca1c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -32,8 +32,8 @@ #include #include - #include + /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded @@ -1182,11 +1182,6 @@ enum pci_dma_burst_strategy { strategy_parameter byte boundaries */ }; -struct msix_entry { - u32 vector; /* kernel uses to write allocated vector */ - u16 entry; /* driver uses to specify entry, OS writes */ -}; - #ifdef CONFIG_PCI_MSI int pci_msi_vec_count(struct pci_dev *dev);