aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/early.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/early.c')
-rw-r--r--arch/s390/kernel/early.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 83c3271c442b..7f4717675c19 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -215,36 +215,54 @@ static noinline __init void init_kernel_storage_key(void)
215 PAGE_DEFAULT_KEY, 0); 215 PAGE_DEFAULT_KEY, 0);
216} 216}
217 217
218static __initdata struct sysinfo_3_2_2 vmms __aligned(PAGE_SIZE); 218static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE);
219 219
220static noinline __init void detect_machine_type(void) 220static noinline __init void detect_machine_type(void)
221{ 221{
222 struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page;
223
222 /* Check current-configuration-level */ 224 /* Check current-configuration-level */
223 if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) { 225 if (stsi(NULL, 0, 0, 0) <= 2) {
224 S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR; 226 S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR;
225 return; 227 return;
226 } 228 }
227 /* Get virtual-machine cpu information. */ 229 /* Get virtual-machine cpu information. */
228 if (stsi(&vmms, 3, 2, 2) == -ENOSYS || !vmms.count) 230 if (stsi(vmms, 3, 2, 2) || !vmms->count)
229 return; 231 return;
230 232
231 /* Running under KVM? If not we assume z/VM */ 233 /* Running under KVM? If not we assume z/VM */
232 if (!memcmp(vmms.vm[0].cpi, "\xd2\xe5\xd4", 3)) 234 if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3))
233 S390_lowcore.machine_flags |= MACHINE_FLAG_KVM; 235 S390_lowcore.machine_flags |= MACHINE_FLAG_KVM;
234 else 236 else
235 S390_lowcore.machine_flags |= MACHINE_FLAG_VM; 237 S390_lowcore.machine_flags |= MACHINE_FLAG_VM;
236} 238}
237 239
240static __init void setup_topology(void)
241{
242#ifdef CONFIG_64BIT
243 int max_mnest;
244
245 if (!test_facility(11))
246 return;
247 S390_lowcore.machine_flags |= MACHINE_FLAG_TOPOLOGY;
248 for (max_mnest = 6; max_mnest > 1; max_mnest--) {
249 if (stsi(&sysinfo_page, 15, 1, max_mnest) == 0)
250 break;
251 }
252 topology_max_mnest = max_mnest;
253#endif
254}
255
238static void early_pgm_check_handler(void) 256static void early_pgm_check_handler(void)
239{ 257{
240 unsigned long addr;
241 const struct exception_table_entry *fixup; 258 const struct exception_table_entry *fixup;
259 unsigned long addr;
242 260
243 addr = S390_lowcore.program_old_psw.addr; 261 addr = S390_lowcore.program_old_psw.addr;
244 fixup = search_exception_tables(addr & PSW_ADDR_INSN); 262 fixup = search_exception_tables(addr & PSW_ADDR_INSN);
245 if (!fixup) 263 if (!fixup)
246 disabled_wait(0); 264 disabled_wait(0);
247 S390_lowcore.program_old_psw.addr = fixup->fixup | PSW_ADDR_AMODE; 265 S390_lowcore.program_old_psw.addr = extable_fixup(fixup)|PSW_ADDR_AMODE;
248} 266}
249 267
250static noinline __init void setup_lowcore_early(void) 268static noinline __init void setup_lowcore_early(void)
@@ -267,12 +285,10 @@ static noinline __init void setup_facility_list(void)
267 285
268static noinline __init void setup_hpage(void) 286static noinline __init void setup_hpage(void)
269{ 287{
270#ifndef CONFIG_DEBUG_PAGEALLOC
271 if (!test_facility(2) || !test_facility(8)) 288 if (!test_facility(2) || !test_facility(8))
272 return; 289 return;
273 S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE; 290 S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE;
274 __ctl_set_bit(0, 23); 291 __ctl_set_bit(0, 23);
275#endif
276} 292}
277 293
278static __init void detect_mvpg(void) 294static __init void detect_mvpg(void)
@@ -366,12 +382,12 @@ static __init void detect_machine_facilities(void)
366 S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; 382 S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE;
367 if (test_facility(8)) 383 if (test_facility(8))
368 S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF; 384 S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF;
369 if (test_facility(11))
370 S390_lowcore.machine_flags |= MACHINE_FLAG_TOPOLOGY;
371 if (test_facility(27)) 385 if (test_facility(27))
372 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; 386 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
373 if (test_facility(40)) 387 if (test_facility(40))
374 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; 388 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP;
389 if (test_facility(50) && test_facility(73))
390 S390_lowcore.machine_flags |= MACHINE_FLAG_TE;
375#endif 391#endif
376} 392}
377 393
@@ -441,7 +457,6 @@ static void __init setup_boot_command_line(void)
441 append_to_cmdline(append_ipl_scpdata); 457 append_to_cmdline(append_ipl_scpdata);
442} 458}
443 459
444
445/* 460/*
446 * Save ipl parameters, clear bss memory, initialize storage keys 461 * Save ipl parameters, clear bss memory, initialize storage keys
447 * and create a kernel NSS at startup if the SAVESYS= parm is defined 462 * and create a kernel NSS at startup if the SAVESYS= parm is defined
@@ -468,6 +483,7 @@ void __init startup_init(void)
468 detect_diag44(); 483 detect_diag44();
469 detect_machine_facilities(); 484 detect_machine_facilities();
470 setup_hpage(); 485 setup_hpage();
486 setup_topology();
471 sclp_facilities_detect(); 487 sclp_facilities_detect();
472 detect_memory_layout(memory_chunk); 488 detect_memory_layout(memory_chunk);
473#ifdef CONFIG_DYNAMIC_FTRACE 489#ifdef CONFIG_DYNAMIC_FTRACE