aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2013-11-13 04:38:27 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-11-15 08:08:40 -0500
commite657d8fe2faf49ed5d35e2325bd0f1712b8058cd (patch)
tree420f6c638e1a42f3a83135eff827dd4832544023 /arch
parentf8049e3e869f6de644e4302b3d85d06e185ddced (diff)
s390/sclp: Determine HSA size dynamically for zfcpdump
Currently we have hardcoded the HSA size to 32 MiB. With this patch the HSA size is determined dynamically via SCLP in early.c. Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/sclp.h2
-rw-r--r--arch/s390/include/asm/setup.h3
-rw-r--r--arch/s390/kernel/crash_dump.c22
-rw-r--r--arch/s390/kernel/early.c1
-rw-r--r--arch/s390/kernel/setup.c7
5 files changed, 20 insertions, 15 deletions
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index 7dc7f9c63b65..593069201bb9 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -57,5 +57,7 @@ bool sclp_has_vt220(void);
57int sclp_pci_configure(u32 fid); 57int sclp_pci_configure(u32 fid);
58int sclp_pci_deconfigure(u32 fid); 58int sclp_pci_deconfigure(u32 fid);
59int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode); 59int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode);
60void sclp_hsa_size_detect(void);
61unsigned long sclp_get_hsa_size(void);
60 62
61#endif /* _ASM_S390_SCLP_H */ 63#endif /* _ASM_S390_SCLP_H */
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index df802ee14af6..94cfbe442f12 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -107,9 +107,6 @@ void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
107#define MACHINE_HAS_RRBM (S390_lowcore.machine_flags & MACHINE_FLAG_RRBM) 107#define MACHINE_HAS_RRBM (S390_lowcore.machine_flags & MACHINE_FLAG_RRBM)
108#endif /* CONFIG_64BIT */ 108#endif /* CONFIG_64BIT */
109 109
110#define ZFCPDUMP_HSA_SIZE (32UL<<20)
111#define ZFCPDUMP_HSA_SIZE_MAX (64UL<<20)
112
113/* 110/*
114 * Console mode. Override with conmode= 111 * Console mode. Override with conmode=
115 */ 112 */
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index f45b2ab0cb81..d7658c4b2ed5 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -95,7 +95,7 @@ static void *elfcorehdr_newmem;
95/* 95/*
96 * Copy one page from zfcpdump "oldmem" 96 * Copy one page from zfcpdump "oldmem"
97 * 97 *
98 * For pages below ZFCPDUMP_HSA_SIZE memory from the HSA is copied. Otherwise 98 * For pages below HSA size memory from the HSA is copied. Otherwise
99 * real memory copy is used. 99 * real memory copy is used.
100 */ 100 */
101static ssize_t copy_oldmem_page_zfcpdump(char *buf, size_t csize, 101static ssize_t copy_oldmem_page_zfcpdump(char *buf, size_t csize,
@@ -103,7 +103,7 @@ static ssize_t copy_oldmem_page_zfcpdump(char *buf, size_t csize,
103{ 103{
104 int rc; 104 int rc;
105 105
106 if (src < ZFCPDUMP_HSA_SIZE) { 106 if (src < sclp_get_hsa_size()) {
107 rc = memcpy_hsa(buf, src, csize, userbuf); 107 rc = memcpy_hsa(buf, src, csize, userbuf);
108 } else { 108 } else {
109 if (userbuf) 109 if (userbuf)
@@ -188,18 +188,19 @@ static int remap_oldmem_pfn_range_kdump(struct vm_area_struct *vma,
188/* 188/*
189 * Remap "oldmem" for zfcpdump 189 * Remap "oldmem" for zfcpdump
190 * 190 *
191 * We only map available memory above ZFCPDUMP_HSA_SIZE. Memory below 191 * We only map available memory above HSA size. Memory below HSA size
192 * ZFCPDUMP_HSA_SIZE is read on demand using the copy_oldmem_page() function. 192 * is read on demand using the copy_oldmem_page() function.
193 */ 193 */
194static int remap_oldmem_pfn_range_zfcpdump(struct vm_area_struct *vma, 194static int remap_oldmem_pfn_range_zfcpdump(struct vm_area_struct *vma,
195 unsigned long from, 195 unsigned long from,
196 unsigned long pfn, 196 unsigned long pfn,
197 unsigned long size, pgprot_t prot) 197 unsigned long size, pgprot_t prot)
198{ 198{
199 unsigned long hsa_end = sclp_get_hsa_size();
199 unsigned long size_hsa; 200 unsigned long size_hsa;
200 201
201 if (pfn < ZFCPDUMP_HSA_SIZE >> PAGE_SHIFT) { 202 if (pfn < hsa_end >> PAGE_SHIFT) {
202 size_hsa = min(size, ZFCPDUMP_HSA_SIZE - (pfn << PAGE_SHIFT)); 203 size_hsa = min(size, hsa_end - (pfn << PAGE_SHIFT));
203 if (size == size_hsa) 204 if (size == size_hsa)
204 return 0; 205 return 0;
205 size -= size_hsa; 206 size -= size_hsa;
@@ -238,9 +239,9 @@ int copy_from_oldmem(void *dest, void *src, size_t count)
238 return rc; 239 return rc;
239 } 240 }
240 } else { 241 } else {
241 if ((unsigned long) src < ZFCPDUMP_HSA_SIZE) { 242 unsigned long hsa_end = sclp_get_hsa_size();
242 copied = min(count, 243 if ((unsigned long) src < hsa_end) {
243 ZFCPDUMP_HSA_SIZE - (unsigned long) src); 244 copied = min(count, hsa_end - (unsigned long) src);
244 rc = memcpy_hsa(dest, (unsigned long) src, copied, 0); 245 rc = memcpy_hsa(dest, (unsigned long) src, copied, 0);
245 if (rc) 246 if (rc)
246 return rc; 247 return rc;
@@ -580,6 +581,9 @@ int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size)
580 /* If elfcorehdr= has been passed via cmdline, we use that one */ 581 /* If elfcorehdr= has been passed via cmdline, we use that one */
581 if (elfcorehdr_addr != ELFCORE_ADDR_MAX) 582 if (elfcorehdr_addr != ELFCORE_ADDR_MAX)
582 return 0; 583 return 0;
584 /* If we cannot get HSA size for zfcpdump return error */
585 if (ipl_info.type == IPL_TYPE_FCP_DUMP && !sclp_get_hsa_size())
586 return -ENODEV;
583 mem_chunk_cnt = get_mem_chunk_cnt(); 587 mem_chunk_cnt = get_mem_chunk_cnt();
584 588
585 alloc_size = 0x1000 + get_cpu_cnt() * 0x300 + 589 alloc_size = 0x1000 + get_cpu_cnt() * 0x300 +
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 96543ac400a7..c0462f45cf1b 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -484,6 +484,7 @@ void __init startup_init(void)
484 detect_machine_facilities(); 484 detect_machine_facilities();
485 setup_topology(); 485 setup_topology();
486 sclp_facilities_detect(); 486 sclp_facilities_detect();
487 sclp_hsa_size_detect();
487#ifdef CONFIG_DYNAMIC_FTRACE 488#ifdef CONFIG_DYNAMIC_FTRACE
488 S390_lowcore.ftrace_func = (unsigned long)ftrace_caller; 489 S390_lowcore.ftrace_func = (unsigned long)ftrace_caller;
489#endif 490#endif
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index ffe1c53264a7..4444875266ee 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -471,8 +471,9 @@ static void __init setup_memory_end(void)
471 471
472 472
473#ifdef CONFIG_ZFCPDUMP 473#ifdef CONFIG_ZFCPDUMP
474 if (ipl_info.type == IPL_TYPE_FCP_DUMP && !OLDMEM_BASE) { 474 if (ipl_info.type == IPL_TYPE_FCP_DUMP &&
475 memory_end = ZFCPDUMP_HSA_SIZE; 475 !OLDMEM_BASE && sclp_get_hsa_size()) {
476 memory_end = sclp_get_hsa_size();
476 memory_end_set = 1; 477 memory_end_set = 1;
477 } 478 }
478#endif 479#endif
@@ -586,7 +587,7 @@ static unsigned long __init find_crash_base(unsigned long crash_size,
586 crash_base = (chunk->addr + chunk->size) - crash_size; 587 crash_base = (chunk->addr + chunk->size) - crash_size;
587 if (crash_base < crash_size) 588 if (crash_base < crash_size)
588 continue; 589 continue;
589 if (crash_base < ZFCPDUMP_HSA_SIZE_MAX) 590 if (crash_base < sclp_get_hsa_size())
590 continue; 591 continue;
591 if (crash_base < (unsigned long) INITRD_START + INITRD_SIZE) 592 if (crash_base < (unsigned long) INITRD_START + INITRD_SIZE)
592 continue; 593 continue;