aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristian Ehrhardt <ehrhardt@linux.vnet.ibm.com>2009-04-14 09:36:16 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-04-14 09:37:21 -0400
commit25097bf153391f7be4c591d47061b3dc4990dac2 (patch)
treee6fce72c43759d97eb80f0af1ae08c0e6058e6bc /arch
parentb21597d0268983f8f9e8b563494f75490403e948 (diff)
[S390] s390: move machine flags to lowcore
Currently the storage of the machine flags is a globally exported unsigned long long variable. By moving the storage location into the lowcore struct we allow assembler code to check machine_flags directly even without needing a register. Addtionally the lowcore and therefore the machine flags too will be in cache most of the time. Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/cpuid.h25
-rw-r--r--arch/s390/include/asm/kvm_host.h1
-rw-r--r--arch/s390/include/asm/lowcore.h12
-rw-r--r--arch/s390/include/asm/processor.h17
-rw-r--r--arch/s390/include/asm/ptrace.h2
-rw-r--r--arch/s390/include/asm/setup.h24
-rw-r--r--arch/s390/include/asm/thread_info.h3
-rw-r--r--arch/s390/kernel/early.c3
-rw-r--r--arch/s390/kernel/setup.c4
-rw-r--r--arch/s390/kernel/smp.c1
10 files changed, 56 insertions, 36 deletions
diff --git a/arch/s390/include/asm/cpuid.h b/arch/s390/include/asm/cpuid.h
new file mode 100644
index 000000000000..07836a2e5222
--- /dev/null
+++ b/arch/s390/include/asm/cpuid.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright IBM Corp. 2000,2009
3 * Author(s): Hartmut Penner <hp@de.ibm.com>,
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Christian Ehrhardt <ehrhardt@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_CPUID_H_
9#define _ASM_S390_CPUID_H_
10
11/*
12 * CPU type and hardware bug flags. Kept separately for each CPU.
13 * Members of this structure are referenced in head.S, so think twice
14 * before touching them. [mj]
15 */
16
17typedef struct
18{
19 unsigned int version : 8;
20 unsigned int ident : 24;
21 unsigned int machine : 16;
22 unsigned int unused : 16;
23} __attribute__ ((packed)) cpuid_t;
24
25#endif /* _ASM_S390_CPUID_H_ */
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index c6e674f5fca9..54ea39f96ecd 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -15,6 +15,7 @@
15#define ASM_KVM_HOST_H 15#define ASM_KVM_HOST_H
16#include <linux/kvm_host.h> 16#include <linux/kvm_host.h>
17#include <asm/debug.h> 17#include <asm/debug.h>
18#include <asm/cpuid.h>
18 19
19#define KVM_MAX_VCPUS 64 20#define KVM_MAX_VCPUS 64
20#define KVM_MEMORY_SLOTS 32 21#define KVM_MEMORY_SLOTS 32
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index b349f1c7fdfa..3aeca492b147 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -66,6 +66,7 @@
66#define __LC_USER_EXEC_ASCE 0x02ac 66#define __LC_USER_EXEC_ASCE 0x02ac
67#define __LC_CPUID 0x02b0 67#define __LC_CPUID 0x02b0
68#define __LC_INT_CLOCK 0x02c8 68#define __LC_INT_CLOCK 0x02c8
69#define __LC_MACHINE_FLAGS 0x02d8
69#define __LC_IRB 0x0300 70#define __LC_IRB 0x0300
70#define __LC_PFAULT_INTPARM 0x0080 71#define __LC_PFAULT_INTPARM 0x0080
71#define __LC_CPU_TIMER_SAVE_AREA 0x00d8 72#define __LC_CPU_TIMER_SAVE_AREA 0x00d8
@@ -110,6 +111,7 @@
110#define __LC_CPUID 0x0320 111#define __LC_CPUID 0x0320
111#define __LC_INT_CLOCK 0x0340 112#define __LC_INT_CLOCK 0x0340
112#define __LC_VDSO_PER_CPU 0x0350 113#define __LC_VDSO_PER_CPU 0x0350
114#define __LC_MACHINE_FLAGS 0x0358
113#define __LC_IRB 0x0380 115#define __LC_IRB 0x0380
114#define __LC_PASTE 0x03c0 116#define __LC_PASTE 0x03c0
115#define __LC_PFAULT_INTPARM 0x11b8 117#define __LC_PFAULT_INTPARM 0x11b8
@@ -127,9 +129,9 @@
127 129
128#ifndef __ASSEMBLY__ 130#ifndef __ASSEMBLY__
129 131
130#include <asm/processor.h> 132#include <asm/cpuid.h>
133#include <asm/ptrace.h>
131#include <linux/types.h> 134#include <linux/types.h>
132#include <asm/sigp.h>
133 135
134void restart_int_handler(void); 136void restart_int_handler(void);
135void ext_int_handler(void); 137void ext_int_handler(void);
@@ -277,7 +279,8 @@ struct _lowcore
277 __u32 ext_call_fast; /* 0x02c4 */ 279 __u32 ext_call_fast; /* 0x02c4 */
278 __u64 int_clock; /* 0x02c8 */ 280 __u64 int_clock; /* 0x02c8 */
279 __u64 clock_comparator; /* 0x02d0 */ 281 __u64 clock_comparator; /* 0x02d0 */
280 __u8 pad_0x02d8[0x0300-0x02d8]; /* 0x02d8 */ 282 __u32 machine_flags; /* 0x02d8 */
283 __u8 pad_0x02dc[0x0300-0x02dc]; /* 0x02dc */
281 284
282 /* Interrupt response block */ 285 /* Interrupt response block */
283 __u8 irb[64]; /* 0x0300 */ 286 __u8 irb[64]; /* 0x0300 */
@@ -381,7 +384,8 @@ struct _lowcore
381 __u64 int_clock; /* 0x0340 */ 384 __u64 int_clock; /* 0x0340 */
382 __u64 clock_comparator; /* 0x0348 */ 385 __u64 clock_comparator; /* 0x0348 */
383 __u64 vdso_per_cpu_data; /* 0x0350 */ 386 __u64 vdso_per_cpu_data; /* 0x0350 */
384 __u8 pad_0x0358[0x0380-0x0358]; /* 0x0358 */ 387 __u64 machine_flags; /* 0x0358 */
388 __u8 pad_0x0360[0x0380-0x0360]; /* 0x0360 */
385 389
386 /* Interrupt response block. */ 390 /* Interrupt response block. */
387 __u8 irb[64]; /* 0x0380 */ 391 __u8 irb[64]; /* 0x0380 */
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 61862b3ac794..c139fa7b8e89 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -14,7 +14,10 @@
14#define __ASM_S390_PROCESSOR_H 14#define __ASM_S390_PROCESSOR_H
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <asm/cpuid.h>
18#include <asm/page.h>
17#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/setup.h>
18 21
19#ifdef __KERNEL__ 22#ifdef __KERNEL__
20/* 23/*
@@ -23,20 +26,6 @@
23 */ 26 */
24#define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; }) 27#define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; })
25 28
26/*
27 * CPU type and hardware bug flags. Kept separately for each CPU.
28 * Members of this structure are referenced in head.S, so think twice
29 * before touching them. [mj]
30 */
31
32typedef struct
33{
34 unsigned int version : 8;
35 unsigned int ident : 24;
36 unsigned int machine : 16;
37 unsigned int unused : 16;
38} __attribute__ ((packed)) cpuid_t;
39
40static inline void get_cpu_id(cpuid_t *ptr) 29static inline void get_cpu_id(cpuid_t *ptr)
41{ 30{
42 asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr)); 31 asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr));
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index f1b051630c50..539263fc9ab9 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -313,8 +313,6 @@ typedef struct
313 313
314 314
315#ifdef __KERNEL__ 315#ifdef __KERNEL__
316#include <asm/setup.h>
317#include <asm/page.h>
318 316
319/* 317/*
320 * The pt_regs struct defines the way the registers are stored on 318 * The pt_regs struct defines the way the registers are stored on
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index e8bd6ac22c99..38b0fc221ed7 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -14,6 +14,7 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#include <asm/lowcore.h>
17#include <asm/types.h> 18#include <asm/types.h>
18 19
19#define PARMAREA 0x10400 20#define PARMAREA 0x10400
@@ -63,7 +64,6 @@ extern unsigned int s390_noexec;
63/* 64/*
64 * Machine features detected in head.S 65 * Machine features detected in head.S
65 */ 66 */
66extern unsigned long machine_flags;
67 67
68#define MACHINE_FLAG_VM (1UL << 0) 68#define MACHINE_FLAG_VM (1UL << 0)
69#define MACHINE_FLAG_IEEE (1UL << 1) 69#define MACHINE_FLAG_IEEE (1UL << 1)
@@ -77,28 +77,28 @@ extern unsigned long machine_flags;
77#define MACHINE_FLAG_HPAGE (1UL << 10) 77#define MACHINE_FLAG_HPAGE (1UL << 10)
78#define MACHINE_FLAG_PFMF (1UL << 11) 78#define MACHINE_FLAG_PFMF (1UL << 11)
79 79
80#define MACHINE_IS_VM (machine_flags & MACHINE_FLAG_VM) 80#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
81#define MACHINE_IS_KVM (machine_flags & MACHINE_FLAG_KVM) 81#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
82#define MACHINE_HAS_DIAG9C (machine_flags & MACHINE_FLAG_DIAG9C) 82#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
83 83
84#ifndef __s390x__ 84#ifndef __s390x__
85#define MACHINE_HAS_IEEE (machine_flags & MACHINE_FLAG_IEEE) 85#define MACHINE_HAS_IEEE (S390_lowcore.machine_flags & MACHINE_FLAG_IEEE)
86#define MACHINE_HAS_CSP (machine_flags & MACHINE_FLAG_CSP) 86#define MACHINE_HAS_CSP (S390_lowcore.machine_flags & MACHINE_FLAG_CSP)
87#define MACHINE_HAS_IDTE (0) 87#define MACHINE_HAS_IDTE (0)
88#define MACHINE_HAS_DIAG44 (1) 88#define MACHINE_HAS_DIAG44 (1)
89#define MACHINE_HAS_MVPG (machine_flags & MACHINE_FLAG_MVPG) 89#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG)
90#define MACHINE_HAS_MVCOS (0) 90#define MACHINE_HAS_MVCOS (0)
91#define MACHINE_HAS_HPAGE (0) 91#define MACHINE_HAS_HPAGE (0)
92#define MACHINE_HAS_PFMF (0) 92#define MACHINE_HAS_PFMF (0)
93#else /* __s390x__ */ 93#else /* __s390x__ */
94#define MACHINE_HAS_IEEE (1) 94#define MACHINE_HAS_IEEE (1)
95#define MACHINE_HAS_CSP (1) 95#define MACHINE_HAS_CSP (1)
96#define MACHINE_HAS_IDTE (machine_flags & MACHINE_FLAG_IDTE) 96#define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
97#define MACHINE_HAS_DIAG44 (machine_flags & MACHINE_FLAG_DIAG44) 97#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
98#define MACHINE_HAS_MVPG (1) 98#define MACHINE_HAS_MVPG (1)
99#define MACHINE_HAS_MVCOS (machine_flags & MACHINE_FLAG_MVCOS) 99#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
100#define MACHINE_HAS_HPAGE (machine_flags & MACHINE_FLAG_HPAGE) 100#define MACHINE_HAS_HPAGE (S390_lowcore.machine_flags & MACHINE_FLAG_HPAGE)
101#define MACHINE_HAS_PFMF (machine_flags & MACHINE_FLAG_PFMF) 101#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
102#endif /* __s390x__ */ 102#endif /* __s390x__ */
103 103
104#define ZFCPDUMP_HSA_SIZE (32UL<<20) 104#define ZFCPDUMP_HSA_SIZE (32UL<<20)
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index c544aa524535..461f2abd2e6f 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -31,8 +31,9 @@
31#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER) 31#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)
32 32
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34#include <asm/processor.h>
35#include <asm/lowcore.h> 34#include <asm/lowcore.h>
35#include <asm/page.h>
36#include <asm/processor.h>
36 37
37/* 38/*
38 * low level task data that entry.S needs immediate access to 39 * low level task data that entry.S needs immediate access to
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 4d221c81c849..d4e1e5b6cfda 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -34,6 +34,8 @@
34 34
35char kernel_nss_name[NSS_NAME_SIZE + 1]; 35char kernel_nss_name[NSS_NAME_SIZE + 1];
36 36
37static unsigned long machine_flags;
38
37static void __init setup_boot_command_line(void); 39static void __init setup_boot_command_line(void);
38 40
39 41
@@ -391,5 +393,6 @@ void __init startup_init(void)
391 setup_hpage(); 393 setup_hpage();
392 sclp_facilities_detect(); 394 sclp_facilities_detect();
393 detect_memory_layout(memory_chunk); 395 detect_memory_layout(memory_chunk);
396 S390_lowcore.machine_flags = machine_flags;
394 lockdep_on(); 397 lockdep_on();
395} 398}
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 06201b93cbbf..163bdfe5a6be 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -82,9 +82,6 @@ EXPORT_SYMBOL(console_devno);
82unsigned int console_irq = -1; 82unsigned int console_irq = -1;
83EXPORT_SYMBOL(console_irq); 83EXPORT_SYMBOL(console_irq);
84 84
85unsigned long machine_flags;
86EXPORT_SYMBOL(machine_flags);
87
88unsigned long elf_hwcap = 0; 85unsigned long elf_hwcap = 0;
89char elf_platform[ELF_PLATFORM_SIZE]; 86char elf_platform[ELF_PLATFORM_SIZE];
90 87
@@ -426,6 +423,7 @@ setup_lowcore(void)
426 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE; 423 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE;
427 lc->current_task = (unsigned long) init_thread_union.thread_info.task; 424 lc->current_task = (unsigned long) init_thread_union.thread_info.task;
428 lc->thread_info = (unsigned long) &init_thread_union; 425 lc->thread_info = (unsigned long) &init_thread_union;
426 lc->machine_flags = S390_lowcore.machine_flags;
429#ifndef CONFIG_64BIT 427#ifndef CONFIG_64BIT
430 if (MACHINE_HAS_IEEE) { 428 if (MACHINE_HAS_IEEE) {
431 lc->extended_save_area_addr = (__u32) 429 lc->extended_save_area_addr = (__u32)
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 006ed5016eb4..796630240715 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -571,6 +571,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
571 cpu_lowcore->current_task = (unsigned long) idle; 571 cpu_lowcore->current_task = (unsigned long) idle;
572 cpu_lowcore->cpu_nr = cpu; 572 cpu_lowcore->cpu_nr = cpu;
573 cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce; 573 cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce;
574 cpu_lowcore->machine_flags = S390_lowcore.machine_flags;
574 eieio(); 575 eieio();
575 576
576 while (signal_processor(cpu, sigp_restart) == sigp_busy) 577 while (signal_processor(cpu, sigp_restart) == sigp_busy)