aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r--arch/s390/kernel/setup.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 6f8e3777a0c8..8ac6bfa2786c 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -62,11 +62,11 @@
62#include <asm/kvm_virtio.h> 62#include <asm/kvm_virtio.h>
63#include <asm/diag.h> 63#include <asm/diag.h>
64 64
65long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | 65long psw_kernel_bits = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_PRIMARY |
66 PSW_MASK_MCHECK | PSW_DEFAULT_KEY); 66 PSW_MASK_EA | PSW_MASK_BA;
67long psw_user_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | 67long psw_user_bits = PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT |
68 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 68 PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_MCHECK |
69 PSW_MASK_PSTATE | PSW_DEFAULT_KEY); 69 PSW_MASK_PSTATE | PSW_ASC_HOME;
70 70
71/* 71/*
72 * User copy operations. 72 * User copy operations.
@@ -278,22 +278,14 @@ early_param("mem", early_parse_mem);
278unsigned int user_mode = HOME_SPACE_MODE; 278unsigned int user_mode = HOME_SPACE_MODE;
279EXPORT_SYMBOL_GPL(user_mode); 279EXPORT_SYMBOL_GPL(user_mode);
280 280
281static int set_amode_and_uaccess(unsigned long user_amode, 281static int set_amode_primary(void)
282 unsigned long user32_amode)
283{ 282{
284 psw_user_bits = PSW_BASE_BITS | PSW_MASK_DAT | user_amode | 283 psw_kernel_bits = (psw_kernel_bits & ~PSW_MASK_ASC) | PSW_ASC_HOME;
285 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 284 psw_user_bits = (psw_user_bits & ~PSW_MASK_ASC) | PSW_ASC_PRIMARY;
286 PSW_MASK_PSTATE | PSW_DEFAULT_KEY;
287#ifdef CONFIG_COMPAT 285#ifdef CONFIG_COMPAT
288 psw_user32_bits = PSW_BASE32_BITS | PSW_MASK_DAT | user_amode | 286 psw32_user_bits =
289 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | 287 (psw32_user_bits & ~PSW32_MASK_ASC) | PSW32_ASC_PRIMARY;
290 PSW_MASK_PSTATE | PSW_DEFAULT_KEY;
291 psw32_user_bits = PSW32_BASE_BITS | PSW32_MASK_DAT | user32_amode |
292 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK |
293 PSW32_MASK_PSTATE;
294#endif 288#endif
295 psw_kernel_bits = PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME |
296 PSW_MASK_MCHECK | PSW_DEFAULT_KEY;
297 289
298 if (MACHINE_HAS_MVCOS) { 290 if (MACHINE_HAS_MVCOS) {
299 memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess)); 291 memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess));
@@ -329,7 +321,7 @@ early_param("user_mode", early_parse_user_mode);
329static void setup_addressing_mode(void) 321static void setup_addressing_mode(void)
330{ 322{
331 if (user_mode == PRIMARY_SPACE_MODE) { 323 if (user_mode == PRIMARY_SPACE_MODE) {
332 if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY)) 324 if (set_amode_primary())
333 pr_info("Address spaces switched, " 325 pr_info("Address spaces switched, "
334 "mvcos available\n"); 326 "mvcos available\n");
335 else 327 else
@@ -348,24 +340,25 @@ setup_lowcore(void)
348 */ 340 */
349 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096); 341 BUILD_BUG_ON(sizeof(struct _lowcore) != LC_PAGES * 4096);
350 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); 342 lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0);
351 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 343 lc->restart_psw.mask = psw_kernel_bits;
352 lc->restart_psw.addr = 344 lc->restart_psw.addr =
353 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; 345 PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
354 if (user_mode != HOME_SPACE_MODE) 346 lc->external_new_psw.mask = psw_kernel_bits |
355 lc->restart_psw.mask |= PSW_ASC_HOME; 347 PSW_MASK_DAT | PSW_MASK_MCHECK;
356 lc->external_new_psw.mask = psw_kernel_bits;
357 lc->external_new_psw.addr = 348 lc->external_new_psw.addr =
358 PSW_ADDR_AMODE | (unsigned long) ext_int_handler; 349 PSW_ADDR_AMODE | (unsigned long) ext_int_handler;
359 lc->svc_new_psw.mask = psw_kernel_bits | PSW_MASK_IO | PSW_MASK_EXT; 350 lc->svc_new_psw.mask = psw_kernel_bits |
351 PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
360 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call; 352 lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call;
361 lc->program_new_psw.mask = psw_kernel_bits; 353 lc->program_new_psw.mask = psw_kernel_bits |
354 PSW_MASK_DAT | PSW_MASK_MCHECK;
362 lc->program_new_psw.addr = 355 lc->program_new_psw.addr =
363 PSW_ADDR_AMODE | (unsigned long)pgm_check_handler; 356 PSW_ADDR_AMODE | (unsigned long) pgm_check_handler;
364 lc->mcck_new_psw.mask = 357 lc->mcck_new_psw.mask = psw_kernel_bits;
365 psw_kernel_bits & ~PSW_MASK_MCHECK & ~PSW_MASK_DAT;
366 lc->mcck_new_psw.addr = 358 lc->mcck_new_psw.addr =
367 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler; 359 PSW_ADDR_AMODE | (unsigned long) mcck_int_handler;
368 lc->io_new_psw.mask = psw_kernel_bits; 360 lc->io_new_psw.mask = psw_kernel_bits |
361 PSW_MASK_DAT | PSW_MASK_MCHECK;
369 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler; 362 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler;
370 lc->clock_comparator = -1ULL; 363 lc->clock_comparator = -1ULL;
371 lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE; 364 lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE;
@@ -554,7 +547,7 @@ static void __init setup_restart_psw(void)
554 * Setup restart PSW for absolute zero lowcore. This is necesary 547 * Setup restart PSW for absolute zero lowcore. This is necesary
555 * if PSW restart is done on an offline CPU that has lowcore zero 548 * if PSW restart is done on an offline CPU that has lowcore zero
556 */ 549 */
557 psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; 550 psw.mask = PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_EA | PSW_MASK_BA;
558 psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; 551 psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
559 copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw)); 552 copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw));
560} 553}