Thread (9 messages) flat view 9 messages, 2 authors, 2015-03-13
STALE4201d

[PATCH 2/4 RFC] fsl/msi: Move fsl, msi mode specific MSI device search out of main loop

From: Bharat Bhushan <hidden>
Date: 2015-03-03 05:43:29
Subsystem: linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

Moving out the specific MSI device search out of main loop. And now
the specific msi device search is placed with other "fsl.msi" specific
code in same function.
This is in preparation to MSI bank partitioning.

Signed-off-by: Bharat Bhushan <redacted>
---
 arch/powerpc/sysdev/fsl_msi.c | 39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index ec3161b..32ba1e3 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -178,7 +178,8 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	unsigned int virq;
 	struct msi_desc *entry;
 	struct msi_msg msg;
-	struct fsl_msi *msi_data;
+	struct fsl_msi *msi_data = NULL;
+	bool specific_msi_bank = false;
 
 	if (type == PCI_CAP_ID_MSIX)
 		pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
@@ -199,12 +200,9 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 				hose->dn->full_name, np->phandle);
 			return -EINVAL;
 		}
-	}
-
-	list_for_each_entry(entry, &pdev->msi_list, list) {
 		/*
-		 * Loop over all the MSI devices until we find one that has an
-		 * available interrupt.
+		 * Loop over all the MSI devices till we find
+		 * specific MSI device.
 		 */
 		list_for_each_entry(msi_data, &msi_head, list) {
 			/*
@@ -215,12 +213,33 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 			 * has the additional benefit of skipping over MSI
 			 * nodes that are not mapped in the PAMU.
 			 */
-			if (phandle && (phandle != msi_data->phandle))
-				continue;
+			if (phandle == msi_data->phandle) {
+				specific_msi_bank = true;
+				break;
+			}
+		}
 
+		if (!specific_msi_bank) {
+			dev_err(&pdev->dev,
+				"No specific MSI device found for node %s\n",
+				hose->dn->full_name);
+			return -EINVAL;
+		}
+	}
+
+	list_for_each_entry(entry, &pdev->msi_list, list) {
+		if (specific_msi_bank) {
 			hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
-			if (hwirq >= 0)
-				break;
+		} else {
+			/*
+			 * Loop over all the MSI devices until we find one that has an
+			 * available interrupt.
+			 */
+			list_for_each_entry(msi_data, &msi_head, list) {
+				hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
+				if (hwirq >= 0)
+					break;
+			}
 		}
 
 		if (hwirq < 0) {
-- 
1.9.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help