lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <562F27AB.1010307@linux.intel.com>
Date:	Tue, 27 Oct 2015 15:28:43 +0800
From:	Jiang Liu <jiang.liu@...ux.intel.com>
To:	"J. German Rivera" <German.Rivera@...escale.com>,
	gregkh@...uxfoundation.org, arnd@...db.de,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc:	stuart.yoder@...escale.com, itai.katz@...escale.com,
	lijun.pan@...escale.com, leoli@...escale.com,
	scottwood@...escale.com, agraf@...e.de, bhamciu1@...escale.com,
	R89243@...escale.com, bhupesh.sharma@...escale.com,
	nir.erez@...escale.com, richard.schmitt@...escale.com,
	dan.carpenter@...cle.com, marc.zyngier@....com
Subject: Re: [PATCH 02/10] staging: fsl-mc: Added generic MSI support for
 FSL-MC devices

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@...escale.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ