drmgr: Check for rpadlpar_io module

Pulled from upstream.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
This commit is contained in:
Tony Breeds 2013-06-26 12:03:15 +10:00
parent 1f4566b671
commit 73f489da17
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,49 @@
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

View File

@ -1,6 +1,6 @@
Name: powerpc-utils
Version: 1.2.16
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Utilities for PowerPC platforms
Group: System Environment/Base
@ -18,6 +18,7 @@ ExclusiveArch: ppc ppc64
# This hack is needed only for platforms with autoconf < 2.63
Patch0: powerpc-utils-autoconf.patch
Patch1: powerpc-utils-1.2.15-man.patch
Patch2: powerpc-utils-1.2.17-972606.patch
# This is done before release of F12
Obsoletes: powerpc-utils-papr < 1.1.6-3
@ -36,6 +37,7 @@ Utilities for PowerPC platforms.
%patch0 -p1 -b .aconf
%endif
%patch1 -p1 -b .man
%patch2 -p1 -b .rpadlpar_io
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
@ -125,6 +127,10 @@ rm -rf $RPM_BUILD_ROOT
%preun
%changelog
* Wed Jun 26 2013 Tony Breeds <tony@bakeyournoodle.com> - 1.2.16-2
- drmgr: Check for rpadlpar_io module
- resolves: #972606
* Tue May 21 2013 Vasant Hegde <hegdevasant@linux.vnet.ibm.com> - 1.2.16
- Update to latest upstream 1.2.16