diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2013-03-05 16:12:37 -0500 |
---|---|---|
committer | Michael Ellerman <michael@ellerman.id.au> | 2013-04-17 23:03:59 -0400 |
commit | fb1b55d654a7038ca6337fbf55839a308c9bc1a7 (patch) | |
tree | 00d57b0dedb5aac0c6ef7c4e5ebc69fb4c43f17c /arch/powerpc/platforms/powernv/pci-ioda.c | |
parent | 2a3563b023e5f99e1ec48b66b4caeac94584e7c7 (diff) |
powerpc/powernv: Use MSI bitmap to manage IRQs
As Michael Ellerman mentioned, arch/powerpc/sysdev/msi_bitmap.c
already implemented bitmap to manage (alloc/free) MSI interrupts.
The patch intends to use that mechanism to manage MSI interrupts
for PowerNV platform.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 8e90e8906df3..a5c5f15242ba 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
27 | #include <asm/pci-bridge.h> | 27 | #include <asm/pci-bridge.h> |
28 | #include <asm/machdep.h> | 28 | #include <asm/machdep.h> |
29 | #include <asm/msi_bitmap.h> | ||
29 | #include <asm/ppc-pci.h> | 30 | #include <asm/ppc-pci.h> |
30 | #include <asm/opal.h> | 31 | #include <asm/opal.h> |
31 | #include <asm/iommu.h> | 32 | #include <asm/iommu.h> |
@@ -647,7 +648,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
647 | 648 | ||
648 | static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) | 649 | static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) |
649 | { | 650 | { |
650 | unsigned int bmap_size; | 651 | unsigned int count; |
651 | const __be32 *prop = of_get_property(phb->hose->dn, | 652 | const __be32 *prop = of_get_property(phb->hose->dn, |
652 | "ibm,opal-msi-ranges", NULL); | 653 | "ibm,opal-msi-ranges", NULL); |
653 | if (!prop) { | 654 | if (!prop) { |
@@ -658,18 +659,17 @@ static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) | |||
658 | return; | 659 | return; |
659 | 660 | ||
660 | phb->msi_base = be32_to_cpup(prop); | 661 | phb->msi_base = be32_to_cpup(prop); |
661 | phb->msi_count = be32_to_cpup(prop + 1); | 662 | count = be32_to_cpup(prop + 1); |
662 | bmap_size = BITS_TO_LONGS(phb->msi_count) * sizeof(unsigned long); | 663 | if (msi_bitmap_alloc(&phb->msi_bmp, count, phb->hose->dn)) { |
663 | phb->msi_map = zalloc_maybe_bootmem(bmap_size, GFP_KERNEL); | ||
664 | if (!phb->msi_map) { | ||
665 | pr_err("PCI %d: Failed to allocate MSI bitmap !\n", | 664 | pr_err("PCI %d: Failed to allocate MSI bitmap !\n", |
666 | phb->hose->global_number); | 665 | phb->hose->global_number); |
667 | return; | 666 | return; |
668 | } | 667 | } |
668 | |||
669 | phb->msi_setup = pnv_pci_ioda_msi_setup; | 669 | phb->msi_setup = pnv_pci_ioda_msi_setup; |
670 | phb->msi32_support = 1; | 670 | phb->msi32_support = 1; |
671 | pr_info(" Allocated bitmap for %d MSIs (base IRQ 0x%x)\n", | 671 | pr_info(" Allocated bitmap for %d MSIs (base IRQ 0x%x)\n", |
672 | phb->msi_count, phb->msi_base); | 672 | count, phb->msi_base); |
673 | } | 673 | } |
674 | #else | 674 | #else |
675 | static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { } | 675 | static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { } |