aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2009-01-22 15:54:33 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-02-10 21:38:02 -0500
commit6071ed0487c6ea8dcfadd9844b9b90944cd9de1e (patch)
tree8890252e4578bc29e079795efa2cec3c9fe35f22 /arch
parent649781f82782d142443d895b98edbd8be4e75c56 (diff)
powerpc/pseries: Return the number of MSIs we could allocate
If we can't allocate the requested number of MSIs, we can still tell the generic code how many we were able to allocate. That can then be passed onto the driver, allowing it to request that many in future, and probably succeeed. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pseries/msi.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index e6c80ac07697..073b518338a3 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -71,11 +71,13 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs)
71 } while (rtas_busy_delay(rc)); 71 } while (rtas_busy_delay(rc));
72 72
73 /* 73 /*
74 * If the RTAS call succeeded, check the number of irqs is actually 74 * If the RTAS call succeeded, return the number of irqs allocated.
75 * what we asked for. If not, return an error. 75 * If not, make sure we return a negative error code.
76 */ 76 */
77 if (rc == 0 && rtas_ret[0] != num_irqs) 77 if (rc == 0)
78 rc = -ENOSPC; 78 rc = rtas_ret[0];
79 else if (rc > 0)
80 rc = -rc;
79 81
80 pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d), got %d rc = %d\n", 82 pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d), got %d rc = %d\n",
81 func, num_irqs, rtas_ret[0], rc); 83 func, num_irqs, rtas_ret[0], rc);
@@ -91,7 +93,7 @@ static void rtas_disable_msi(struct pci_dev *pdev)
91 if (!pdn) 93 if (!pdn)
92 return; 94 return;
93 95
94 if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0)) 96 if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0) != 0)
95 pr_debug("rtas_msi: Setting MSIs to 0 failed!\n"); 97 pr_debug("rtas_msi: Setting MSIs to 0 failed!\n");
96} 98}
97 99
@@ -195,14 +197,14 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
195 if (type == PCI_CAP_ID_MSI) { 197 if (type == PCI_CAP_ID_MSI) {
196 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); 198 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec);
197 199
198 if (rc) { 200 if (rc < 0) {
199 pr_debug("rtas_msi: trying the old firmware call.\n"); 201 pr_debug("rtas_msi: trying the old firmware call.\n");
200 rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); 202 rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec);
201 } 203 }
202 } else 204 } else
203 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); 205 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
204 206
205 if (rc) { 207 if (rc != nvec) {
206 pr_debug("rtas_msi: rtas_change_msi() failed\n"); 208 pr_debug("rtas_msi: rtas_change_msi() failed\n");
207 return rc; 209 return rc;
208 } 210 }