aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/setup.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /arch/s390/kernel/setup.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r--arch/s390/kernel/setup.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 061479ff029f..91625f759ccd 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -25,7 +25,6 @@
25#include <linux/stddef.h> 25#include <linux/stddef.h>
26#include <linux/unistd.h> 26#include <linux/unistd.h>
27#include <linux/ptrace.h> 27#include <linux/ptrace.h>
28#include <linux/slab.h>
29#include <linux/user.h> 28#include <linux/user.h>
30#include <linux/tty.h> 29#include <linux/tty.h>
31#include <linux/ioport.h> 30#include <linux/ioport.h>
@@ -87,7 +86,6 @@ unsigned long elf_hwcap = 0;
87char elf_platform[ELF_PLATFORM_SIZE]; 86char elf_platform[ELF_PLATFORM_SIZE];
88 87
89struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 88struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
90volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
91 89
92int __initdata memory_end_set; 90int __initdata memory_end_set;
93unsigned long __initdata memory_end; 91unsigned long __initdata memory_end;
@@ -124,12 +122,6 @@ void __cpuinit cpu_init(void)
124 */ 122 */
125 get_cpu_id(&S390_lowcore.cpu_id); 123 get_cpu_id(&S390_lowcore.cpu_id);
126 124
127 /*
128 * Force FPU initialization:
129 */
130 clear_thread_flag(TIF_USEDFPU);
131 clear_used_math();
132
133 atomic_inc(&init_mm.mm_count); 125 atomic_inc(&init_mm.mm_count);
134 current->active_mm = &init_mm; 126 current->active_mm = &init_mm;
135 BUG_ON(current->mm); 127 BUG_ON(current->mm);
@@ -305,9 +297,8 @@ static int __init early_parse_mem(char *p)
305} 297}
306early_param("mem", early_parse_mem); 298early_param("mem", early_parse_mem);
307 299
308#ifdef CONFIG_S390_SWITCH_AMODE 300unsigned int user_mode = HOME_SPACE_MODE;
309unsigned int switch_amode = 0; 301EXPORT_SYMBOL_GPL(user_mode);
310EXPORT_SYMBOL_GPL(switch_amode);
311 302
312static int set_amode_and_uaccess(unsigned long user_amode, 303static int set_amode_and_uaccess(unsigned long user_amode,
313 unsigned long user32_amode) 304 unsigned long user32_amode)
@@ -340,23 +331,29 @@ static int set_amode_and_uaccess(unsigned long user_amode,
340 */ 331 */
341static int __init early_parse_switch_amode(char *p) 332static int __init early_parse_switch_amode(char *p)
342{ 333{
343 switch_amode = 1; 334 if (user_mode != SECONDARY_SPACE_MODE)
335 user_mode = PRIMARY_SPACE_MODE;
344 return 0; 336 return 0;
345} 337}
346early_param("switch_amode", early_parse_switch_amode); 338early_param("switch_amode", early_parse_switch_amode);
347 339
348#else /* CONFIG_S390_SWITCH_AMODE */ 340static int __init early_parse_user_mode(char *p)
349static inline int set_amode_and_uaccess(unsigned long user_amode,
350 unsigned long user32_amode)
351{ 341{
342 if (p && strcmp(p, "primary") == 0)
343 user_mode = PRIMARY_SPACE_MODE;
344#ifdef CONFIG_S390_EXEC_PROTECT
345 else if (p && strcmp(p, "secondary") == 0)
346 user_mode = SECONDARY_SPACE_MODE;
347#endif
348 else if (!p || strcmp(p, "home") == 0)
349 user_mode = HOME_SPACE_MODE;
350 else
351 return 1;
352 return 0; 352 return 0;
353} 353}
354#endif /* CONFIG_S390_SWITCH_AMODE */ 354early_param("user_mode", early_parse_user_mode);
355 355
356#ifdef CONFIG_S390_EXEC_PROTECT 356#ifdef CONFIG_S390_EXEC_PROTECT
357unsigned int s390_noexec = 0;
358EXPORT_SYMBOL_GPL(s390_noexec);
359
360/* 357/*
361 * Enable execute protection? 358 * Enable execute protection?
362 */ 359 */
@@ -364,8 +361,7 @@ static int __init early_parse_noexec(char *p)
364{ 361{
365 if (!strncmp(p, "off", 3)) 362 if (!strncmp(p, "off", 3))
366 return 0; 363 return 0;
367 switch_amode = 1; 364 user_mode = SECONDARY_SPACE_MODE;
368 s390_noexec = 1;
369 return 0; 365 return 0;
370} 366}
371early_param("noexec", early_parse_noexec); 367early_param("noexec", early_parse_noexec);
@@ -373,7 +369,7 @@ early_param("noexec", early_parse_noexec);
373 369
374static void setup_addressing_mode(void) 370static void setup_addressing_mode(void)
375{ 371{
376 if (s390_noexec) { 372 if (user_mode == SECONDARY_SPACE_MODE) {
377 if (set_amode_and_uaccess(PSW_ASC_SECONDARY, 373 if (set_amode_and_uaccess(PSW_ASC_SECONDARY,
378 PSW32_ASC_SECONDARY)) 374 PSW32_ASC_SECONDARY))
379 pr_info("Execute protection active, " 375 pr_info("Execute protection active, "
@@ -381,7 +377,7 @@ static void setup_addressing_mode(void)
381 else 377 else
382 pr_info("Execute protection active, " 378 pr_info("Execute protection active, "
383 "mvcos not available\n"); 379 "mvcos not available\n");
384 } else if (switch_amode) { 380 } else if (user_mode == PRIMARY_SPACE_MODE) {
385 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) 381 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY))
386 pr_info("Address spaces switched, " 382 pr_info("Address spaces switched, "
387 "mvcos available\n"); 383 "mvcos available\n");
@@ -399,19 +395,16 @@ static void __init
399setup_lowcore(void) 395setup_lowcore(void)
400{ 396{
401 struct _lowcore *lc; 397 struct _lowcore *lc;
402 int lc_pages;
403 398
404 /* 399 /*
405 * Setup lowcore for boot cpu 400 * Setup lowcore for boot cpu
406 */ 401 */
407 lc_pages = sizeof(void *) == 8 ? 2 : 1; 402 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096);
408 lc = (struct _lowcore *) 403 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
409 __alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
410 memset(lc, 0, lc_pages * PAGE_SIZE);
411 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 404 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
412 lc->restart_psw.addr = 405 lc->restart_psw.addr =
413 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 406 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
414 if (switch_amode) 407 if (user_mode != HOME_SPACE_MODE)
415 lc->restart_psw.mask |= PSW_ASC_HOME; 408 lc->restart_psw.mask |= PSW_ASC_HOME;
416 lc->external_new_psw.mask = psw_kernel_bits; 409 lc->external_new_psw.mask = psw_kernel_bits;
417 lc->external_new_psw.addr = 410 lc->external_new_psw.addr =
@@ -439,7 +432,7 @@ setup_lowcore(void)
439#ifndef CONFIG_64BIT 432#ifndef CONFIG_64BIT
440 if (MACHINE_HAS_IEEE) { 433 if (MACHINE_HAS_IEEE) {
441 lc->extended_save_area_addr = (__u32) 434 lc->extended_save_area_addr = (__u32)
442 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0); 435 __alloc_bootmem_low(PAGE_SIZE, PAGE_SIZE, 0);
443 /* enable extended save area */ 436 /* enable extended save area */
444 __ctl_set_bit(14, 29); 437 __ctl_set_bit(14, 29);
445 } 438 }
@@ -807,7 +800,7 @@ setup_arch(char **cmdline_p)
807 if (MACHINE_IS_VM) 800 if (MACHINE_IS_VM)
808 pr_info("Linux is running as a z/VM " 801 pr_info("Linux is running as a z/VM "
809 "guest operating system in 31-bit mode\n"); 802 "guest operating system in 31-bit mode\n");
810 else 803 else if (MACHINE_IS_LPAR)
811 pr_info("Linux is running natively in 31-bit mode\n"); 804 pr_info("Linux is running natively in 31-bit mode\n");
812 if (MACHINE_HAS_IEEE) 805 if (MACHINE_HAS_IEEE)
813 pr_info("The hardware system has IEEE compatible " 806 pr_info("The hardware system has IEEE compatible "
@@ -821,7 +814,7 @@ setup_arch(char **cmdline_p)
821 "guest operating system in 64-bit mode\n"); 814 "guest operating system in 64-bit mode\n");
822 else if (MACHINE_IS_KVM) 815 else if (MACHINE_IS_KVM)
823 pr_info("Linux is running under KVM in 64-bit mode\n"); 816 pr_info("Linux is running under KVM in 64-bit mode\n");
824 else 817 else if (MACHINE_IS_LPAR)
825 pr_info("Linux is running natively in 64-bit mode\n"); 818 pr_info("Linux is running natively in 64-bit mode\n");
826#endif /* CONFIG_64BIT */ 819#endif /* CONFIG_64BIT */
827 820
@@ -851,7 +844,6 @@ setup_arch(char **cmdline_p)
851 setup_lowcore(); 844 setup_lowcore();
852 845
853 cpu_init(); 846 cpu_init();
854 __cpu_logical_map[0] = stap();
855 s390_init_cpu_topology(); 847 s390_init_cpu_topology();
856 848
857 /* 849 /*