* [RFC][PATCH 0/8] kexec/kdump support for ppc32
@ 2008-08-01 14:13 Anton Vorontsov
2008-08-01 14:14 ` [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec Anton Vorontsov
` (8 more replies)
0 siblings, 9 replies; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
Hi all,
I refreshed some Dale Farnsworth's kexec/kdump patches[1] against
the latest kernel, and here they are.
There is a difference though. Dale's patches were using
kmap_atomic_pfn() to map oldmem memory, while for this patches
I took PPC64 approach to use ioremap(). This is done to be able
to support kdump on !HIGHMEM kernels.
Also, please take a special look into 8/8 patch, there is a hunk
marked with "XXX:", which I don't quite understand for PPC64 case
(this hunk also persist in the original Dale's patch, and w/o it
the capturing kernel doesn't boot on ppc32).
I'll try to refresh BookE support as soon as I'll find some BookE
board.
The patchset includes:
- Kexec support
[PATCH 1/8] powerpc: set up OF properties for ppc32 kexec
[PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit
[PATCH 3/8] powerpc: remove default kexec/crash_kernel ops assignments
2/8 and 3/8 patches are used to avoid adding lots of default ops
to the board files.
- Kdump support
[PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M
[PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump kernel on ppc32
[PATCH 6/8] powerpc: set up OF properties for ppc32 kdump
[PATCH 7/8] powerpc: implement crash_setup_regs for ppc32
[PATCH 8/8] powerpc: last bits to support kdump on ppc32
[1] http://ozlabs.org/pipermail/linuxppc-dev/2007-November/046739.html
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-07 10:44 ` Michael Ellerman
2008-08-01 14:14 ` [PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit Anton Vorontsov
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
From: Dale Farnsworth <dale@farnsworth.org>
Refactor the setting of kexec OF properties, moving the common code
from machine_kexec_64.c to machine_kexec.c where it can be used on
both ppc64 and ppc32. This is needed for kexec to work on ppc32
platforms.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/kernel/machine_kexec.c | 27 +++++++++++++++++++++++++++
arch/powerpc/kernel/machine_kexec_64.c | 20 +++++---------------
2 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index aab7688..a625673 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -13,8 +13,10 @@
#include <linux/reboot.h>
#include <linux/threads.h>
#include <linux/lmb.h>
+#include <linux/of.h>
#include <asm/machdep.h>
#include <asm/prom.h>
+#include <asm/sections.h>
void machine_crash_shutdown(struct pt_regs *regs)
{
@@ -116,3 +118,28 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
{
return (start + size) > crashk_res.start && start <= crashk_res.end;
}
+
+/* Values we need to export to the second kernel via the device tree. */
+static unsigned long kernel_end;
+
+static struct property kernel_end_prop = {
+ .name = "linux,kernel-end",
+ .length = sizeof(unsigned long),
+ .value = &kernel_end,
+};
+
+static int __init kexec_setup(void)
+{
+ struct device_node *node;
+
+ node = of_find_node_by_path("/chosen");
+ if (!node)
+ return -ENOENT;
+
+ kernel_end = __pa(_end);
+ prom_add_property(node, &kernel_end_prop);
+
+ of_node_put(node);
+ return 0;
+}
+__initcall(kexec_setup);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index a168514..c30678d 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -289,7 +289,7 @@ void default_machine_kexec(struct kimage *image)
}
/* Values we need to export to the second kernel via the device tree. */
-static unsigned long htab_base, kernel_end;
+static unsigned long htab_base;
static struct property htab_base_prop = {
.name = "linux,htab-base",
@@ -303,32 +303,22 @@ static struct property htab_size_prop = {
.value = &htab_size_bytes,
};
-static struct property kernel_end_prop = {
- .name = "linux,kernel-end",
- .length = sizeof(unsigned long),
- .value = &kernel_end,
-};
-
static void __init export_htab_values(void)
{
struct device_node *node;
+ /* On machines with no htab htab_address is NULL */
+ if (NULL == htab_address)
+ return;
+
node = of_find_node_by_path("/chosen");
if (!node)
return;
- kernel_end = __pa(_end);
- prom_add_property(node, &kernel_end_prop);
-
- /* On machines with no htab htab_address is NULL */
- if (NULL == htab_address)
- goto out;
-
htab_base = __pa(htab_address);
prom_add_property(node, &htab_base_prop);
prom_add_property(node, &htab_size_prop);
- out:
of_node_put(node);
}
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
2008-08-01 14:14 ` [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-01 14:14 ` [PATCH 3/8] powerpc: remove default kexec/crash_kernel ops assignments Anton Vorontsov
` (6 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
This patch removes need for each platform to specify default kexec and
crash kernel ops, thus effectively adds a working kexec support for most
boards.
Platforms that can't cope with default ops will explode in some weird
way, which means that the board's kexec support should be fixed or
blacklisted via dummy _prepare callback returning -ENOSYS.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/kernel/machine_kexec.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index a625673..ac42cfb 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -22,6 +22,8 @@ void machine_crash_shutdown(struct pt_regs *regs)
{
if (ppc_md.machine_crash_shutdown)
ppc_md.machine_crash_shutdown(regs);
+ else
+ return default_machine_crash_shutdown(regs);
}
/*
@@ -33,11 +35,8 @@ int machine_kexec_prepare(struct kimage *image)
{
if (ppc_md.machine_kexec_prepare)
return ppc_md.machine_kexec_prepare(image);
- /*
- * Fail if platform doesn't provide its own machine_kexec_prepare
- * implementation.
- */
- return -ENOSYS;
+ else
+ return default_machine_kexec_prepare(image);
}
void machine_kexec_cleanup(struct kimage *image)
@@ -54,13 +53,10 @@ void machine_kexec(struct kimage *image)
{
if (ppc_md.machine_kexec)
ppc_md.machine_kexec(image);
- else {
- /*
- * Fall back to normal restart if platform doesn't provide
- * its own kexec function, and user insist to kexec...
- */
- machine_restart(NULL);
- }
+ else
+ default_machine_kexec(image);
+ /* Fall back to normal restart if we're still alive. */
+ machine_restart(NULL);
for(;;);
}
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/8] powerpc: remove default kexec/crash_kernel ops assignments
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
2008-08-01 14:14 ` [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec Anton Vorontsov
2008-08-01 14:14 ` [PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-01 14:14 ` [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M Anton Vorontsov
` (5 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
Default ops are implicit now.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/platforms/cell/celleb_setup.c | 9 ---------
arch/powerpc/platforms/cell/setup.c | 6 ------
arch/powerpc/platforms/embedded6xx/c2k.c | 6 ------
arch/powerpc/platforms/embedded6xx/prpmc2800.c | 6 ------
arch/powerpc/platforms/maple/setup.c | 6 ------
arch/powerpc/platforms/powermac/setup.c | 6 ------
arch/powerpc/platforms/ps3/setup.c | 4 ----
7 files changed, 0 insertions(+), 43 deletions(-)
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index b11cb30..07c234f 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -45,7 +45,6 @@
#include <asm/mmu.h>
#include <asm/processor.h>
#include <asm/io.h>
-#include <asm/kexec.h>
#include <asm/prom.h>
#include <asm/machdep.h>
#include <asm/cputable.h>
@@ -226,9 +225,6 @@ define_machine(celleb_beat) {
.pci_setup_phb = celleb_setup_phb,
#ifdef CONFIG_KEXEC
.kexec_cpu_down = beat_kexec_cpu_down,
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
#endif
};
@@ -248,9 +244,4 @@ define_machine(celleb_native) {
.pci_probe_mode = celleb_pci_probe_mode,
.pci_setup_phb = celleb_setup_phb,
.init_IRQ = celleb_init_IRQ_native,
-#ifdef CONFIG_KEXEC
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
};
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index ab721b5..5930536 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -35,7 +35,6 @@
#include <asm/mmu.h>
#include <asm/processor.h>
#include <asm/io.h>
-#include <asm/kexec.h>
#include <asm/pgtable.h>
#include <asm/prom.h>
#include <asm/rtas.h>
@@ -289,9 +288,4 @@ define_machine(cell) {
.progress = cell_progress,
.init_IRQ = cell_init_irq,
.pci_setup_phb = cell_setup_phb,
-#ifdef CONFIG_KEXEC
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
};
diff --git a/arch/powerpc/platforms/embedded6xx/c2k.c b/arch/powerpc/platforms/embedded6xx/c2k.c
index d0b25b8..19d3bc4 100644
--- a/arch/powerpc/platforms/embedded6xx/c2k.c
+++ b/arch/powerpc/platforms/embedded6xx/c2k.c
@@ -20,7 +20,6 @@
#include <linux/seq_file.h>
#include <linux/time.h>
#include <linux/of.h>
-#include <linux/kexec.h>
#include <asm/machdep.h>
#include <asm/prom.h>
@@ -150,9 +149,4 @@ define_machine(c2k) {
.get_irq = mv64x60_get_irq,
.restart = c2k_restart,
.calibrate_decr = generic_calibrate_decr,
-#ifdef CONFIG_KEXEC
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
};
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index 5a19b9a..e40b5a8 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -19,7 +19,6 @@
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/time.h>
-#include <asm/kexec.h>
#include <mm/mmu_decl.h>
@@ -158,9 +157,4 @@ define_machine(prpmc2800){
.get_irq = mv64x60_get_irq,
.restart = prpmc2800_restart,
.calibrate_decr = generic_calibrate_decr,
-#ifdef CONFIG_KEXEC
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
};
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 3647147..1be9b7c 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -51,7 +51,6 @@
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/io.h>
-#include <asm/kexec.h>
#include <asm/pci-bridge.h>
#include <asm/iommu.h>
#include <asm/machdep.h>
@@ -336,9 +335,4 @@ define_machine(maple) {
.calibrate_decr = generic_calibrate_decr,
.progress = maple_progress,
.power_save = power4_idle,
-#ifdef CONFIG_KEXEC
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
};
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 88ccf3a..5e0999b 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -61,7 +61,6 @@
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/io.h>
-#include <asm/kexec.h>
#include <asm/pci-bridge.h>
#include <asm/ohare.h>
#include <asm/mediabay.h>
@@ -741,11 +740,6 @@ define_machine(powermac) {
.pci_probe_mode = pmac_pci_probe_mode,
.power_save = power4_idle,
.enable_pmcs = power4_enable_pmcs,
-#ifdef CONFIG_KEXEC
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
-#endif
#endif /* CONFIG_PPC64 */
#ifdef CONFIG_PPC32
.pcibios_enable_device_hook = pmac_pci_enable_device_hook,
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index a413abb..a8b99a6 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -23,7 +23,6 @@
#include <linux/fs.h>
#include <linux/root_dev.h>
#include <linux/console.h>
-#include <linux/kexec.h>
#include <linux/bootmem.h>
#include <asm/machdep.h>
@@ -278,8 +277,5 @@ define_machine(ps3) {
.halt = ps3_halt,
#if defined(CONFIG_KEXEC)
.kexec_cpu_down = ps3_kexec_cpu_down,
- .machine_kexec = default_machine_kexec,
- .machine_kexec_prepare = default_machine_kexec_prepare,
- .machine_crash_shutdown = default_machine_crash_shutdown,
#endif
};
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
` (2 preceding siblings ...)
2008-08-01 14:14 ` [PATCH 3/8] powerpc: remove default kexec/crash_kernel ops assignments Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-01 18:49 ` Scott Wood
2008-08-01 14:14 ` [PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump kernel on ppc32 Anton Vorontsov
` (4 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
From: Dale Farnsworth <dale@farnsworth.org>
Add the ability for a classic ppc kernel to be loaded at an address
of 32MB. This done by fixing a few places that assume we are loaded
at address 0, and by changing several uses of KERNELBASE to use
PAGE_OFFSET, instead.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/kernel/head_32.S | 11 ++++++-----
arch/powerpc/mm/init_32.c | 2 +-
arch/powerpc/mm/pgtable_32.c | 4 ++--
arch/powerpc/mm/ppc_mmu_32.c | 8 ++++----
include/asm-powerpc/ppc_asm.h | 4 ++--
5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 99ee2f0..45e612b 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -176,7 +176,8 @@ __after_mmu_off:
bl reloc_offset
mr r26,r3
addis r4,r3,KERNELBASE@h /* current address of _start */
- cmpwi 0,r4,0 /* are we already running at 0? */
+ lis r5,PHYSICAL_START@h
+ cmplw 0,r4,r5 /* already running at PHYSICAL_START? */
bne relocate_kernel
/*
* we now have the 1st 16M of ram mapped with the bats.
@@ -804,13 +805,13 @@ giveup_altivec:
/*
* This code is jumped to from the startup code to copy
- * the kernel image to physical address 0.
+ * the kernel image to physical address PHYSICAL_START.
*/
relocate_kernel:
addis r9,r26,klimit@ha /* fetch klimit */
lwz r25,klimit@l(r9)
addis r25,r25,-KERNELBASE@h
- li r3,0 /* Destination base address */
+ lis r3,PHYSICAL_START@h /* Destination base address */
li r6,0 /* Destination offset */
li r5,0x4000 /* # bytes of memory to copy */
bl copy_and_flush /* copy the first 0x4000 bytes */
@@ -1172,11 +1173,11 @@ mmu_off:
/*
* Use the first pair of BAT registers to map the 1st 16MB
- * of RAM to KERNELBASE. From this point on we can't safely
+ * of RAM to PAGE_OFFSET. From this point on we can't safely
* call OF any more.
*/
initial_bats:
- lis r11,KERNELBASE@h
+ lis r11,PAGE_OFFSET@h
mfspr r9,SPRN_PVR
rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
cmpwi 0,r9,1
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 388ceda..4ac0e4e 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -49,7 +49,7 @@
#if defined(CONFIG_KERNEL_START_BOOL) || defined(CONFIG_LOWMEM_SIZE_BOOL)
/* The ammount of lowmem must be within 0xF0000000 - KERNELBASE. */
-#if (CONFIG_LOWMEM_SIZE > (0xF0000000 - KERNELBASE))
+#if (CONFIG_LOWMEM_SIZE > (0xF0000000 - PAGE_OFFSET))
#error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_START_KERNEL"
#endif
#endif
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 2001abd..ea50968 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -288,7 +288,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
}
/*
- * Map in all of physical memory starting at KERNELBASE.
+ * Map in all of physical memory starting at PAGE_OFFSET.
*/
void __init mapin_ram(void)
{
@@ -297,7 +297,7 @@ void __init mapin_ram(void)
int ktext;
s = mmu_mapin_ram();
- v = KERNELBASE + s;
+ v = PAGE_OFFSET + s;
p = memstart_addr + s;
for (; s < total_lowmem; s += PAGE_SIZE) {
ktext = ((char *) v >= _stext && (char *) v < etext);
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index c53145f..7c86103 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -95,16 +95,16 @@ unsigned long __init mmu_mapin_ram(void)
break;
}
- setbat(2, KERNELBASE, 0, bl, _PAGE_RAM);
- done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1;
+ setbat(2, PAGE_OFFSET, 0, bl, _PAGE_RAM);
+ done = (unsigned long)bat_addrs[2].limit - PAGE_OFFSET + 1;
if ((done < tot) && !bat_addrs[3].limit) {
/* use BAT3 to cover a bit more */
tot -= done;
for (bl = 128<<10; bl < max_size; bl <<= 1)
if (bl * 2 > tot)
break;
- setbat(3, KERNELBASE+done, done, bl, _PAGE_RAM);
- done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1;
+ setbat(3, PAGE_OFFSET+done, done, bl, _PAGE_RAM);
+ done = (unsigned long)bat_addrs[3].limit - PAGE_OFFSET + 1;
}
return done;
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index 0966899..d0c7f33 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -425,14 +425,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
#define fromreal(rd) tovirt(rd,rd)
#define tophys(rd,rs) \
-0: addis rd,rs,-KERNELBASE@h; \
+0: addis rd,rs,-PAGE_OFFSET@h; \
.section ".vtop_fixup","aw"; \
.align 1; \
.long 0b; \
.previous
#define tovirt(rd,rs) \
-0: addis rd,rs,KERNELBASE@h; \
+0: addis rd,rs,PAGE_OFFSET@h; \
.section ".ptov_fixup","aw"; \
.align 1; \
.long 0b; \
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump kernel on ppc32
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
` (3 preceding siblings ...)
2008-08-01 14:14 ` [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-01 14:14 ` [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump Anton Vorontsov
` (3 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
While for debugging it is good to catch bogus users of ioremap, but
for kdump support it is more convenient to use ioremap for
copy_oldmem_page() (exactly as we do for PPC64 currently).
The other option is to use kmap_atomic_pfn()*, but it will not work for
kernels compiled without HIGHMEM.
That is, on a board with 256MB RAM and crashkernel=64M@32M case, the
!HIGHMEM capturing kernel maps 0-96M range, which does not include all
the memory needed to capture the dump. And obviously accessing anything
upper than 96M will cause faults.
* http://ozlabs.org/pipermail/linuxppc-dev/2007-November/046747.html
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/mm/pgtable_32.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index ea50968..3e69b0d 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -194,6 +194,7 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
if (p < 16*1024*1024)
p += _ISA_MEM_BASE;
+#ifndef CONFIG_CRASH_DUMP
/*
* Don't allow anybody to remap normal RAM that we're using.
* mem_init() sets high_memory so only do the check after that.
@@ -203,6 +204,7 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
(unsigned long long)p, __builtin_return_address(0));
return NULL;
}
+#endif
if (size == 0)
return NULL;
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
` (4 preceding siblings ...)
2008-08-01 14:14 ` [PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump kernel on ppc32 Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-07 10:47 ` Michael Ellerman
2008-08-01 14:14 ` [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32 Anton Vorontsov
` (2 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
From: Dale Farnsworth <dale@farnsworth.org>
Refactor the setting of kexec OF properties, moving the common code
from machine_kexec_64.c to machine_kexec.c where it can be used on
both ppc64 and ppc32. This will be needed for kdump to work on ppc32
platforms.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/kernel/machine_kexec.c | 38 ++++++++++++++++++++++++++++
arch/powerpc/kernel/machine_kexec_64.c | 43 --------------------------------
2 files changed, 38 insertions(+), 43 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index ac42cfb..bfef717 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -117,6 +117,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
/* Values we need to export to the second kernel via the device tree. */
static unsigned long kernel_end;
+static unsigned long crashk_size;
static struct property kernel_end_prop = {
.name = "linux,kernel-end",
@@ -124,6 +125,41 @@ static struct property kernel_end_prop = {
.value = &kernel_end,
};
+static struct property crashk_base_prop = {
+ .name = "linux,crashkernel-base",
+ .length = sizeof(unsigned long),
+ .value = &crashk_res.start,
+};
+
+static struct property crashk_size_prop = {
+ .name = "linux,crashkernel-size",
+ .length = sizeof(unsigned long),
+ .value = &crashk_size,
+};
+
+static void __init export_crashk_values(struct device_node *node)
+{
+ struct property *prop;
+
+ /* There might be existing crash kernel properties, but we can't
+ * be sure what's in them, so remove them. */
+ prop = of_find_property(node, "linux,crashkernel-base", NULL);
+ if (prop)
+ prom_remove_property(node, prop);
+
+ prop = of_find_property(node, "linux,crashkernel-size", NULL);
+ if (prop)
+ prom_remove_property(node, prop);
+
+ if (crashk_res.start != 0) {
+ prom_add_property(node, &crashk_base_prop);
+ crashk_size = crashk_res.end - crashk_res.start + 1;
+ prom_add_property(node, &crashk_size_prop);
+ }
+
+ of_node_put(node);
+}
+
static int __init kexec_setup(void)
{
struct device_node *node;
@@ -135,6 +171,8 @@ static int __init kexec_setup(void)
kernel_end = __pa(_end);
prom_add_property(node, &kernel_end_prop);
+ export_crashk_values(node);
+
of_node_put(node);
return 0;
}
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index c30678d..2aab296 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -322,52 +322,9 @@ static void __init export_htab_values(void)
of_node_put(node);
}
-static struct property crashk_base_prop = {
- .name = "linux,crashkernel-base",
- .length = sizeof(unsigned long),
- .value = &crashk_res.start,
-};
-
-static unsigned long crashk_size;
-
-static struct property crashk_size_prop = {
- .name = "linux,crashkernel-size",
- .length = sizeof(unsigned long),
- .value = &crashk_size,
-};
-
-static void __init export_crashk_values(void)
-{
- struct device_node *node;
- struct property *prop;
-
- node = of_find_node_by_path("/chosen");
- if (!node)
- return;
-
- /* There might be existing crash kernel properties, but we can't
- * be sure what's in them, so remove them. */
- prop = of_find_property(node, "linux,crashkernel-base", NULL);
- if (prop)
- prom_remove_property(node, prop);
-
- prop = of_find_property(node, "linux,crashkernel-size", NULL);
- if (prop)
- prom_remove_property(node, prop);
-
- if (crashk_res.start != 0) {
- prom_add_property(node, &crashk_base_prop);
- crashk_size = crashk_res.end - crashk_res.start + 1;
- prom_add_property(node, &crashk_size_prop);
- }
-
- of_node_put(node);
-}
-
static int __init kexec_setup(void)
{
export_htab_values();
- export_crashk_values();
return 0;
}
__initcall(kexec_setup);
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
` (5 preceding siblings ...)
2008-08-01 14:14 ` [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-07 10:32 ` Michael Ellerman
2008-08-01 14:14 ` [PATCH 8/8] powerpc: last bits to support kdump on ppc32 Anton Vorontsov
2008-08-01 14:21 ` [RFC][PATCH 0/8] kexec/kdump support for ppc32 Kumar Gala
8 siblings, 1 reply; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
From: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
include/asm-powerpc/kexec.h | 60 ++++++++++++++++++++++++++++++++++++------
1 files changed, 51 insertions(+), 9 deletions(-)
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index acdcdc6..9ecc307 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -38,7 +38,6 @@ typedef void (*crash_shutdown_t)(void);
#ifdef CONFIG_KEXEC
-#ifdef __powerpc64__
/*
* This function is responsible for capturing register states if coming
* via panic or invoking dump using sysrq-trigger.
@@ -51,6 +50,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
else {
/* FIXME Merge this with xmon_save_regs ?? */
unsigned long tmp1, tmp2;
+#ifdef __powerpc64__
__asm__ __volatile__ (
"std 0,0(%2)\n"
"std 1,8(%2)\n"
@@ -99,16 +99,58 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
: "=&r" (tmp1), "=&r" (tmp2)
: "b" (newregs)
: "memory");
+#else /* __powerpc64__ */
+ __asm__ __volatile__ (
+ "stw 0,0(%2)\n"
+ "stw 1,4(%2)\n"
+ "stw 2,8(%2)\n"
+ "stw 3,12(%2)\n"
+ "stw 4,16(%2)\n"
+ "stw 5,20(%2)\n"
+ "stw 6,24(%2)\n"
+ "stw 7,28(%2)\n"
+ "stw 8,32(%2)\n"
+ "stw 9,36(%2)\n"
+ "stw 10,40(%2)\n"
+ "stw 11,44(%2)\n"
+ "stw 12,48(%2)\n"
+ "stw 13,52(%2)\n"
+ "stw 14,56(%2)\n"
+ "stw 15,60(%2)\n"
+ "stw 16,64(%2)\n"
+ "stw 17,68(%2)\n"
+ "stw 18,72(%2)\n"
+ "stw 19,76(%2)\n"
+ "stw 20,80(%2)\n"
+ "stw 21,84(%2)\n"
+ "stw 22,88(%2)\n"
+ "stw 23,92(%2)\n"
+ "stw 24,96(%2)\n"
+ "stw 25,100(%2)\n"
+ "stw 26,104(%2)\n"
+ "stw 27,108(%2)\n"
+ "stw 28,112(%2)\n"
+ "stw 29,116(%2)\n"
+ "stw 30,120(%2)\n"
+ "stw 31,124(%2)\n"
+ "mfmsr %0\n"
+ "stw %0,132(%2)\n"
+ "mfctr %0\n"
+ "stw %0,140(%2)\n"
+ "mflr %0\n"
+ "stw %0,144(%2)\n"
+ "bl 1f\n"
+ "1: mflr %1\n"
+ "stw %1,128(%2)\n"
+ "mtlr %0\n"
+ "mfxer %0\n"
+ "stw %0,148(%2)\n"
+ : "=&r" (tmp1), "=&r" (tmp2)
+ : "b" (newregs)
+ : "memory");
+#endif /* __powerpc64 __ */
}
}
-#else
-/*
- * Provide a dummy definition to avoid build failures. Will remain
- * empty till crash dump support is enabled.
- */
-static inline void crash_setup_regs(struct pt_regs *newregs,
- struct pt_regs *oldregs) { }
-#endif /* !__powerpc64 __ */
extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
master to copy new code to 0 */
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 8/8] powerpc: last bits to support kdump on ppc32
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
` (6 preceding siblings ...)
2008-08-01 14:14 ` [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32 Anton Vorontsov
@ 2008-08-01 14:14 ` Anton Vorontsov
2008-08-03 14:40 ` Michael Ellerman
2008-08-01 14:21 ` [RFC][PATCH 0/8] kexec/kdump support for ppc32 Kumar Gala
8 siblings, 1 reply; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
From: Dale Farnsworth <dale@farnsworth.org>
Wire up the trampoline code for ppc32 to relay exceptions from the
vectors at address 0 to vectors at address 32MB, and modify Kconfig
to enable Kdump support for all powerpcs (except BookE, for now).
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/crash_dump.c | 6 +++++-
arch/powerpc/kernel/setup_32.c | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 587da5e..006a475 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -321,7 +321,7 @@ config KEXEC
config CRASH_DUMP
bool "Build a kdump crash kernel"
- depends on PPC_MULTIPLATFORM && PPC64
+ depends on PPC_MULTIPLATFORM && !BOOKE
help
Build a kernel suitable for use as a kdump capture kernel.
The kernel will be linked at a different address than normal, and
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index e0debcc..96cd521 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -34,7 +34,11 @@ void __init reserve_kdump_trampoline(void)
static void __init create_trampoline(unsigned long addr)
{
- unsigned int *p = (unsigned int *)addr;
+ unsigned int *p;
+
+ /* XXX: why this code is working without += PAGE_OFFSET on PPC64? */
+ addr += PAGE_OFFSET;
+ p = (unsigned int *)addr;
/* The maximum range of a single instruction branch, is the current
* instruction's address + (32 MB - 4) bytes. For the trampoline we
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 066e65c..1d76afc 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -121,6 +121,8 @@ notrace void __init machine_init(unsigned long dt_ptr, unsigned long phys)
probe_machine();
+ setup_kdump_trampoline();
+
#ifdef CONFIG_6xx
if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
cpu_has_feature(CPU_FTR_CAN_NAP))
--
1.5.5.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [RFC][PATCH 0/8] kexec/kdump support for ppc32
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
` (7 preceding siblings ...)
2008-08-01 14:14 ` [PATCH 8/8] powerpc: last bits to support kdump on ppc32 Anton Vorontsov
@ 2008-08-01 14:21 ` Kumar Gala
2008-08-01 14:46 ` Anton Vorontsov
8 siblings, 1 reply; 19+ messages in thread
From: Kumar Gala @ 2008-08-01 14:21 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev, Paul Mackerras
On Aug 1, 2008, at 9:13 AM, Anton Vorontsov wrote:
> Hi all,
>
> I refreshed some Dale Farnsworth's kexec/kdump patches[1] against
> the latest kernel, and here they are.
>
> There is a difference though. Dale's patches were using
> kmap_atomic_pfn() to map oldmem memory, while for this patches
> I took PPC64 approach to use ioremap(). This is done to be able
> to support kdump on !HIGHMEM kernels.
>
> Also, please take a special look into 8/8 patch, there is a hunk
> marked with "XXX:", which I don't quite understand for PPC64 case
> (this hunk also persist in the original Dale's patch, and w/o it
> the capturing kernel doesn't boot on ppc32).
>
> I'll try to refresh BookE support as soon as I'll find some BookE
> board.
>
> The patchset includes:
>
> - Kexec support
>
> [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec
> [PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit
> [PATCH 3/8] powerpc: remove default kexec/crash_kernel ops
> assignments
>
> 2/8 and 3/8 patches are used to avoid adding lots of default ops
> to the board files.
>
> - Kdump support
>
> [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be
> loaded at 32M
> [PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump
> kernel on ppc32
> [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump
> [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32
> [PATCH 8/8] powerpc: last bits to support kdump on ppc32
>
> [1] http://ozlabs.org/pipermail/linuxppc-dev/2007-November/046739.html
What's the state of the kexec tools for ppc32?
- k
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC][PATCH 0/8] kexec/kdump support for ppc32
2008-08-01 14:21 ` [RFC][PATCH 0/8] kexec/kdump support for ppc32 Kumar Gala
@ 2008-08-01 14:46 ` Anton Vorontsov
0 siblings, 0 replies; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 14:46 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
On Fri, Aug 01, 2008 at 09:21:02AM -0500, Kumar Gala wrote:
>
> On Aug 1, 2008, at 9:13 AM, Anton Vorontsov wrote:
>
>> Hi all,
>>
>> I refreshed some Dale Farnsworth's kexec/kdump patches[1] against
>> the latest kernel, and here they are.
>>
>> There is a difference though. Dale's patches were using
>> kmap_atomic_pfn() to map oldmem memory, while for this patches
>> I took PPC64 approach to use ioremap(). This is done to be able
>> to support kdump on !HIGHMEM kernels.
>>
>> Also, please take a special look into 8/8 patch, there is a hunk
>> marked with "XXX:", which I don't quite understand for PPC64 case
>> (this hunk also persist in the original Dale's patch, and w/o it
>> the capturing kernel doesn't boot on ppc32).
>>
>> I'll try to refresh BookE support as soon as I'll find some BookE
>> board.
>>
>> The patchset includes:
>>
>> - Kexec support
>>
>> [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec
>> [PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit
>> [PATCH 3/8] powerpc: remove default kexec/crash_kernel ops
>> assignments
>>
>> 2/8 and 3/8 patches are used to avoid adding lots of default ops
>> to the board files.
>>
>> - Kdump support
>>
>> [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be
>> loaded at 32M
>> [PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump kernel
>> on ppc32
>> [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump
>> [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32
>> [PATCH 8/8] powerpc: last bits to support kdump on ppc32
>>
>> [1] http://ozlabs.org/pipermail/linuxppc-dev/2007-November/046739.html
>
> What's the state of the kexec tools for ppc32?
Current kexec-tools has split arch support, and ppc32 is officially
broken.
I use some old (20070330), patched kexec-tools with ppc32/ and ppc64/
merged into powerpc (alike to Linux).
I hope one day I (or somebody else) will find time to cleanup or
re-do the patches for the recent kexec-tools, and merge them after
all.
Though, I didn't look into the patches themselves yet, so I can't
tell how much work is pending.
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M
2008-08-01 14:14 ` [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M Anton Vorontsov
@ 2008-08-01 18:49 ` Scott Wood
2008-08-01 20:38 ` Anton Vorontsov
0 siblings, 1 reply; 19+ messages in thread
From: Scott Wood @ 2008-08-01 18:49 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Paul Mackerras
On Fri, Aug 01, 2008 at 06:14:20PM +0400, Anton Vorontsov wrote:
> From: Dale Farnsworth <dale@farnsworth.org>
>
> Add the ability for a classic ppc kernel to be loaded at an address
> of 32MB. This done by fixing a few places that assume we are loaded
> at address 0, and by changing several uses of KERNELBASE to use
> PAGE_OFFSET, instead.
What do you do about the exception vectors?
-Scott
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M
2008-08-01 18:49 ` Scott Wood
@ 2008-08-01 20:38 ` Anton Vorontsov
2008-08-20 4:57 ` Paul Mackerras
0 siblings, 1 reply; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-01 20:38 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, Paul Mackerras
On Fri, Aug 01, 2008 at 01:49:52PM -0500, Scott Wood wrote:
> On Fri, Aug 01, 2008 at 06:14:20PM +0400, Anton Vorontsov wrote:
> > From: Dale Farnsworth <dale@farnsworth.org>
> >
> > Add the ability for a classic ppc kernel to be loaded at an address
> > of 32MB. This done by fixing a few places that assume we are loaded
> > at address 0, and by changing several uses of KERNELBASE to use
> > PAGE_OFFSET, instead.
>
> What do you do about the exception vectors?
Making a trampoline code in place of exception vectors. See this patch:
[PATCH 8/8] powerpc: last bits to support kdump on ppc32
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 8/8] powerpc: last bits to support kdump on ppc32
2008-08-01 14:14 ` [PATCH 8/8] powerpc: last bits to support kdump on ppc32 Anton Vorontsov
@ 2008-08-03 14:40 ` Michael Ellerman
0 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2008-08-03 14:40 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]
On Fri, 2008-08-01 at 18:14 +0400, Anton Vorontsov wrote:
> From: Dale Farnsworth <dale@farnsworth.org>
>
> Wire up the trampoline code for ppc32 to relay exceptions from the
> vectors at address 0 to vectors at address 32MB, and modify Kconfig
> to enable Kdump support for all powerpcs (except BookE, for now).
>
> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
> index e0debcc..96cd521 100644
> --- a/arch/powerpc/kernel/crash_dump.c
> +++ b/arch/powerpc/kernel/crash_dump.c
> @@ -34,7 +34,11 @@ void __init reserve_kdump_trampoline(void)
>
> static void __init create_trampoline(unsigned long addr)
> {
> - unsigned int *p = (unsigned int *)addr;
> + unsigned int *p;
> +
> + /* XXX: why this code is working without += PAGE_OFFSET on PPC64? */
> + addr += PAGE_OFFSET;
> + p = (unsigned int *)addr;
Because we're still in real mode when we call it.
It's kind of funny that it works on 32-bit as well. You're creating a
branch from 0xc0000000 to 0xc2000000, and then expecting it to work when
you're in real mode and you actually want to jump from 0x0 to 0x2000000
- luckily it's a relative branch :)
To clean this up you should just be able to change the definitions for
KDUMP_TRAMPOLINE_START/END to include PAGE_OFFSET and that should work
for 32 & 64-bit.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32
2008-08-01 14:14 ` [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32 Anton Vorontsov
@ 2008-08-07 10:32 ` Michael Ellerman
0 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2008-08-07 10:32 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]
On Fri, 2008-08-01 at 18:14 +0400, Anton Vorontsov wrote:
> From: Dale Farnsworth <dale@farnsworth.org>
>
> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> @@ -51,6 +50,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
> else {
> /* FIXME Merge this with xmon_save_regs ?? */
> unsigned long tmp1, tmp2;
> +#ifdef __powerpc64__
> __asm__ __volatile__ (
> "std 0,0(%2)\n"
> "std 1,8(%2)\n"
> @@ -99,16 +99,58 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
> : "=&r" (tmp1), "=&r" (tmp2)
> : "b" (newregs)
> : "memory");
> +#else /* __powerpc64__ */
> + __asm__ __volatile__ (
> + "stw 0,0(%2)\n"
> + "stw 1,4(%2)\n"
> + "stw 2,8(%2)\n"
> + "stw 3,12(%2)\n"
> + "stw 4,16(%2)\n"
> + "stw 5,20(%2)\n"
> + "stw 6,24(%2)\n"
> + "stw 7,28(%2)\n"
> + "stw 8,32(%2)\n"
..
Hi Anton,
You should be able to avoid any use of #ifdefs in this routine. Look at
SAVE_GPR() and friends in asm/ppc_asm.h.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec
2008-08-01 14:14 ` [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec Anton Vorontsov
@ 2008-08-07 10:44 ` Michael Ellerman
0 siblings, 0 replies; 19+ messages in thread
From: Michael Ellerman @ 2008-08-07 10:44 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
On Fri, 2008-08-01 at 18:14 +0400, Anton Vorontsov wrote:
> From: Dale Farnsworth <dale@farnsworth.org>
>
> Refactor the setting of kexec OF properties, moving the common code
> from machine_kexec_64.c to machine_kexec.c where it can be used on
> both ppc64 and ppc32. This is needed for kexec to work on ppc32
> platforms.
Hi Anton,
> diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> index aab7688..a625673 100644
> --- a/arch/powerpc/kernel/machine_kexec.c
> +++ b/arch/powerpc/kernel/machine_kexec.c
...
> +
> +static int __init kexec_setup(void)
> +{
> + struct device_node *node;
> +
> + node = of_find_node_by_path("/chosen");
> + if (!node)
> + return -ENOENT;
> +
> + kernel_end = __pa(_end);
> + prom_add_property(node, &kernel_end_prop);
> +
> + of_node_put(node);
> + return 0;
> +}
> +__initcall(kexec_setup);
__initcall() is supposedly deprecated, use device_initcall() instead.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump
2008-08-01 14:14 ` [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump Anton Vorontsov
@ 2008-08-07 10:47 ` Michael Ellerman
2008-08-07 11:11 ` Anton Vorontsov
0 siblings, 1 reply; 19+ messages in thread
From: Michael Ellerman @ 2008-08-07 10:47 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]
On Fri, 2008-08-01 at 18:14 +0400, Anton Vorontsov wrote:
> From: Dale Farnsworth <dale@farnsworth.org>
>
> Refactor the setting of kexec OF properties, moving the common code
> from machine_kexec_64.c to machine_kexec.c where it can be used on
> both ppc64 and ppc32. This will be needed for kdump to work on ppc32
> platforms.
Hi Anton,
> diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> index ac42cfb..bfef717 100644
> --- a/arch/powerpc/kernel/machine_kexec.c
> +++ b/arch/powerpc/kernel/machine_kexec.c
> @@ -117,6 +117,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
>
> static int __init kexec_setup(void)
> {
> struct device_node *node;
> @@ -135,6 +171,8 @@ static int __init kexec_setup(void)
> kernel_end = __pa(_end);
> prom_add_property(node, &kernel_end_prop);
>
> + export_crashk_values(node);
> +
> of_node_put(node);
> return 0;
> }
> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
> index c30678d..2aab296 100644
> --- a/arch/powerpc/kernel/machine_kexec_64.c
> +++ b/arch/powerpc/kernel/machine_kexec_64.c
...
> -
> static int __init kexec_setup(void)
> {
> export_htab_values();
> - export_crashk_values();
> return 0;
> }
> __initcall(kexec_setup);
This leaves us with two routines called kexec_setup(), do you mind
getting rid of this one and making export_htab_values() an initcall
directly.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump
2008-08-07 10:47 ` Michael Ellerman
@ 2008-08-07 11:11 ` Anton Vorontsov
0 siblings, 0 replies; 19+ messages in thread
From: Anton Vorontsov @ 2008-08-07 11:11 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras
On Thu, Aug 07, 2008 at 08:47:31PM +1000, Michael Ellerman wrote:
> On Fri, 2008-08-01 at 18:14 +0400, Anton Vorontsov wrote:
> > From: Dale Farnsworth <dale@farnsworth.org>
> >
> > Refactor the setting of kexec OF properties, moving the common code
> > from machine_kexec_64.c to machine_kexec.c where it can be used on
> > both ppc64 and ppc32. This will be needed for kdump to work on ppc32
> > platforms.
>
> Hi Anton,
Hi,
> > diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> > index ac42cfb..bfef717 100644
> > --- a/arch/powerpc/kernel/machine_kexec.c
> > +++ b/arch/powerpc/kernel/machine_kexec.c
> > @@ -117,6 +117,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
> >
>
> > static int __init kexec_setup(void)
> > {
> > struct device_node *node;
> > @@ -135,6 +171,8 @@ static int __init kexec_setup(void)
> > kernel_end = __pa(_end);
> > prom_add_property(node, &kernel_end_prop);
> >
> > + export_crashk_values(node);
> > +
> > of_node_put(node);
> > return 0;
> > }
> > diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
> > index c30678d..2aab296 100644
> > --- a/arch/powerpc/kernel/machine_kexec_64.c
> > +++ b/arch/powerpc/kernel/machine_kexec_64.c
> ...
>
> > -
> > static int __init kexec_setup(void)
> > {
> > export_htab_values();
> > - export_crashk_values();
> > return 0;
> > }
> > __initcall(kexec_setup);
>
> This leaves us with two routines called kexec_setup(), do you mind
> getting rid of this one and making export_htab_values() an initcall
> directly.
Yup, good idea. Will do this, and will address your other comments,
too.
Thanks!
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M
2008-08-01 20:38 ` Anton Vorontsov
@ 2008-08-20 4:57 ` Paul Mackerras
0 siblings, 0 replies; 19+ messages in thread
From: Paul Mackerras @ 2008-08-20 4:57 UTC (permalink / raw)
To: avorontsov; +Cc: Scott Wood, linuxppc-dev
Anton Vorontsov writes:
> > What do you do about the exception vectors?
>
> Making a trampoline code in place of exception vectors. See this patch:
>
> [PATCH 8/8] powerpc: last bits to support kdump on ppc32
It would probably be worth looking at whether we could do a
relocatable 32-bit kernel by linking it as a PIE and processing the
dynamic relocations at boot time (like the patches I posted recently
for 64-bit).
Paul.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2008-08-20 4:57 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-01 14:13 [RFC][PATCH 0/8] kexec/kdump support for ppc32 Anton Vorontsov
2008-08-01 14:14 ` [PATCH 1/8] powerpc: set up OF properties for ppc32 kexec Anton Vorontsov
2008-08-07 10:44 ` Michael Ellerman
2008-08-01 14:14 ` [PATCH 2/8] powerpc: make default kexec/crash_kernel ops implicit Anton Vorontsov
2008-08-01 14:14 ` [PATCH 3/8] powerpc: remove default kexec/crash_kernel ops assignments Anton Vorontsov
2008-08-01 14:14 ` [PATCH 4/8] powerpc: add the ability for a classic ppc kernel to be loaded at 32M Anton Vorontsov
2008-08-01 18:49 ` Scott Wood
2008-08-01 20:38 ` Anton Vorontsov
2008-08-20 4:57 ` Paul Mackerras
2008-08-01 14:14 ` [PATCH 5/8] powerpc: allow to ioremap RAM addresses for kdump kernel on ppc32 Anton Vorontsov
2008-08-01 14:14 ` [PATCH 6/8] powerpc: set up OF properties for ppc32 kdump Anton Vorontsov
2008-08-07 10:47 ` Michael Ellerman
2008-08-07 11:11 ` Anton Vorontsov
2008-08-01 14:14 ` [PATCH 7/8] powerpc: implement crash_setup_regs for ppc32 Anton Vorontsov
2008-08-07 10:32 ` Michael Ellerman
2008-08-01 14:14 ` [PATCH 8/8] powerpc: last bits to support kdump on ppc32 Anton Vorontsov
2008-08-03 14:40 ` Michael Ellerman
2008-08-01 14:21 ` [RFC][PATCH 0/8] kexec/kdump support for ppc32 Kumar Gala
2008-08-01 14:46 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).