Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-13 Thread Michael Ellerman
On Thu, 2010-05-13 at 04:19 -0700, Christian Kujau wrote:
 On Wed, 12 May 2010 at 00:22, Christian Kujau wrote:
  # kexec -e
  Starting new kernel
  Bye!
  
  but then the system just hung there, no more messages, I had to
  powercycle it.
 
 Are there any debug flags (or kernel options?) I can set, to find out why 
 it hangs here? Or does kexec not understand zImages?

Not really. There's extra debugging on some systems (with a hypervisor
console). I think you're on 32-bit, which means I don't really know what
I'm talking about, but I don't think zImage works - use vmlinux.

cheers


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-13 Thread Maxim Uvarov
2010/5/13 Christian Kujau li...@nerdbynature.de

 On Wed, 12 May 2010 at 00:22, Christian Kujau wrote:
  # kexec -e
  Starting new kernel
  Bye!
 
  but then the system just hung there, no more messages, I had to
  powercycle it.

 Are there any debug flags (or kernel options?) I can set, to find out why
 it hangs here? Or does kexec not understand zImages?


zImage should not work with kexec. Only vmlinux.


 Thanks,
 Christian.
 --
 BOFH excuse #373:

 Suspicious pointer corrupted virtual machine




-- 
Best regards,
Maxim Uvarov
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-13 Thread Christian Kujau
On Thu, 13 May 2010 at 15:50, Maxim Uvarov wrote:
 zImage should not work with kexec. Only vmlinux.

should?

PPC64 has something nice there:

   kexec/arch/ppc64/kexec-zImage-ppc64.c:
   fprintf(stderr, zImage support is still broken\n);

but I could not figure out where this is called from.

Anyway, tried vmlinux now and it's working, yay!

Thanks a lot, Maxim!

Christian.
-- 
BOFH excuse #363:

Out of cards on drive D:
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-12 Thread Maxim Uvarov
2010/5/12 Christian Kujau li...@nerdbynature.de

 Maxim Uvarov wrote on 2010-05-11 10:47 :
  This patch is required in case if you are using new toolchains.

 I'm on Debian/stable (binutils 2.18, gcc 4.3.2), so I applied your patches
 to the latest -git checkout:

 First, compilation fails with:

 cc1: warnings being treated as errors
 kexec/arch/ppc/kexec-ppc.c: In function ‘get_base_ranges’:
 kexec/arch/ppc/kexec-ppc.c:258: error: value computed is not used
 make: *** [kexec/arch/ppc/kexec-ppc.o] Error 1

 Somehow a - hyphen made it into one of the functions:

  --- a/kexec/arch/ppc/kexec-ppc.c
  +++ b/kexec/arch/ppc/kexec-ppc.c
 [...]
if (local_memory_ranges = max_memory_ranges) {
  - fclose(file);
  - break;
  + if (realloc_memory_ranges()  0){
  + -   fclose(file);

 Oh, I sent this patch twice with stg -a by mistake. And second version has
-. I will fix and resend patches.


 Removing this, gets me further, until:


 purgatory/arch/ppc/crt.o: In function `__lshrdi3':
 (.text+0xf0): multiple definition of `__lshrdi3'
 purgatory/arch/ppc/misc.o:(.text+0x50): first defined here
 collect2: ld returned 1 exit status
 make: *** [purgatory/purgatory.ro] Error 1

 And has been defined in purgatory/arch/ppc/crt.S and
 ./purgatory/arch/ppc/misc.S. Removing it from e.g. crt.S
 makes it compile, I have not tested it yet, though :-)


Yes, that is expected result for old tool chains. New tool chains (from code
sourcery )  need this crt.S.
I think we can have --with-oldtoolchain option to configure to point to old
tool chains. (or even rename it to --with-crts,
I don't know what is better.)


 Thanks,
 Christian.

 PS: Where is -Werror defined? I could not find it anywhere in the kexec
source (execpt in arch/mips)...
 --


This -Werror came from mips. kexec/arch/mips/Makefile. It is already removed
in the git. We already saw this problem.




 make bzImage, not war




-- 
Best regards,
Maxim Uvarov
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-12 Thread Christian Kujau
On Wed, 12 May 2010 at 10:31, Maxim Uvarov wrote:
 Yes, that is expected result for old tool chains. New tool chains (from code
 sourcery )  need this crt.S.
 I think we can have --with-oldtoolchain option to configure to point to old
 tool chains. (or even rename it to --with-crts,
 I don't know what is better.)

Yes, I've seen this --with-oldtoolchain flag in ./configure, but: when 
exactly is my toolchain old enough so that this flag has to be used? Is my 
binutils 2.18 too old?

So, I'm all in favour of --with-crts (which I would use when compilation breaks
with some descriptive error message) or, even better: can't we set this 
flag during ./configure automatically, based on the actual toolchain installed
on the system? ./configure should be able to determine this, no?

 This -Werror came from mips. kexec/arch/mips/Makefile. It is already removed
 in the git. We already saw this problem.

Powerpc including a mops Makefile, whooha :-)

Thanks,
Christian.
-- 
BOFH excuse #91:

Mouse chewed through power cable
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 1/2] Fix kexec on powerpc32

2010-05-12 Thread Maxim Uvarov

Hello everybody,

  Changes from previous version:
  - removed bogus hyphen from the patch;
  - move ifdefs to crt.S instead of Makefile


  Please find here patch for user land kexec-tools application. Following
  patch makes kexec-tools work for both kexec and kdump. I tested it with 
  git kernel (linus-tree) and Freescale/Logic MPC8360ERDK board with 
  mpc83xx_defconfig kernel config.

  kexec:
  kexec -l vmlinux --command-line=console= ... etc
  kexec -e

  kdump:
  kexec -p vmlinux_dump --command-line=console=... etc
  echo c  /proc/sysrq-trigger

  I also think that is is reasonable:
  - put GAME_CUBE specific code to separate files;
  - combine  ppc and ppc64 to powerpc directory (I'm planning to do it.
And that why in some places my patch have ifdefs for PPC64);

Best regards,
Maxim Uvarov.

From: Maxim Uvarov muva...@gmail.com

Signed-off-by: Maxim Uvarov muva...@gmail.com
Signed-off-by: Maxim Uvarov muva...@gmail.com
---

 kexec/arch/ppc/Makefile|2 
 kexec/arch/ppc/crashdump-powerpc.c |  439 ++
 kexec/arch/ppc/crashdump-powerpc.h |   38 +++
 kexec/arch/ppc/fs2dt.c |  460 
 kexec/arch/ppc/kexec-elf-ppc.c |  186 +--
 kexec/arch/ppc/kexec-ppc.c |  275 --
 kexec/arch/ppc/kexec-ppc.h |   32 +++
 purgatory/arch/ppc/Makefile|2 
 purgatory/arch/ppc/purgatory-ppc.c |   38 ++-
 purgatory/arch/ppc/purgatory-ppc.h |4 
 purgatory/arch/ppc/v2wrap.S|   66 -
 purgatory/arch/ppc/v2wrap_32.S |   91 +++
 12 files changed, 1524 insertions(+), 109 deletions(-)
 create mode 100644 kexec/arch/ppc/crashdump-powerpc.c
 create mode 100644 kexec/arch/ppc/crashdump-powerpc.h
 create mode 100644 kexec/arch/ppc/fs2dt.c
 delete mode 100644 purgatory/arch/ppc/v2wrap.S
 create mode 100644 purgatory/arch/ppc/v2wrap_32.S

diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile
index 1c7441c..5988213 100644
--- a/kexec/arch/ppc/Makefile
+++ b/kexec/arch/ppc/Makefile
@@ -11,6 +11,8 @@ ppc_KEXEC_SRCS += kexec/arch/ppc/kexec-uImage-ppc.c
 ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-simple.S
 ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-dol.S
 ppc_KEXEC_SRCS += kexec/arch/ppc/fixup_dtb.c
+ppc_KEXEC_SRCS += kexec/arch/ppc/fs2dt.c
+ppc_KEXEC_SRCS += kexec/arch/ppc/crashdump-powerpc.c
 ppc_KEXEC_SRCS += kexec/kexec-uImage.c
 
 libfdt_SRCS = kexec/arch/ppc/libfdt-wrapper.c
diff --git a/kexec/arch/ppc/crashdump-powerpc.c 
b/kexec/arch/ppc/crashdump-powerpc.c
new file mode 100644
index 000..7bfad20
--- /dev/null
+++ b/kexec/arch/ppc/crashdump-powerpc.c
@@ -0,0 +1,439 @@
+#include stdio.h
+#include string.h
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include limits.h
+#include elf.h
+#include dirent.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+#include ../../kexec.h
+#include ../../kexec-elf.h
+#include ../../kexec-syscall.h
+#include ../../crashdump.h
+#include kexec-ppc.h
+#include crashdump-powerpc.h
+
+#ifdef CONFIG_PPC64
+static struct crash_elf_info elf_info64 = {
+class: ELFCLASS64,
+data: ELFDATA2MSB,
+machine: EM_PPC64,
+backup_src_start: BACKUP_SRC_START,
+backup_src_end: BACKUP_SRC_END,
+page_offset: PAGE_OFFSET,
+lowmem_limit: MAXMEM,
+};
+#endif
+static struct crash_elf_info elf_info32 = {
+class: ELFCLASS32,
+data: ELFDATA2MSB,
+#ifdef CONFIG_PPC64
+machine: EM_PPC64,
+#else
+machine: EM_PPC,
+#endif
+backup_src_start: BACKUP_SRC_START,
+backup_src_end: BACKUP_SRC_END,
+page_offset: PAGE_OFFSET,
+lowmem_limit: MAXMEM,
+};
+
+/* Stores a sorted list of RAM memory ranges for which to create elf headers.
+ * A separate program header is created for backup region
+ */
+static struct memory_range *crash_memory_range;
+
+/* Define a variable to replace the CRASH_MAX_MEMORY_RANGES macro */
+static int crash_max_memory_ranges;
+
+/*
+ * Used to save various memory ranges/regions needed for the captured
+ * kernel to boot. (lime memmap= option in other archs)
+ */
+mem_rgns_t usablemem_rgns = {0, NULL};
+
+/*
+ * To store the memory size of the first kernel and this value will be
+ * passed to the second kernel as command line (savemaxmem=xM).
+ * The second kernel will be calculated saved_max_pfn based on this
+ * variable.
+ * Since we are creating/using usable-memory property, there is no way
+ * we can determine the RAM size unless parsing the device-tree/memoy@/reg
+ * property in the kernel.
+ */
+unsigned long long saved_max_mem;
+
+/* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to
+ * create Elf headers. Keeping it separate from get_memory_ranges() as
+ * requirements are different in the case of normal kexec and crashdumps.
+ *
+ * Normal kexec needs to look at all of available physical memory irrespective
+ * of the fact how much of it is being used by currently running kernel.
+ * Crashdumps need to 

Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-12 Thread Christian Kujau
On Tue, 11 May 2010 at 21:47, Maxim Uvarov wrote:
 This patch is required in case if you are using new toolchains.

After kexec-tools compiled, I actually tried it:

# kexec -l /boot/2.6/zImage --command-line=root=/dev/hda6 ro
# echo $?
0
# kexec -e
Starting new kernel
Bye!

but then the system just hung there, no more messages, I had to
powercycle it.

The --debug options is listed for dol-ppc systems (I have a PowerBook
G4, not sure if this falls into this category), when I use it the help
screen of kexec is displayed again and at the bottom:

   Cannot load /boot/2.6/zImage


This is with 2.6.34-rc7 (today's git):

# file /boot/2.6/zImage
/boot/2.6/zImage: ELF 32-bit MSB executable, PowerPC or cisco 4500,
version 1 (SYSV), statically linked, with unknown capability 0x4100
= 0x11676e75, with unknown capability 0x1 = 0x90402, not stripped


.config and dmesg: http://nerdbynature.de/bits/2.6.34-rc7/kexec/

Christian.
-- 
make bzImage, not war
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-12 Thread Maxim Uvarov
2010/5/12 Christian Kujau li...@nerdbynature.de

 On Tue, 11 May 2010 at 21:47, Maxim Uvarov wrote:
  This patch is required in case if you are using new toolchains.

 After kexec-tools compiled, I actually tried it:

 # kexec -l /boot/2.6/zImage --command-line=root=/dev/hda6 ro
 # echo $?
 0
 # kexec -e
 Starting new kernel
 Bye!

 but then the system just hung there, no more messages, I had to
 powercycle it.

 The --debug options is listed for dol-ppc systems (I have a PowerBook
 G4, not sure if this falls into this category), when I use it the help
 screen of kexec is displayed again and at the bottom:

   Cannot load /boot/2.6/zImage


 This is with 2.6.34-rc7 (today's git):

 # file /boot/2.6/zImage
 /boot/2.6/zImage: ELF 32-bit MSB executable, PowerPC or cisco 4500,
 version 1 (SYSV), statically linked, with unknown capability 0x4100
 = 0x11676e75, with unknown capability 0x1 = 0x90402, not stripped


 .config and dmesg: http://nerdbynature.de/bits/2.6.34-rc7/kexec/

 Christian.
 --
 make bzImage, not war



Can you try vmlinux? I tested only with vmlinux.

-- 
Best regards,
Maxim Uvarov
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-12 Thread Simon Horman
On Wed, May 12, 2010 at 10:31:26AM +0400, Maxim Uvarov wrote:
 2010/5/12 Christian Kujau li...@nerdbynature.de
 
  Maxim Uvarov wrote on 2010-05-11 10:47 :
   This patch is required in case if you are using new toolchains.
 
  I'm on Debian/stable (binutils 2.18, gcc 4.3.2), so I applied your patches
  to the latest -git checkout:
 
  First, compilation fails with:
 
  cc1: warnings being treated as errors
  kexec/arch/ppc/kexec-ppc.c: In function ‘get_base_ranges’:
  kexec/arch/ppc/kexec-ppc.c:258: error: value computed is not used
  make: *** [kexec/arch/ppc/kexec-ppc.o] Error 1
 
  Somehow a - hyphen made it into one of the functions:
 
   --- a/kexec/arch/ppc/kexec-ppc.c
   +++ b/kexec/arch/ppc/kexec-ppc.c
  [...]
 if (local_memory_ranges = max_memory_ranges) {
   - fclose(file);
   - break;
   + if (realloc_memory_ranges()  0){
   + -   fclose(file);
 
  Oh, I sent this patch twice with stg -a by mistake. And second version has
 -. I will fix and resend patches.
 
 
  Removing this, gets me further, until:
 
 
  purgatory/arch/ppc/crt.o: In function `__lshrdi3':
  (.text+0xf0): multiple definition of `__lshrdi3'
  purgatory/arch/ppc/misc.o:(.text+0x50): first defined here
  collect2: ld returned 1 exit status
  make: *** [purgatory/purgatory.ro] Error 1
 
  And has been defined in purgatory/arch/ppc/crt.S and
  ./purgatory/arch/ppc/misc.S. Removing it from e.g. crt.S
  makes it compile, I have not tested it yet, though :-)
 
 
 Yes, that is expected result for old tool chains. New tool chains (from code
 sourcery )  need this crt.S.
 I think we can have --with-oldtoolchain option to configure to point to old
 tool chains. (or even rename it to --with-crts,
 I don't know what is better.)

I think --with-crts would be better as --with-oldtoolchain could
mean many things.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] Fix kexec on powerpc32

2010-05-11 Thread Maxim Uvarov

Hello everybody,

  Please find here patch for user land kexec-tools application. Following
  patch makes kexec-tools work for both kexec and kdump. I tested it with 
  git kernel (linus-tree) and Freescale/Logic MPC8360ERDK board with 
  mpc83xx_defconfig kernel config.

  kexec:
  kexec -l vmlinux --command-line=console= ... etc
  kexec -e

  kdump:
  kexec -p vmlinux_dump --command-line=console=... etc
  echo c  /proc/sysrq-trigger

  I also think that is is reasonable:
  - put GAME_CUBE specific code to separate files;
  - combine  ppc and ppc64 to powerpc directory (I'm planning to do it.
And that why in some places my patch have ifdefs for PPC64);

Best regards,
Maxim Uvarov.

From: Maxim Uvarov muva...@gmail.com

Signed-off-by: Maxim Uvarov muva...@gmail.com
Signed-off-by: Maxim Uvarov muva...@gmail.com
---

 kexec/arch/ppc/Makefile|2 
 kexec/arch/ppc/crashdump-powerpc.c |  439 ++
 kexec/arch/ppc/crashdump-powerpc.h |   38 +++
 kexec/arch/ppc/fs2dt.c |  460 
 kexec/arch/ppc/kexec-elf-ppc.c |  186 +--
 kexec/arch/ppc/kexec-ppc.c |  276 --
 kexec/arch/ppc/kexec-ppc.h |   32 +++
 purgatory/arch/ppc/Makefile|2 
 purgatory/arch/ppc/purgatory-ppc.c |   38 ++-
 purgatory/arch/ppc/purgatory-ppc.h |4 
 purgatory/arch/ppc/v2wrap.S|   66 -
 purgatory/arch/ppc/v2wrap_32.S |   91 +++
 12 files changed, 1524 insertions(+), 110 deletions(-)
 create mode 100644 kexec/arch/ppc/crashdump-powerpc.c
 create mode 100644 kexec/arch/ppc/crashdump-powerpc.h
 create mode 100644 kexec/arch/ppc/fs2dt.c
 delete mode 100644 purgatory/arch/ppc/v2wrap.S
 create mode 100644 purgatory/arch/ppc/v2wrap_32.S

diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile
index 1c7441c..5988213 100644
--- a/kexec/arch/ppc/Makefile
+++ b/kexec/arch/ppc/Makefile
@@ -11,6 +11,8 @@ ppc_KEXEC_SRCS += kexec/arch/ppc/kexec-uImage-ppc.c
 ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-simple.S
 ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-dol.S
 ppc_KEXEC_SRCS += kexec/arch/ppc/fixup_dtb.c
+ppc_KEXEC_SRCS += kexec/arch/ppc/fs2dt.c
+ppc_KEXEC_SRCS += kexec/arch/ppc/crashdump-powerpc.c
 ppc_KEXEC_SRCS += kexec/kexec-uImage.c
 
 libfdt_SRCS = kexec/arch/ppc/libfdt-wrapper.c
diff --git a/kexec/arch/ppc/crashdump-powerpc.c 
b/kexec/arch/ppc/crashdump-powerpc.c
new file mode 100644
index 000..7bfad20
--- /dev/null
+++ b/kexec/arch/ppc/crashdump-powerpc.c
@@ -0,0 +1,439 @@
+#include stdio.h
+#include string.h
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include limits.h
+#include elf.h
+#include dirent.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+#include ../../kexec.h
+#include ../../kexec-elf.h
+#include ../../kexec-syscall.h
+#include ../../crashdump.h
+#include kexec-ppc.h
+#include crashdump-powerpc.h
+
+#ifdef CONFIG_PPC64
+static struct crash_elf_info elf_info64 = {
+class: ELFCLASS64,
+data: ELFDATA2MSB,
+machine: EM_PPC64,
+backup_src_start: BACKUP_SRC_START,
+backup_src_end: BACKUP_SRC_END,
+page_offset: PAGE_OFFSET,
+lowmem_limit: MAXMEM,
+};
+#endif
+static struct crash_elf_info elf_info32 = {
+class: ELFCLASS32,
+data: ELFDATA2MSB,
+#ifdef CONFIG_PPC64
+machine: EM_PPC64,
+#else
+machine: EM_PPC,
+#endif
+backup_src_start: BACKUP_SRC_START,
+backup_src_end: BACKUP_SRC_END,
+page_offset: PAGE_OFFSET,
+lowmem_limit: MAXMEM,
+};
+
+/* Stores a sorted list of RAM memory ranges for which to create elf headers.
+ * A separate program header is created for backup region
+ */
+static struct memory_range *crash_memory_range;
+
+/* Define a variable to replace the CRASH_MAX_MEMORY_RANGES macro */
+static int crash_max_memory_ranges;
+
+/*
+ * Used to save various memory ranges/regions needed for the captured
+ * kernel to boot. (lime memmap= option in other archs)
+ */
+mem_rgns_t usablemem_rgns = {0, NULL};
+
+/*
+ * To store the memory size of the first kernel and this value will be
+ * passed to the second kernel as command line (savemaxmem=xM).
+ * The second kernel will be calculated saved_max_pfn based on this
+ * variable.
+ * Since we are creating/using usable-memory property, there is no way
+ * we can determine the RAM size unless parsing the device-tree/memoy@/reg
+ * property in the kernel.
+ */
+unsigned long long saved_max_mem;
+
+/* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to
+ * create Elf headers. Keeping it separate from get_memory_ranges() as
+ * requirements are different in the case of normal kexec and crashdumps.
+ *
+ * Normal kexec needs to look at all of available physical memory irrespective
+ * of the fact how much of it is being used by currently running kernel.
+ * Crashdumps need to have access to memory regions actually being used by
+ * running  kernel. Expecting a different file/data structure than /proc/iomem
+ * 

[PATCH 1/2] Fix kexec on powerpc32

2010-05-11 Thread Maxim Uvarov

This patch is required in case if you are using new toolchains.

Best regards,
Maxim Uvarov.

From: Maxim Uvarov muva...@gmail.com

Signed-off-by: Maxim Uvarov muva...@gmail.com
---

 kexec/arch/ppc/Makefile|2 
 kexec/arch/ppc/crashdump-powerpc.c |  439 ++
 kexec/arch/ppc/crashdump-powerpc.h |   38 +++
 kexec/arch/ppc/fs2dt.c |  460 
 kexec/arch/ppc/kexec-elf-ppc.c |  186 +--
 kexec/arch/ppc/kexec-ppc.c |  276 --
 kexec/arch/ppc/kexec-ppc.h |   32 +++
 purgatory/arch/ppc/Makefile|2 
 purgatory/arch/ppc/purgatory-ppc.c |   38 ++-
 purgatory/arch/ppc/purgatory-ppc.h |4 
 purgatory/arch/ppc/v2wrap.S|   66 -
 purgatory/arch/ppc/v2wrap_32.S |   91 +++
 12 files changed, 1524 insertions(+), 110 deletions(-)
 create mode 100644 kexec/arch/ppc/crashdump-powerpc.c
 create mode 100644 kexec/arch/ppc/crashdump-powerpc.h
 create mode 100644 kexec/arch/ppc/fs2dt.c
 delete mode 100644 purgatory/arch/ppc/v2wrap.S
 create mode 100644 purgatory/arch/ppc/v2wrap_32.S

diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile
index 1c7441c..5988213 100644
--- a/kexec/arch/ppc/Makefile
+++ b/kexec/arch/ppc/Makefile
@@ -11,6 +11,8 @@ ppc_KEXEC_SRCS += kexec/arch/ppc/kexec-uImage-ppc.c
 ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-simple.S
 ppc_KEXEC_SRCS += kexec/arch/ppc/ppc-setup-dol.S
 ppc_KEXEC_SRCS += kexec/arch/ppc/fixup_dtb.c
+ppc_KEXEC_SRCS += kexec/arch/ppc/fs2dt.c
+ppc_KEXEC_SRCS += kexec/arch/ppc/crashdump-powerpc.c
 ppc_KEXEC_SRCS += kexec/kexec-uImage.c
 
 libfdt_SRCS = kexec/arch/ppc/libfdt-wrapper.c
diff --git a/kexec/arch/ppc/crashdump-powerpc.c 
b/kexec/arch/ppc/crashdump-powerpc.c
new file mode 100644
index 000..7bfad20
--- /dev/null
+++ b/kexec/arch/ppc/crashdump-powerpc.c
@@ -0,0 +1,439 @@
+#include stdio.h
+#include string.h
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include limits.h
+#include elf.h
+#include dirent.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+#include ../../kexec.h
+#include ../../kexec-elf.h
+#include ../../kexec-syscall.h
+#include ../../crashdump.h
+#include kexec-ppc.h
+#include crashdump-powerpc.h
+
+#ifdef CONFIG_PPC64
+static struct crash_elf_info elf_info64 = {
+class: ELFCLASS64,
+data: ELFDATA2MSB,
+machine: EM_PPC64,
+backup_src_start: BACKUP_SRC_START,
+backup_src_end: BACKUP_SRC_END,
+page_offset: PAGE_OFFSET,
+lowmem_limit: MAXMEM,
+};
+#endif
+static struct crash_elf_info elf_info32 = {
+class: ELFCLASS32,
+data: ELFDATA2MSB,
+#ifdef CONFIG_PPC64
+machine: EM_PPC64,
+#else
+machine: EM_PPC,
+#endif
+backup_src_start: BACKUP_SRC_START,
+backup_src_end: BACKUP_SRC_END,
+page_offset: PAGE_OFFSET,
+lowmem_limit: MAXMEM,
+};
+
+/* Stores a sorted list of RAM memory ranges for which to create elf headers.
+ * A separate program header is created for backup region
+ */
+static struct memory_range *crash_memory_range;
+
+/* Define a variable to replace the CRASH_MAX_MEMORY_RANGES macro */
+static int crash_max_memory_ranges;
+
+/*
+ * Used to save various memory ranges/regions needed for the captured
+ * kernel to boot. (lime memmap= option in other archs)
+ */
+mem_rgns_t usablemem_rgns = {0, NULL};
+
+/*
+ * To store the memory size of the first kernel and this value will be
+ * passed to the second kernel as command line (savemaxmem=xM).
+ * The second kernel will be calculated saved_max_pfn based on this
+ * variable.
+ * Since we are creating/using usable-memory property, there is no way
+ * we can determine the RAM size unless parsing the device-tree/memoy@/reg
+ * property in the kernel.
+ */
+unsigned long long saved_max_mem;
+
+/* Reads the appropriate file and retrieves the SYSTEM RAM regions for whom to
+ * create Elf headers. Keeping it separate from get_memory_ranges() as
+ * requirements are different in the case of normal kexec and crashdumps.
+ *
+ * Normal kexec needs to look at all of available physical memory irrespective
+ * of the fact how much of it is being used by currently running kernel.
+ * Crashdumps need to have access to memory regions actually being used by
+ * running  kernel. Expecting a different file/data structure than /proc/iomem
+ * to look into down the line. May be something like /proc/kernelmem or may
+ * be zone data structures exported from kernel.
+ */
+static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
+{
+
+   int memory_ranges = 0;
+   char device_tree[256] = /proc/device-tree/;
+   char fname[256];
+   char buf[MAXBYTES-1];
+   DIR *dir, *dmem;
+   FILE *file;
+   struct dirent *dentry, *mentry;
+   int i, n, crash_rng_len = 0;
+   unsigned long long start, end, cstart, cend;
+
+   crash_max_memory_ranges = max_memory_ranges + 6;
+   crash_rng_len = sizeof(struct memory_range) * crash_max_memory_ranges;
+
+   crash_memory_range = (struct 

Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-11 Thread Christian Kujau
On Tue, 11 May 2010 at 21:47, Maxim Uvarov wrote:
 This patch is required in case if you are using new toolchains.

Ah, thanks I was missing (and looking for) crashdump-powerpc.h
already :-)

Christian
-- 
make bzImage, not war
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] Fix kexec on powerpc32

2010-05-11 Thread Christian Kujau
Maxim Uvarov wrote on 2010-05-11 10:47 :
 This patch is required in case if you are using new toolchains.

I'm on Debian/stable (binutils 2.18, gcc 4.3.2), so I applied your patches 
to the latest -git checkout:

First, compilation fails with:

cc1: warnings being treated as errors
kexec/arch/ppc/kexec-ppc.c: In function ‘get_base_ranges’:
kexec/arch/ppc/kexec-ppc.c:258: error: value computed is not used
make: *** [kexec/arch/ppc/kexec-ppc.o] Error 1

Somehow a - hyphen made it into one of the functions:

 --- a/kexec/arch/ppc/kexec-ppc.c
 +++ b/kexec/arch/ppc/kexec-ppc.c
[...]
   if (local_memory_ranges = max_memory_ranges) {
 - fclose(file);
 - break;
 + if (realloc_memory_ranges()  0){
 + -   fclose(file);


Removing this, gets me further, until:


purgatory/arch/ppc/crt.o: In function `__lshrdi3':
(.text+0xf0): multiple definition of `__lshrdi3'
purgatory/arch/ppc/misc.o:(.text+0x50): first defined here
collect2: ld returned 1 exit status
make: *** [purgatory/purgatory.ro] Error 1

And has been defined in purgatory/arch/ppc/crt.S and
./purgatory/arch/ppc/misc.S. Removing it from e.g. crt.S
makes it compile, I have not tested it yet, though :-)

Thanks,
Christian.

PS: Where is -Werror defined? I could not find it anywhere in the kexec 
source (execpt in arch/mips)...
-- 
make bzImage, not war
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: kexec for powerpc32

2010-04-01 Thread Maxim Uvarov

Christian Kujau wrote:

On Wed, 31 Mar 2010 at 17:23, Anton Vorontsov wrote:
  

Kernel has all needed for kexec, but kexec-tools are broken for
powerpc32.

http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg22498.html



Oh :-\

  

I've just asked around, and it seems that Maxim (Cc'ed) will start
working on reviving ppc32 support real soon.



Well, in my case the powerpc32 machine is far from being a production 
system, but I'm glad to hear that he's working on it!


Thanks for the response,
Christian.
  

Yes,  the plan was to push upstream all MontaVista's powerpc kexec patches.
But also some work here is required in understanding how far community 
code from our,
port, cleanup and test patches. I hope that I will get to that task in 
this month.


Best regards,
Maxim Uvarov.



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


kexec for powerpc32

2010-03-31 Thread Christian Kujau
[please CC me as I am not subscribed]

Hi,

when building a kernel for powerpc32 (PowerBook6,8 / 7447A) I can select
CONFIG_KEXEC. However, after booting I can't convince kexec (from 
kexec-tools, latest git checkout) to load the kernel:

# /opt/kexec-tools/sbin/kexec -l /boot/2.6/zImage --append=root=/dev/hda6 
get_memory_ranges(): Unsupported platform
Could not get memory layout

Can anybody comment on wether or not kexec is supported on this platform? 
If not, is this a limitation of kexec-tools or the kernel? If it's the 
latter, can't the option be hidden/disabled in Kconfig for this platform?

Then again, from looking at the Kconfig files, I see that the 74xx CPU 
is among quite a few CPU types and so PPC_BOOK3S_32 is selected, and then
ALTIVEC selects 6xx which in turn selects PPC_BOOK3S - so, I guess 
!PPC_BOOK3S for KEXEC is not an option here?

Thanks,
Christian.
-- 
BOFH excuse #69:

knot in cables caused data stream to become twisted and kinked
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: kexec for powerpc32

2010-03-31 Thread Anton Vorontsov
Hi,

On Wed, Mar 31, 2010 at 05:18:18AM -0700, Christian Kujau wrote:
 [please CC me as I am not subscribed]
 
 Hi,
 
 when building a kernel for powerpc32 (PowerBook6,8 / 7447A) I can select
 CONFIG_KEXEC. However, after booting I can't convince kexec (from 
 kexec-tools, latest git checkout) to load the kernel:
 
 # /opt/kexec-tools/sbin/kexec -l /boot/2.6/zImage --append=root=/dev/hda6 
 get_memory_ranges(): Unsupported platform
 Could not get memory layout

Kernel has all needed for kexec, but kexec-tools are broken for
powerpc32.

http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg22498.html

I've just asked around, and it seems that Maxim (Cc'ed) will start
working on reviving ppc32 support real soon.

Thanks,

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: kexec for powerpc32

2010-03-31 Thread Christian Kujau
On Wed, 31 Mar 2010 at 17:23, Anton Vorontsov wrote:
 Kernel has all needed for kexec, but kexec-tools are broken for
 powerpc32.
 
 http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg22498.html

Oh :-\

 I've just asked around, and it seems that Maxim (Cc'ed) will start
 working on reviving ppc32 support real soon.

Well, in my case the powerpc32 machine is far from being a production 
system, but I'm glad to hear that he's working on it!

Thanks for the response,
Christian.
-- 
BOFH excuse #292:

We ran out of dial tone and we're and waiting for the phone company to deliver 
another bottle.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev