Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932763AbbKXWsd (ORCPT ); Tue, 24 Nov 2015 17:48:33 -0500 Received: from mail-bl2on0146.outbound.protection.outlook.com ([65.55.169.146]:41328 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932429AbbKXWsR (ORCPT ); Tue, 24 Nov 2015 17:48:17 -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 RESEND v3 03/11] staging: fsl-mc: Added generic MSI support for FSL-MC devices Date: Tue, 24 Nov 2015 16:31:16 -0600 Message-ID: <1448404284-22258-4-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1448404284-22258-1-git-send-email-German.Rivera@freescale.com> References: <1448404284-22258-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD024;1:SIPL55lT0bjXqQGNDCuwy4byiag8wkgiDm7IaqFYaUgKDYeHp+qnowN3eXPyzgV1iZs/c32A13wbE6UVqy1FoQiLDe27GDxI72dU5Df5/IVfSNX3m9Pozt7WI4O7ETKsBPH8xRXE8wQmuSB3qowBt0hFhAyoj57Y6hekiv1NoVNfVxkCnF1epDN7OKt5emy21z2kVgz6P0PQPOoCeC+7+fvbpx/CuC1sjodxxNv6GIEF94dpJt/Ko3s/JM3u2LkJAVb+6IGVXlMdUUma5moLltf+cUtKVwwHp8Tm6zbJjLo8ZE8hOSc8T6Zjla7VmVEjDomB+YXsJfDqlDQi7pWDTvCFn+LgrJkVGYEW/7HVWlCrrxSpkV3xfPbZ7SAvxqGhqwK9XS3szkS6C4V0ES3Nt3h9y17ugSZBxEnNiLUKlRJ1Q5nMgmyFiW1EhIA4fjFicqKhEAOZq6mj/ITqhz28qw== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(448002)(3190300001)(189002)(199003)(586003)(5003940100001)(2201001)(50226001)(50986999)(104016004)(47776003)(36756003)(5008740100001)(189998001)(87936001)(6806005)(4001430100002)(76176999)(5001960100002)(229853001)(107886002)(92566002)(2950100001)(106466001)(77096005)(19580395003)(97736004)(85326001)(81156007)(48376002)(5001770100001)(5007970100001)(86362001)(11100500001)(19580405001)(50466002)(41533002)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1304;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1304;2:q0dbPyfQnvkZ+w77GNCHG96s2l1jmwlkvQFtU2J5Fowb2ZMuACbc35rgOR6MIppP1aGf8cy/cAI4h73QxhOHj0YrX67S65toSrpgEHfpfOPEg6tq7ImwfKnceVOUdL3jX8ubx4V/Nhi/0IEoML+s0A==;3:SkB9z73R1xmspb36it/N3THdrxJ59qLhPmW0h3NmgoYnJ8r2gBlr/HHhdFbBl3WT6QnCkMo3fcZbjxN18T340MQxvg4J0f7pQin41G2PIHyn3qs7eZC83GYplfOy3rXb+1JGa/0w6RvPJ3mels8WuCyZPhH578JsdyLbnjZSdbk/ddvsca0vMuL0kT9lTTQDioz6tTD9MUFaHBzpzaSG392pHDVflcDAI8c60ZuzIfM=;25:B7WhM5oOdiBZwfT8VDQ9qt8Qm2RmblO3JvtOYcTLb71gw5zQYVuLUhOixHjv/bSE1yF4TaTsgYcP/Vq3lG3uZEMKTB+BQWjNaDqXjbJ7LAZC4giAWDrRcBIrHKPSMRRbsgS5d/MI19UDbTOAXkrLIigF9j4yAZci+DjJaC6PqMgUimZ8mrVBbElI03IQNMQ1bOzO2Tec4PevSuHpz8schWsYrntvYvZ7VeXmfJy0bS5edMffeY8umIlDTv0lMNfY+r84jBM5vL2kxXgwjUE84w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1304; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1304;20:+zlBMp76hB5eoQ6FaP9jl1DAH9YPsvGcteLLaBkTMVrtlhtG/VTnwDfk2eO42NkfZ7tw08hdWuXX5POmD5I9371L9Dyq69FO7H9Rk73KjQ2tfAxZnkmptk8p0sh5a/mQSnuPi3DNI0HByrj7MUPGAPHTarjHfJx0dr1ptOTt+5uadKUr4KXr/8HqcFeWV0IPf1/lT5tV9jQs4iHcItDEPLXqas7uodnjY9haed5BtoIsbCx7LASjSOZYwRpe3tEYGsoaphGw9GFR7Cs2Wc9m3KW2Q3Nu6EO4diuK8jrRVREh0iRORzoG96JJ+yDfWoBzZCVZs70sp4BeGNNSSnYTWboLqu6uqlBKMb294NQ3HjA=;4:6u98YngdhU4H6CY6ZPl2gJZZhbtdn+v3S5wMTQWXW1c1CHl3+40fa89AJA/snP/hdWZPTKrNt1hRaD4DrqJlq34sDIursJPl7R3MznvQgNfvD5GEoY+9Z2WJC4EpSLVE2YAEmuyU2tJoIBeYQdaYvQswo6/cG6k+zS52f72u+zGsj2Hefj8karpuQbXVohqoDE2y9vw/to7fjTlpdLP2wO7ux13d3nzwIxisc/Zt506IAu02mq0EQYlV/0O2rQvkW3FlzTLR1/zpQ4jFXt+2O+cU4JxByy8CtfgCpFigvLyRPyGJIU924+TLFhMsXfpDss2KPQr4Y8I1MDyTOHOHWNQCaChXVh9n15EKFYMa94yQ2QLNI9t/HErI0E+NgnEGKztyZC1c3DtmBpgORdOG/VMKFrmIgw8qJLl2nfkQMDXoDOuUUn5e0SYlQKK6GAtI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046);SRVR:BY1PR0301MB1304;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1304; X-Forefront-PRVS: 0770F75EA9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1304;23:2IGO9O3KsbIqGoaJs4BPmR6ODfmFeAH4auhJQkB?= =?us-ascii?Q?OGyhpEPI5f0nsCA+LxHS2kuJqTNeczPfqNOG/pFgJt9d+lK2aKXhiq3W6gP9?= =?us-ascii?Q?Zc/gP30d8EoqXQ5m2IiW6sSYkBr+eCjdkBWy+hVePCJjHWUc60douFBdXxFt?= =?us-ascii?Q?uVETyd6dL6KTGEZ7BseRCtfmyVIaYlORJu7w7P5jGBBQd3Nf0xRWMfOyl4U5?= =?us-ascii?Q?n6xzOY2yUPbw94WAs8fVqbLTABEqoHNmQBEG7lwIPTPHNRyJMiRfmzVgcv6o?= =?us-ascii?Q?cfBDEIhD3AfjYlxlRQz3Ix+2G1OqU5egraOgRfmtHjtLNS5RsteM5ybg1YSb?= =?us-ascii?Q?Sf3KhQSm5bySgKl5XBh+4/9H8T8JhJQvp1iEnh872V7LkvnUh5NnMCzg7en+?= =?us-ascii?Q?LQt+ycKH+iedFeHJA7F0XlPdUg4tLdczI0Q17d0csRJ5cODPKAz9y1IH68iL?= =?us-ascii?Q?yNhFj9NcW7kLiwCUn3QDyK9dSe7D6+M+g6HAt58YuVIUXJ8MlZqXUrVbtexj?= =?us-ascii?Q?fXywuWmsNvoEICRx+hLicPaSIEOFAt7d5YNWTgmtMLqCx+BKocbV/XY29mld?= =?us-ascii?Q?hkOsQRrxf0eOmRI4ckLMP5IwGhPW9861DVdx2Ca44ufIc2G8brsZpgdzMpCp?= =?us-ascii?Q?CeyiKU5fVIiflFWSD+lyFBiraboi4v/Rtj5J+ixdctGBvLVxCLb+wmvejoPg?= =?us-ascii?Q?nJORSJq//MajxpFPfL4eFrdEbzPXMONX/VXVb7TlESGJ07QzdJoVrf3AXbnq?= =?us-ascii?Q?7k7LSIQAA093Guw2w6SHwR33t+MFWRtJcpJKhb8ua4d3voClD8MFbz632U0U?= =?us-ascii?Q?7WXyyWTLqL1NqysCDz6DjGUCBddHlsSZLpBbJAKj3iv4c+4xbC0k/zgKfmec?= =?us-ascii?Q?DvGttO8/g05/RC5/UflMSJSDq4oySt66Z97E4lY8PtW2eGw2oNXAJT06SXE6?= =?us-ascii?Q?lvEuWfsscuI8zNK7ZR9klKey5d7jWudEtiTvnnrWTvDdH4dfLjqSdD3ZxrvQ?= =?us-ascii?Q?MRVqwdYiHeBEYGB17EMP9bi2DBSRHzzwZJGsxb6RNfpUC/CG8GXjOVN4Lnjg?= =?us-ascii?Q?dUydTZKFWDEGawOGMXsNvuJEb0e9lcYcLh0jjbazpn5MFnlHxdw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1304;5:jAtgBbhFm4CCHNOQUJWvZH0+BukDeOjkyjv3gagKX7UwQG2P8lkRCzU3rm8FgHzESGIIT+T/waEj/61hzWuzZmN3zRksBbDzYoTsCJdl6PM27/r958PuPE8XJNRieWeRnYc1Em4GSV9xWzyyYmNlbQ==;24:t9YWMaiTsfa7h/L+sCQiAvn3k4C0IdBExUxbiZp8x7Am+FSJnro0ZUoGZK3/DOZSPonmm/uJMq7tfNJEDCRNA3JbUQoHrz8NYjoJCigPeFo= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 22:48:02.8868 (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: BY1PR0301MB1304 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 12553 Lines: 435 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 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 | 285 ++++++++++++++++++++++++++++ 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, 322 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..d6ac465 --- /dev/null +++ b/drivers/staging/fsl-mc/bus/mc-msi.c @@ -0,0 +1,285 @@ +/* + * 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/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_node *mc_of_node, + struct irq_domain **mc_msi_domain) +{ + struct device_node *msi_parent_node; + struct irq_domain *msi_domain; + + msi_parent_node = of_parse_phandle(mc_of_node, "msi-parent", 0); + if (!msi_parent_node) { + pr_err("msi-parent phandle missing for %s\n", + mc_of_node->full_name); + return -ENOENT; + } + + /* + * Look up the fsl-mc MSI domain: + */ + msi_domain = irq_find_matching_host(msi_parent_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..0b294d4 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_node *mc_of_node, + 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/