aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/kernel/setup.c20
-rw-r--r--drivers/s390/cio/cio.c4
-rw-r--r--drivers/s390/cio/device_ops.c6
-rw-r--r--drivers/s390/cio/qdio.h6
-rw-r--r--include/asm-s390/page.h2
-rw-r--r--include/asm-s390/processor.h2
-rw-r--r--include/asm-s390/ptrace.h16
8 files changed, 41 insertions, 16 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
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 99ce5a567982..1d9b3f18d8de 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/s390/cio/cio.c 2 * drivers/s390/cio/cio.c
3 * S/390 common I/O routines -- low level i/o calls 3 * S/390 common I/O routines -- low level i/o calls
4 * $Revision: 1.131 $ 4 * $Revision: 1.133 $
5 * 5 *
6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, 6 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
7 * IBM Corporation 7 * IBM Corporation
@@ -228,7 +228,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */
228int 228int
229cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm) 229cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
230{ 230{
231 return cio_start_key(sch, cpa, lpm, default_storage_key); 231 return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY);
232} 232}
233 233
234/* 234/*
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index 11e260e0b9c9..02d01a0de16c 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/s390/cio/device_ops.c 2 * drivers/s390/cio/device_ops.c
3 * 3 *
4 * $Revision: 1.55 $ 4 * $Revision: 1.56 $
5 * 5 *
6 * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, 6 * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
7 * IBM Corporation 7 * IBM Corporation
@@ -128,7 +128,7 @@ ccw_device_start(struct ccw_device *cdev, struct ccw1 *cpa,
128 unsigned long intparm, __u8 lpm, unsigned long flags) 128 unsigned long intparm, __u8 lpm, unsigned long flags)
129{ 129{
130 return ccw_device_start_key(cdev, cpa, intparm, lpm, 130 return ccw_device_start_key(cdev, cpa, intparm, lpm,
131 default_storage_key, flags); 131 PAGE_DEFAULT_KEY, flags);
132} 132}
133 133
134int 134int
@@ -137,7 +137,7 @@ ccw_device_start_timeout(struct ccw_device *cdev, struct ccw1 *cpa,
137 int expires) 137 int expires)
138{ 138{
139 return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm, 139 return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm,
140 default_storage_key, flags, 140 PAGE_DEFAULT_KEY, flags,
141 expires); 141 expires);
142} 142}
143 143
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 9ad14db24143..b6daadac4e8b 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -1,7 +1,9 @@
1#ifndef _CIO_QDIO_H 1#ifndef _CIO_QDIO_H
2#define _CIO_QDIO_H 2#define _CIO_QDIO_H
3 3
4#define VERSION_CIO_QDIO_H "$Revision: 1.26 $" 4#include <asm/page.h>
5
6#define VERSION_CIO_QDIO_H "$Revision: 1.32 $"
5 7
6#ifdef CONFIG_QDIO_DEBUG 8#ifdef CONFIG_QDIO_DEBUG
7#define QDIO_VERBOSE_LEVEL 9 9#define QDIO_VERBOSE_LEVEL 9
@@ -42,7 +44,7 @@
42 44
43#define QDIO_Q_LAPS 5 45#define QDIO_Q_LAPS 5
44 46
45#define QDIO_STORAGE_KEY 0 47#define QDIO_STORAGE_KEY PAGE_DEFAULT_KEY
46 48
47#define L2_CACHELINE_SIZE 256 49#define L2_CACHELINE_SIZE 256
48#define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32)) 50#define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index 614e2a93c703..2be287b9df88 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -16,6 +16,8 @@
16#define PAGE_SHIFT 12 16#define PAGE_SHIFT 12
17#define PAGE_SIZE (1UL << PAGE_SHIFT) 17#define PAGE_SIZE (1UL << PAGE_SHIFT)
18#define PAGE_MASK (~(PAGE_SIZE-1)) 18#define PAGE_MASK (~(PAGE_SIZE-1))
19#define PAGE_DEFAULT_ACC 0
20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
19 21
20#ifdef __KERNEL__ 22#ifdef __KERNEL__
21#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index 88c272ca48bf..fb46e9090b50 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -245,7 +245,7 @@ static inline void enabled_wait(void)
245 psw_t wait_psw; 245 psw_t wait_psw;
246 246
247 wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | 247 wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT |
248 PSW_MASK_MCHECK | PSW_MASK_WAIT; 248 PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY;
249#ifndef __s390x__ 249#ifndef __s390x__
250 asm volatile ( 250 asm volatile (
251 " basr %0,0\n" 251 " basr %0,0\n"
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index 1dc80666e97e..4eff8f2e3bf1 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -185,6 +185,7 @@
185#include <linux/stddef.h> 185#include <linux/stddef.h>
186#include <linux/types.h> 186#include <linux/types.h>
187#include <asm/setup.h> 187#include <asm/setup.h>
188#include <asm/page.h>
188 189
189typedef union 190typedef union
190{ 191{
@@ -235,6 +236,7 @@ typedef struct
235#define PSW_ADDR_INSN 0x7FFFFFFFUL 236#define PSW_ADDR_INSN 0x7FFFFFFFUL
236 237
237#define PSW_BASE_BITS 0x00080000UL 238#define PSW_BASE_BITS 0x00080000UL
239#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
238 240
239#define PSW_ASC_PRIMARY 0x00000000UL 241#define PSW_ASC_PRIMARY 0x00000000UL
240#define PSW_ASC_ACCREG 0x00004000UL 242#define PSW_ASC_ACCREG 0x00004000UL
@@ -260,6 +262,7 @@ typedef struct
260 262
261#define PSW_BASE_BITS 0x0000000180000000UL 263#define PSW_BASE_BITS 0x0000000180000000UL
262#define PSW_BASE32_BITS 0x0000000080000000UL 264#define PSW_BASE32_BITS 0x0000000080000000UL
265#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
263 266
264#define PSW_ASC_PRIMARY 0x0000000000000000UL 267#define PSW_ASC_PRIMARY 0x0000000000000000UL
265#define PSW_ASC_ACCREG 0x0000400000000000UL 268#define PSW_ASC_ACCREG 0x0000400000000000UL
@@ -268,14 +271,15 @@ typedef struct
268 271
269#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ 272#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
270 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ 273 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
271 PSW_MASK_PSTATE) 274 PSW_MASK_PSTATE | PSW_DEFAULT_KEY)
272 275
273#endif /* __s390x__ */ 276#endif /* __s390x__ */
274 277
275#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY) 278#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | \
279 PSW_DEFAULT_KEY)
276#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ 280#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
277 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ 281 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
278 PSW_MASK_PSTATE) 282 PSW_MASK_PSTATE | PSW_DEFAULT_KEY)
279 283
280/* This macro merges a NEW PSW mask specified by the user into 284/* This macro merges a NEW PSW mask specified by the user into
281 the currently active PSW mask CURRENT, modifying only those 285 the currently active PSW mask CURRENT, modifying only those
@@ -470,6 +474,12 @@ struct user_regs_struct
470extern void show_regs(struct pt_regs * regs); 474extern void show_regs(struct pt_regs * regs);
471#endif 475#endif
472 476
477static inline void
478psw_set_key(unsigned int key)
479{
480 asm volatile ( "spka 0(%0)" : : "d" (key) );
481}
482
473#endif /* __ASSEMBLY__ */ 483#endif /* __ASSEMBLY__ */
474 484
475#endif /* _S390_PTRACE_H */ 485#endif /* _S390_PTRACE_H */