[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>
This commit is contained in:
Родитель
c9e3735359
Коммит
0b642ede47
|
@ -34,7 +34,6 @@ EXPORT_SYMBOL(__clear_user_asm);
|
||||||
EXPORT_SYMBOL(__strncpy_from_user_asm);
|
EXPORT_SYMBOL(__strncpy_from_user_asm);
|
||||||
EXPORT_SYMBOL(__strnlen_user_asm);
|
EXPORT_SYMBOL(__strnlen_user_asm);
|
||||||
EXPORT_SYMBOL(diag10);
|
EXPORT_SYMBOL(diag10);
|
||||||
EXPORT_SYMBOL(default_storage_key);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* semaphore ops
|
* semaphore ops
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#include <asm/cpcmd.h>
|
#include <asm/cpcmd.h>
|
||||||
#include <asm/lowcore.h>
|
#include <asm/lowcore.h>
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
|
#include <asm/page.h>
|
||||||
|
#include <asm/ptrace.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Machine setup..
|
* Machine setup..
|
||||||
|
@ -53,7 +55,6 @@ unsigned int console_devno = -1;
|
||||||
unsigned int console_irq = -1;
|
unsigned int console_irq = -1;
|
||||||
unsigned long memory_size = 0;
|
unsigned long memory_size = 0;
|
||||||
unsigned long machine_flags = 0;
|
unsigned long machine_flags = 0;
|
||||||
unsigned int default_storage_key = 0;
|
|
||||||
struct {
|
struct {
|
||||||
unsigned long addr, size, type;
|
unsigned long addr, size, type;
|
||||||
} memory_chunk[MEMORY_CHUNKS] = { { 0 } };
|
} memory_chunk[MEMORY_CHUNKS] = { { 0 } };
|
||||||
|
@ -402,7 +403,7 @@ setup_lowcore(void)
|
||||||
lc = (struct _lowcore *)
|
lc = (struct _lowcore *)
|
||||||
__alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
|
__alloc_bootmem(lc_pages * PAGE_SIZE, lc_pages * PAGE_SIZE, 0);
|
||||||
memset(lc, 0, lc_pages * PAGE_SIZE);
|
memset(lc, 0, lc_pages * PAGE_SIZE);
|
||||||
lc->restart_psw.mask = PSW_BASE_BITS;
|
lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY;
|
||||||
lc->restart_psw.addr =
|
lc->restart_psw.addr =
|
||||||
PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
|
PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
|
||||||
lc->external_new_psw.mask = PSW_KERNEL_BITS;
|
lc->external_new_psw.mask = PSW_KERNEL_BITS;
|
||||||
|
@ -470,7 +471,7 @@ static void __init
|
||||||
setup_memory(void)
|
setup_memory(void)
|
||||||
{
|
{
|
||||||
unsigned long bootmap_size;
|
unsigned long bootmap_size;
|
||||||
unsigned long start_pfn, end_pfn;
|
unsigned long start_pfn, end_pfn, init_pfn;
|
||||||
unsigned long last_rw_end;
|
unsigned long last_rw_end;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -481,6 +482,10 @@ setup_memory(void)
|
||||||
start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
end_pfn = max_pfn = memory_end >> PAGE_SHIFT;
|
end_pfn = max_pfn = memory_end >> PAGE_SHIFT;
|
||||||
|
|
||||||
|
/* Initialize storage key for kernel pages */
|
||||||
|
for (init_pfn = 0 ; init_pfn < start_pfn; init_pfn++)
|
||||||
|
page_set_storage_key(init_pfn << PAGE_SHIFT, PAGE_DEFAULT_KEY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the boot-time allocator (with low memory only):
|
* Initialize the boot-time allocator (with low memory only):
|
||||||
*/
|
*/
|
||||||
|
@ -491,7 +496,7 @@ setup_memory(void)
|
||||||
*/
|
*/
|
||||||
last_rw_end = start_pfn;
|
last_rw_end = start_pfn;
|
||||||
|
|
||||||
for (i = 0; i < 16 && memory_chunk[i].size > 0; i++) {
|
for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
|
||||||
unsigned long start_chunk, end_chunk;
|
unsigned long start_chunk, end_chunk;
|
||||||
|
|
||||||
if (memory_chunk[i].type != CHUNK_READ_WRITE)
|
if (memory_chunk[i].type != CHUNK_READ_WRITE)
|
||||||
|
@ -505,6 +510,11 @@ setup_memory(void)
|
||||||
if (end_chunk > end_pfn)
|
if (end_chunk > end_pfn)
|
||||||
end_chunk = end_pfn;
|
end_chunk = end_pfn;
|
||||||
if (start_chunk < end_chunk) {
|
if (start_chunk < end_chunk) {
|
||||||
|
/* Initialize storage key for RAM pages */
|
||||||
|
for (init_pfn = start_chunk ; init_pfn < end_chunk;
|
||||||
|
init_pfn++)
|
||||||
|
page_set_storage_key(init_pfn << PAGE_SHIFT,
|
||||||
|
PAGE_DEFAULT_KEY);
|
||||||
free_bootmem(start_chunk << PAGE_SHIFT,
|
free_bootmem(start_chunk << PAGE_SHIFT,
|
||||||
(end_chunk - start_chunk) << PAGE_SHIFT);
|
(end_chunk - start_chunk) << PAGE_SHIFT);
|
||||||
if (last_rw_end < start_chunk)
|
if (last_rw_end < start_chunk)
|
||||||
|
@ -513,6 +523,8 @@ setup_memory(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psw_set_key(PAGE_DEFAULT_KEY);
|
||||||
|
|
||||||
if (last_rw_end < end_pfn - 1)
|
if (last_rw_end < end_pfn - 1)
|
||||||
add_memory_hole(last_rw_end, end_pfn - 1);
|
add_memory_hole(last_rw_end, end_pfn - 1);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* drivers/s390/cio/cio.c
|
* drivers/s390/cio/cio.c
|
||||||
* S/390 common I/O routines -- low level i/o calls
|
* S/390 common I/O routines -- low level i/o calls
|
||||||
* $Revision: 1.131 $
|
* $Revision: 1.133 $
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
|
* Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
|
@ -228,7 +228,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */
|
||||||
int
|
int
|
||||||
cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
|
cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
|
||||||
{
|
{
|
||||||
return cio_start_key(sch, cpa, lpm, default_storage_key);
|
return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* drivers/s390/cio/device_ops.c
|
* drivers/s390/cio/device_ops.c
|
||||||
*
|
*
|
||||||
* $Revision: 1.55 $
|
* $Revision: 1.56 $
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
|
* Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
|
@ -128,7 +128,7 @@ ccw_device_start(struct ccw_device *cdev, struct ccw1 *cpa,
|
||||||
unsigned long intparm, __u8 lpm, unsigned long flags)
|
unsigned long intparm, __u8 lpm, unsigned long flags)
|
||||||
{
|
{
|
||||||
return ccw_device_start_key(cdev, cpa, intparm, lpm,
|
return ccw_device_start_key(cdev, cpa, intparm, lpm,
|
||||||
default_storage_key, flags);
|
PAGE_DEFAULT_KEY, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -137,7 +137,7 @@ ccw_device_start_timeout(struct ccw_device *cdev, struct ccw1 *cpa,
|
||||||
int expires)
|
int expires)
|
||||||
{
|
{
|
||||||
return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm,
|
return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm,
|
||||||
default_storage_key, flags,
|
PAGE_DEFAULT_KEY, flags,
|
||||||
expires);
|
expires);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#ifndef _CIO_QDIO_H
|
#ifndef _CIO_QDIO_H
|
||||||
#define _CIO_QDIO_H
|
#define _CIO_QDIO_H
|
||||||
|
|
||||||
#define VERSION_CIO_QDIO_H "$Revision: 1.26 $"
|
#include <asm/page.h>
|
||||||
|
|
||||||
|
#define VERSION_CIO_QDIO_H "$Revision: 1.32 $"
|
||||||
|
|
||||||
#ifdef CONFIG_QDIO_DEBUG
|
#ifdef CONFIG_QDIO_DEBUG
|
||||||
#define QDIO_VERBOSE_LEVEL 9
|
#define QDIO_VERBOSE_LEVEL 9
|
||||||
|
@ -42,7 +44,7 @@
|
||||||
|
|
||||||
#define QDIO_Q_LAPS 5
|
#define QDIO_Q_LAPS 5
|
||||||
|
|
||||||
#define QDIO_STORAGE_KEY 0
|
#define QDIO_STORAGE_KEY PAGE_DEFAULT_KEY
|
||||||
|
|
||||||
#define L2_CACHELINE_SIZE 256
|
#define L2_CACHELINE_SIZE 256
|
||||||
#define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
|
#define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#define PAGE_SHIFT 12
|
#define PAGE_SHIFT 12
|
||||||
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
||||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||||
|
#define PAGE_DEFAULT_ACC 0
|
||||||
|
#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
|
|
|
@ -245,7 +245,7 @@ static inline void enabled_wait(void)
|
||||||
psw_t wait_psw;
|
psw_t wait_psw;
|
||||||
|
|
||||||
wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT |
|
wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT |
|
||||||
PSW_MASK_MCHECK | PSW_MASK_WAIT;
|
PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY;
|
||||||
#ifndef __s390x__
|
#ifndef __s390x__
|
||||||
asm volatile (
|
asm volatile (
|
||||||
" basr %0,0\n"
|
" basr %0,0\n"
|
||||||
|
|
|
@ -185,6 +185,7 @@
|
||||||
#include <linux/stddef.h>
|
#include <linux/stddef.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <asm/setup.h>
|
#include <asm/setup.h>
|
||||||
|
#include <asm/page.h>
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
|
@ -235,6 +236,7 @@ typedef struct
|
||||||
#define PSW_ADDR_INSN 0x7FFFFFFFUL
|
#define PSW_ADDR_INSN 0x7FFFFFFFUL
|
||||||
|
|
||||||
#define PSW_BASE_BITS 0x00080000UL
|
#define PSW_BASE_BITS 0x00080000UL
|
||||||
|
#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
|
||||||
|
|
||||||
#define PSW_ASC_PRIMARY 0x00000000UL
|
#define PSW_ASC_PRIMARY 0x00000000UL
|
||||||
#define PSW_ASC_ACCREG 0x00004000UL
|
#define PSW_ASC_ACCREG 0x00004000UL
|
||||||
|
@ -260,6 +262,7 @@ typedef struct
|
||||||
|
|
||||||
#define PSW_BASE_BITS 0x0000000180000000UL
|
#define PSW_BASE_BITS 0x0000000180000000UL
|
||||||
#define PSW_BASE32_BITS 0x0000000080000000UL
|
#define PSW_BASE32_BITS 0x0000000080000000UL
|
||||||
|
#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
|
||||||
|
|
||||||
#define PSW_ASC_PRIMARY 0x0000000000000000UL
|
#define PSW_ASC_PRIMARY 0x0000000000000000UL
|
||||||
#define PSW_ASC_ACCREG 0x0000400000000000UL
|
#define PSW_ASC_ACCREG 0x0000400000000000UL
|
||||||
|
@ -268,14 +271,15 @@ typedef struct
|
||||||
|
|
||||||
#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
|
#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
|
||||||
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
|
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
|
||||||
PSW_MASK_PSTATE)
|
PSW_MASK_PSTATE | PSW_DEFAULT_KEY)
|
||||||
|
|
||||||
#endif /* __s390x__ */
|
#endif /* __s390x__ */
|
||||||
|
|
||||||
#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY)
|
#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | \
|
||||||
|
PSW_DEFAULT_KEY)
|
||||||
#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
|
#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
|
||||||
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
|
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
|
||||||
PSW_MASK_PSTATE)
|
PSW_MASK_PSTATE | PSW_DEFAULT_KEY)
|
||||||
|
|
||||||
/* This macro merges a NEW PSW mask specified by the user into
|
/* This macro merges a NEW PSW mask specified by the user into
|
||||||
the currently active PSW mask CURRENT, modifying only those
|
the currently active PSW mask CURRENT, modifying only those
|
||||||
|
@ -470,6 +474,12 @@ struct user_regs_struct
|
||||||
extern void show_regs(struct pt_regs * regs);
|
extern void show_regs(struct pt_regs * regs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
psw_set_key(unsigned int key)
|
||||||
|
{
|
||||||
|
asm volatile ( "spka 0(%0)" : : "d" (key) );
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
#endif /* _S390_PTRACE_H */
|
#endif /* _S390_PTRACE_H */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче