From: Jiang Liu <jiang.liu@linux.intel.com>
To: "J. German Rivera" <German.Rivera@freescale.com>,
gregkh@linuxfoundation.org, arnd@arndb.de,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: stuart.yoder@freescale.com, itai.katz@freescale.com,
lijun.pan@freescale.com, leoli@freescale.com,
scottwood@freescale.com, agraf@suse.de, bhamciu1@freescale.com,
R89243@freescale.com, bhupesh.sharma@freescale.com,
nir.erez@freescale.com, richard.schmitt@freescale.com,
dan.carpenter@oracle.com, marc.zyngier@arm.com
Subject: Re: [PATCH 02/10] staging: fsl-mc: Added generic MSI support for FSL-MC devices
Date: Tue, 27 Oct 2015 15:28:43 +0800 [thread overview]
Message-ID: <562F27AB.1010307@linux.intel.com> (raw)
In-Reply-To: <1445874561-14761-3-git-send-email-German.Rivera@freescale.com>
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>
next prev parent reply other threads:[~2015-10-27 7:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 15:49 [PATCH 00/10] staging: fsl-mc: MC bus MSI support J. German Rivera
2015-10-26 15:49 ` [PATCH 01/10] irqdomain: Added domain bus token DOMAIN_BUS_FSL_MC_MSI J. German Rivera
2015-10-26 15:49 ` [PATCH 02/10] staging: fsl-mc: Added generic MSI support for FSL-MC devices J. German Rivera
2015-10-27 7:28 ` Jiang Liu [this message]
2015-10-26 15:49 ` [PATCH 03/10] staging: fsl-mc: Added GICv3-ITS support for FSL-MC MSIs J. German Rivera
2015-10-26 15:49 ` [PATCH 04/10] staging: fsl-mc: Extended MC bus allocator to include IRQs J. German Rivera
2015-10-26 15:49 ` [PATCH 05/10] staging: fsl-mc: Changed DPRC built-in portal's mc_io to be atomic J. German Rivera
2015-10-26 15:49 ` [PATCH 06/10] staging: fsl-mc: Populate the IRQ pool for an MC bus instance J. German Rivera
2015-10-26 15:49 ` [PATCH 07/10] staging: fsl-mc: set MSI domain for DPRC objects J. German Rivera
2015-10-26 15:49 ` [PATCH 08/10] staging: fsl-mc: Fixed bug in dprc_probe() error path J. German Rivera
2015-10-27 10:04 ` Dan Carpenter
2015-10-26 15:49 ` [PATCH 09/10] staging: fsl-mc: Added DPRC interrupt handler J. German Rivera
2015-10-26 15:49 ` [PATCH 10/10] staging: fsl-mc: Added MSI support to the MC bus driver J. German Rivera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=562F27AB.1010307@linux.intel.com \
--to=jiang.liu@linux.intel.com \
--cc=German.Rivera@freescale.com \
--cc=R89243@freescale.com \
--cc=agraf@suse.de \
--cc=arnd@arndb.de \
--cc=bhamciu1@freescale.com \
--cc=bhupesh.sharma@freescale.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=itai.katz@freescale.com \
--cc=leoli@freescale.com \
--cc=lijun.pan@freescale.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=nir.erez@freescale.com \
--cc=richard.schmitt@freescale.com \
--cc=scottwood@freescale.com \
--cc=stuart.yoder@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.