Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256137 > unrolled thread

[PATCH 00/10] staging: fsl-mc: MC bus MSI support

Started by"J. German Rivera" <German.Rivera@freescale.com>
First post2015-10-26 17:10 +0100
Last post2015-10-27 11:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/10] staging: fsl-mc: MC bus MSI support "J. German Rivera" <German.Rivera@freescale.com> - 2015-10-26 17:10 +0100
    Re: [PATCH 02/10] staging: fsl-mc: Added generic MSI support for  FSL-MC devices Jiang Liu <jiang.liu@linux.intel.com> - 2015-10-27 08:30 +0100
    Re: [PATCH 08/10] staging: fsl-mc: Fixed bug in dprc_probe() error  path Dan Carpenter <dan.carpenter@oracle.com> - 2015-10-27 11:10 +0100

#1256137 — [PATCH 00/10] staging: fsl-mc: MC bus MSI support

From"J. German Rivera" <German.Rivera@freescale.com>
Date2015-10-26 17:10 +0100
Subject[PATCH 00/10] staging: fsl-mc: MC bus MSI support
Message-ID<qnSvo-1WC-11@gated-at.bofh.it>
This patch series addresses the following item from the TODO list
for the MC bus driver to exit staging:

* Interrupt support. For meaningful driver support we need
  interrupts, and thus need message interrupt support by the bus
  driver.

MC Bus MSI Support Architecture
===============================
A new IRQ domain bus token is added for the FSL-MC bus.
An MSI IRQ domain is created for each top-level (root) data-path
resource container (DPRC), based on its msi-parent in the device
tree (which is the GIC-ITS). Child DPRCs inherit the MSI IRQ
domain form their parent DPRC.

MC Bus MSI Allocation
---------------------
Given the way in which the GIC-ITS works, we need to pre-allocate
a block of MSIs in the GIC-ITS for the IRQs of all the DPAA2 objects
in the same data-path resource container (DPRC) and for the IRQ of
the DPRC iself.

This is due to the fact that all the IRQs for DPAA2 objects in the
same DPRC (and the DPRC's own IRQ) must use the same "device Id" in
the GIC-ITS. Thus, all these IRQs must share the same ITT table in
the GIC-ITS, and therefore must be allocated in the GIC-ITS as
a block of MSIs for the same "device Id".

This is because all the DPAA2 objects in the same DPRC (and the
DPRC itself) use the DPRC's SMMU stream ID as their device Id for
the GIC-ITS.
The DPAA2 Management Complex (MC) firmware does not assign a separate
SMMU stream ID to each DPAA2 object. The MC only assigns SMMU stream
IDs to DPRCs. In MC terms, the stream ID assigned to a DPRC is known
as the DPRC's Isolation Context ID (ICID).

As a consequence of having to pre-allocate a block of MSIs in
the GIC-ITS, the object allocator of the MC bus driver needs to be
extended to provide IRQ allocation services to DPAA2 device drivers
and to the DPRC driver. For a given DPAA2 object, MSIs are allocated
from the corresponding DPRC's pool of pre-allocated MSIs. The MSI
for the DPRC itself is also allocated from this pool.

The following are the patches in this series:

Patch 1: Added domain bus token DOMAIN_BUS_FSL_MC_MSI
Patch 2: Added generic MSI support for FSL-MC devices
Patch 3: Added GICv3-ITS support for FSL-MC MSIs
Patch 4: Extended MC bus allocator to include IRQs
Patch 5: Changed DPRC built-in portal's mc_io to be atomic
Patch 6: Populate the IRQ pool for an MC bus instance
Patch 7: Set MSI domain for DPRC objects
Patch 8: Fixed bug in dprc_probe() error path
Patch 9: Added DPRC interrupt handler
Patch 10: Added MSI support to the MC bus driver

--
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/

[toc] | [next] | [standalone]


#1256527 — Re: [PATCH 02/10] staging: fsl-mc: Added generic MSI support for FSL-MC devices

FromJiang Liu <jiang.liu@linux.intel.com>
Date2015-10-27 08:30 +0100
SubjectRe: [PATCH 02/10] staging: fsl-mc: Added generic MSI support for FSL-MC devices
Message-ID<qo6RH-2ld-3@gated-at.bofh.it>
In reply to#1256137
On 2015/10/26 23:49, J. German Rivera wrote:
> 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 <German.Rivera@freescale.com>
> ---
>  drivers/staging/fsl-mc/bus/Kconfig          |   1 +
>  drivers/staging/fsl-mc/bus/Makefile         |   1 +
>  drivers/staging/fsl-mc/bus/mc-msi.c         | 278 ++++++++++++++++++++++++++++
>  drivers/staging/fsl-mc/include/mc-private.h |  17 ++
>  drivers/staging/fsl-mc/include/mc.h         |  17 ++
>  5 files changed, 314 insertions(+)
>  create mode 100644 drivers/staging/fsl-mc/bus/mc-msi.c
> 
<snit>

> +
> +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->msi_attrib.is_msix = 1;
> +		msi_desc->msi_attrib.is_64 = 1;
> +		msi_desc->msi_attrib.entry_nr = i;

Hi Rivera,
	Field msi_desc->msi_attrib is for PCI MSI only, it would be better to
introduce a dedicated structure for FSL-MC, just like
struct platform_msi_desc.
Thanks,
Gerry

> +		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;
> +}
> +
<snit>
--
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/

[toc] | [prev] | [next] | [standalone]


#1256647 — Re: [PATCH 08/10] staging: fsl-mc: Fixed bug in dprc_probe() error path

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-10-27 11:10 +0100
SubjectRe: [PATCH 08/10] staging: fsl-mc: Fixed bug in dprc_probe() error path
Message-ID<qo9mz-3Vk-11@gated-at.bofh.it>
In reply to#1256137
On Mon, Oct 26, 2015 at 10:49:19AM -0500, J. German Rivera wrote:
> -error_cleanup_open:
> +dprc_scan_container_error:
>  	(void)dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);

The error label was better in the original code.  A "goto
error_cleanup_open", that tells you what the goto does.  "goto
dprc_scan_container_error" tells you nothing because you can see from
the line before that there was a container error.  No new information.
It's just like a function name tells you what a function does.  You
wouldn't name the function called_from_main().

regards,
dan carpenter

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web