aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/ipl.h9
-rw-r--r--arch/s390/include/asm/smp.h1
-rw-r--r--arch/s390/kernel/crash_dump.c34
-rw-r--r--arch/s390/kernel/smp.c11
4 files changed, 40 insertions, 15 deletions
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
index 2bd6cb897b90..ea7d9d6ab06e 100644
--- a/arch/s390/include/asm/ipl.h
+++ b/arch/s390/include/asm/ipl.h
@@ -7,6 +7,7 @@
7#ifndef _ASM_S390_IPL_H 7#ifndef _ASM_S390_IPL_H
8#define _ASM_S390_IPL_H 8#define _ASM_S390_IPL_H
9 9
10#include <asm/lowcore.h>
10#include <asm/types.h> 11#include <asm/types.h>
11#include <asm/cio.h> 12#include <asm/cio.h>
12#include <asm/setup.h> 13#include <asm/setup.h>
@@ -88,6 +89,14 @@ extern u32 ipl_flags;
88extern u32 dump_prefix_page; 89extern u32 dump_prefix_page;
89extern unsigned int zfcpdump_prefix_array[]; 90extern unsigned int zfcpdump_prefix_array[];
90 91
92struct dump_save_areas {
93 struct save_area **areas;
94 int count;
95};
96
97extern struct dump_save_areas dump_save_areas;
98struct save_area *dump_save_area_create(int cpu);
99
91extern void do_reipl(void); 100extern void do_reipl(void);
92extern void do_halt(void); 101extern void do_halt(void);
93extern void do_poff(void); 102extern void do_poff(void);
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index b64f15c3b4cc..ac9bed8e103f 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -14,7 +14,6 @@
14#define raw_smp_processor_id() (S390_lowcore.cpu_nr) 14#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
15 15
16extern struct mutex smp_cpu_state_mutex; 16extern struct mutex smp_cpu_state_mutex;
17extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
18 17
19extern int __cpu_up(unsigned int cpu, struct task_struct *tidle); 18extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
20 19
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 3db6af0601a5..f45b2ab0cb81 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -22,6 +22,32 @@
22#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) 22#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y)))
23#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) 23#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y))))
24 24
25struct dump_save_areas dump_save_areas;
26
27/*
28 * Allocate and add a save area for a CPU
29 */
30struct save_area *dump_save_area_create(int cpu)
31{
32 struct save_area **save_areas, *save_area;
33
34 save_area = kmalloc(sizeof(*save_area), GFP_KERNEL);
35 if (!save_area)
36 return NULL;
37 if (cpu + 1 > dump_save_areas.count) {
38 dump_save_areas.count = cpu + 1;
39 save_areas = krealloc(dump_save_areas.areas,
40 dump_save_areas.count * sizeof(void *),
41 GFP_KERNEL | __GFP_ZERO);
42 if (!save_areas) {
43 kfree(save_area);
44 return NULL;
45 }
46 dump_save_areas.areas = save_areas;
47 }
48 dump_save_areas.areas[cpu] = save_area;
49 return save_area;
50}
25 51
26/* 52/*
27 * Return physical address for virtual address 53 * Return physical address for virtual address
@@ -450,8 +476,8 @@ static int get_cpu_cnt(void)
450{ 476{
451 int i, cpus = 0; 477 int i, cpus = 0;
452 478
453 for (i = 0; zfcpdump_save_areas[i]; i++) { 479 for (i = 0; i < dump_save_areas.count; i++) {
454 if (zfcpdump_save_areas[i]->pref_reg == 0) 480 if (dump_save_areas.areas[i]->pref_reg == 0)
455 continue; 481 continue;
456 cpus++; 482 cpus++;
457 } 483 }
@@ -522,8 +548,8 @@ static void *notes_init(Elf64_Phdr *phdr, void *ptr, u64 notes_offset)
522 548
523 ptr = nt_prpsinfo(ptr); 549 ptr = nt_prpsinfo(ptr);
524 550
525 for (i = 0; zfcpdump_save_areas[i]; i++) { 551 for (i = 0; i < dump_save_areas.count; i++) {
526 sa = zfcpdump_save_areas[i]; 552 sa = dump_save_areas.areas[i];
527 if (sa->pref_reg == 0) 553 if (sa->pref_reg == 0)
528 continue; 554 continue;
529 ptr = fill_cpu_elf_notes(ptr, sa); 555 ptr = fill_cpu_elf_notes(ptr, sa);
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index cca6cf6abacc..739313db71e5 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -533,9 +533,6 @@ EXPORT_SYMBOL(smp_ctl_clear_bit);
533 533
534#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP) 534#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_CRASH_DUMP)
535 535
536struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
537EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
538
539static void __init smp_get_save_area(int cpu, u16 address) 536static void __init smp_get_save_area(int cpu, u16 address)
540{ 537{
541 void *lc = pcpu_devices[0].lowcore; 538 void *lc = pcpu_devices[0].lowcore;
@@ -546,15 +543,9 @@ static void __init smp_get_save_area(int cpu, u16 address)
546 if (!OLDMEM_BASE && (address == boot_cpu_address || 543 if (!OLDMEM_BASE && (address == boot_cpu_address ||
547 ipl_info.type != IPL_TYPE_FCP_DUMP)) 544 ipl_info.type != IPL_TYPE_FCP_DUMP))
548 return; 545 return;
549 if (cpu >= NR_CPUS) { 546 save_area = dump_save_area_create(cpu);
550 pr_warning("CPU %i exceeds the maximum %i and is excluded "
551 "from the dump\n", cpu, NR_CPUS - 1);
552 return;
553 }
554 save_area = kmalloc(sizeof(struct save_area), GFP_KERNEL);
555 if (!save_area) 547 if (!save_area)
556 panic("could not allocate memory for save area\n"); 548 panic("could not allocate memory for save area\n");
557 zfcpdump_save_areas[cpu] = save_area;
558#ifdef CONFIG_CRASH_DUMP 549#ifdef CONFIG_CRASH_DUMP
559 if (address == boot_cpu_address) { 550 if (address == boot_cpu_address) {
560 /* Copy the registers of the boot cpu. */ 551 /* Copy the registers of the boot cpu. */