Subject: [PATCH 12/16 v3] powerpc: Verify CMO memory entitlement updates with virtual I/O

From: Robert Jennings <[email-masked]>
Date: Fri, 4 Jul 2008 07:55:25 -0500

From: Nathan Fontenot <[email-masked]>

Verify memory entitlement updates can be handled by vio.

Signed-off-by: Nathan Fontenot <[email-masked]>
Signed-off-by: Robert Jennings <[email-masked]>

---
 arch/powerpc/kernel/lparcfg.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: b/arch/powerpc/kernel/lparcfg.c
===================================================================
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -34,6 +34,7 @@
 #include <asm/time.h>
 #include <asm/prom.h>
 #include <asm/vdso_datapage.h>
+#include <asm/vio.h>
 
 #define MODULE_VERS "1.7"
 #define MODULE_NAME "lparcfg"
@@ -528,6 +529,15 @@ static ssize_t update_mpp(u64 *entitleme
 	u8 new_weight;
 	ssize_t rc;
 
+	if (entitlement) {
+		/* Check with vio to ensure the new memory entitlement
+		 * can be handled.
+		 */
+		rc = vio_cmo_entitlement_update(*entitlement);
+		if (rc)
+			return rc;
+	}
+
 	rc = h_get_mpp(&mpp_data);
 	if (rc)
 		return rc;