Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbbLKS3a (ORCPT ); Fri, 11 Dec 2015 13:29:30 -0500 Received: from mail-bn1on0117.outbound.protection.outlook.com ([157.56.110.117]:55954 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751043AbbLKS1M (ORCPT ); Fri, 11 Dec 2015 13:27:12 -0500 Authentication-Results: spf=permerror (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none;freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; From: "J. German Rivera" To: , , , CC: , , , , , , , , , , , , , , "J. German Rivera" Subject: [PATCH v4 03/11] staging: fsl-mc: Added generic MSI support for FSL-MC devices Date: Fri, 11 Dec 2015 12:09:41 -0600 Message-ID: <1449857389-2506-4-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1449857389-2506-1-git-send-email-German.Rivera@freescale.com> References: <1449857389-2506-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC011;1:FQQNGlGurv927r9LzkPxbbfUuFB9rL76xYcd+B1jI4geDyptMcechYa2cD4BBBojrD1m4x/FqCCfy8REKy0eduKle54J60WQMQwNlBUVu6HoSSXebiFB8T0rNlsCTD2nuziYrYHf8T4oWDCeGYbd4+qeX91pTPLn0FfMl1ItVCXZkKoQ0xk3u7rGT8mlvsr3eF2HSetbO4A2WgZl2MSRsBWKCs1yoawdaZvK/Kyh3mo60uGmeq3ySHz41SrUosN6fSRGJ+owEdM0OnqnYF4/SNzTxCNXvsIkaQcfCLXoU8+FOIDUiUbvgbQGtm09QimgLJiC10+13eOpLmtU3booHIo8zPzl6hQugFEC8B9GGMh+1FFH6/j07INriwhq280h6kdubLh6/QBI/23IaJ51ra8llVW839MkiD6Kp0JQgURa+bxEL/03zpYMSq+kFtt0 X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(448002)(199003)(189002)(47776003)(5003940100001)(189998001)(5001960100002)(50986999)(92566002)(19580395003)(50466002)(48376002)(5001770100001)(107886002)(5008740100001)(36756003)(2950100001)(81156007)(19580405001)(76176999)(229853001)(97736004)(87936001)(77096005)(86362001)(586003)(104016004)(4001430100002)(1220700001)(1096002)(6806005)(2201001)(106466001)(50226001)(11100500001)(85326001)(41533002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR03MB509;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;DM2PR03MB509;2:paf5nk3EzZuwScZwamADy0REeq8IIeprYzv9cZL3j/6okCFj2uZy1O3pMJx7El1pW8QMIm8AfkEjoUWEIqmwmsh9EjcY0Iv47IFaNL2NrVjBwN4W94aEMnLPSFs4BR2qJCZSKqrt9JMbmDrsv/xrjw==;3:9hRR24MLl3ka/yPoSWBK+DbW0B/ldGmDOqI6U4vrKYcDKcyVurImsqJOiJ7C28yx0FcU8+ocaFI3kzfkBLQceGtoylMxSV522XczRJisQyM2Tt2XskaAFb9FAsUlsgPdizsg6+OYixBpk67O5FovshO6R+TA49VUL513qencRxGPfV6hkVHt9O6EKbdzf1BLevgGLKt98ZNpZ0mA4ahLHXDhWgD4fkXLTA9irb4N5P4=;25:MVfZJ39Duy3VO95JVLTVHZBwrVe6f8Sa6a5RnkEwy2MkrpVbmQuypD1hgEHV9xMXxHF0pGJfj72hJ4lkesMchlLvTrDyr0cq537CBAbPOEwYYgwuENUlzf5RcEidlfATwRXE1NwcwStS5uI7Pt4Jj0TBdaYsYCIEzNevvSCTzd0WB13BjphkVffSGFt0Q2vnpH3wjRlL3b5uWT5zPMg9fRiZlD6cuMBTSXljds7nTuQfnwNCDnS46Sgw0QGYvX6j83b6vcubV+SmNczG8pie+w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB509; X-Microsoft-Exchange-Diagnostics: 1;DM2PR03MB509;20:QfjlifeFoRD7Ujw78yQmOGfk3JYBud+iwxvfWOcxcQy88ttLcXrl1ojjlRz9ULXfjQKLGcqhBDBDME6f75dvX7NL08a83JI2EcFQuEoqoxAiDsqIeLKQEKOGucGLzmCXNV8T/OeIsbNgzQ03zQTaIpcwarNzqAMRbKTg2rlr0N5lcDaEXzX5HR3Ba8ZLC4oHAaD1JAfmy+ZZXhfiJKZaBbG1LORCEEFuKKoJCuLohGRP7ZIWrux08nNFkV8XNO3tCCj4sgk0JUsMO6+/MyWC7cW6ETus7CpBNSnP2NLd3S3a3BXPSHlVYcmsNIvPLgv2FqPHSMunQJJ0YZHXBRr8Tm8XTukgw6dDG65nQjEscPk=;4:pJ/Zmk2KvLdroI6BZIsZMqRAyJCQgg3MClsaqcoUc+WO5qu8dtUoYF0XbB3p4tPt0OChV17VhX3MFsfQ2n0EcwjwWZpW3H0gNnD90pQ1yHwYP+NhlZDaBYBIsKgQ/SfVtY1dX5wwuXEKi772pE9XXrqrhpqKfjAOo/39zAwbCszPTiuCDKQqBS4TfdfvmpnuiQT2DyZu05R9g5ymx+kEETDYkORwSpixBK/SdCp9e6HIgzUrwFpinuhcP7ablGfI5QoXZVldvs53ArJoDSMFhIs/+b1xyoC4MNEs6oPGT6z4e+GZuL88Tx+CNRlUsqy0wUozdR3ZAsPk878cbEsrIneV/iXOTF2IU+UylRrOa1f56LSaPCw3s49mxqXzNxr/uFVlHbIwnVvxb4bsPY5GbqJNLK/MSDpPfOqiZCIDEjb3z/TEvx72uSUeOWEZmDvc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046);SRVR:DM2PR03MB509;BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB509; X-Forefront-PRVS: 0787459938 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM2PR03MB509;23:+El7B46fb65wsystx2IuwrXfK75ivnyiY3HrSd5Yvt?= =?us-ascii?Q?1VqrnWADn5mUeCnqk59QGZyC6vVXYeNMcChFMsCgnLocSDGEjv5SQcipK/GD?= =?us-ascii?Q?bkKObYwZvigCHCHH7wOpZimMRoPLIw9vx1l5w3AWFLrAAlV6jc012gjMlguB?= =?us-ascii?Q?UAWsP9OLWx4oufE6nYQzHTrv4j5JKYPWzb8cb9ll3gcyyLDBNI/4jSe+ZtN8?= =?us-ascii?Q?880BKSq69Nbt4d4ogfrcIMheKyRzKXGqwey7rAz2RkRNeYyPkEkbmmAC45wM?= =?us-ascii?Q?8LI+reOZeTsnJn+5IFCVW8UwPSTCZyg0JReQthkdAgLcB0ej4XOMrDajQLiS?= =?us-ascii?Q?HETeJlQH4RcMZn6U+RN4vXWZUJXnrTJhqs5YwP4kc9X1Jj03bOTwdwohpO65?= =?us-ascii?Q?aCJF4FEiXMDhYiUxM7cSTb2kdpaXLxg1UR4QZ9e5ASmhaGMSHcUY4V6k68Iy?= =?us-ascii?Q?S9IZZiDArDSz4DJ/c2YnUtrzv4iYHFZvEW7uY807cJLBjfHxCj9W9yQGDAyc?= =?us-ascii?Q?VRtJoATRshAv91x7ZG4QvS+hy/V7gijc09BF6ks4kl+FwsGYRwNnDNEaGV7h?= =?us-ascii?Q?eQ484ogqunYXTUEYTxwEs94PRh9DgxLQHZVzwA3L0op7j81eCTkx1eiRX4In?= =?us-ascii?Q?u/QUbabaVIxsdU7TaXAQNAAXc2BuYlp5QPuFbUbvHA1saW6xvkFJgeR3/MOU?= =?us-ascii?Q?loDdMmwMkJUxwWc8FjKkiJHqSyF8aWrdql+gw1XiBTx6hVoiOVWhUsO73Qke?= =?us-ascii?Q?Ekj2wgkNqFyt4d2KanKSdeqgQMJ+f0OQ1TcqmYnN4pypChIK+8hrndKnoZEi?= =?us-ascii?Q?n6Hjwtto2MdkiPPYe4xPPAN6UaZVYS+q6/Etfp4Vu3up0uqtel4KNBNXRGyv?= =?us-ascii?Q?84rN8P16f9odzhM0ERqEQVIXH8gEqJI+Toj3zoU14kMYxYQNTLUfXW6kEgvr?= =?us-ascii?Q?/z4T7Ohh5ZV7MosQd1Xo9HRchFPlXuBqsjc6Nhx2+p/x40kjLfCIzOyQeZHP?= =?us-ascii?Q?I5l5Rjjl4oa4S5eySWQUl84ALi4in+JuMryfpjzJOJqqplMasWtAjXfI0GY9?= =?us-ascii?Q?SZcK8=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR03MB509;5:EGgDAhOdTUW1N5YV4m3UtirlChjuPM2XsF2Bw1pl93Utss8B3wcjY20FMcukdWmUVHm2nZUIZP++N1484YhU9cr94VleyW5v/DrwPfFs1lKZE52yD3h+6k78hud4nbpeslvlKmwLAw1xKZLc8gA2sw==;24:+MskXe7amoW7GSa+SlAury7fMRj4/vkfNCQzEifwSL7BK8cfodrIzEaqBWzrSm5ys0epdtY45M/vQNVkT23oNbtB7b8vQ0G/vl+WQKvVO6k= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2015 18:27:08.8194 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB509 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 12489 Lines: 430 Created an MSI domain for the fsl-mc bus-- including functions to create a domain, find a domain, alloc/free domain irqs, and bus specific overrides for domain and irq_chip ops. Signed-off-by: J. German Rivera --- CHANGE HISTORY Changes in v4: - Addressed comments from Marc Zyngier: * Re-implemented fsl_mc_find_msi_domain() using of_msi_get_domain() Changes in v3: - Addressed comments from Marc Zyngier: * Added WARN_ON in fsl_mc_msi_set_desc to check that caller does not set set_desc * Changed type of paddr in irq_cfg to be phys_addr_t * Added WARN_ON in fsl_mc_msi_update_chip_op() to check that caller does not set irq_write_msi_msg Changes in v2: none drivers/staging/fsl-mc/bus/Kconfig | 1 + drivers/staging/fsl-mc/bus/Makefile | 1 + drivers/staging/fsl-mc/bus/mc-msi.c | 276 ++++++++++++++++++++++++++++ drivers/staging/fsl-mc/include/dprc.h | 2 +- drivers/staging/fsl-mc/include/mc-private.h | 17 ++ drivers/staging/fsl-mc/include/mc.h | 17 ++ 6 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/fsl-mc/bus/mc-msi.c diff --git a/drivers/staging/fsl-mc/bus/Kconfig b/drivers/staging/fsl-mc/bus/Kconfig index 0d779d9..c498ac6 100644 --- a/drivers/staging/fsl-mc/bus/Kconfig +++ b/drivers/staging/fsl-mc/bus/Kconfig @@ -9,6 +9,7 @@ config FSL_MC_BUS tristate "Freescale Management Complex (MC) bus driver" depends on OF && ARM64 + select GENERIC_MSI_IRQ_DOMAIN help Driver to enable the bus infrastructure for the Freescale QorIQ Management Complex (fsl-mc). The fsl-mc is a hardware diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile index 25433a9..a5f2ba4 100644 --- a/drivers/staging/fsl-mc/bus/Makefile +++ b/drivers/staging/fsl-mc/bus/Makefile @@ -13,5 +13,6 @@ mc-bus-driver-objs := mc-bus.o \ dpmng.o \ dprc-driver.o \ mc-allocator.o \ + mc-msi.o \ dpmcp.o \ dpbp.o diff --git a/drivers/staging/fsl-mc/bus/mc-msi.c b/drivers/staging/fsl-mc/bus/mc-msi.c new file mode 100644 index 0000000..3a8258f --- /dev/null +++ b/drivers/staging/fsl-mc/bus/mc-msi.c @@ -0,0 +1,276 @@ +/* + * Freescale Management Complex (MC) bus driver MSI support + * + * Copyright (C) 2015 Freescale Semiconductor, Inc. + * Author: German Rivera + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include "../include/mc-private.h" +#include +#include +#include +#include +#include +#include +#include +#include "../include/mc-sys.h" +#include "dprc-cmd.h" + +static void fsl_mc_msi_set_desc(msi_alloc_info_t *arg, + struct msi_desc *desc) +{ + arg->desc = desc; + arg->hwirq = (irq_hw_number_t)desc->fsl_mc.msi_index; +} + +static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info) +{ + struct msi_domain_ops *ops = info->ops; + + if (WARN_ON(!ops)) + return; + + /* + * set_desc should not be set by the caller + */ + if (WARN_ON(ops->set_desc)) + return; + + ops->set_desc = fsl_mc_msi_set_desc; +} + +static void __fsl_mc_msi_write_msg(struct fsl_mc_device *mc_bus_dev, + struct fsl_mc_device_irq *mc_dev_irq) +{ + int error; + struct fsl_mc_device *owner_mc_dev = mc_dev_irq->mc_dev; + struct msi_desc *msi_desc = mc_dev_irq->msi_desc; + struct dprc_irq_cfg irq_cfg; + + /* + * msi_desc->msg.address is 0x0 when this function is invoked in + * the free_irq() code path. In this case, for the MC, we don't + * really need to "unprogram" the MSI, so we just return. + */ + if (msi_desc->msg.address_lo == 0x0 && msi_desc->msg.address_hi == 0x0) + return; + + if (WARN_ON(!owner_mc_dev)) + return; + + irq_cfg.paddr = ((u64)msi_desc->msg.address_hi << 32) | + msi_desc->msg.address_lo; + irq_cfg.val = msi_desc->msg.data; + irq_cfg.user_irq_id = msi_desc->irq; + + if (owner_mc_dev == mc_bus_dev) { + /* + * IRQ is for the mc_bus_dev's DPRC itself + */ + error = dprc_set_irq(mc_bus_dev->mc_io, + MC_CMD_FLAG_INTR_DIS | MC_CMD_FLAG_PRI, + mc_bus_dev->mc_handle, + mc_dev_irq->dev_irq_index, + &irq_cfg); + if (error < 0) { + dev_err(&owner_mc_dev->dev, + "dprc_set_irq() failed: %d\n", error); + } + } else { + /* + * IRQ is for for a child device of mc_bus_dev + */ + error = dprc_set_obj_irq(mc_bus_dev->mc_io, + MC_CMD_FLAG_INTR_DIS | MC_CMD_FLAG_PRI, + mc_bus_dev->mc_handle, + owner_mc_dev->obj_desc.type, + owner_mc_dev->obj_desc.id, + mc_dev_irq->dev_irq_index, + &irq_cfg); + if (error < 0) { + dev_err(&owner_mc_dev->dev, + "dprc_obj_set_irq() failed: %d\n", error); + } + } +} + +/* + * NOTE: This function is invoked with interrupts disabled + */ +static void fsl_mc_msi_write_msg(struct irq_data *irq_data, + struct msi_msg *msg) +{ + struct msi_desc *msi_desc = irq_data_get_msi_desc(irq_data); + struct fsl_mc_device *mc_bus_dev = to_fsl_mc_device(msi_desc->dev); + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + struct fsl_mc_device_irq *mc_dev_irq = + &mc_bus->irq_resources[msi_desc->fsl_mc.msi_index]; + + WARN_ON(mc_dev_irq->msi_desc != msi_desc); + msi_desc->msg = *msg; + + /* + * Program the MSI (paddr, value) pair in the device: + */ + __fsl_mc_msi_write_msg(mc_bus_dev, mc_dev_irq); +} + +static void fsl_mc_msi_update_chip_ops(struct msi_domain_info *info) +{ + struct irq_chip *chip = info->chip; + + if (WARN_ON((!chip))) + return; + + /* + * irq_write_msi_msg should not be set by the caller + */ + if (WARN_ON(chip->irq_write_msi_msg)) + return; + + chip->irq_write_msi_msg = fsl_mc_msi_write_msg; +} + +/** + * fsl_mc_msi_create_irq_domain - Create a fsl-mc MSI interrupt domain + * @np: Optional device-tree node of the interrupt controller + * @info: MSI domain info + * @parent: Parent irq domain + * + * Updates the domain and chip ops and creates a fsl-mc MSI + * interrupt domain. + * + * Returns: + * A domain pointer or NULL in case of failure. + */ +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent) +{ + struct irq_domain *domain; + + if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS) + fsl_mc_msi_update_dom_ops(info); + if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS) + fsl_mc_msi_update_chip_ops(info); + + domain = msi_create_irq_domain(fwnode, info, parent); + if (domain) + domain->bus_token = DOMAIN_BUS_FSL_MC_MSI; + + return domain; +} + +int fsl_mc_find_msi_domain(struct device *mc_platform_dev, + struct irq_domain **mc_msi_domain) +{ + struct irq_domain *msi_domain; + struct device_node *mc_of_node = mc_platform_dev->of_node; + + msi_domain = of_msi_get_domain(mc_platform_dev, mc_of_node, + DOMAIN_BUS_FSL_MC_MSI); + if (!msi_domain) { + pr_err("Unable to find fsl-mc MSI domain for %s\n", + mc_of_node->full_name); + + return -ENOENT; + } + + *mc_msi_domain = msi_domain; + return 0; +} + +static void fsl_mc_msi_free_descs(struct device *dev) +{ + struct msi_desc *desc, *tmp; + + list_for_each_entry_safe(desc, tmp, dev_to_msi_list(dev), list) { + list_del(&desc->list); + free_msi_entry(desc); + } +} + +static int fsl_mc_msi_alloc_descs(struct device *dev, unsigned int irq_count) + +{ + unsigned int i; + int error; + struct msi_desc *msi_desc; + + for (i = 0; i < irq_count; i++) { + msi_desc = alloc_msi_entry(dev); + if (!msi_desc) { + dev_err(dev, "Failed to allocate msi entry\n"); + error = -ENOMEM; + goto cleanup_msi_descs; + } + + msi_desc->fsl_mc.msi_index = i; + msi_desc->nvec_used = 1; + INIT_LIST_HEAD(&msi_desc->list); + list_add_tail(&msi_desc->list, dev_to_msi_list(dev)); + } + + return 0; + +cleanup_msi_descs: + fsl_mc_msi_free_descs(dev); + return error; +} + +int fsl_mc_msi_domain_alloc_irqs(struct device *dev, + unsigned int irq_count) +{ + struct irq_domain *msi_domain; + int error; + + if (WARN_ON(!list_empty(dev_to_msi_list(dev)))) + return -EINVAL; + + error = fsl_mc_msi_alloc_descs(dev, irq_count); + if (error < 0) + return error; + + msi_domain = dev_get_msi_domain(dev); + if (WARN_ON(!msi_domain)) { + error = -EINVAL; + goto cleanup_msi_descs; + } + + /* + * NOTE: Calling this function will trigger the invocation of the + * its_fsl_mc_msi_prepare() callback + */ + error = msi_domain_alloc_irqs(msi_domain, dev, irq_count); + + if (error) { + dev_err(dev, "Failed to allocate IRQs\n"); + goto cleanup_msi_descs; + } + + return 0; + +cleanup_msi_descs: + fsl_mc_msi_free_descs(dev); + return error; +} + +void fsl_mc_msi_domain_free_irqs(struct device *dev) +{ + struct irq_domain *msi_domain; + + msi_domain = dev_get_msi_domain(dev); + if (WARN_ON(!msi_domain)) + return; + + msi_domain_free_irqs(msi_domain, dev); + + if (WARN_ON(list_empty(dev_to_msi_list(dev)))) + return; + + fsl_mc_msi_free_descs(dev); +} diff --git a/drivers/staging/fsl-mc/include/dprc.h b/drivers/staging/fsl-mc/include/dprc.h index c3152f6..94c4927 100644 --- a/drivers/staging/fsl-mc/include/dprc.h +++ b/drivers/staging/fsl-mc/include/dprc.h @@ -176,7 +176,7 @@ int dprc_reset_container(struct fsl_mc_io *mc_io, * @user_irq_id: A user defined number associated with this IRQ */ struct dprc_irq_cfg { - u64 paddr; + phys_addr_t paddr; u32 val; int user_irq_id; }; diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index c706f77..36b418c 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -26,6 +26,9 @@ strcmp(_obj_type, "dpmcp") == 0 || \ strcmp(_obj_type, "dpcon") == 0) +struct irq_domain; +struct msi_domain_info; + /** * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device * @root_mc_bus_dev: MC object device representing the root DPRC @@ -79,11 +82,13 @@ struct fsl_mc_resource_pool { * @resource_pools: array of resource pools (one pool per resource type) * for this MC bus. These resources represent allocatable entities * from the physical DPRC. + * @irq_resources: Pointer to array of IRQ objects for the IRQ pool * @scan_mutex: Serializes bus scanning */ struct fsl_mc_bus { struct fsl_mc_device mc_dev; struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES]; + struct fsl_mc_device_irq *irq_resources; struct mutex scan_mutex; /* serializes bus scanning */ }; @@ -116,4 +121,16 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus, void fsl_mc_resource_free(struct fsl_mc_resource *resource); +struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode, + struct msi_domain_info *info, + struct irq_domain *parent); + +int fsl_mc_find_msi_domain(struct device *mc_platform_dev, + struct irq_domain **mc_msi_domain); + +int fsl_mc_msi_domain_alloc_irqs(struct device *dev, + unsigned int irq_count); + +void fsl_mc_msi_domain_free_irqs(struct device *dev); + #endif /* _FSL_MC_PRIVATE_H_ */ diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index a933291..1c1d6ae 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -104,6 +104,23 @@ struct fsl_mc_resource { }; /** + * struct fsl_mc_device_irq - MC object device message-based interrupt + * @msi_desc: pointer to MSI descriptor allocated by fsl_mc_msi_alloc_descs() + * @mc_dev: MC object device that owns this interrupt + * @dev_irq_index: device-relative IRQ index + * @resource: MC generic resource associated with the interrupt + */ +struct fsl_mc_device_irq { + struct msi_desc *msi_desc; + struct fsl_mc_device *mc_dev; + u8 dev_irq_index; + struct fsl_mc_resource resource; +}; + +#define to_fsl_mc_irq(_mc_resource) \ + container_of(_mc_resource, struct fsl_mc_device_irq, resource) + +/** * Bit masks for a MC object device (struct fsl_mc_device) flags */ #define FSL_MC_IS_DPRC 0x0001 -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/