Skip to content

Commit

Permalink
powerpc/fsl_msi: enable msi allocation in all banks
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
  • Loading branch information
Li Yang authored and Kumar Gala committed May 25, 2010
1 parent 02adac6 commit 694a7a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions arch/powerpc/sysdev/fsl_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <asm/mpic.h>
#include "fsl_msi.h"

LIST_HEAD(msi_head);

struct fsl_msi_feature {
u32 fsl_pic_ip;
u32 msiir_offset;
Expand Down Expand Up @@ -138,16 +140,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",
Expand All @@ -173,6 +178,7 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
return 0;

out_free:
/* free by the caller of this function */
return rc;
}

Expand Down Expand Up @@ -337,6 +343,8 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
}
}

list_add_tail(&msi->list, &msi_head);

/* The multiple setting ppc_md.setup_msi_irqs will not harm things */
if (!ppc_md.setup_msi_irqs) {
ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/sysdev/fsl_msi.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ struct fsl_msi {
u32 feature;

struct msi_bitmap bitmap;

struct list_head list; /* support multiple MSI banks */
};

#endif /* _POWERPC_SYSDEV_FSL_MSI_H */
Expand Down

0 comments on commit 694a7a3

Please sign in to comment.