From ff981e0e652364d9b3a3262d315d87e26c772135 Mon Sep 17 00:00:00 2001
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Date: Tue, 25 Jun 2013 08:12:40 -0500
Subject: [PATCH] drmgr: Check for rpadlpar_io module
When attempting to do slot or phb DLPAR we need to have the rpadlpar_io
kernel module loaded. This patch updates the check made for slot and
phb DLPAR capabilities to also load the module if it is not present.
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
src/drmgr/common.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/drmgr/common.c b/src/drmgr/common.c
index e239587..dd6b28c 100644
--- a/src/drmgr/common.c
+++ b/src/drmgr/common.c
@@ -16,6 +16,7 @@
#include <dirent.h>
#include <execinfo.h>
#include <ctype.h>
+#include <sys/wait.h>
#include "dr.h"
#include "ofdt.h"
@@ -1152,8 +1153,19 @@ mem_dlpar_capable(void)
static int
check_slot_phb_dlpar(const char *type)
{
+ struct stat sbuf;
int rc;
+ /* Before checking for dlpar capability, we need to ensure that
+ * rpadlpar_io module is loaded or built into the kernel. This
+ * does make the checking a bit redundant though.
+ */
+ if ((stat(dlpar_add_slot, &sbuf)) || (stat(DLPAR_ADD_SLOT2, &sbuf))) {
+ rc = system("/sbin/modprobe rpadlpar_io");
+ if (WIFEXITED(rc) && WEXITSTATUS(rc))
+ say(ERROR, "rpadlpar_io module was not loaded\n");
+ }
+
/* For unknown reasons the add_slot and remove_slot sysfs files
* used for dlpar operations started appearing with quotes around
* the filename. So, this little hack exists to ensure nothing
--
1.8.1.4