fix for removal of linux,platform in recent ppc64 kernels

This commit is contained in:
Jarod Wilson 2006-08-22 15:34:14 +00:00
parent e4cc23de29
commit ab74511f4b
2 changed files with 122 additions and 1 deletions

View File

@ -0,0 +1,116 @@
In recent kernels, the plaform property is removed from the /proc/device-tree.
This property is used to determine whether the platform is LPAR or non-lpar,
and reads htab-* and tce-* properties based on the platform. Fixed this issue
such that read these properties if exists, otherwise continue instead of
exiting with an error message.
Signed-off-by: David Wilder <dwilder@us.ibm.com>
Signed-off-by: Haren Myneni <haren@us.ibm.com>
---
kexec/arch/ppc64/kexec-ppc64.c | 55 +++++++++++------------------------------
1 file changed, 15 insertions(+), 40 deletions(-)
Index: kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/ppc64/kexec-ppc64.c
+++ kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.c
@@ -34,13 +34,8 @@
#include "crashdump-ppc64.h"
#include <arch/options.h>
-/* Platforms supported by kexec on PPC64 */
-#define PLATFORM_PSERIES 0x0100
-#define PLATFORM_PSERIES_LPAR 0x0101
-
static struct exclude_range exclude_range[MAX_MEMORY_RANGES];
static unsigned long long rmo_top;
-static unsigned int platform;
static struct memory_range memory_range[MAX_MEMORY_RANGES];
static struct memory_range base_memory_range[MAX_MEMORY_RANGES];
unsigned long long memory_max = 0;
@@ -201,26 +196,6 @@ static int get_devtree_details(unsigned
}
if (strncmp(dentry->d_name, "chosen", 6) == 0) {
- /* get platform details from /chosen node */
- strcat(fname, "/linux,platform");
- if ((file = fopen(fname, "r")) == NULL) {
- perror(fname);
- closedir(cdir);
- closedir(dir);
- return -1;
- }
- if (fread(&platform, sizeof(int), 1, file) != 1) {
- perror(fname);
- fclose(file);
- closedir(cdir);
- closedir(dir);
- return -1;
- }
- fclose(file);
-
- memset(fname, 0, sizeof(fname));
- strcpy(fname, device_tree);
- strcat(fname, dentry->d_name);
strcat(fname, "/linux,kernel-end");
if ((file = fopen(fname, "r")) == NULL) {
perror(fname);
@@ -291,18 +266,18 @@ static int get_devtree_details(unsigned
reserve(KDUMP_BACKUP_LIMIT, crash_base-KDUMP_BACKUP_LIMIT);
}
- /* if LPAR, no need to read any more from /chosen */
- if (platform != PLATFORM_PSERIES) {
- closedir(cdir);
- continue;
- }
memset(fname, 0, sizeof(fname));
strcpy(fname, device_tree);
strcat(fname, dentry->d_name);
strcat(fname, "/linux,htab-base");
if ((file = fopen(fname, "r")) == NULL) {
- perror(fname);
closedir(cdir);
+ if (errno == ENOENT) {
+ /* Non LPAR */
+ errno = 0;
+ continue;
+ }
+ perror(fname);
closedir(dir);
return -1;
}
@@ -394,23 +369,23 @@ static int get_devtree_details(unsigned
}
rmo_base = ((unsigned long long *)buf)[0];
rmo_top = rmo_base + ((unsigned long long *)buf)[1];
- if (platform == PLATFORM_PSERIES) {
- if (rmo_top > 0x30000000UL)
- rmo_top = 0x30000000UL;
- }
+ if (rmo_top > 0x30000000UL)
+ rmo_top = 0x30000000UL;
+
fclose(file);
closedir(cdir);
} /* memory */
if (strncmp(dentry->d_name, "pci@", 4) == 0) {
- if (platform != PLATFORM_PSERIES) {
- closedir(cdir);
- continue;
- }
strcat(fname, "/linux,tce-base");
if ((file = fopen(fname, "r")) == NULL) {
- perror(fname);
closedir(cdir);
+ if (errno == ENOENT) {
+ /* Non LPAR */
+ errno = 0;
+ continue;
+ }
+ perror(fname);
closedir(dir);
return -1;
}

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 1.101
Release: 46%{dist}
Release: 47%{?dist}
License: GPL
Group: Applications/System
Summary: The kexec/kdump userspace component.
@ -37,6 +37,7 @@ Patch201: kexec-tools-1.101-ia64-fixup.patch
Patch301: kexec-tools-1.101-ppc64-ignore-args.patch
Patch302: kexec-tools-1.101-ppc64-usage.patch
Patch303: kexec-tools-1.101-ppc64-cliargs.patch
Patch304: kexec-tools-1.101-ppc64-platform-fix.patch
#
# Patches 401 through 500 are meant for s390 kexec-tools enablement
@ -74,6 +75,7 @@ rm -f ../kexec-tools-1.101.spec
%patch301 -p1
%patch302 -p1
%patch303 -p1
%patch304 -p1
%patch401 -p1
%patch501 -p1
%patch601 -p1
@ -155,6 +157,9 @@ exit 0
%doc TODO
%changelog
* Tue Aug 22 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-47%{dist}
- ppc64 no-more-platform fix
* Mon Aug 21 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-46%{dist}
- ppc64 fixups:
- actually build ppc64 binaries (bug 203407)