diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-12-07 06:51:43 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2009-12-07 06:51:33 -0500 |
commit | b11b53342773361f3353b285eb6a3fd6074e7997 (patch) | |
tree | b7fda314933b82d39cb8d30c7882ca3044dd0367 /arch/s390/kernel/setup.c | |
parent | 61365e132ef987f7719af5d2e434db4465957637 (diff) |
[S390] Improve address space mode selection.
Introduce user_mode to replace the two variables switch_amode and
s390_noexec. There are three valid combinations of the old values:
1) switch_amode == 0 && s390_noexec == 0
2) switch_amode == 1 && s390_noexec == 0
3) switch_amode == 1 && s390_noexec == 1
They get replaced by
1) user_mode == HOME_SPACE_MODE
2) user_mode == PRIMARY_SPACE_MODE
3) user_mode == SECONDARY_SPACE_MODE
The new kernel parameter user_mode=[primary,secondary,home] lets
you choose the address space mode the user space processes should
use. In addition the CONFIG_S390_SWITCH_AMODE config option
is removed.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r-- | arch/s390/kernel/setup.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 061479ff029f..0663287fa1b3 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -305,9 +305,8 @@ static int __init early_parse_mem(char *p) | |||
305 | } | 305 | } |
306 | early_param("mem", early_parse_mem); | 306 | early_param("mem", early_parse_mem); |
307 | 307 | ||
308 | #ifdef CONFIG_S390_SWITCH_AMODE | 308 | unsigned int user_mode = HOME_SPACE_MODE; |
309 | unsigned int switch_amode = 0; | 309 | EXPORT_SYMBOL_GPL(user_mode); |
310 | EXPORT_SYMBOL_GPL(switch_amode); | ||
311 | 310 | ||
312 | static int set_amode_and_uaccess(unsigned long user_amode, | 311 | static int set_amode_and_uaccess(unsigned long user_amode, |
313 | unsigned long user32_amode) | 312 | unsigned long user32_amode) |
@@ -340,23 +339,29 @@ static int set_amode_and_uaccess(unsigned long user_amode, | |||
340 | */ | 339 | */ |
341 | static int __init early_parse_switch_amode(char *p) | 340 | static int __init early_parse_switch_amode(char *p) |
342 | { | 341 | { |
343 | switch_amode = 1; | 342 | if (user_mode != SECONDARY_SPACE_MODE) |
343 | user_mode = PRIMARY_SPACE_MODE; | ||
344 | return 0; | 344 | return 0; |
345 | } | 345 | } |
346 | early_param("switch_amode", early_parse_switch_amode); | 346 | early_param("switch_amode", early_parse_switch_amode); |
347 | 347 | ||
348 | #else /* CONFIG_S390_SWITCH_AMODE */ | 348 | static int __init early_parse_user_mode(char *p) |
349 | static inline int set_amode_and_uaccess(unsigned long user_amode, | ||
350 | unsigned long user32_amode) | ||
351 | { | 349 | { |
350 | if (p && strcmp(p, "primary") == 0) | ||
351 | user_mode = PRIMARY_SPACE_MODE; | ||
352 | #ifdef CONFIG_S390_EXEC_PROTECT | ||
353 | else if (p && strcmp(p, "secondary") == 0) | ||
354 | user_mode = SECONDARY_SPACE_MODE; | ||
355 | #endif | ||
356 | else if (!p || strcmp(p, "home") == 0) | ||
357 | user_mode = HOME_SPACE_MODE; | ||
358 | else | ||
359 | return 1; | ||
352 | return 0; | 360 | return 0; |
353 | } | 361 | } |
354 | #endif /* CONFIG_S390_SWITCH_AMODE */ | 362 | early_param("user_mode", early_parse_user_mode); |
355 | 363 | ||
356 | #ifdef CONFIG_S390_EXEC_PROTECT | 364 | #ifdef CONFIG_S390_EXEC_PROTECT |
357 | unsigned int s390_noexec = 0; | ||
358 | EXPORT_SYMBOL_GPL(s390_noexec); | ||
359 | |||
360 | /* | 365 | /* |
361 | * Enable execute protection? | 366 | * Enable execute protection? |
362 | */ | 367 | */ |
@@ -364,8 +369,7 @@ static int __init early_parse_noexec(char *p) | |||
364 | { | 369 | { |
365 | if (!strncmp(p, "off", 3)) | 370 | if (!strncmp(p, "off", 3)) |
366 | return 0; | 371 | return 0; |
367 | switch_amode = 1; | 372 | user_mode = SECONDARY_SPACE_MODE; |
368 | s390_noexec = 1; | ||
369 | return 0; | 373 | return 0; |
370 | } | 374 | } |
371 | early_param("noexec", early_parse_noexec); | 375 | early_param("noexec", early_parse_noexec); |
@@ -373,7 +377,7 @@ early_param("noexec", early_parse_noexec); | |||
373 | 377 | ||
374 | static void setup_addressing_mode(void) | 378 | static void setup_addressing_mode(void) |
375 | { | 379 | { |
376 | if (s390_noexec) { | 380 | if (user_mode == SECONDARY_SPACE_MODE) { |
377 | if (set_amode_and_uaccess(PSW_ASC_SECONDARY, | 381 | if (set_amode_and_uaccess(PSW_ASC_SECONDARY, |
378 | PSW32_ASC_SECONDARY)) | 382 | PSW32_ASC_SECONDARY)) |
379 | pr_info("Execute protection active, " | 383 | pr_info("Execute protection active, " |
@@ -381,7 +385,7 @@ static void setup_addressing_mode(void) | |||
381 | else | 385 | else |
382 | pr_info("Execute protection active, " | 386 | pr_info("Execute protection active, " |
383 | "mvcos not available\n"); | 387 | "mvcos not available\n"); |
384 | } else if (switch_amode) { | 388 | } else if (user_mode == PRIMARY_SPACE_MODE) { |
385 | if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) | 389 | if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) |
386 | pr_info("Address spaces switched, " | 390 | pr_info("Address spaces switched, " |
387 | "mvcos available\n"); | 391 | "mvcos available\n"); |
@@ -411,7 +415,7 @@ setup_lowcore(void) | |||
411 | lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | 415 | lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; |
412 | lc->restart_psw.addr = | 416 | lc->restart_psw.addr = |
413 | PSW_ADDR_AMODE | (unsigned long) restart_int_handler; | 417 | PSW_ADDR_AMODE | (unsigned long) restart_int_handler; |
414 | if (switch_amode) | 418 | if (user_mode != HOME_SPACE_MODE) |
415 | lc->restart_psw.mask |= PSW_ASC_HOME; | 419 | lc->restart_psw.mask |= PSW_ASC_HOME; |
416 | lc->external_new_psw.mask = psw_kernel_bits; | 420 | lc->external_new_psw.mask = psw_kernel_bits; |
417 | lc->external_new_psw.addr = | 421 | lc->external_new_psw.addr = |