aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2011-10-30 10:16:44 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2011-10-30 10:16:42 -0400
commitdab7a7b1538fec48790a321a58180adae79a3f3c (patch)
tree145614bdf89a106508cec17bd6f13e6686ffed07 /arch/s390
parent558df7209e7997275f6b8ad37737494cf2da1512 (diff)
[S390] Add architecture code for unmapping crashkernel memory
This patch implements the crash_map_pages() function for s390. KEXEC_CRASH_MEM_ALIGN is set to HPAGE_SIZE, in order to support kernel mappings that use large pages. We also use HPAGE_SIZE alignment for CONFIG_HUGETLB_PAGE=n in order to have the same 1 MiB alignment on all s390 systems. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/kexec.h3
-rw-r--r--arch/s390/kernel/machine_kexec.c31
-rw-r--r--arch/s390/kernel/setup.c10
3 files changed, 40 insertions, 4 deletions
diff --git a/arch/s390/include/asm/kexec.h b/arch/s390/include/asm/kexec.h
index fb1c96fa348c..cf4e47b0948c 100644
--- a/arch/s390/include/asm/kexec.h
+++ b/arch/s390/include/asm/kexec.h
@@ -36,6 +36,9 @@
36/* Allocate one page for the pdp and the second for the code */ 36/* Allocate one page for the pdp and the second for the code */
37#define KEXEC_CONTROL_PAGE_SIZE 4096 37#define KEXEC_CONTROL_PAGE_SIZE 4096
38 38
39/* Alignment of crashkernel memory */
40#define KEXEC_CRASH_MEM_ALIGN HPAGE_SIZE
41
39/* The native architecture */ 42/* The native architecture */
40#define KEXEC_ARCH KEXEC_ARCH_S390 43#define KEXEC_ARCH KEXEC_ARCH_S390
41 44
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 0ceac06a0299..13a0b528c70b 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -133,6 +133,37 @@ static int kdump_csum_valid(struct kimage *image)
133} 133}
134 134
135/* 135/*
136 * Map or unmap crashkernel memory
137 */
138static void crash_map_pages(int enable)
139{
140 unsigned long size = resource_size(&crashk_res);
141
142 BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
143 size % KEXEC_CRASH_MEM_ALIGN);
144 if (enable)
145 vmem_add_mapping(crashk_res.start, size);
146 else
147 vmem_remove_mapping(crashk_res.start, size);
148}
149
150/*
151 * Map crashkernel memory
152 */
153void crash_map_reserved_pages(void)
154{
155 crash_map_pages(1);
156}
157
158/*
159 * Unmap crashkernel memory
160 */
161void crash_unmap_reserved_pages(void)
162{
163 crash_map_pages(0);
164}
165
166/*
136 * Give back memory to hypervisor before new kdump is loaded 167 * Give back memory to hypervisor before new kdump is loaded
137 */ 168 */
138static int machine_kexec_prepare_kdump(void) 169static int machine_kexec_prepare_kdump(void)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 63c81de665ec..6f8e3777a0c8 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -446,6 +446,7 @@ static void __init setup_resources(void)
446 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 446 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
447 switch (memory_chunk[i].type) { 447 switch (memory_chunk[i].type) {
448 case CHUNK_READ_WRITE: 448 case CHUNK_READ_WRITE:
449 case CHUNK_CRASHK:
449 res->name = "System RAM"; 450 res->name = "System RAM";
450 break; 451 break;
451 case CHUNK_READ_ONLY: 452 case CHUNK_READ_ONLY:
@@ -720,8 +721,8 @@ static void __init reserve_crashkernel(void)
720 &crash_base); 721 &crash_base);
721 if (rc || crash_size == 0) 722 if (rc || crash_size == 0)
722 return; 723 return;
723 crash_base = PAGE_ALIGN(crash_base); 724 crash_base = ALIGN(crash_base, KEXEC_CRASH_MEM_ALIGN);
724 crash_size = PAGE_ALIGN(crash_size); 725 crash_size = ALIGN(crash_size, KEXEC_CRASH_MEM_ALIGN);
725 if (register_memory_notifier(&kdump_mem_nb)) 726 if (register_memory_notifier(&kdump_mem_nb))
726 return; 727 return;
727 if (!crash_base) 728 if (!crash_base)
@@ -741,7 +742,7 @@ static void __init reserve_crashkernel(void)
741 crashk_res.start = crash_base; 742 crashk_res.start = crash_base;
742 crashk_res.end = crash_base + crash_size - 1; 743 crashk_res.end = crash_base + crash_size - 1;
743 insert_resource(&iomem_resource, &crashk_res); 744 insert_resource(&iomem_resource, &crashk_res);
744 reserve_kdump_bootmem(crash_base, crash_size, CHUNK_READ_WRITE); 745 reserve_kdump_bootmem(crash_base, crash_size, CHUNK_CRASHK);
745 pr_info("Reserving %lluMB of memory at %lluMB " 746 pr_info("Reserving %lluMB of memory at %lluMB "
746 "for crashkernel (System RAM: %luMB)\n", 747 "for crashkernel (System RAM: %luMB)\n",
747 crash_size >> 20, crash_base >> 20, memory_end >> 20); 748 crash_size >> 20, crash_base >> 20, memory_end >> 20);
@@ -816,7 +817,8 @@ setup_memory(void)
816 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 817 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
817 unsigned long start_chunk, end_chunk, pfn; 818 unsigned long start_chunk, end_chunk, pfn;
818 819
819 if (memory_chunk[i].type != CHUNK_READ_WRITE) 820 if (memory_chunk[i].type != CHUNK_READ_WRITE &&
821 memory_chunk[i].type != CHUNK_CRASHK)
820 continue; 822 continue;
821 start_chunk = PFN_DOWN(memory_chunk[i].addr); 823 start_chunk = PFN_DOWN(memory_chunk[i].addr);
822 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size); 824 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size);