From: Michael Ellerman <michael@ellerman.id.au>
To: Li Yang <leoli@freescale.com>
Cc: linuxppc-dev@ozlabs.org, Zhao Chenhui <b26998@freescale.com>
Subject: Re: [PATCH 2/4] fsl_msi: enable msi allocation in all banks
Date: Mon, 19 Apr 2010 12:46:21 +1000 [thread overview]
Message-ID: <1271645181.14835.46.camel@concordia> (raw)
In-Reply-To: <1271403278-30091-2-git-send-email-leoli@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 2316 bytes --]
On Fri, 2010-04-16 at 15:34 +0800, Li Yang wrote:
> From: Zhao Chenhui <b26998@freescale.com>
>
> Put all fsl_msi banks in a linked list. The list of banks then can be
> traversed when allocating new msi interrupts.
So there are multiple banks, and you just use the first one that has an
empty slot in it's bitmap?
> Signed-off-by: Zhao Chenhui <b26998@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/sysdev/fsl_msi.c | 29 ++++++++++++++++++++++-------
> arch/powerpc/sysdev/fsl_msi.h | 2 ++
> 2 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index 716862f..c46db75 100644
> --- a/arch/powerpc/sysdev/fsl_msi.c
> +++ b/arch/powerpc/sysdev/fsl_msi.c
> @@ -24,6 +24,8 @@
> #include <asm/mpic.h>
> #include "fsl_msi.h"
>
> +LIST_HEAD(msi_head);
> +
> struct fsl_msi_feature {
> u32 fsl_pic_ip;
> u32 msiir_offset;
> @@ -143,15 +145,26 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
> struct msi_msg msg;
> struct fsl_msi *msi_data;
>
> + if (list_empty(&msi_head)) {
> + pr_debug("%s: msi init error\n", __func__);
> + rc = -EFAULT;
> + goto out_free;
> + }
If there's an error probing then fsl_setup_msi_irqs() should not be
installed as ppc_md.setup_msi_irqs(), and this code should never run.
ie. You shouldn't need this check.
> +
> list_for_each_entry(entry, &pdev->msi_list, list) {
> - msi_data = get_irq_chip_data(entry->irq);
>
> - hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
> - if (hwirq < 0) {
> - rc = hwirq;
> - pr_debug("%s: fail allocating msi interrupt\n",
> - __func__);
> - goto out_free;
> + list_for_each_entry(msi_data, &msi_head, list) {
> +
> + hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
> + if (hwirq >= 0)
> + break;
> +
> + if (list_is_last(&msi_data->list, &msi_head)) {
> + rc = hwirq;
> + pr_debug("%s: fail allocating msi interrupt\n",
> + __func__);
> + goto out_free;
> + }
You could make this cleaner by pulling the inner loop into a separate
function, and when you fall off the end of the list you return < 0. That
would avoid needing the list_is_last() check.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2010-04-19 2:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 7:34 [PATCH 1/4] fsl_msi: fix the conflict of virt_msir's chip_data Li Yang
2010-04-16 7:34 ` [PATCH 2/4] fsl_msi: enable msi allocation in all banks Li Yang
2010-04-16 7:34 ` [PATCH 3/4] fsl_msi: enable msi sharing through AMP OSes Li Yang
2010-04-16 7:34 ` [PATCH 4/4] mpc8572ds: change camp dtses for MSI sharing Li Yang
2010-04-19 2:34 ` [PATCH 3/4] fsl_msi: enable msi sharing through AMP OSes Michael Ellerman
2010-04-19 6:23 ` Li Yang
2010-04-19 2:46 ` Michael Ellerman [this message]
2010-04-19 6:46 ` [PATCH 2/4] fsl_msi: enable msi allocation in all banks Li Yang
2010-04-19 2:40 ` [PATCH 1/4] fsl_msi: fix the conflict of virt_msir's chip_data Michael Ellerman
2010-04-19 4:50 ` Li Yang
2010-04-19 12:19 ` Kumar Gala
2010-04-20 3:10 ` Li Yang
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=1271645181.14835.46.camel@concordia \
--to=michael@ellerman.id.au \
--cc=b26998@freescale.com \
--cc=leoli@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).