Commit 285f6722 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] smp: Merge smp_count_cpus() and smp_get_save_areas().

Merge smp_count_cpus() and smp_get_save_areas() so we save a loop over
all potentially present cpus.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent d9f774d4
...@@ -410,58 +410,40 @@ EXPORT_SYMBOL(smp_ctl_clear_bit); ...@@ -410,58 +410,40 @@ EXPORT_SYMBOL(smp_ctl_clear_bit);
unsigned int zfcpdump_prefix_array[NR_CPUS + 1] \ unsigned int zfcpdump_prefix_array[NR_CPUS + 1] \
__attribute__((__section__(".data"))); __attribute__((__section__(".data")));
static void __init smp_get_save_areas(void) static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
{ {
unsigned int cpu, cpu_num, rc;
__u16 boot_cpu_addr;
if (ipl_info.type != IPL_TYPE_FCP_DUMP) if (ipl_info.type != IPL_TYPE_FCP_DUMP)
return; return;
boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; if (cpu >= NR_CPUS) {
cpu_num = 1; printk(KERN_WARNING "Registers for cpu %i not saved since dump "
for (cpu = 0; cpu <= 65535; cpu++) { "kernel was compiled with NR_CPUS=%i\n", cpu, NR_CPUS);
if ((u16) cpu == boot_cpu_addr) return;
continue;
__cpu_logical_map[1] = (__u16) cpu;
if (signal_processor(1, sigp_sense) == sigp_not_operational)
continue;
if (cpu_num >= NR_CPUS) {
printk("WARNING: Registers for cpu %i are not "
"saved, since dump kernel was compiled with"
"NR_CPUS=%i!\n", cpu_num, NR_CPUS);
continue;
} }
zfcpdump_save_areas[cpu_num] = zfcpdump_save_areas[cpu] = alloc_bootmem(sizeof(union save_area));
alloc_bootmem(sizeof(union save_area)); __cpu_logical_map[1] = (__u16) phy_cpu;
while (1) { while (signal_processor(1, sigp_stop_and_store_status) == sigp_busy)
rc = signal_processor(1, sigp_stop_and_store_status);
if (rc != sigp_busy)
break;
cpu_relax(); cpu_relax();
} memcpy(zfcpdump_save_areas[cpu],
memcpy(zfcpdump_save_areas[cpu_num], (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE,
(void *)(unsigned long) store_prefix() + SAVE_AREA_SIZE);
SAVE_AREA_BASE, SAVE_AREA_SIZE); #ifdef CONFIG_64BIT
#ifdef __s390x__
/* copy original prefix register */ /* copy original prefix register */
zfcpdump_save_areas[cpu_num]->s390x.pref_reg = zfcpdump_save_areas[cpu]->s390x.pref_reg = zfcpdump_prefix_array[cpu];
zfcpdump_prefix_array[cpu_num];
#endif #endif
cpu_num++;
}
} }
union save_area *zfcpdump_save_areas[NR_CPUS + 1]; union save_area *zfcpdump_save_areas[NR_CPUS + 1];
EXPORT_SYMBOL_GPL(zfcpdump_save_areas); EXPORT_SYMBOL_GPL(zfcpdump_save_areas);
#else #else
#define smp_get_save_areas() do { } while (0)
#endif static inline void smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) { }
#endif /* CONFIG_ZFCPDUMP || CONFIG_ZFCPDUMP_MODULE */
/* /*
* Lets check how many CPUs we have. * Lets check how many CPUs we have.
*/ */
static unsigned int __init smp_count_cpus(void) static unsigned int __init smp_count_cpus(void)
{ {
unsigned int cpu, num_cpus; unsigned int cpu, num_cpus;
...@@ -470,7 +452,6 @@ static unsigned int __init smp_count_cpus(void) ...@@ -470,7 +452,6 @@ static unsigned int __init smp_count_cpus(void)
/* /*
* cpu 0 is the boot cpu. See smp_prepare_boot_cpu. * cpu 0 is the boot cpu. See smp_prepare_boot_cpu.
*/ */
boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
current_thread_info()->cpu = 0; current_thread_info()->cpu = 0;
num_cpus = 1; num_cpus = 1;
...@@ -480,12 +461,11 @@ static unsigned int __init smp_count_cpus(void) ...@@ -480,12 +461,11 @@ static unsigned int __init smp_count_cpus(void)
__cpu_logical_map[1] = (__u16) cpu; __cpu_logical_map[1] = (__u16) cpu;
if (signal_processor(1, sigp_sense) == sigp_not_operational) if (signal_processor(1, sigp_sense) == sigp_not_operational)
continue; continue;
smp_get_save_area(num_cpus, cpu);
num_cpus++; num_cpus++;
} }
printk("Detected %d CPU's\n", (int) num_cpus); printk("Detected %d CPU's\n", (int) num_cpus);
printk("Boot cpu address %2X\n", boot_cpu_addr); printk("Boot cpu address %2X\n", boot_cpu_addr);
return num_cpus; return num_cpus;
} }
...@@ -606,7 +586,6 @@ void __init smp_setup_cpu_possible_map(void) ...@@ -606,7 +586,6 @@ void __init smp_setup_cpu_possible_map(void)
{ {
unsigned int phy_cpus, pos_cpus, cpu; unsigned int phy_cpus, pos_cpus, cpu;
smp_get_save_areas();
phy_cpus = smp_count_cpus(); phy_cpus = smp_count_cpus();
pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS); pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment