Patchwork powerpc/pseries: Return req#msi(-x) if request is larger

login
register
mail settings
Submitter Michael Ellerman
Date Feb. 17, 2009, 10:18 a.m.
Message ID <ec7db3fa1052ff2797b77c41d441937b836a7ed0.1234865919.git.michael@ellerman.id.au>
Download mbox | patch
Permalink /patch/23247/
State Accepted, archived
Commit d523cc379da57f1c39f5db9c47bdaa94f74727ff
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Michael Ellerman - Feb. 17, 2009, 10:18 a.m.
If a driver asks for more MSIs than the devices "req#msi(-x)" property,
we currently return -ENOSPC. This doesn't give the driver any chance to
make a new request with a number that might work.

So if "req#msi(-x)" is less than the request, return its value. To be
100% safe, make sure we return an error if req_msi == 0.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/msi.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index b42dfa6..e56ae42 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -154,7 +154,11 @@  static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
 
 	if (*req_msi < nvec) {
 		pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec);
-		return -ENOSPC;
+
+		if (*req_msi == 0) /* Be paranoid */
+			return -ENOSPC;
+
+		return *req_msi;
 	}
 
 	return 0;