* [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32
[not found] <foo@xyzzy.farnsworth.org>
@ 2007-11-22 15:42 ` Dale Farnsworth
2007-11-22 15:45 ` [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec Dale Farnsworth
` (10 more replies)
0 siblings, 11 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:42 UTC (permalink / raw)
To: linuxppc-dev
This patch series adds kexec and kdump support for ppc32 in arch/powerpc.
It has been successfully tested on the mpc8548_cds and prpmc2800 platforms.
Mark Greer and I are preparing patches to the kexec-tools package as
well.
These patches apply to current powerpc.git.
Dale Farnsworth
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
@ 2007-11-22 15:45 ` Dale Farnsworth
2007-11-22 22:17 ` Stephen Rothwell
2007-11-22 15:46 ` [PATCH 02/10] powerpc: Cleanup CONFIG_KEXEC dependency Dale Farnsworth
` (9 subsequent siblings)
10 siblings, 1 reply; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:45 UTC (permalink / raw)
To: linuxppc-dev
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>
---
arch/powerpc/kernel/machine_kexec.c | 63 ++++++++++++++++++++++++++++++
arch/powerpc/kernel/machine_kexec_64.c | 67 +++----------------------------
2 files changed, 70 insertions(+), 60 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index c0c8e8c..691dba7 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -12,8 +12,11 @@
#include <linux/kexec.h>
#include <linux/reboot.h>
#include <linux/threads.h>
+#include <linux/of.h>
#include <asm/machdep.h>
#include <asm/lmb.h>
+#include <asm/sections.h> /* _end */
+#include <asm/prom.h>
void machine_crash_shutdown(struct pt_regs *regs)
{
@@ -115,3 +118,63 @@ 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 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;
+
+ kernel_end = __pa(_end);
+ prom_add_property(node, &kernel_end_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)
+{
+ export_crashk_values();
+ return 0;
+}
+__initcall(kexec_setup);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 704375b..a4bddb7 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,81 +303,28 @@ 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;
- 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);
-}
-
-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;
+ return;
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);
- }
+ htab_base = __pa(htab_address);
+ prom_add_property(node, &htab_base_prop);
+ prom_add_property(node, &htab_size_prop);
of_node_put(node);
}
-static int __init kexec_setup(void)
+static int __init kexec_setup_64(void)
{
export_htab_values();
- export_crashk_values();
return 0;
}
-__initcall(kexec_setup);
+__initcall(kexec_setup_64);
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 02/10] powerpc: Cleanup CONFIG_KEXEC dependency
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
2007-11-22 15:45 ` [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms Dale Farnsworth
` (8 subsequent siblings)
10 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
KEXEC's dependency on PPC_PRPMC2800 is redundant, since PPC_MULTIPLATFORM
is now set for the prpmc2800 platform. Remove the dependency.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 18f397c..191cc2c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -236,7 +236,7 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
config KEXEC
bool "kexec system call (EXPERIMENTAL)"
- depends on (PPC_PRPMC2800 || PPC_MULTIPLATFORM) && EXPERIMENTAL
+ depends on PPC_MULTIPLATFORM && EXPERIMENTAL
help
kexec is a system call that implements the ability to shutdown your
current kernel, and to start another kernel. It is like a reboot
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
2007-11-22 15:45 ` [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec Dale Farnsworth
2007-11-22 15:46 ` [PATCH 02/10] powerpc: Cleanup CONFIG_KEXEC dependency Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-11-22 22:20 ` Stephen Rothwell
2007-12-15 6:16 ` Benjamin Herrenschmidt
2007-11-22 15:46 ` [PATCH 04/10] powerpc: Add crash kernel support for classic ppc Dale Farnsworth
` (7 subsequent siblings)
10 siblings, 2 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
Book E processors need some extra setup in relocate_new_kernel,
because the MMU can't be turned off. Add the code to create
the required one-to-one memory map.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/misc_32.S | 69 +++++++++++++++++++++++++++++
arch/powerpc/platforms/85xx/mpc85xx_ads.c | 6 +++
arch/powerpc/platforms/85xx/mpc85xx_cds.c | 6 +++
arch/powerpc/platforms/85xx/mpc85xx_ds.c | 6 +++
arch/powerpc/platforms/85xx/mpc85xx_mds.c | 6 +++
6 files changed, 94 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 191cc2c..9e9581a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -236,7 +236,7 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
config KEXEC
bool "kexec system call (EXPERIMENTAL)"
- depends on PPC_MULTIPLATFORM && EXPERIMENTAL
+ depends on (PPC_MULTIPLATFORM || PPC_85xx) && EXPERIMENTAL
help
kexec is a system call that implements the ability to shutdown your
current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 8b642ab..db0e749 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -816,6 +816,75 @@ relocate_new_kernel:
/* r4 = reboot_code_buffer */
/* r5 = start_address */
+#ifdef CONFIG_E500
+ /*
+ * Since we can't turn off the MMU, we must create an identity
+ * map for kernel low memory. We start by invalidating the
+ * TLB entries we don't need.
+ *
+ * First, invalidate the TLB0 entries
+ */
+ li r6, 0x04
+ tlbivax 0, r6
+#ifdef CONFIG_SMP
+ tlbsync
+#endif
+ msync
+
+ /*
+ * Kernel low memory is mapped by TLB1 entries 0, 1, and 2.
+ * Preserve these, but invalidate all other TLB1 entries.
+ */
+ li r7, 3 /* first TLB1 entry */
+ mfspr r6, SPRN_TLB1CFG
+ andi. r6, r6, 0xfff
+ mr r8, r6
+ subf r6, r7, r6
+ mtctr r6
+1:
+ rlwinm r6, r7, 16, 12, 15
+ oris r6, r6, 0x1000
+ mtspr SPRN_MAS0, r6
+ tlbre
+ mfspr r6, SPRN_MAS1
+ rlwinm r6, r6, 0, 2, 31 /* Clear MAS1 Valid and IPROT */
+ mtspr SPRN_MAS1, r6
+ tlbwe
+ isync
+ addi r7, r7, 1
+ bdnz 1b
+
+ /*
+ * Using TLB1 entries 3, 4, and 5, identity-map kernel low
+ * memory by copying and modifying the contents of TLB1
+ * entries 0, 1 and 2, respectively.
+ */
+ li r7, 0 /* source TLB entry */
+ li r8, 3 /* destination TLB entry */
+ li r6, 3 /* number of TLBs to copy */
+ mtctr r6
+1:
+ rlwinm r6, r7, 16, 12, 15
+ oris r6, r6, 0x1000
+ mtspr SPRN_MAS0, r6
+ tlbre
+
+ mfspr r6, SPRN_MAS2
+ lis r0, PAGE_OFFSET@h
+ subf r6, r0, r6 /* identity map */
+ mtspr SPRN_MAS2, r6
+
+ rlwinm r6, r8, 16, 12, 15
+ oris r6, r6, 0x1000
+ mtspr SPRN_MAS0, r6
+ tlbwe
+ sync
+ isync
+ addi r7, r7, 1
+ addi r8, r8, 1
+ bdnz 1b
+#endif /* CONFIG_E500 */
+
li r0, 0
/*
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index bccdc25..1ade3dd 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -18,6 +18,7 @@
#include <linux/delay.h>
#include <linux/seq_file.h>
#include <linux/of_platform.h>
+#include <linux/kexec.h>
#include <asm/system.h>
#include <asm/time.h>
@@ -259,6 +260,11 @@ define_machine(mpc85xx_ads) {
.show_cpuinfo = mpc85xx_ads_show_cpuinfo,
.get_irq = mpic_get_irq,
.restart = fsl_rstcr_restart,
+#ifdef CONFIG_KEXEC
+ .machine_kexec_prepare = default_machine_kexec_prepare,
+ .machine_kexec = default_machine_kexec,
+ .machine_crash_shutdown = default_machine_crash_shutdown,
+#endif
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 4d063ee..b8a5ed2 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/fsl_devices.h>
+#include <linux/kexec.h>
#include <asm/system.h>
#include <asm/pgtable.h>
@@ -352,6 +353,11 @@ define_machine(mpc85xx_cds) {
#else
.restart = fsl_rstcr_restart,
#endif
+#ifdef CONFIG_KEXEC
+ .machine_kexec_prepare = default_machine_kexec_prepare,
+ .machine_kexec = default_machine_kexec,
+ .machine_crash_shutdown = default_machine_crash_shutdown,
+#endif
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 59c121a..4c106b6 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -19,6 +19,7 @@
#include <linux/delay.h>
#include <linux/seq_file.h>
#include <linux/interrupt.h>
+#include <linux/kexec.h>
#include <asm/system.h>
#include <asm/time.h>
@@ -224,6 +225,11 @@ define_machine(mpc8572_ds) {
#endif
.get_irq = mpic_get_irq,
.restart = fsl_rstcr_restart,
+#ifdef CONFIG_KEXEC
+ .machine_kexec_prepare = default_machine_kexec_prepare,
+ .machine_kexec = default_machine_kexec,
+ .machine_crash_shutdown = default_machine_crash_shutdown,
+#endif
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 61b3eed..49f55c1 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -30,6 +30,7 @@
#include <linux/initrd.h>
#include <linux/module.h>
#include <linux/fsl_devices.h>
+#include <linux/kexec.h>
#include <asm/of_device.h>
#include <asm/of_platform.h>
@@ -202,6 +203,11 @@ define_machine(mpc85xx_mds) {
.init_IRQ = mpc85xx_mds_pic_init,
.get_irq = mpic_get_irq,
.restart = fsl_rstcr_restart,
+#ifdef CONFIG_KEXEC
+ .machine_kexec_prepare = default_machine_kexec_prepare,
+ .machine_kexec = default_machine_kexec,
+ .machine_crash_shutdown = default_machine_crash_shutdown,
+#endif
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
#ifdef CONFIG_PCI
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 04/10] powerpc: Add crash kernel support for classic ppc
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (2 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 05/10] powerpc: Add crash kernel support for 85xx Dale Farnsworth
` (6 subsequent siblings)
10 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
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. We also
wire up the trampoline code for ppc32 to relay exceptions
from the vectors at address 0 to vectors at address 32MB.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/crash_dump.c | 1 +
arch/powerpc/kernel/head_32.S | 11 ++++++-----
arch/powerpc/kernel/setup_32.c | 2 ++
arch/powerpc/kernel/vmlinux.lds.S | 4 +---
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 ++--
9 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9e9581a..805b4d1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -253,7 +253,7 @@ config KEXEC
config CRASH_DUMP
bool "Build a kdump crash kernel (EXPERIMENTAL)"
- depends on PPC_MULTIPLATFORM && PPC64 && EXPERIMENTAL
+ depends on PPC_MULTIPLATFORM && EXPERIMENTAL
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 29ff77c..77c0376 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -40,6 +40,7 @@ static void __init create_trampoline(unsigned long addr)
* branch to "addr" we jump to ("addr" + 32 MB). Although it requires
* two instructions it doesn't require any registers.
*/
+ addr += PAGE_OFFSET;
create_instruction(addr, 0x60000000); /* nop */
create_branch(addr + 4, addr + PHYSICAL_START, 0);
}
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index a5b13ae..a9b50ab 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -175,7 +175,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.
@@ -818,13 +819,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 */
@@ -1186,11 +1187,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/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index cd870a8..bbb4caf 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -128,6 +128,8 @@ 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))
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index f66fa5d..242f17d 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -1,11 +1,9 @@
#ifdef CONFIG_PPC64
-#include <asm/page.h>
#define PROVIDE32(x) PROVIDE(__unused__##x)
#else
-#define PAGE_SIZE 4096
-#define KERNELBASE CONFIG_KERNEL_START
#define PROVIDE32(x) PROVIDE(x)
#endif
+#include <asm/page.h>
#include <asm-generic/vmlinux.lds.h>
#include <asm/cache.h>
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 977cb1e..a25d3d7 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -48,7 +48,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 6448872..e7505ea 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -275,7 +275,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)
{
@@ -283,7 +283,7 @@ void __init mapin_ram(void)
int ktext;
s = mmu_mapin_ram();
- v = KERNELBASE + s;
+ v = PAGE_OFFSET + s;
p = PPC_MEMSTART + 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 5c45d47..6316895 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -105,16 +105,16 @@ unsigned long __init mmu_mapin_ram(void)
break;
}
- setbat(2, KERNELBASE, PPC_MEMSTART, bl, _PAGE_RAM);
- done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1;
+ setbat(2, PAGE_OFFSET, PPC_MEMSTART, 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, PPC_MEMSTART+done, bl, _PAGE_RAM);
- done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1;
+ setbat(3, PAGE_OFFSET+done, PPC_MEMSTART+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 2dbd4e7..f8943ec 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -382,14 +382,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.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 05/10] powerpc: Add crash kernel support for 85xx
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (3 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 04/10] powerpc: Add crash kernel support for classic ppc Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-12-14 16:48 ` Kumar Gala
2008-01-21 16:19 ` Kumar Gala
2007-11-22 15:46 ` [PATCH 06/10] powerpc: Fix bogus crash kernel messages Dale Farnsworth
` (5 subsequent siblings)
10 siblings, 2 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
Add the ability to build a ppc_85xx kernel to run at a physical
address of 32MB.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/kernel/head_fsl_booke.S | 23 ++++++++++++++++++-----
arch/powerpc/mm/fsl_booke_mmu.c | 6 +++---
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 805b4d1..d405298 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -253,7 +253,7 @@ config KEXEC
config CRASH_DUMP
bool "Build a kdump crash kernel (EXPERIMENTAL)"
- depends on PPC_MULTIPLATFORM && EXPERIMENTAL
+ depends on (PPC_MULTIPLATFORM || PPC_85xx) && EXPERIMENTAL
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/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 4b98227..1c9685f 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -41,6 +41,12 @@
#include <asm/asm-offsets.h>
#include "head_booke.h"
+#ifdef CONFIG_CRASH_DUMP
+#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_64M)
+#else
+#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_16M)
+#endif
+
/* As with the other PowerPC ports, it is expected that when code
* execution begins here, the following registers contain valid, yet
* optional, information:
@@ -75,6 +81,7 @@ _ENTRY(_start);
* boot loader and load a single entry in TLB1[0] to map the
* first 16M of kernel memory. Any boot info passed from the
* bootloader needs to live in this first 16M.
+ * Note that for crash (kdump) kernels, the first 64M is mapped.
*
* Requirement on bootloader:
* - The page we're executing in needs to reside in TLB1 and
@@ -167,7 +174,7 @@ skpinv: addi r6,r6,1 /* Increment */
mtspr SPRN_MAS0,r7
tlbre
- /* Just modify the entry ID and EPN for the temp mapping */
+ /* Just modify the entry ID, EPN and RPN for the temp mapping */
lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
mtspr SPRN_MAS0,r7
@@ -177,9 +184,12 @@ skpinv: addi r6,r6,1 /* Increment */
ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l
mtspr SPRN_MAS1,r6
mfspr r6,SPRN_MAS2
- li r7,0 /* temp EPN = 0 */
+ lis r7,PHYSICAL_START@h
rlwimi r7,r6,0,20,31
mtspr SPRN_MAS2,r7
+ mfspr r6,SPRN_MAS3
+ rlwimi r7,r6,0,20,31
+ mtspr SPRN_MAS3,r7
tlbwe
xori r6,r4,1
@@ -222,11 +232,11 @@ skpinv: addi r6,r6,1 /* Increment */
lis r6,0x1000 /* Set MAS0(TLBSEL) = TLB1(1), ESEL = 0 */
mtspr SPRN_MAS0,r6
lis r6,(MAS1_VALID|MAS1_IPROT)@h
- ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_16M))@l
+ ori r6,r6,(MAS1_TSIZE(INITIAL_BOOKE_PAGESZ))@l
mtspr SPRN_MAS1,r6
li r7,0
- lis r6,KERNELBASE@h
- ori r6,r6,KERNELBASE@l
+ lis r6,PAGE_OFFSET@h
+ ori r6,r6,PAGE_OFFSET@l
rlwimi r6,r7,0,20,31
mtspr SPRN_MAS2,r6
li r7,(MAS3_SX|MAS3_SW|MAS3_SR)
@@ -234,6 +244,9 @@ skpinv: addi r6,r6,1 /* Increment */
tlbwe
/* 7. Jump to KERNELBASE mapping */
+ lis r6,KERNELBASE@h
+ ori r6,r6,KERNELBASE@l
+ rlwimi r6,r7,0,20,31
lis r7,MSR_KERNEL@h
ori r7,r7,MSR_KERNEL@l
bl 1f /* Find our address */
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 17139da..c93a966 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -165,15 +165,15 @@ void invalidate_tlbcam_entry(int index)
void __init cam_mapin_ram(unsigned long cam0, unsigned long cam1,
unsigned long cam2)
{
- settlbcam(0, KERNELBASE, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0);
+ settlbcam(0, PAGE_OFFSET, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0);
tlbcam_index++;
if (cam1) {
tlbcam_index++;
- settlbcam(1, KERNELBASE+cam0, PPC_MEMSTART+cam0, cam1, _PAGE_KERNEL, 0);
+ settlbcam(1, PAGE_OFFSET+cam0, PPC_MEMSTART+cam0, cam1, _PAGE_KERNEL, 0);
}
if (cam2) {
tlbcam_index++;
- settlbcam(2, KERNELBASE+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2, _PAGE_KERNEL, 0);
+ settlbcam(2, PAGE_OFFSET+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2, _PAGE_KERNEL, 0);
}
}
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 06/10] powerpc: Fix bogus crash kernel messages
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (4 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 05/10] powerpc: Add crash kernel support for 85xx Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc Dale Farnsworth
` (4 subsequent siblings)
10 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
Commit edd8ce67, Use extended crashkernel command line on ppc64,
resulted in reserve_crashkernel() attempting to reserve a 1 byte
crashkernel area when no no crashkernel reservation is requested.
This results in the following bogus messages:
Crash kernel location must be 0x2000000
Reserving 0MB of memory at 32MB for crashkernel
The problem is that when crashk_res.start and crashk_res.end are
both 0, the crash_size is computed to be 1 byte.
Revert back to using the value of crashk_res.start to determine
if crashkernel memory is being reserved, rather than the computed
crash_size.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/kernel/machine_kexec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 691dba7..38c1c1a 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -84,7 +84,7 @@ void __init reserve_crashkernel(void)
crash_size = crashk_res.end - crashk_res.start + 1;
}
- if (crash_size == 0)
+ if (crashk_res.start == 0)
return;
/* We might have got these values via the command line or the
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (5 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 06/10] powerpc: Fix bogus crash kernel messages Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-12-15 6:17 ` Benjamin Herrenschmidt
2007-11-22 15:46 ` [PATCH 08/10] powerpc: Implement crash dump support on ppc32 Dale Farnsworth
` (3 subsequent siblings)
10 siblings, 1 reply; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
This is needed for the ppc32 /dev/oldmem driver of crash dump.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
include/asm-powerpc/highmem.h | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/include/asm-powerpc/highmem.h b/include/asm-powerpc/highmem.h
index f7b21ee..88d9e05 100644
--- a/include/asm-powerpc/highmem.h
+++ b/include/asm-powerpc/highmem.h
@@ -117,6 +117,24 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
pagefault_enable();
}
+/* This is the same as kmap_atomic() but can map memory that doesn't
+ * have a struct page associated with it.
+ */
+static inline void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+{
+ unsigned int idx;
+ unsigned long vaddr;
+
+ pagefault_disable();
+
+ idx = type + KM_TYPE_NR * smp_processor_id();
+ vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE;
+ set_pte_at(&init_mm, vaddr, kmap_pte+idx, pfn_pte(pfn, kmap_prot));
+ flush_tlb_page(NULL, vaddr);
+
+ return (void*) vaddr;
+}
+
static inline struct page *kmap_atomic_to_page(void *ptr)
{
unsigned long idx, vaddr = (unsigned long) ptr;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 08/10] powerpc: Implement crash dump support on ppc32
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (6 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 09/10] powepc: Remove unnecessary of_get_flat_dt_prop casts Dale Farnsworth
` (2 subsequent siblings)
10 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
Implement /dev/oldmem and /proc/vmcore support for ppc32.
It is used to provide crash dumps of the previously running kernel.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/kernel/crash_dump.c | 67 ++++++++++++++++++++++++++++++++++++++
include/asm-powerpc/kexec.h | 62 +++++++++++++++++++++++++++++++++--
2 files changed, 126 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 77c0376..39a3d92 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -13,6 +13,7 @@
#include <linux/crash_dump.h>
#include <linux/bootmem.h>
+#include <linux/highmem.h>
#include <asm/kdump.h>
#include <asm/lmb.h>
#include <asm/firmware.h>
@@ -83,6 +84,7 @@ static int __init parse_savemaxmem(char *p)
}
__setup("savemaxmem=", parse_savemaxmem);
+#ifdef CONFIG_PPC64
/**
* copy_oldmem_page - copy one page from "oldmem"
* @pfn: page frame number to be copied
@@ -117,3 +119,68 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
iounmap(vaddr);
return csize;
}
+
+#else /* CONFIG_PPC64 */
+
+static void *kdump_buf_page;
+
+/**
+ * copy_oldmem_page - copy one page from "oldmem"
+ * @pfn: page frame number to be copied
+ * @buf: target memory address for the copy; this can be in kernel address
+ * space or user address space (see @userbuf)
+ * @csize: number of bytes to copy
+ * @offset: offset in bytes into the page (based on pfn) to begin the copy
+ * @userbuf: if set, @buf is in user address space, use copy_to_user(),
+ * otherwise @buf is in kernel address space, use memcpy().
+ *
+ * Copy a page from "oldmem". For this page, there is no pte mapped
+ * in the current kernel.
+ *
+ * Calling copy_to_user() in atomic context is not desirable. Hence first
+ * copying the data to a pre-allocated kernel page and then copying to user
+ * space in non-atomic context.
+ */
+ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
+ size_t csize, unsigned long offset, int userbuf)
+{
+ void *vaddr;
+
+ if (!csize)
+ return 0;
+
+ vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
+
+ if (!userbuf) {
+ memcpy(buf, (vaddr + offset), csize);
+ kunmap_atomic(vaddr, KM_PTE0);
+ } else {
+ if (!kdump_buf_page) {
+ printk(KERN_WARNING "Kdump: Kdump buffer page not"
+ " allocated\n");
+ return -EFAULT;
+ }
+ copy_page(kdump_buf_page, vaddr);
+ kunmap_atomic(vaddr, KM_PTE0);
+ if (copy_to_user(buf, (kdump_buf_page + offset), csize))
+ return -EFAULT;
+ }
+
+ return csize;
+}
+
+static int __init kdump_buf_page_init(void)
+{
+ int ret = 0;
+
+ kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (!kdump_buf_page) {
+ printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer"
+ " page\n");
+ ret = -ENOMEM;
+ }
+
+ return ret;
+}
+arch_initcall(kdump_buf_page_init);
+#endif /* CONFIG_PPC64 */
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index b6f817b..8c213c0 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -101,11 +101,67 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
}
#else
/*
- * Provide a dummy definition to avoid build failures. Will remain
- * empty till crash dump support is enabled.
+ * This function is responsible for capturing register states if coming
+ * via panic or invoking dump using sysrq-trigger.
*/
static inline void crash_setup_regs(struct pt_regs *newregs,
- struct pt_regs *oldregs) { }
+ struct pt_regs *oldregs)
+{
+ if (oldregs)
+ memcpy(newregs, oldregs, sizeof(*newregs));
+ else {
+ /* FIXME Merge this with xmon_save_regs ?? */
+ unsigned long tmp1, tmp2;
+ __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 __ */
extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 09/10] powepc: Remove unnecessary of_get_flat_dt_prop casts
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (7 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 08/10] powerpc: Implement crash dump support on ppc32 Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 10/10] powerpc: Make crashkernels ignore crashkernel reservations Dale Farnsworth
2008-04-24 12:50 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Kumar Gala
10 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
of_get_flat_dt_prop returns a void*. There is no need to cast its
value when assigning to a pointer variable. This also avoids warnings
on ppc32 where unsigned long is 32 bits.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/kernel/prom.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index acc0d24..e2e7d9c 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -790,11 +790,11 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
#endif
#ifdef CONFIG_KEXEC
- lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL);
+ lprop = of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL);
if (lprop)
crashk_res.start = *lprop;
- lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-size", NULL);
+ lprop = of_get_flat_dt_prop(node, "linux,crashkernel-size", NULL);
if (lprop)
crashk_res.end = crashk_res.start + *lprop - 1;
#endif
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 10/10] powerpc: Make crashkernels ignore crashkernel reservations
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (8 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 09/10] powepc: Remove unnecessary of_get_flat_dt_prop casts Dale Farnsworth
@ 2007-11-22 15:46 ` Dale Farnsworth
2008-04-24 12:50 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Kumar Gala
10 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-22 15:46 UTC (permalink / raw)
To: linuxppc-dev
If a user requests a crash kernel to reserve crashkernel memory,
the kernel fails to boot. While the user shouldn't do that, it
is easy to check for and makes it possible to use the same command
line for crash kernels as for the initial kernel.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
arch/powerpc/kernel/machine_kexec.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 38c1c1a..733726a 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -94,6 +94,14 @@ void __init reserve_crashkernel(void)
printk("Crash kernel location must be 0x%x\n",
KDUMP_KERNELBASE);
+ if (PHYSICAL_START == KDUMP_KERNELBASE) {
+ printk("Already running a crashkernel, "
+ "ignoring crashkernel reservation\n");
+ crashk_res.start = 0;
+ crashk_res.end = 0;
+ return;
+ }
+
crashk_res.start = KDUMP_KERNELBASE;
crash_size = PAGE_ALIGN(crash_size);
crashk_res.end = crashk_res.start + crash_size - 1;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec
2007-11-22 15:45 ` [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec Dale Farnsworth
@ 2007-11-22 22:17 ` Stephen Rothwell
2007-11-23 4:43 ` Dale Farnsworth
0 siblings, 1 reply; 27+ messages in thread
From: Stephen Rothwell @ 2007-11-22 22:17 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 450 bytes --]
Hi Dale,
Just a nit ...
On Thu, 22 Nov 2007 08:45:17 -0700 Dale Farnsworth <dale@farnsworth.org> wrote:
>
> +static struct property crashk_base_prop = {
> + .name = "linux,crashkernel-base",
> + .length = sizeof(unsigned long),
> + .value = &crashk_res.start, };
^^
Should be on a new line.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms
2007-11-22 15:46 ` [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms Dale Farnsworth
@ 2007-11-22 22:20 ` Stephen Rothwell
2007-12-15 6:16 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 27+ messages in thread
From: Stephen Rothwell @ 2007-11-22 22:20 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1670 bytes --]
More nits ...
On Thu, 22 Nov 2007 08:46:07 -0700 Dale Farnsworth <dale@farnsworth.org> wrote:
>
> @@ -259,6 +260,11 @@ define_machine(mpc85xx_ads) {
> .show_cpuinfo = mpc85xx_ads_show_cpuinfo,
> .get_irq = mpic_get_irq,
> .restart = fsl_rstcr_restart,
> +#ifdef CONFIG_KEXEC
> + .machine_kexec_prepare = default_machine_kexec_prepare,
> + .machine_kexec = default_machine_kexec,
> + .machine_crash_shutdown = default_machine_crash_shutdown,
> +#endif
Please line these up for consistency.
> @@ -352,6 +353,11 @@ define_machine(mpc85xx_cds) {
> #else
> .restart = fsl_rstcr_restart,
> #endif
> +#ifdef CONFIG_KEXEC
> + .machine_kexec_prepare = default_machine_kexec_prepare,
> + .machine_kexec = default_machine_kexec,
> + .machine_crash_shutdown = default_machine_crash_shutdown,
> +#endif
And here
> @@ -224,6 +225,11 @@ define_machine(mpc8572_ds) {
> #endif
> .get_irq = mpic_get_irq,
> .restart = fsl_rstcr_restart,
> +#ifdef CONFIG_KEXEC
> + .machine_kexec_prepare = default_machine_kexec_prepare,
> + .machine_kexec = default_machine_kexec,
> + .machine_crash_shutdown = default_machine_crash_shutdown,
> +#endif
And again ...
> @@ -202,6 +203,11 @@ define_machine(mpc85xx_mds) {
> .init_IRQ = mpc85xx_mds_pic_init,
> .get_irq = mpic_get_irq,
> .restart = fsl_rstcr_restart,
> +#ifdef CONFIG_KEXEC
> + .machine_kexec_prepare = default_machine_kexec_prepare,
> + .machine_kexec = default_machine_kexec,
> + .machine_crash_shutdown = default_machine_crash_shutdown,
> +#endif
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec
2007-11-22 22:17 ` Stephen Rothwell
@ 2007-11-23 4:43 ` Dale Farnsworth
0 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-11-23 4:43 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
On Fri, Nov 23, 2007 at 09:17:27AM +1100, Stephen Rothwell wrote:
> Hi Dale,
>
> Just a nit ...
>
> On Thu, 22 Nov 2007 08:45:17 -0700 Dale Farnsworth <dale@farnsworth.org> wrote:
> > +static struct property crashk_base_prop = {
> > + .name = "linux,crashkernel-base",
> > + .length = sizeof(unsigned long),
> > + .value = &crashk_res.start, };
Heh. How did that happen? :)
I'll fix it as well as the alignment issues you mentioned.
Thanks Stephen.
-Dale
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/10] powerpc: Add crash kernel support for 85xx
2007-11-22 15:46 ` [PATCH 05/10] powerpc: Add crash kernel support for 85xx Dale Farnsworth
@ 2007-12-14 16:48 ` Kumar Gala
2007-12-14 17:23 ` Dale Farnsworth
2008-01-21 16:19 ` Kumar Gala
1 sibling, 1 reply; 27+ messages in thread
From: Kumar Gala @ 2007-12-14 16:48 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Nov 22, 2007, at 9:46 AM, Dale Farnsworth wrote:
> Add the ability to build a ppc_85xx kernel to run at a physical
> address of 32MB.
>
> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> ---
> arch/powerpc/Kconfig | 2 +-
> arch/powerpc/kernel/head_fsl_booke.S | 23 ++++++++++++++++++-----
> arch/powerpc/mm/fsl_booke_mmu.c | 6 +++---
> 3 files changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 805b4d1..d405298 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -253,7 +253,7 @@ config KEXEC
>
> config CRASH_DUMP
> bool "Build a kdump crash kernel (EXPERIMENTAL)"
> - depends on PPC_MULTIPLATFORM && EXPERIMENTAL
> + depends on (PPC_MULTIPLATFORM || PPC_85xx) && EXPERIMENTAL
> 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/head_fsl_booke.S b/arch/powerpc/
> kernel/head_fsl_booke.S
> index 4b98227..1c9685f 100644
> --- a/arch/powerpc/kernel/head_fsl_booke.S
> +++ b/arch/powerpc/kernel/head_fsl_booke.S
> @@ -41,6 +41,12 @@
> #include <asm/asm-offsets.h>
> #include "head_booke.h"
>
> +#ifdef CONFIG_CRASH_DUMP
> +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_64M)
> +#else
> +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_16M)
> +#endif
I'm ok with bumping the first page to 64M in all cases.
>
> +
> /* As with the other PowerPC ports, it is expected that when code
> * execution begins here, the following registers contain valid, yet
> * optional, information:
> @@ -75,6 +81,7 @@ _ENTRY(_start);
> * boot loader and load a single entry in TLB1[0] to map the
> * first 16M of kernel memory. Any boot info passed from the
> * bootloader needs to live in this first 16M.
> + * Note that for crash (kdump) kernels, the first 64M is mapped.
> *
> * Requirement on bootloader:
> * - The page we're executing in needs to reside in TLB1 and
> @@ -167,7 +174,7 @@ skpinv: addi r6,r6,1 /* Increment */
> mtspr SPRN_MAS0,r7
> tlbre
>
> - /* Just modify the entry ID and EPN for the temp mapping */
> + /* Just modify the entry ID, EPN and RPN for the temp mapping */
> lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
> rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
> mtspr SPRN_MAS0,r7
> @@ -177,9 +184,12 @@ skpinv: addi r6,r6,1 /* Increment */
> ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l
> mtspr SPRN_MAS1,r6
> mfspr r6,SPRN_MAS2
> - li r7,0 /* temp EPN = 0 */
> + lis r7,PHYSICAL_START@h
> rlwimi r7,r6,0,20,31
> mtspr SPRN_MAS2,r7
> + mfspr r6,SPRN_MAS3
> + rlwimi r7,r6,0,20,31
> + mtspr SPRN_MAS3,r7
> tlbwe
>
> xori r6,r4,1
> @@ -222,11 +232,11 @@ skpinv: addi r6,r6,1 /* Increment */
> lis r6,0x1000 /* Set MAS0(TLBSEL) = TLB1(1), ESEL = 0 */
> mtspr SPRN_MAS0,r6
> lis r6,(MAS1_VALID|MAS1_IPROT)@h
> - ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_16M))@l
> + ori r6,r6,(MAS1_TSIZE(INITIAL_BOOKE_PAGESZ))@l
> mtspr SPRN_MAS1,r6
> li r7,0
> - lis r6,KERNELBASE@h
> - ori r6,r6,KERNELBASE@l
> + lis r6,PAGE_OFFSET@h
> + ori r6,r6,PAGE_OFFSET@l
> rlwimi r6,r7,0,20,31
> mtspr SPRN_MAS2,r6
> li r7,(MAS3_SX|MAS3_SW|MAS3_SR)
> @@ -234,6 +244,9 @@ skpinv: addi r6,r6,1 /* Increment */
> tlbwe
>
> /* 7. Jump to KERNELBASE mapping */
> + lis r6,KERNELBASE@h
> + ori r6,r6,KERNELBASE@l
> + rlwimi r6,r7,0,20,31
> lis r7,MSR_KERNEL@h
> ori r7,r7,MSR_KERNEL@l
> bl 1f /* Find our address */
> diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/
> fsl_booke_mmu.c
> index 17139da..c93a966 100644
> --- a/arch/powerpc/mm/fsl_booke_mmu.c
> +++ b/arch/powerpc/mm/fsl_booke_mmu.c
> @@ -165,15 +165,15 @@ void invalidate_tlbcam_entry(int index)
> void __init cam_mapin_ram(unsigned long cam0, unsigned long cam1,
> unsigned long cam2)
> {
> - settlbcam(0, KERNELBASE, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0);
> + settlbcam(0, PAGE_OFFSET, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0);
> tlbcam_index++;
> if (cam1) {
> tlbcam_index++;
> - settlbcam(1, KERNELBASE+cam0, PPC_MEMSTART+cam0, cam1,
> _PAGE_KERNEL, 0);
> + settlbcam(1, PAGE_OFFSET+cam0, PPC_MEMSTART+cam0, cam1,
> _PAGE_KERNEL, 0);
> }
> if (cam2) {
> tlbcam_index++;
> - settlbcam(2, KERNELBASE+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2,
> _PAGE_KERNEL, 0);
> + settlbcam(2, PAGE_OFFSET+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2,
> _PAGE_KERNEL, 0);
> }
> }
The rest looks good. Does this mean we can boot a e500 kernel at a
non-zero physical address? (can we run or is the non-zero phy just
for a short period of init time).
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/10] powerpc: Add crash kernel support for 85xx
2007-12-14 16:48 ` Kumar Gala
@ 2007-12-14 17:23 ` Dale Farnsworth
2008-01-18 22:29 ` Kumar Gala
0 siblings, 1 reply; 27+ messages in thread
From: Dale Farnsworth @ 2007-12-14 17:23 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Fri, Dec 14, 2007 at 10:48:58AM -0600, Kumar Gala wrote:
> On Nov 22, 2007, at 9:46 AM, Dale Farnsworth wrote:
>
> > Add the ability to build a ppc_85xx kernel to run at a physical
> > address of 32MB.
> >
> > Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> > ---
> > arch/powerpc/Kconfig | 2 +-
> > arch/powerpc/kernel/head_fsl_booke.S | 23 ++++++++++++++++++-----
> > arch/powerpc/mm/fsl_booke_mmu.c | 6 +++---
> > 3 files changed, 22 insertions(+), 9 deletions(-)
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 805b4d1..d405298 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -253,7 +253,7 @@ config KEXEC
> >
> > config CRASH_DUMP
> > bool "Build a kdump crash kernel (EXPERIMENTAL)"
> > - depends on PPC_MULTIPLATFORM && EXPERIMENTAL
> > + depends on (PPC_MULTIPLATFORM || PPC_85xx) && EXPERIMENTAL
> > 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/head_fsl_booke.S b/arch/powerpc/
> > kernel/head_fsl_booke.S
> > index 4b98227..1c9685f 100644
> > --- a/arch/powerpc/kernel/head_fsl_booke.S
> > +++ b/arch/powerpc/kernel/head_fsl_booke.S
> > @@ -41,6 +41,12 @@
> > #include <asm/asm-offsets.h>
> > #include "head_booke.h"
> >
> > +#ifdef CONFIG_CRASH_DUMP
> > +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_64M)
> > +#else
> > +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_16M)
> > +#endif
>
> I'm ok with bumping the first page to 64M in all cases.
OK, I'll make that change in the next rev. Thanks.
<snip>
> The rest looks good. Does this mean we can boot a e500 kernel at a
> non-zero physical address? (can we run or is the non-zero phy just
> for a short period of init time).
Yes, with this series of patches, we can boot and run with a classic ppc
or e500 kernel at 32MB physical (0xc2000000 virtual). Note that on
classic, we still need memory at phys 0 for the exception vectors.
On e500 IIRC, we don't use the vectors at phys 0, but we still write
the trampoline vectors there. I just didn't bother making that conditional.
I'll post an updated series soon, with hopes of getting it into 2.6.25
-Dale
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms
2007-11-22 15:46 ` [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms Dale Farnsworth
2007-11-22 22:20 ` Stephen Rothwell
@ 2007-12-15 6:16 ` Benjamin Herrenschmidt
2007-12-18 16:14 ` Dale Farnsworth
1 sibling, 1 reply; 27+ messages in thread
From: Benjamin Herrenschmidt @ 2007-12-15 6:16 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
> index 8b642ab..db0e749 100644
> --- a/arch/powerpc/kernel/misc_32.S
> +++ b/arch/powerpc/kernel/misc_32.S
> @@ -816,6 +816,75 @@ relocate_new_kernel:
> /* r4 = reboot_code_buffer */
> /* r5 = start_address */
>
> +#ifdef CONFIG_E500
> + /*
> + * Since we can't turn off the MMU, we must create an identity
> + * map for kernel low memory. We start by invalidating the
> + * TLB entries we don't need.
> + *
> + * First, invalidate the TLB0 entries
> + */
> + li r6, 0x04
> + tlbivax 0, r6
> +#ifdef CONFIG_SMP
> + tlbsync
> +#endif
> + msync
> +
This is really E500 specific or should it be CONFIG_FSL_BOOKE ?
Ben.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc
2007-11-22 15:46 ` [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc Dale Farnsworth
@ 2007-12-15 6:17 ` Benjamin Herrenschmidt
2007-12-18 16:20 ` Dale Farnsworth
0 siblings, 1 reply; 27+ messages in thread
From: Benjamin Herrenschmidt @ 2007-12-15 6:17 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Thu, 2007-11-22 at 08:46 -0700, Dale Farnsworth wrote:
> This is needed for the ppc32 /dev/oldmem driver of crash dump.
Kumar's working (well, last I heard he was) on a fixmap mechanism
so we can do that sort of thing without CONFIG_HIGHMEM, you may
want to sync with him here, that would allow to shrink the crash
kernel by not having highmem selected.
Cheers,
Ben.
> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> ---
> include/asm-powerpc/highmem.h | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/include/asm-powerpc/highmem.h b/include/asm-powerpc/highmem.h
> index f7b21ee..88d9e05 100644
> --- a/include/asm-powerpc/highmem.h
> +++ b/include/asm-powerpc/highmem.h
> @@ -117,6 +117,24 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
> pagefault_enable();
> }
>
> +/* This is the same as kmap_atomic() but can map memory that doesn't
> + * have a struct page associated with it.
> + */
> +static inline void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
> +{
> + unsigned int idx;
> + unsigned long vaddr;
> +
> + pagefault_disable();
> +
> + idx = type + KM_TYPE_NR * smp_processor_id();
> + vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE;
> + set_pte_at(&init_mm, vaddr, kmap_pte+idx, pfn_pte(pfn, kmap_prot));
> + flush_tlb_page(NULL, vaddr);
> +
> + return (void*) vaddr;
> +}
> +
> static inline struct page *kmap_atomic_to_page(void *ptr)
> {
> unsigned long idx, vaddr = (unsigned long) ptr;
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms
2007-12-15 6:16 ` Benjamin Herrenschmidt
@ 2007-12-18 16:14 ` Dale Farnsworth
0 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2007-12-18 16:14 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Sat, Dec 15, 2007 at 05:16:25PM +1100, Benjamin Herrenschmidt wrote:
> > index 8b642ab..db0e749 100644
> > --- a/arch/powerpc/kernel/misc_32.S
> > +++ b/arch/powerpc/kernel/misc_32.S
> > @@ -816,6 +816,75 @@ relocate_new_kernel:
> > /* r4 = reboot_code_buffer */
> > /* r5 = start_address */
> >
> > +#ifdef CONFIG_E500
> > + /*
> > + * Since we can't turn off the MMU, we must create an identity
> > + * map for kernel low memory. We start by invalidating the
> > + * TLB entries we don't need.
> > + *
> > + * First, invalidate the TLB0 entries
> > + */
> > + li r6, 0x04
> > + tlbivax 0, r6
> > +#ifdef CONFIG_SMP
> > + tlbsync
> > +#endif
> > + msync
> > +
>
> This is really E500 specific or should it be CONFIG_FSL_BOOKE ?
>
> Ben.
I agree that CONFIG_FSL_BOOKE is more appropriate. I'll reflect that
in the next respin.
Thanks,
-Dale
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc
2007-12-15 6:17 ` Benjamin Herrenschmidt
@ 2007-12-18 16:20 ` Dale Farnsworth
2007-12-18 16:42 ` Kumar Gala
0 siblings, 1 reply; 27+ messages in thread
From: Dale Farnsworth @ 2007-12-18 16:20 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Sat, Dec 15, 2007 at 05:17:41PM +1100, Benjamin Herrenschmidt wrote:
>
> On Thu, 2007-11-22 at 08:46 -0700, Dale Farnsworth wrote:
> > This is needed for the ppc32 /dev/oldmem driver of crash dump.
>
> Kumar's working (well, last I heard he was) on a fixmap mechanism
> so we can do that sort of thing without CONFIG_HIGHMEM, you may
> want to sync with him here, that would allow to shrink the crash
> kernel by not having highmem selected.
>
> Cheers,
> Ben.
Kumar, are you close to posting something that would make the
patch below unnecessary (or change it significantly)? If so,
I'll hold off.
-Dale
> > Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> > ---
> > include/asm-powerpc/highmem.h | 18 ++++++++++++++++++
> > 1 files changed, 18 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/asm-powerpc/highmem.h b/include/asm-powerpc/highmem.h
> > index f7b21ee..88d9e05 100644
> > --- a/include/asm-powerpc/highmem.h
> > +++ b/include/asm-powerpc/highmem.h
> > @@ -117,6 +117,24 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
> > pagefault_enable();
> > }
> >
> > +/* This is the same as kmap_atomic() but can map memory that doesn't
> > + * have a struct page associated with it.
> > + */
> > +static inline void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
> > +{
> > + unsigned int idx;
> > + unsigned long vaddr;
> > +
> > + pagefault_disable();
> > +
> > + idx = type + KM_TYPE_NR * smp_processor_id();
> > + vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE;
> > + set_pte_at(&init_mm, vaddr, kmap_pte+idx, pfn_pte(pfn, kmap_prot));
> > + flush_tlb_page(NULL, vaddr);
> > +
> > + return (void*) vaddr;
> > +}
> > +
> > static inline struct page *kmap_atomic_to_page(void *ptr)
> > {
> > unsigned long idx, vaddr = (unsigned long) ptr;
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc
2007-12-18 16:20 ` Dale Farnsworth
@ 2007-12-18 16:42 ` Kumar Gala
0 siblings, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2007-12-18 16:42 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Dec 18, 2007, at 10:20 AM, Dale Farnsworth wrote:
> On Sat, Dec 15, 2007 at 05:17:41PM +1100, Benjamin Herrenschmidt
> wrote:
>>
>> On Thu, 2007-11-22 at 08:46 -0700, Dale Farnsworth wrote:
>>> This is needed for the ppc32 /dev/oldmem driver of crash dump.
>>
>> Kumar's working (well, last I heard he was) on a fixmap mechanism
>> so we can do that sort of thing without CONFIG_HIGHMEM, you may
>> want to sync with him here, that would allow to shrink the crash
>> kernel by not having highmem selected.
>>
>> Cheers,
>> Ben.
>
> Kumar, are you close to posting something that would make the
> patch below unnecessary (or change it significantly)? If so,
> I'll hold off.
My plan is to get the fixmap stuff posted this week.
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/10] powerpc: Add crash kernel support for 85xx
2007-12-14 17:23 ` Dale Farnsworth
@ 2008-01-18 22:29 ` Kumar Gala
2008-01-18 23:09 ` Dale Farnsworth
0 siblings, 1 reply; 27+ messages in thread
From: Kumar Gala @ 2008-01-18 22:29 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Dec 14, 2007, at 11:23 AM, Dale Farnsworth wrote:
> On Fri, Dec 14, 2007 at 10:48:58AM -0600, Kumar Gala wrote:
>> On Nov 22, 2007, at 9:46 AM, Dale Farnsworth wrote:
>>
>>> Add the ability to build a ppc_85xx kernel to run at a physical
>>> address of 32MB.
>>>
>>> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
>>> ---
>>> arch/powerpc/Kconfig | 2 +-
>>> arch/powerpc/kernel/head_fsl_booke.S | 23 ++++++++++++++++++-----
>>> arch/powerpc/mm/fsl_booke_mmu.c | 6 +++---
>>> 3 files changed, 22 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index 805b4d1..d405298 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -253,7 +253,7 @@ config KEXEC
>>>
>>> config CRASH_DUMP
>>> bool "Build a kdump crash kernel (EXPERIMENTAL)"
>>> - depends on PPC_MULTIPLATFORM && EXPERIMENTAL
>>> + depends on (PPC_MULTIPLATFORM || PPC_85xx) && EXPERIMENTAL
>>> 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/head_fsl_booke.S b/arch/powerpc/
>>> kernel/head_fsl_booke.S
>>> index 4b98227..1c9685f 100644
>>> --- a/arch/powerpc/kernel/head_fsl_booke.S
>>> +++ b/arch/powerpc/kernel/head_fsl_booke.S
>>> @@ -41,6 +41,12 @@
>>> #include <asm/asm-offsets.h>
>>> #include "head_booke.h"
>>>
>>> +#ifdef CONFIG_CRASH_DUMP
>>> +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_64M)
>>> +#else
>>> +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_16M)
>>> +#endif
>>
>> I'm ok with bumping the first page to 64M in all cases.
>
> OK, I'll make that change in the next rev. Thanks.
I'm about to commit a version of this patch, why did you need to bump
to 64M?
>
>
> <snip>
>
>> The rest looks good. Does this mean we can boot a e500 kernel at a
>> non-zero physical address? (can we run or is the non-zero phy just
>> for a short period of init time).
>
> Yes, with this series of patches, we can boot and run with a classic
> ppc
> or e500 kernel at 32MB physical (0xc2000000 virtual). Note that on
> classic, we still need memory at phys 0 for the exception vectors.
> On e500 IIRC, we don't use the vectors at phys 0, but we still write
> the trampoline vectors there. I just didn't bother making that
> conditional.
trampoline vectors?
> I'll post an updated series soon, with hopes of getting it into 2.6.25
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/10] powerpc: Add crash kernel support for 85xx
2008-01-18 22:29 ` Kumar Gala
@ 2008-01-18 23:09 ` Dale Farnsworth
0 siblings, 0 replies; 27+ messages in thread
From: Dale Farnsworth @ 2008-01-18 23:09 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Fri, Jan 18, 2008 at 04:29:23PM -0600, Kumar Gala wrote:
> On Dec 14, 2007, at 11:23 AM, Dale Farnsworth wrote:
>> On Fri, Dec 14, 2007 at 10:48:58AM -0600, Kumar Gala wrote:
>>> On Nov 22, 2007, at 9:46 AM, Dale Farnsworth wrote:
>>>
>>>> Add the ability to build a ppc_85xx kernel to run at a physical
>>>> address of 32MB.
>>>>
>>>> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
>>>> ---
>>>> arch/powerpc/Kconfig | 2 +-
>>>> arch/powerpc/kernel/head_fsl_booke.S | 23 ++++++++++++++++++-----
>>>> arch/powerpc/mm/fsl_booke_mmu.c | 6 +++---
>>>> 3 files changed, 22 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>>> index 805b4d1..d405298 100644
>>>> --- a/arch/powerpc/Kconfig
>>>> +++ b/arch/powerpc/Kconfig
>>>> @@ -253,7 +253,7 @@ config KEXEC
>>>>
>>>> config CRASH_DUMP
>>>> bool "Build a kdump crash kernel (EXPERIMENTAL)"
>>>> - depends on PPC_MULTIPLATFORM && EXPERIMENTAL
>>>> + depends on (PPC_MULTIPLATFORM || PPC_85xx) && EXPERIMENTAL
>>>> 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/head_fsl_booke.S b/arch/powerpc/
>>>> kernel/head_fsl_booke.S
>>>> index 4b98227..1c9685f 100644
>>>> --- a/arch/powerpc/kernel/head_fsl_booke.S
>>>> +++ b/arch/powerpc/kernel/head_fsl_booke.S
>>>> @@ -41,6 +41,12 @@
>>>> #include <asm/asm-offsets.h>
>>>> #include "head_booke.h"
>>>>
>>>> +#ifdef CONFIG_CRASH_DUMP
>>>> +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_64M)
>>>> +#else
>>>> +#define INITIAL_BOOKE_PAGESZ (BOOKE_PAGESZ_16M)
>>>> +#endif
>>>
>>> I'm ok with bumping the first page to 64M in all cases.
>>
>> OK, I'll make that change in the next rev. Thanks.
>
> I'm about to commit a version of this patch, why did you need to bump to
> 64M?
See below.
>> <snip>
>>
>>> The rest looks good. Does this mean we can boot a e500 kernel at a
>>> non-zero physical address? (can we run or is the non-zero phy just
>>> for a short period of init time).
>>
>> Yes, with this series of patches, we can boot and run with a classic ppc
>> or e500 kernel at 32MB physical (0xc2000000 virtual). Note that on
>> classic, we still need memory at phys 0 for the exception vectors.
>> On e500 IIRC, we don't use the vectors at phys 0, but we still write
>> the trampoline vectors there. I just didn't bother making that
>> conditional.
>
> trampoline vectors?
Even though the kernel is loaded at 32M, the vectors still reside at 0
(at least on non-booke). There is code that saves the low 64K away, then
create_trampoline() in crash_dump.c fills each vector with a "b . + 32M"
sequence.
As to why 64M, since the kernel is loaded at 32M, and we still set up
the trampoline vectors at 0, we need more than 16M. It's possible
that we could skip writing the trampoline vectors on booke and
then just just initially map 16M at 32M. I haven't tried it and
can't prove that it won't work, but I don't know that it's worth doing.
>> I'll post an updated series soon, with hopes of getting it into 2.6.25
I think my time for doing it "soon" has passed. Still plan to do it.
Kumar, thanks for pursuing this.
-Dale
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 05/10] powerpc: Add crash kernel support for 85xx
2007-11-22 15:46 ` [PATCH 05/10] powerpc: Add crash kernel support for 85xx Dale Farnsworth
2007-12-14 16:48 ` Kumar Gala
@ 2008-01-21 16:19 ` Kumar Gala
1 sibling, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-01-21 16:19 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Thu, 22 Nov 2007, Dale Farnsworth wrote:
> Add the ability to build a ppc_85xx kernel to run at a physical
> address of 32MB.
>
> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> ---
> arch/powerpc/Kconfig | 2 +-
> arch/powerpc/kernel/head_fsl_booke.S | 23 ++++++++++++++++++-----
> arch/powerpc/mm/fsl_booke_mmu.c | 6 +++---
> 3 files changed, 22 insertions(+), 9 deletions(-)
>
applied. (w/o Kconfig since this is useful for other purposes).
-k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
` (9 preceding siblings ...)
2007-11-22 15:46 ` [PATCH 10/10] powerpc: Make crashkernels ignore crashkernel reservations Dale Farnsworth
@ 2008-04-24 12:50 ` Kumar Gala
2008-04-24 15:42 ` Dale Farnsworth
10 siblings, 1 reply; 27+ messages in thread
From: Kumar Gala @ 2008-04-24 12:50 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Nov 22, 2007, at 9:42 AM, Dale Farnsworth wrote:
> This patch series adds kexec and kdump support for ppc32 in arch/
> powerpc.
> It has been successfully tested on the mpc8548_cds and prpmc2800
> platforms.
> Mark Greer and I are preparing patches to the kexec-tools package as
> well.
Dale, can you look at updating your patchset now that we've made some
progress on other patches.
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32
2008-04-24 12:50 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Kumar Gala
@ 2008-04-24 15:42 ` Dale Farnsworth
2008-04-24 16:28 ` Kumar Gala
0 siblings, 1 reply; 27+ messages in thread
From: Dale Farnsworth @ 2008-04-24 15:42 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Thu, Apr 24, 2008 at 07:50:52AM -0500, Kumar Gala wrote:
> On Nov 22, 2007, at 9:42 AM, Dale Farnsworth wrote:
>> This patch series adds kexec and kdump support for ppc32 in arch/
>> powerpc.
>> It has been successfully tested on the mpc8548_cds and prpmc2800
>> platforms.
>> Mark Greer and I are preparing patches to the kexec-tools package as
>> well.
>
> Dale, can you look at updating your patchset now that we've made some
> progress on other patches.
Yes. It'll take a couple of weeks for me to fit it in though.
-Dale
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32
2008-04-24 15:42 ` Dale Farnsworth
@ 2008-04-24 16:28 ` Kumar Gala
0 siblings, 0 replies; 27+ messages in thread
From: Kumar Gala @ 2008-04-24 16:28 UTC (permalink / raw)
To: Dale Farnsworth; +Cc: linuxppc-dev
On Apr 24, 2008, at 10:42 AM, Dale Farnsworth wrote:
> On Thu, Apr 24, 2008 at 07:50:52AM -0500, Kumar Gala wrote:
>> On Nov 22, 2007, at 9:42 AM, Dale Farnsworth wrote:
>>> This patch series adds kexec and kdump support for ppc32 in arch/
>>> powerpc.
>>> It has been successfully tested on the mpc8548_cds and prpmc2800
>>> platforms.
>>> Mark Greer and I are preparing patches to the kexec-tools package as
>>> well.
>>
>> Dale, can you look at updating your patchset now that we've made some
>> progress on other patches.
>
> Yes. It'll take a couple of weeks for me to fit it in though.
no problem. I figure we are aiming for 2.6.27 for this functionality.
- k
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2008-04-24 16:28 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <foo@xyzzy.farnsworth.org>
2007-11-22 15:42 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Dale Farnsworth
2007-11-22 15:45 ` [PATCH 01/10] powerpc: Set up OF properties for ppc32 kexec Dale Farnsworth
2007-11-22 22:17 ` Stephen Rothwell
2007-11-23 4:43 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 02/10] powerpc: Cleanup CONFIG_KEXEC dependency Dale Farnsworth
2007-11-22 15:46 ` [PATCH 03/10] powerpc: Add kexec support for PPC_85xx platforms Dale Farnsworth
2007-11-22 22:20 ` Stephen Rothwell
2007-12-15 6:16 ` Benjamin Herrenschmidt
2007-12-18 16:14 ` Dale Farnsworth
2007-11-22 15:46 ` [PATCH 04/10] powerpc: Add crash kernel support for classic ppc Dale Farnsworth
2007-11-22 15:46 ` [PATCH 05/10] powerpc: Add crash kernel support for 85xx Dale Farnsworth
2007-12-14 16:48 ` Kumar Gala
2007-12-14 17:23 ` Dale Farnsworth
2008-01-18 22:29 ` Kumar Gala
2008-01-18 23:09 ` Dale Farnsworth
2008-01-21 16:19 ` Kumar Gala
2007-11-22 15:46 ` [PATCH 06/10] powerpc: Fix bogus crash kernel messages Dale Farnsworth
2007-11-22 15:46 ` [PATCH 07/10] powerpc: Implement kmap_atomic_pfn on powerpc Dale Farnsworth
2007-12-15 6:17 ` Benjamin Herrenschmidt
2007-12-18 16:20 ` Dale Farnsworth
2007-12-18 16:42 ` Kumar Gala
2007-11-22 15:46 ` [PATCH 08/10] powerpc: Implement crash dump support on ppc32 Dale Farnsworth
2007-11-22 15:46 ` [PATCH 09/10] powepc: Remove unnecessary of_get_flat_dt_prop casts Dale Farnsworth
2007-11-22 15:46 ` [PATCH 10/10] powerpc: Make crashkernels ignore crashkernel reservations Dale Farnsworth
2008-04-24 12:50 ` [PATCH 00/10] powerpc: Add kexec/kdump support for ppc32 Kumar Gala
2008-04-24 15:42 ` Dale Farnsworth
2008-04-24 16:28 ` Kumar Gala
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).