aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>2005-05-01 11:58:58 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:58:58 -0400
commit0b642ede47969d4180b0922d982777fe64379228 (patch)
treeb54173402cfcd590976f639ef6c2f0490cc23c74 /arch/s390
parentc9e3735359ac2d74ee61c6f1e5724f4a6db570bf (diff)
[PATCH] s390: default storage key
Provide an easy way to define a non-zero storage key at compile time. This is useful for debugging purposes. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/kernel/setup.c20
2 files changed, 16 insertions, 5 deletions
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index 11fd6d556d8f..bee654abb6d3 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -34,7 +34,6 @@ EXPORT_SYMBOL(__clear_user_asm);
34EXPORT_SYMBOL(__strncpy_from_user_asm); 34EXPORT_SYMBOL(__strncpy_from_user_asm);
35EXPORT_SYMBOL(__strnlen_user_asm); 35EXPORT_SYMBOL(__strnlen_user_asm);
36EXPORT_SYMBOL(diag10); 36EXPORT_SYMBOL(diag10);
37EXPORT_SYMBOL(default_storage_key);
38 37
39/* 38/*
40 * semaphore ops 39 * semaphore ops
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index f0679be4f96f..df83215beac3 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -44,6 +44,8 @@
44#include <asm/cpcmd.h> 44#include <asm/cpcmd.h>
45#include <asm/lowcore.h> 45#include <asm/lowcore.h>
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/page.h>
48#include <asm/ptrace.h>
47 49
48/* 50/*
49 * Machine setup.. 51 * Machine setup..
@@ -53,7 +55,6 @@ unsigned int console_devno = -1;
53unsigned int console_irq = -1; 55unsigned int console_irq = -1;
54unsigned long memory_size = 0; 56unsigned long memory_size = 0;
55unsigned long machine_flags = 0; 57unsigned long machine_flags = 0;
56unsigned int default_storage_key = 0;
57struct { 58struct {
58 unsigned long addr, size, type; 59 unsigned long addr, size, type;
59} memory_chunk[MEMORY_CHUNKS] = { { 0 } }; 60} memory_chunk[MEMORY_CHUNKS] = { { 0 } };
@@ -402,7 +403,7 @@ setup_lowcore(void)
402 lc = (struct _lowcore *) 403 lc = (struct _lowcore *)
403 __alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0); 404 __alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
404 memset(lc, 0, lc_pages * PAGE_SIZE); 405 memset(lc, 0, lc_pages * PAGE_SIZE);
405 lc->restart_psw.mask = PSW_BASE_BITS; 406 lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
406 lc->restart_psw.addr = 407 lc->restart_psw.addr =
407 PSW_ADDR_AMODE | (unsigned long) restart_int_handler; 408 PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
408 lc->external_new_psw.mask = PSW_KERNEL_BITS; 409 lc->external_new_psw.mask = PSW_KERNEL_BITS;
@@ -470,7 +471,7 @@ static void __init
470setup_memory(void) 471setup_memory(void)
471{ 472{
472 unsigned long bootmap_size; 473 unsigned long bootmap_size;
473 unsigned long start_pfn, end_pfn; 474 unsigned long start_pfn, end_pfn, init_pfn;
474 unsigned long last_rw_end; 475 unsigned long last_rw_end;
475 int i; 476 int i;
476 477
@@ -481,6 +482,10 @@ setup_memory(void)
481 start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT; 482 start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT;
482 end_pfn = max_pfn = memory_end >> PAGE_SHIFT; 483 end_pfn = max_pfn = memory_end >> PAGE_SHIFT;
483 484
485 /* Initialize storage key for kernel pages */
486 for (init_pfn = 0 ; init_pfn < start_pfn; init_pfn++)
487 page_set_storage_key(init_pfn << PAGE_SHIFT, PAGE_DEFAULT_KEY);
488
484 /* 489 /*
485 * Initialize the boot-time allocator (with low memory only): 490 * Initialize the boot-time allocator (with low memory only):
486 */ 491 */
@@ -491,7 +496,7 @@ setup_memory(void)
491 */ 496 */
492 last_rw_end = start_pfn; 497 last_rw_end = start_pfn;
493 498
494 for (i = 0; i < 16 && memory_chunk[i].size > 0; i++) { 499 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
495 unsigned long start_chunk, end_chunk; 500 unsigned long start_chunk, end_chunk;
496 501
497 if (memory_chunk[i].type != CHUNK_READ_WRITE) 502 if (memory_chunk[i].type != CHUNK_READ_WRITE)
@@ -505,6 +510,11 @@ setup_memory(void)
505 if (end_chunk > end_pfn) 510 if (end_chunk > end_pfn)
506 end_chunk = end_pfn; 511 end_chunk = end_pfn;
507 if (start_chunk < end_chunk) { 512 if (start_chunk < end_chunk) {
513 /* Initialize storage key for RAM pages */
514 for (init_pfn = start_chunk ; init_pfn < end_chunk;
515 init_pfn++)
516 page_set_storage_key(init_pfn << PAGE_SHIFT,
517 PAGE_DEFAULT_KEY);
508 free_bootmem(start_chunk << PAGE_SHIFT, 518 free_bootmem(start_chunk << PAGE_SHIFT,
509 (end_chunk - start_chunk) << PAGE_SHIFT); 519 (end_chunk - start_chunk) << PAGE_SHIFT);
510 if (last_rw_end < start_chunk) 520 if (last_rw_end < start_chunk)
@@ -513,6 +523,8 @@ setup_memory(void)
513 } 523 }
514 } 524 }
515 525
526 psw_set_key(PAGE_DEFAULT_KEY);
527
516 if (last_rw_end < end_pfn - 1) 528 if (last_rw_end < end_pfn - 1)
517 add_memory_hole(last_rw_end, end_pfn - 1); 529 add_memory_hole(last_rw_end, end_pfn - 1);
518 530