linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Li Yang <leoli@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, Zhao Chenhui <b26998@freescale.com>
Subject: Re: [PATCH v2 2/5] fsl_msi: enable msi allocation in all banks
Date: Tue, 20 Apr 2010 22:23:22 +1000	[thread overview]
Message-ID: <1271766202.4324.5.camel@concordia> (raw)
In-Reply-To: <1271766048-19272-2-git-send-email-leoli@freescale.com>

[-- Attachment #1: Type: text/plain, Size: 2444 bytes --]

On Tue, 2010-04-20 at 20:20 +0800, Li Yang wrote:
> Put all fsl_msi banks in a linked list. The list of banks then can be
> traversed when allocating new msi interrupts.  Also fix failing path
> of fsl_setup_msi_irqs().
> 
> Signed-off-by: Zhao Chenhui <b26998@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
>  arch/powerpc/sysdev/fsl_msi.c |   16 +++++++++++++---
>  arch/powerpc/sysdev/fsl_msi.h |    2 ++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index 93a638a..712f934 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;
> @@ -137,16 +139,19 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq,
>  
>  static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
>  {
> -	int rc, hwirq = NO_IRQ;
> +	int rc, hwirq = -ENOMEM;
>  	unsigned int virq;
>  	struct msi_desc *entry;
>  	struct msi_msg msg;
>  	struct fsl_msi *msi_data;
>  
>  	list_for_each_entry(entry, &pdev->msi_list, list) {
> -		msi_data = get_irq_chip_data(entry->irq);
> +		list_for_each_entry(msi_data, &msi_head, list) {
> +			hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
> +			if (hwirq >= 0)
> +				break;
> +		}
>  
> -		hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
>  		if (hwirq < 0) {
>  			rc = hwirq;
>  			pr_debug("%s: fail allocating msi interrupt\n",
> @@ -160,6 +165,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
>  			pr_debug("%s: fail mapping hwirq 0x%x\n",
>  					__func__, hwirq);
>  			msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1);
> +			irq_dispose_mapping(virq);

No, you're in the body of this if because virq == NO_IRQ, so you don't
need to dispose of the mapping - there is no mapping. Unless the
out-of-context code has changed from what I'm looking at.


> @@ -172,6 +178,8 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
>  	return 0;
>  
>  out_free:
> +	/* free MSI interrupt already allocated */
> +	fsl_teardown_msi_irqs(pdev);

You don't need to do this. The generic code (drivers/pci/msi.c) always
calls teardown if setup fails.

cheers


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

      parent reply	other threads:[~2010-04-20 12:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 12:20 [PATCH v2 1/5] fsl_msi: fix the conflict of virt_msir's chip_data Li Yang
2010-04-20 12:20 ` [PATCH v2 2/5] fsl_msi: enable msi allocation in all banks Li Yang
2010-04-20 12:20   ` [PATCH v2 3/5] fsl_msi: enable msi sharing through AMP OSes Li Yang
2010-04-20 12:20     ` [PATCH v2 4/5] mpc8572ds: change camp dtses for MSI sharing Li Yang
2010-04-20 12:20       ` [PATCH v2 5/5] fsl_msi: add remove path and probe failing path Li Yang
2010-04-20 12:23   ` Michael Ellerman [this message]

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=1271766202.4324.5.camel@concordia \
    --to=michael@ellerman.id.au \
    --cc=b26998@freescale.com \
    --cc=leoli@freescale.com \
    --cc=linuxppc-dev@lists.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).