diff options
Diffstat (limited to 'arch/s390')
27 files changed, 735 insertions, 344 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 373679b3744a..28d183c42751 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -87,11 +87,13 @@ config S390 | |||
87 | select HAVE_KERNEL_LZMA | 87 | select HAVE_KERNEL_LZMA |
88 | select HAVE_KERNEL_LZO | 88 | select HAVE_KERNEL_LZO |
89 | select HAVE_KERNEL_XZ | 89 | select HAVE_KERNEL_XZ |
90 | select HAVE_GET_USER_PAGES_FAST | ||
91 | select HAVE_ARCH_MUTEX_CPU_RELAX | 90 | select HAVE_ARCH_MUTEX_CPU_RELAX |
92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 | 91 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 |
93 | select HAVE_RCU_TABLE_FREE if SMP | 92 | select HAVE_RCU_TABLE_FREE if SMP |
94 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION | 93 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION |
94 | select HAVE_MEMBLOCK | ||
95 | select HAVE_MEMBLOCK_NODE_MAP | ||
96 | select ARCH_DISCARD_MEMBLOCK | ||
95 | select ARCH_INLINE_SPIN_TRYLOCK | 97 | select ARCH_INLINE_SPIN_TRYLOCK |
96 | select ARCH_INLINE_SPIN_TRYLOCK_BH | 98 | select ARCH_INLINE_SPIN_TRYLOCK_BH |
97 | select ARCH_INLINE_SPIN_LOCK | 99 | select ARCH_INLINE_SPIN_LOCK |
@@ -345,9 +347,6 @@ config WARN_DYNAMIC_STACK | |||
345 | 347 | ||
346 | Say N if you are unsure. | 348 | Say N if you are unsure. |
347 | 349 | ||
348 | config ARCH_POPULATES_NODE_MAP | ||
349 | def_bool y | ||
350 | |||
351 | comment "Kernel preemption" | 350 | comment "Kernel preemption" |
352 | 351 | ||
353 | source "kernel/Kconfig.preempt" | 352 | source "kernel/Kconfig.preempt" |
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c index 92f1cb745d69..4de031d6b76c 100644 --- a/arch/s390/appldata/appldata_os.c +++ b/arch/s390/appldata/appldata_os.c | |||
@@ -115,21 +115,21 @@ static void appldata_get_os_data(void *data) | |||
115 | j = 0; | 115 | j = 0; |
116 | for_each_online_cpu(i) { | 116 | for_each_online_cpu(i) { |
117 | os_data->os_cpu[j].per_cpu_user = | 117 | os_data->os_cpu[j].per_cpu_user = |
118 | cputime_to_jiffies(kstat_cpu(i).cpustat.user); | 118 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]); |
119 | os_data->os_cpu[j].per_cpu_nice = | 119 | os_data->os_cpu[j].per_cpu_nice = |
120 | cputime_to_jiffies(kstat_cpu(i).cpustat.nice); | 120 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]); |
121 | os_data->os_cpu[j].per_cpu_system = | 121 | os_data->os_cpu[j].per_cpu_system = |
122 | cputime_to_jiffies(kstat_cpu(i).cpustat.system); | 122 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]); |
123 | os_data->os_cpu[j].per_cpu_idle = | 123 | os_data->os_cpu[j].per_cpu_idle = |
124 | cputime_to_jiffies(kstat_cpu(i).cpustat.idle); | 124 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]); |
125 | os_data->os_cpu[j].per_cpu_irq = | 125 | os_data->os_cpu[j].per_cpu_irq = |
126 | cputime_to_jiffies(kstat_cpu(i).cpustat.irq); | 126 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]); |
127 | os_data->os_cpu[j].per_cpu_softirq = | 127 | os_data->os_cpu[j].per_cpu_softirq = |
128 | cputime_to_jiffies(kstat_cpu(i).cpustat.softirq); | 128 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]); |
129 | os_data->os_cpu[j].per_cpu_iowait = | 129 | os_data->os_cpu[j].per_cpu_iowait = |
130 | cputime_to_jiffies(kstat_cpu(i).cpustat.iowait); | 130 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]); |
131 | os_data->os_cpu[j].per_cpu_steal = | 131 | os_data->os_cpu[j].per_cpu_steal = |
132 | cputime_to_jiffies(kstat_cpu(i).cpustat.steal); | 132 | cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]); |
133 | os_data->os_cpu[j].cpu_id = i; | 133 | os_data->os_cpu[j].cpu_id = i; |
134 | j++; | 134 | j++; |
135 | } | 135 | } |
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 481f4f76f664..8a2a887478cc 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c | |||
@@ -97,7 +97,7 @@ static void hypfs_delete_tree(struct dentry *root) | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | static struct inode *hypfs_make_inode(struct super_block *sb, int mode) | 100 | static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode) |
101 | { | 101 | { |
102 | struct inode *ret = new_inode(sb); | 102 | struct inode *ret = new_inode(sb); |
103 | 103 | ||
@@ -107,7 +107,7 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode) | |||
107 | ret->i_uid = hypfs_info->uid; | 107 | ret->i_uid = hypfs_info->uid; |
108 | ret->i_gid = hypfs_info->gid; | 108 | ret->i_gid = hypfs_info->gid; |
109 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | 109 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; |
110 | if (mode & S_IFDIR) | 110 | if (S_ISDIR(mode)) |
111 | set_nlink(ret, 2); | 111 | set_nlink(ret, 2); |
112 | } | 112 | } |
113 | return ret; | 113 | return ret; |
@@ -259,9 +259,9 @@ static int hypfs_parse_options(char *options, struct super_block *sb) | |||
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
261 | 261 | ||
262 | static int hypfs_show_options(struct seq_file *s, struct vfsmount *mnt) | 262 | static int hypfs_show_options(struct seq_file *s, struct dentry *root) |
263 | { | 263 | { |
264 | struct hypfs_sb_info *hypfs_info = mnt->mnt_sb->s_fs_info; | 264 | struct hypfs_sb_info *hypfs_info = root->d_sb->s_fs_info; |
265 | 265 | ||
266 | seq_printf(s, ",uid=%u", hypfs_info->uid); | 266 | seq_printf(s, ",uid=%u", hypfs_info->uid); |
267 | seq_printf(s, ",gid=%u", hypfs_info->gid); | 267 | seq_printf(s, ",gid=%u", hypfs_info->gid); |
@@ -333,7 +333,7 @@ static void hypfs_kill_super(struct super_block *sb) | |||
333 | 333 | ||
334 | static struct dentry *hypfs_create_file(struct super_block *sb, | 334 | static struct dentry *hypfs_create_file(struct super_block *sb, |
335 | struct dentry *parent, const char *name, | 335 | struct dentry *parent, const char *name, |
336 | char *data, mode_t mode) | 336 | char *data, umode_t mode) |
337 | { | 337 | { |
338 | struct dentry *dentry; | 338 | struct dentry *dentry; |
339 | struct inode *inode; | 339 | struct inode *inode; |
@@ -350,13 +350,13 @@ static struct dentry *hypfs_create_file(struct super_block *sb, | |||
350 | dentry = ERR_PTR(-ENOMEM); | 350 | dentry = ERR_PTR(-ENOMEM); |
351 | goto fail; | 351 | goto fail; |
352 | } | 352 | } |
353 | if (mode & S_IFREG) { | 353 | if (S_ISREG(mode)) { |
354 | inode->i_fop = &hypfs_file_ops; | 354 | inode->i_fop = &hypfs_file_ops; |
355 | if (data) | 355 | if (data) |
356 | inode->i_size = strlen(data); | 356 | inode->i_size = strlen(data); |
357 | else | 357 | else |
358 | inode->i_size = 0; | 358 | inode->i_size = 0; |
359 | } else if (mode & S_IFDIR) { | 359 | } else if (S_ISDIR(mode)) { |
360 | inode->i_op = &simple_dir_inode_operations; | 360 | inode->i_op = &simple_dir_inode_operations; |
361 | inode->i_fop = &simple_dir_operations; | 361 | inode->i_fop = &simple_dir_operations; |
362 | inc_nlink(parent->d_inode); | 362 | inc_nlink(parent->d_inode); |
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h index 081434878296..c23c3900c304 100644 --- a/arch/s390/include/asm/cputime.h +++ b/arch/s390/include/asm/cputime.h | |||
@@ -16,114 +16,100 @@ | |||
16 | 16 | ||
17 | /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ | 17 | /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */ |
18 | 18 | ||
19 | typedef unsigned long long cputime_t; | 19 | typedef unsigned long long __nocast cputime_t; |
20 | typedef unsigned long long cputime64_t; | 20 | typedef unsigned long long __nocast cputime64_t; |
21 | 21 | ||
22 | #ifndef __s390x__ | 22 | static inline unsigned long __div(unsigned long long n, unsigned long base) |
23 | |||
24 | static inline unsigned int | ||
25 | __div(unsigned long long n, unsigned int base) | ||
26 | { | 23 | { |
24 | #ifndef __s390x__ | ||
27 | register_pair rp; | 25 | register_pair rp; |
28 | 26 | ||
29 | rp.pair = n >> 1; | 27 | rp.pair = n >> 1; |
30 | asm ("dr %0,%1" : "+d" (rp) : "d" (base >> 1)); | 28 | asm ("dr %0,%1" : "+d" (rp) : "d" (base >> 1)); |
31 | return rp.subreg.odd; | 29 | return rp.subreg.odd; |
30 | #else /* __s390x__ */ | ||
31 | return n / base; | ||
32 | #endif /* __s390x__ */ | ||
32 | } | 33 | } |
33 | 34 | ||
34 | #else /* __s390x__ */ | 35 | #define cputime_one_jiffy jiffies_to_cputime(1) |
36 | |||
37 | /* | ||
38 | * Convert cputime to jiffies and back. | ||
39 | */ | ||
40 | static inline unsigned long cputime_to_jiffies(const cputime_t cputime) | ||
41 | { | ||
42 | return __div((__force unsigned long long) cputime, 4096000000ULL / HZ); | ||
43 | } | ||
35 | 44 | ||
36 | static inline unsigned int | 45 | static inline cputime_t jiffies_to_cputime(const unsigned int jif) |
37 | __div(unsigned long long n, unsigned int base) | ||
38 | { | 46 | { |
39 | return n / base; | 47 | return (__force cputime_t)(jif * (4096000000ULL / HZ)); |
40 | } | 48 | } |
41 | 49 | ||
42 | #endif /* __s390x__ */ | 50 | static inline u64 cputime64_to_jiffies64(cputime64_t cputime) |
51 | { | ||
52 | unsigned long long jif = (__force unsigned long long) cputime; | ||
53 | do_div(jif, 4096000000ULL / HZ); | ||
54 | return jif; | ||
55 | } | ||
43 | 56 | ||
44 | #define cputime_zero (0ULL) | 57 | static inline cputime64_t jiffies64_to_cputime64(const u64 jif) |
45 | #define cputime_one_jiffy jiffies_to_cputime(1) | 58 | { |
46 | #define cputime_max ((~0UL >> 1) - 1) | 59 | return (__force cputime64_t)(jif * (4096000000ULL / HZ)); |
47 | #define cputime_add(__a, __b) ((__a) + (__b)) | ||
48 | #define cputime_sub(__a, __b) ((__a) - (__b)) | ||
49 | #define cputime_div(__a, __n) ({ \ | ||
50 | unsigned long long __div = (__a); \ | ||
51 | do_div(__div,__n); \ | ||
52 | __div; \ | ||
53 | }) | ||
54 | #define cputime_halve(__a) ((__a) >> 1) | ||
55 | #define cputime_eq(__a, __b) ((__a) == (__b)) | ||
56 | #define cputime_gt(__a, __b) ((__a) > (__b)) | ||
57 | #define cputime_ge(__a, __b) ((__a) >= (__b)) | ||
58 | #define cputime_lt(__a, __b) ((__a) < (__b)) | ||
59 | #define cputime_le(__a, __b) ((__a) <= (__b)) | ||
60 | #define cputime_to_jiffies(__ct) (__div((__ct), 4096000000ULL / HZ)) | ||
61 | #define cputime_to_scaled(__ct) (__ct) | ||
62 | #define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (4096000000ULL / HZ)) | ||
63 | |||
64 | #define cputime64_zero (0ULL) | ||
65 | #define cputime64_add(__a, __b) ((__a) + (__b)) | ||
66 | #define cputime_to_cputime64(__ct) (__ct) | ||
67 | |||
68 | static inline u64 | ||
69 | cputime64_to_jiffies64(cputime64_t cputime) | ||
70 | { | ||
71 | do_div(cputime, 4096000000ULL / HZ); | ||
72 | return cputime; | ||
73 | } | 60 | } |
74 | 61 | ||
75 | /* | 62 | /* |
76 | * Convert cputime to microseconds and back. | 63 | * Convert cputime to microseconds and back. |
77 | */ | 64 | */ |
78 | static inline unsigned int | 65 | static inline unsigned int cputime_to_usecs(const cputime_t cputime) |
79 | cputime_to_usecs(const cputime_t cputime) | ||
80 | { | 66 | { |
81 | return cputime_div(cputime, 4096); | 67 | return (__force unsigned long long) cputime >> 12; |
82 | } | 68 | } |
83 | 69 | ||
84 | static inline cputime_t | 70 | static inline cputime_t usecs_to_cputime(const unsigned int m) |
85 | usecs_to_cputime(const unsigned int m) | ||
86 | { | 71 | { |
87 | return (cputime_t) m * 4096; | 72 | return (__force cputime_t)(m * 4096ULL); |
88 | } | 73 | } |
89 | 74 | ||
75 | #define usecs_to_cputime64(m) usecs_to_cputime(m) | ||
76 | |||
90 | /* | 77 | /* |
91 | * Convert cputime to milliseconds and back. | 78 | * Convert cputime to milliseconds and back. |
92 | */ | 79 | */ |
93 | static inline unsigned int | 80 | static inline unsigned int cputime_to_secs(const cputime_t cputime) |
94 | cputime_to_secs(const cputime_t cputime) | ||
95 | { | 81 | { |
96 | return __div(cputime, 2048000000) >> 1; | 82 | return __div((__force unsigned long long) cputime, 2048000000) >> 1; |
97 | } | 83 | } |
98 | 84 | ||
99 | static inline cputime_t | 85 | static inline cputime_t secs_to_cputime(const unsigned int s) |
100 | secs_to_cputime(const unsigned int s) | ||
101 | { | 86 | { |
102 | return (cputime_t) s * 4096000000ULL; | 87 | return (__force cputime_t)(s * 4096000000ULL); |
103 | } | 88 | } |
104 | 89 | ||
105 | /* | 90 | /* |
106 | * Convert cputime to timespec and back. | 91 | * Convert cputime to timespec and back. |
107 | */ | 92 | */ |
108 | static inline cputime_t | 93 | static inline cputime_t timespec_to_cputime(const struct timespec *value) |
109 | timespec_to_cputime(const struct timespec *value) | ||
110 | { | 94 | { |
111 | return value->tv_nsec * 4096 / 1000 + (u64) value->tv_sec * 4096000000ULL; | 95 | unsigned long long ret = value->tv_sec * 4096000000ULL; |
96 | return (__force cputime_t)(ret + value->tv_nsec * 4096 / 1000); | ||
112 | } | 97 | } |
113 | 98 | ||
114 | static inline void | 99 | static inline void cputime_to_timespec(const cputime_t cputime, |
115 | cputime_to_timespec(const cputime_t cputime, struct timespec *value) | 100 | struct timespec *value) |
116 | { | 101 | { |
102 | unsigned long long __cputime = (__force unsigned long long) cputime; | ||
117 | #ifndef __s390x__ | 103 | #ifndef __s390x__ |
118 | register_pair rp; | 104 | register_pair rp; |
119 | 105 | ||
120 | rp.pair = cputime >> 1; | 106 | rp.pair = __cputime >> 1; |
121 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); | 107 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); |
122 | value->tv_nsec = rp.subreg.even * 1000 / 4096; | 108 | value->tv_nsec = rp.subreg.even * 1000 / 4096; |
123 | value->tv_sec = rp.subreg.odd; | 109 | value->tv_sec = rp.subreg.odd; |
124 | #else | 110 | #else |
125 | value->tv_nsec = (cputime % 4096000000ULL) * 1000 / 4096; | 111 | value->tv_nsec = (__cputime % 4096000000ULL) * 1000 / 4096; |
126 | value->tv_sec = cputime / 4096000000ULL; | 112 | value->tv_sec = __cputime / 4096000000ULL; |
127 | #endif | 113 | #endif |
128 | } | 114 | } |
129 | 115 | ||
@@ -132,50 +118,52 @@ cputime_to_timespec(const cputime_t cputime, struct timespec *value) | |||
132 | * Since cputime and timeval have the same resolution (microseconds) | 118 | * Since cputime and timeval have the same resolution (microseconds) |
133 | * this is easy. | 119 | * this is easy. |
134 | */ | 120 | */ |
135 | static inline cputime_t | 121 | static inline cputime_t timeval_to_cputime(const struct timeval *value) |
136 | timeval_to_cputime(const struct timeval *value) | ||
137 | { | 122 | { |
138 | return value->tv_usec * 4096 + (u64) value->tv_sec * 4096000000ULL; | 123 | unsigned long long ret = value->tv_sec * 4096000000ULL; |
124 | return (__force cputime_t)(ret + value->tv_usec * 4096ULL); | ||
139 | } | 125 | } |
140 | 126 | ||
141 | static inline void | 127 | static inline void cputime_to_timeval(const cputime_t cputime, |
142 | cputime_to_timeval(const cputime_t cputime, struct timeval *value) | 128 | struct timeval *value) |
143 | { | 129 | { |
130 | unsigned long long __cputime = (__force unsigned long long) cputime; | ||
144 | #ifndef __s390x__ | 131 | #ifndef __s390x__ |
145 | register_pair rp; | 132 | register_pair rp; |
146 | 133 | ||
147 | rp.pair = cputime >> 1; | 134 | rp.pair = __cputime >> 1; |
148 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); | 135 | asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL)); |
149 | value->tv_usec = rp.subreg.even / 4096; | 136 | value->tv_usec = rp.subreg.even / 4096; |
150 | value->tv_sec = rp.subreg.odd; | 137 | value->tv_sec = rp.subreg.odd; |
151 | #else | 138 | #else |
152 | value->tv_usec = (cputime % 4096000000ULL) / 4096; | 139 | value->tv_usec = (__cputime % 4096000000ULL) / 4096; |
153 | value->tv_sec = cputime / 4096000000ULL; | 140 | value->tv_sec = __cputime / 4096000000ULL; |
154 | #endif | 141 | #endif |
155 | } | 142 | } |
156 | 143 | ||
157 | /* | 144 | /* |
158 | * Convert cputime to clock and back. | 145 | * Convert cputime to clock and back. |
159 | */ | 146 | */ |
160 | static inline clock_t | 147 | static inline clock_t cputime_to_clock_t(cputime_t cputime) |
161 | cputime_to_clock_t(cputime_t cputime) | ||
162 | { | 148 | { |
163 | return cputime_div(cputime, 4096000000ULL / USER_HZ); | 149 | unsigned long long clock = (__force unsigned long long) cputime; |
150 | do_div(clock, 4096000000ULL / USER_HZ); | ||
151 | return clock; | ||
164 | } | 152 | } |
165 | 153 | ||
166 | static inline cputime_t | 154 | static inline cputime_t clock_t_to_cputime(unsigned long x) |
167 | clock_t_to_cputime(unsigned long x) | ||
168 | { | 155 | { |
169 | return (cputime_t) x * (4096000000ULL / USER_HZ); | 156 | return (__force cputime_t)(x * (4096000000ULL / USER_HZ)); |
170 | } | 157 | } |
171 | 158 | ||
172 | /* | 159 | /* |
173 | * Convert cputime64 to clock. | 160 | * Convert cputime64 to clock. |
174 | */ | 161 | */ |
175 | static inline clock_t | 162 | static inline clock_t cputime64_to_clock_t(cputime64_t cputime) |
176 | cputime64_to_clock_t(cputime64_t cputime) | ||
177 | { | 163 | { |
178 | return cputime_div(cputime, 4096000000ULL / USER_HZ); | 164 | unsigned long long clock = (__force unsigned long long) cputime; |
165 | do_div(clock, 4096000000ULL / USER_HZ); | ||
166 | return clock; | ||
179 | } | 167 | } |
180 | 168 | ||
181 | struct s390_idle_data { | 169 | struct s390_idle_data { |
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h index 18124b75a7ab..9d88db1f55d0 100644 --- a/arch/s390/include/asm/debug.h +++ b/arch/s390/include/asm/debug.h | |||
@@ -73,7 +73,7 @@ typedef struct debug_info { | |||
73 | struct dentry* debugfs_entries[DEBUG_MAX_VIEWS]; | 73 | struct dentry* debugfs_entries[DEBUG_MAX_VIEWS]; |
74 | struct debug_view* views[DEBUG_MAX_VIEWS]; | 74 | struct debug_view* views[DEBUG_MAX_VIEWS]; |
75 | char name[DEBUG_MAX_NAME_LEN]; | 75 | char name[DEBUG_MAX_NAME_LEN]; |
76 | mode_t mode; | 76 | umode_t mode; |
77 | } debug_info_t; | 77 | } debug_info_t; |
78 | 78 | ||
79 | typedef int (debug_header_proc_t) (debug_info_t* id, | 79 | typedef int (debug_header_proc_t) (debug_info_t* id, |
@@ -124,7 +124,7 @@ debug_info_t *debug_register(const char *name, int pages, int nr_areas, | |||
124 | int buf_size); | 124 | int buf_size); |
125 | 125 | ||
126 | debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas, | 126 | debug_info_t *debug_register_mode(const char *name, int pages, int nr_areas, |
127 | int buf_size, mode_t mode, uid_t uid, | 127 | int buf_size, umode_t mode, uid_t uid, |
128 | gid_t gid); | 128 | gid_t gid); |
129 | 129 | ||
130 | void debug_unregister(debug_info_t* id); | 130 | void debug_unregister(debug_info_t* id); |
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 24e18473d926..b0c235cb6ad5 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h | |||
@@ -47,7 +47,7 @@ struct sca_block { | |||
47 | #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) | 47 | #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) |
48 | #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) | 48 | #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) |
49 | 49 | ||
50 | #define CPUSTAT_HOST 0x80000000 | 50 | #define CPUSTAT_STOPPED 0x80000000 |
51 | #define CPUSTAT_WAIT 0x10000000 | 51 | #define CPUSTAT_WAIT 0x10000000 |
52 | #define CPUSTAT_ECALL_PEND 0x08000000 | 52 | #define CPUSTAT_ECALL_PEND 0x08000000 |
53 | #define CPUSTAT_STOP_INT 0x04000000 | 53 | #define CPUSTAT_STOP_INT 0x04000000 |
@@ -139,6 +139,7 @@ struct kvm_vcpu_stat { | |||
139 | u32 instruction_stfl; | 139 | u32 instruction_stfl; |
140 | u32 instruction_tprot; | 140 | u32 instruction_tprot; |
141 | u32 instruction_sigp_sense; | 141 | u32 instruction_sigp_sense; |
142 | u32 instruction_sigp_sense_running; | ||
142 | u32 instruction_sigp_external_call; | 143 | u32 instruction_sigp_external_call; |
143 | u32 instruction_sigp_emergency; | 144 | u32 instruction_sigp_emergency; |
144 | u32 instruction_sigp_stop; | 145 | u32 instruction_sigp_stop; |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 524d23b8610c..4f289ff0b7fe 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -599,10 +599,10 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste) | |||
599 | skey = page_get_storage_key(address); | 599 | skey = page_get_storage_key(address); |
600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); | 600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); |
601 | /* Clear page changed & referenced bit in the storage key */ | 601 | /* Clear page changed & referenced bit in the storage key */ |
602 | if (bits) { | 602 | if (bits & _PAGE_CHANGED) |
603 | skey ^= bits; | 603 | page_set_storage_key(address, skey ^ bits, 1); |
604 | page_set_storage_key(address, skey, 1); | 604 | else if (bits) |
605 | } | 605 | page_reset_referenced(address); |
606 | /* Transfer page changed & referenced bit to guest bits in pgste */ | 606 | /* Transfer page changed & referenced bit to guest bits in pgste */ |
607 | pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ | 607 | pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ |
608 | /* Get host changed & referenced bits from pgste */ | 608 | /* Get host changed & referenced bits from pgste */ |
diff --git a/arch/s390/include/asm/socket.h b/arch/s390/include/asm/socket.h index fdff1e995c73..67b5c1b14b51 100644 --- a/arch/s390/include/asm/socket.h +++ b/arch/s390/include/asm/socket.h | |||
@@ -70,4 +70,7 @@ | |||
70 | 70 | ||
71 | #define SO_RXQ_OVFL 40 | 71 | #define SO_RXQ_OVFL 40 |
72 | 72 | ||
73 | #define SO_WIFI_STATUS 41 | ||
74 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | ||
75 | |||
73 | #endif /* _ASM_SOCKET_H */ | 76 | #endif /* _ASM_SOCKET_H */ |
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index a23183423b14..a73038155e0d 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h | |||
@@ -102,7 +102,6 @@ static inline struct thread_info *current_thread_info(void) | |||
102 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 102 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
103 | #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ | 103 | #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ |
104 | #define TIF_SINGLE_STEP 20 /* This task is single stepped */ | 104 | #define TIF_SINGLE_STEP 20 /* This task is single stepped */ |
105 | #define TIF_FREEZE 21 /* thread is freezing for suspend */ | ||
106 | 105 | ||
107 | #define _TIF_SYSCALL (1<<TIF_SYSCALL) | 106 | #define _TIF_SYSCALL (1<<TIF_SYSCALL) |
108 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 107 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
@@ -119,7 +118,6 @@ static inline struct thread_info *current_thread_info(void) | |||
119 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 118 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
120 | #define _TIF_31BIT (1<<TIF_31BIT) | 119 | #define _TIF_31BIT (1<<TIF_31BIT) |
121 | #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) | 120 | #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) |
122 | #define _TIF_FREEZE (1<<TIF_FREEZE) | ||
123 | 121 | ||
124 | #ifdef CONFIG_64BIT | 122 | #ifdef CONFIG_64BIT |
125 | #define is_32bit_task() (test_thread_flag(TIF_31BIT)) | 123 | #define is_32bit_task() (test_thread_flag(TIF_31BIT)) |
diff --git a/arch/s390/include/asm/types.h b/arch/s390/include/asm/types.h index eeb52ccf499f..05ebbcdbbf6b 100644 --- a/arch/s390/include/asm/types.h +++ b/arch/s390/include/asm/types.h | |||
@@ -13,8 +13,6 @@ | |||
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
15 | 15 | ||
16 | typedef unsigned short umode_t; | ||
17 | |||
18 | /* A address type so that arithmetic can be done on it & it can be upgraded to | 16 | /* A address type so that arithmetic can be done on it & it can be upgraded to |
19 | 64 bit when necessary | 17 | 64 bit when necessary |
20 | */ | 18 | */ |
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index 5ad6bc078bfd..6848828b962e 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c | |||
@@ -74,7 +74,7 @@ static ssize_t debug_input(struct file *file, const char __user *user_buf, | |||
74 | static int debug_open(struct inode *inode, struct file *file); | 74 | static int debug_open(struct inode *inode, struct file *file); |
75 | static int debug_close(struct inode *inode, struct file *file); | 75 | static int debug_close(struct inode *inode, struct file *file); |
76 | static debug_info_t *debug_info_create(const char *name, int pages_per_area, | 76 | static debug_info_t *debug_info_create(const char *name, int pages_per_area, |
77 | int nr_areas, int buf_size, mode_t mode); | 77 | int nr_areas, int buf_size, umode_t mode); |
78 | static void debug_info_get(debug_info_t *); | 78 | static void debug_info_get(debug_info_t *); |
79 | static void debug_info_put(debug_info_t *); | 79 | static void debug_info_put(debug_info_t *); |
80 | static int debug_prolog_level_fn(debug_info_t * id, | 80 | static int debug_prolog_level_fn(debug_info_t * id, |
@@ -330,7 +330,7 @@ debug_info_free(debug_info_t* db_info){ | |||
330 | 330 | ||
331 | static debug_info_t* | 331 | static debug_info_t* |
332 | debug_info_create(const char *name, int pages_per_area, int nr_areas, | 332 | debug_info_create(const char *name, int pages_per_area, int nr_areas, |
333 | int buf_size, mode_t mode) | 333 | int buf_size, umode_t mode) |
334 | { | 334 | { |
335 | debug_info_t* rc; | 335 | debug_info_t* rc; |
336 | 336 | ||
@@ -688,7 +688,7 @@ debug_close(struct inode *inode, struct file *file) | |||
688 | */ | 688 | */ |
689 | 689 | ||
690 | debug_info_t *debug_register_mode(const char *name, int pages_per_area, | 690 | debug_info_t *debug_register_mode(const char *name, int pages_per_area, |
691 | int nr_areas, int buf_size, mode_t mode, | 691 | int nr_areas, int buf_size, umode_t mode, |
692 | uid_t uid, gid_t gid) | 692 | uid_t uid, gid_t gid) |
693 | { | 693 | { |
694 | debug_info_t *rc = NULL; | 694 | debug_info_t *rc = NULL; |
@@ -1090,7 +1090,7 @@ debug_register_view(debug_info_t * id, struct debug_view *view) | |||
1090 | int rc = 0; | 1090 | int rc = 0; |
1091 | int i; | 1091 | int i; |
1092 | unsigned long flags; | 1092 | unsigned long flags; |
1093 | mode_t mode; | 1093 | umode_t mode; |
1094 | struct dentry *pde; | 1094 | struct dentry *pde; |
1095 | 1095 | ||
1096 | if (!id) | 1096 | if (!id) |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 9451b210a1b4..3201ae447990 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -91,10 +91,12 @@ static void default_idle(void) | |||
91 | void cpu_idle(void) | 91 | void cpu_idle(void) |
92 | { | 92 | { |
93 | for (;;) { | 93 | for (;;) { |
94 | tick_nohz_stop_sched_tick(1); | 94 | tick_nohz_idle_enter(); |
95 | rcu_idle_enter(); | ||
95 | while (!need_resched()) | 96 | while (!need_resched()) |
96 | default_idle(); | 97 | default_idle(); |
97 | tick_nohz_restart_sched_tick(); | 98 | rcu_idle_exit(); |
99 | tick_nohz_idle_exit(); | ||
98 | preempt_enable_no_resched(); | 100 | preempt_enable_no_resched(); |
99 | schedule(); | 101 | schedule(); |
100 | preempt_disable(); | 102 | preempt_disable(); |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 450931a45b68..573bc29551ef 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -296,13 +296,6 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
296 | ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) | 296 | ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) |
297 | /* Invalid psw mask. */ | 297 | /* Invalid psw mask. */ |
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | if (addr == (addr_t) &dummy->regs.psw.addr) | ||
300 | /* | ||
301 | * The debugger changed the instruction address, | ||
302 | * reset system call restart, see signal.c:do_signal | ||
303 | */ | ||
304 | task_thread_info(child)->system_call = 0; | ||
305 | |||
306 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; | 299 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; |
307 | 300 | ||
308 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { | 301 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { |
@@ -614,11 +607,6 @@ static int __poke_user_compat(struct task_struct *child, | |||
614 | /* Transfer 31 bit amode bit to psw mask. */ | 607 | /* Transfer 31 bit amode bit to psw mask. */ |
615 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | | 608 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | |
616 | (__u64)(tmp & PSW32_ADDR_AMODE); | 609 | (__u64)(tmp & PSW32_ADDR_AMODE); |
617 | /* | ||
618 | * The debugger changed the instruction address, | ||
619 | * reset system call restart, see signal.c:do_signal | ||
620 | */ | ||
621 | task_thread_info(child)->system_call = 0; | ||
622 | } else { | 610 | } else { |
623 | /* gpr 0-15 */ | 611 | /* gpr 0-15 */ |
624 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; | 612 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; |
@@ -905,6 +893,14 @@ static int s390_last_break_get(struct task_struct *target, | |||
905 | return 0; | 893 | return 0; |
906 | } | 894 | } |
907 | 895 | ||
896 | static int s390_last_break_set(struct task_struct *target, | ||
897 | const struct user_regset *regset, | ||
898 | unsigned int pos, unsigned int count, | ||
899 | const void *kbuf, const void __user *ubuf) | ||
900 | { | ||
901 | return 0; | ||
902 | } | ||
903 | |||
908 | #endif | 904 | #endif |
909 | 905 | ||
910 | static int s390_system_call_get(struct task_struct *target, | 906 | static int s390_system_call_get(struct task_struct *target, |
@@ -951,6 +947,7 @@ static const struct user_regset s390_regsets[] = { | |||
951 | .size = sizeof(long), | 947 | .size = sizeof(long), |
952 | .align = sizeof(long), | 948 | .align = sizeof(long), |
953 | .get = s390_last_break_get, | 949 | .get = s390_last_break_get, |
950 | .set = s390_last_break_set, | ||
954 | }, | 951 | }, |
955 | #endif | 952 | #endif |
956 | [REGSET_SYSTEM_CALL] = { | 953 | [REGSET_SYSTEM_CALL] = { |
@@ -1116,6 +1113,14 @@ static int s390_compat_last_break_get(struct task_struct *target, | |||
1116 | return 0; | 1113 | return 0; |
1117 | } | 1114 | } |
1118 | 1115 | ||
1116 | static int s390_compat_last_break_set(struct task_struct *target, | ||
1117 | const struct user_regset *regset, | ||
1118 | unsigned int pos, unsigned int count, | ||
1119 | const void *kbuf, const void __user *ubuf) | ||
1120 | { | ||
1121 | return 0; | ||
1122 | } | ||
1123 | |||
1119 | static const struct user_regset s390_compat_regsets[] = { | 1124 | static const struct user_regset s390_compat_regsets[] = { |
1120 | [REGSET_GENERAL] = { | 1125 | [REGSET_GENERAL] = { |
1121 | .core_note_type = NT_PRSTATUS, | 1126 | .core_note_type = NT_PRSTATUS, |
@@ -1139,6 +1144,7 @@ static const struct user_regset s390_compat_regsets[] = { | |||
1139 | .size = sizeof(long), | 1144 | .size = sizeof(long), |
1140 | .align = sizeof(long), | 1145 | .align = sizeof(long), |
1141 | .get = s390_compat_last_break_get, | 1146 | .get = s390_compat_last_break_get, |
1147 | .set = s390_compat_last_break_set, | ||
1142 | }, | 1148 | }, |
1143 | [REGSET_SYSTEM_CALL] = { | 1149 | [REGSET_SYSTEM_CALL] = { |
1144 | .core_note_type = NT_S390_SYSTEM_CALL, | 1150 | .core_note_type = NT_S390_SYSTEM_CALL, |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index e58a462949b1..f11d1b037c50 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/memblock.h> | ||
24 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
25 | #include <linux/stddef.h> | 26 | #include <linux/stddef.h> |
26 | #include <linux/unistd.h> | 27 | #include <linux/unistd.h> |
@@ -579,7 +580,7 @@ static unsigned long __init find_crash_base(unsigned long crash_size, | |||
579 | *msg = "first memory chunk must be at least crashkernel size"; | 580 | *msg = "first memory chunk must be at least crashkernel size"; |
580 | return 0; | 581 | return 0; |
581 | } | 582 | } |
582 | if (is_kdump_kernel() && (crash_size == OLDMEM_SIZE)) | 583 | if (OLDMEM_BASE && crash_size == OLDMEM_SIZE) |
583 | return OLDMEM_BASE; | 584 | return OLDMEM_BASE; |
584 | 585 | ||
585 | for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { | 586 | for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { |
@@ -820,7 +821,8 @@ setup_memory(void) | |||
820 | end_chunk = min(end_chunk, end_pfn); | 821 | end_chunk = min(end_chunk, end_pfn); |
821 | if (start_chunk >= end_chunk) | 822 | if (start_chunk >= end_chunk) |
822 | continue; | 823 | continue; |
823 | add_active_range(0, start_chunk, end_chunk); | 824 | memblock_add_node(PFN_PHYS(start_chunk), |
825 | PFN_PHYS(end_chunk - start_chunk), 0); | ||
824 | pfn = max(start_chunk, start_pfn); | 826 | pfn = max(start_chunk, start_pfn); |
825 | for (; pfn < end_chunk; pfn++) | 827 | for (; pfn < end_chunk; pfn++) |
826 | page_set_storage_key(PFN_PHYS(pfn), | 828 | page_set_storage_key(PFN_PHYS(pfn), |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 05a85bc14c98..7f6f9f354545 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -460,9 +460,9 @@ void do_signal(struct pt_regs *regs) | |||
460 | regs->svc_code >> 16); | 460 | regs->svc_code >> 16); |
461 | break; | 461 | break; |
462 | } | 462 | } |
463 | /* No longer in a system call */ | ||
464 | clear_thread_flag(TIF_SYSCALL); | ||
465 | } | 463 | } |
464 | /* No longer in a system call */ | ||
465 | clear_thread_flag(TIF_SYSCALL); | ||
466 | 466 | ||
467 | if ((is_compat_task() ? | 467 | if ((is_compat_task() ? |
468 | handle_signal32(signr, &ka, &info, oldset, regs) : | 468 | handle_signal32(signr, &ka, &info, oldset, regs) : |
@@ -486,6 +486,7 @@ void do_signal(struct pt_regs *regs) | |||
486 | } | 486 | } |
487 | 487 | ||
488 | /* No handlers present - check for system call restart */ | 488 | /* No handlers present - check for system call restart */ |
489 | clear_thread_flag(TIF_SYSCALL); | ||
489 | if (current_thread_info()->system_call) { | 490 | if (current_thread_info()->system_call) { |
490 | regs->svc_code = current_thread_info()->system_call; | 491 | regs->svc_code = current_thread_info()->system_call; |
491 | switch (regs->gprs[2]) { | 492 | switch (regs->gprs[2]) { |
@@ -500,9 +501,6 @@ void do_signal(struct pt_regs *regs) | |||
500 | regs->gprs[2] = regs->orig_gpr2; | 501 | regs->gprs[2] = regs->orig_gpr2; |
501 | set_thread_flag(TIF_SYSCALL); | 502 | set_thread_flag(TIF_SYSCALL); |
502 | break; | 503 | break; |
503 | default: | ||
504 | clear_thread_flag(TIF_SYSCALL); | ||
505 | break; | ||
506 | } | 504 | } |
507 | } | 505 | } |
508 | 506 | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 3ea872890da2..66cca03c0282 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -831,8 +831,8 @@ int setup_profiling_timer(unsigned int multiplier) | |||
831 | } | 831 | } |
832 | 832 | ||
833 | #ifdef CONFIG_HOTPLUG_CPU | 833 | #ifdef CONFIG_HOTPLUG_CPU |
834 | static ssize_t cpu_configure_show(struct sys_device *dev, | 834 | static ssize_t cpu_configure_show(struct device *dev, |
835 | struct sysdev_attribute *attr, char *buf) | 835 | struct device_attribute *attr, char *buf) |
836 | { | 836 | { |
837 | ssize_t count; | 837 | ssize_t count; |
838 | 838 | ||
@@ -842,8 +842,8 @@ static ssize_t cpu_configure_show(struct sys_device *dev, | |||
842 | return count; | 842 | return count; |
843 | } | 843 | } |
844 | 844 | ||
845 | static ssize_t cpu_configure_store(struct sys_device *dev, | 845 | static ssize_t cpu_configure_store(struct device *dev, |
846 | struct sysdev_attribute *attr, | 846 | struct device_attribute *attr, |
847 | const char *buf, size_t count) | 847 | const char *buf, size_t count) |
848 | { | 848 | { |
849 | int cpu = dev->id; | 849 | int cpu = dev->id; |
@@ -889,11 +889,11 @@ out: | |||
889 | put_online_cpus(); | 889 | put_online_cpus(); |
890 | return rc ? rc : count; | 890 | return rc ? rc : count; |
891 | } | 891 | } |
892 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); | 892 | static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); |
893 | #endif /* CONFIG_HOTPLUG_CPU */ | 893 | #endif /* CONFIG_HOTPLUG_CPU */ |
894 | 894 | ||
895 | static ssize_t cpu_polarization_show(struct sys_device *dev, | 895 | static ssize_t cpu_polarization_show(struct device *dev, |
896 | struct sysdev_attribute *attr, char *buf) | 896 | struct device_attribute *attr, char *buf) |
897 | { | 897 | { |
898 | int cpu = dev->id; | 898 | int cpu = dev->id; |
899 | ssize_t count; | 899 | ssize_t count; |
@@ -919,22 +919,22 @@ static ssize_t cpu_polarization_show(struct sys_device *dev, | |||
919 | mutex_unlock(&smp_cpu_state_mutex); | 919 | mutex_unlock(&smp_cpu_state_mutex); |
920 | return count; | 920 | return count; |
921 | } | 921 | } |
922 | static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); | 922 | static DEVICE_ATTR(polarization, 0444, cpu_polarization_show, NULL); |
923 | 923 | ||
924 | static ssize_t show_cpu_address(struct sys_device *dev, | 924 | static ssize_t show_cpu_address(struct device *dev, |
925 | struct sysdev_attribute *attr, char *buf) | 925 | struct device_attribute *attr, char *buf) |
926 | { | 926 | { |
927 | return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); | 927 | return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); |
928 | } | 928 | } |
929 | static SYSDEV_ATTR(address, 0444, show_cpu_address, NULL); | 929 | static DEVICE_ATTR(address, 0444, show_cpu_address, NULL); |
930 | 930 | ||
931 | 931 | ||
932 | static struct attribute *cpu_common_attrs[] = { | 932 | static struct attribute *cpu_common_attrs[] = { |
933 | #ifdef CONFIG_HOTPLUG_CPU | 933 | #ifdef CONFIG_HOTPLUG_CPU |
934 | &attr_configure.attr, | 934 | &dev_attr_configure.attr, |
935 | #endif | 935 | #endif |
936 | &attr_address.attr, | 936 | &dev_attr_address.attr, |
937 | &attr_polarization.attr, | 937 | &dev_attr_polarization.attr, |
938 | NULL, | 938 | NULL, |
939 | }; | 939 | }; |
940 | 940 | ||
@@ -942,8 +942,8 @@ static struct attribute_group cpu_common_attr_group = { | |||
942 | .attrs = cpu_common_attrs, | 942 | .attrs = cpu_common_attrs, |
943 | }; | 943 | }; |
944 | 944 | ||
945 | static ssize_t show_capability(struct sys_device *dev, | 945 | static ssize_t show_capability(struct device *dev, |
946 | struct sysdev_attribute *attr, char *buf) | 946 | struct device_attribute *attr, char *buf) |
947 | { | 947 | { |
948 | unsigned int capability; | 948 | unsigned int capability; |
949 | int rc; | 949 | int rc; |
@@ -953,10 +953,10 @@ static ssize_t show_capability(struct sys_device *dev, | |||
953 | return rc; | 953 | return rc; |
954 | return sprintf(buf, "%u\n", capability); | 954 | return sprintf(buf, "%u\n", capability); |
955 | } | 955 | } |
956 | static SYSDEV_ATTR(capability, 0444, show_capability, NULL); | 956 | static DEVICE_ATTR(capability, 0444, show_capability, NULL); |
957 | 957 | ||
958 | static ssize_t show_idle_count(struct sys_device *dev, | 958 | static ssize_t show_idle_count(struct device *dev, |
959 | struct sysdev_attribute *attr, char *buf) | 959 | struct device_attribute *attr, char *buf) |
960 | { | 960 | { |
961 | struct s390_idle_data *idle; | 961 | struct s390_idle_data *idle; |
962 | unsigned long long idle_count; | 962 | unsigned long long idle_count; |
@@ -976,10 +976,10 @@ repeat: | |||
976 | goto repeat; | 976 | goto repeat; |
977 | return sprintf(buf, "%llu\n", idle_count); | 977 | return sprintf(buf, "%llu\n", idle_count); |
978 | } | 978 | } |
979 | static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); | 979 | static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); |
980 | 980 | ||
981 | static ssize_t show_idle_time(struct sys_device *dev, | 981 | static ssize_t show_idle_time(struct device *dev, |
982 | struct sysdev_attribute *attr, char *buf) | 982 | struct device_attribute *attr, char *buf) |
983 | { | 983 | { |
984 | struct s390_idle_data *idle; | 984 | struct s390_idle_data *idle; |
985 | unsigned long long now, idle_time, idle_enter; | 985 | unsigned long long now, idle_time, idle_enter; |
@@ -1001,12 +1001,12 @@ repeat: | |||
1001 | goto repeat; | 1001 | goto repeat; |
1002 | return sprintf(buf, "%llu\n", idle_time >> 12); | 1002 | return sprintf(buf, "%llu\n", idle_time >> 12); |
1003 | } | 1003 | } |
1004 | static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); | 1004 | static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL); |
1005 | 1005 | ||
1006 | static struct attribute *cpu_online_attrs[] = { | 1006 | static struct attribute *cpu_online_attrs[] = { |
1007 | &attr_capability.attr, | 1007 | &dev_attr_capability.attr, |
1008 | &attr_idle_count.attr, | 1008 | &dev_attr_idle_count.attr, |
1009 | &attr_idle_time_us.attr, | 1009 | &dev_attr_idle_time_us.attr, |
1010 | NULL, | 1010 | NULL, |
1011 | }; | 1011 | }; |
1012 | 1012 | ||
@@ -1019,7 +1019,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self, | |||
1019 | { | 1019 | { |
1020 | unsigned int cpu = (unsigned int)(long)hcpu; | 1020 | unsigned int cpu = (unsigned int)(long)hcpu; |
1021 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 1021 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
1022 | struct sys_device *s = &c->sysdev; | 1022 | struct device *s = &c->dev; |
1023 | struct s390_idle_data *idle; | 1023 | struct s390_idle_data *idle; |
1024 | int err = 0; | 1024 | int err = 0; |
1025 | 1025 | ||
@@ -1045,7 +1045,7 @@ static struct notifier_block __cpuinitdata smp_cpu_nb = { | |||
1045 | static int __devinit smp_add_present_cpu(int cpu) | 1045 | static int __devinit smp_add_present_cpu(int cpu) |
1046 | { | 1046 | { |
1047 | struct cpu *c = &per_cpu(cpu_devices, cpu); | 1047 | struct cpu *c = &per_cpu(cpu_devices, cpu); |
1048 | struct sys_device *s = &c->sysdev; | 1048 | struct device *s = &c->dev; |
1049 | int rc; | 1049 | int rc; |
1050 | 1050 | ||
1051 | c->hotpluggable = 1; | 1051 | c->hotpluggable = 1; |
@@ -1098,8 +1098,8 @@ out: | |||
1098 | return rc; | 1098 | return rc; |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | static ssize_t __ref rescan_store(struct sysdev_class *class, | 1101 | static ssize_t __ref rescan_store(struct device *dev, |
1102 | struct sysdev_class_attribute *attr, | 1102 | struct device_attribute *attr, |
1103 | const char *buf, | 1103 | const char *buf, |
1104 | size_t count) | 1104 | size_t count) |
1105 | { | 1105 | { |
@@ -1108,11 +1108,11 @@ static ssize_t __ref rescan_store(struct sysdev_class *class, | |||
1108 | rc = smp_rescan_cpus(); | 1108 | rc = smp_rescan_cpus(); |
1109 | return rc ? rc : count; | 1109 | return rc ? rc : count; |
1110 | } | 1110 | } |
1111 | static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); | 1111 | static DEVICE_ATTR(rescan, 0200, NULL, rescan_store); |
1112 | #endif /* CONFIG_HOTPLUG_CPU */ | 1112 | #endif /* CONFIG_HOTPLUG_CPU */ |
1113 | 1113 | ||
1114 | static ssize_t dispatching_show(struct sysdev_class *class, | 1114 | static ssize_t dispatching_show(struct device *dev, |
1115 | struct sysdev_class_attribute *attr, | 1115 | struct device_attribute *attr, |
1116 | char *buf) | 1116 | char *buf) |
1117 | { | 1117 | { |
1118 | ssize_t count; | 1118 | ssize_t count; |
@@ -1123,8 +1123,8 @@ static ssize_t dispatching_show(struct sysdev_class *class, | |||
1123 | return count; | 1123 | return count; |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | static ssize_t dispatching_store(struct sysdev_class *dev, | 1126 | static ssize_t dispatching_store(struct device *dev, |
1127 | struct sysdev_class_attribute *attr, | 1127 | struct device_attribute *attr, |
1128 | const char *buf, | 1128 | const char *buf, |
1129 | size_t count) | 1129 | size_t count) |
1130 | { | 1130 | { |
@@ -1148,7 +1148,7 @@ out: | |||
1148 | put_online_cpus(); | 1148 | put_online_cpus(); |
1149 | return rc ? rc : count; | 1149 | return rc ? rc : count; |
1150 | } | 1150 | } |
1151 | static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, | 1151 | static DEVICE_ATTR(dispatching, 0644, dispatching_show, |
1152 | dispatching_store); | 1152 | dispatching_store); |
1153 | 1153 | ||
1154 | static int __init topology_init(void) | 1154 | static int __init topology_init(void) |
@@ -1159,11 +1159,11 @@ static int __init topology_init(void) | |||
1159 | register_cpu_notifier(&smp_cpu_nb); | 1159 | register_cpu_notifier(&smp_cpu_nb); |
1160 | 1160 | ||
1161 | #ifdef CONFIG_HOTPLUG_CPU | 1161 | #ifdef CONFIG_HOTPLUG_CPU |
1162 | rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan); | 1162 | rc = device_create_file(cpu_subsys.dev_root, &dev_attr_rescan); |
1163 | if (rc) | 1163 | if (rc) |
1164 | return rc; | 1164 | return rc; |
1165 | #endif | 1165 | #endif |
1166 | rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching); | 1166 | rc = device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching); |
1167 | if (rc) | 1167 | if (rc) |
1168 | return rc; | 1168 | return rc; |
1169 | for_each_present_cpu(cpu) { | 1169 | for_each_present_cpu(cpu) { |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index ebbfab3c6e5a..fa02f443f5f6 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/cpu.h> | 27 | #include <linux/cpu.h> |
28 | #include <linux/stop_machine.h> | 28 | #include <linux/stop_machine.h> |
29 | #include <linux/time.h> | 29 | #include <linux/time.h> |
30 | #include <linux/sysdev.h> | 30 | #include <linux/device.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/smp.h> | 33 | #include <linux/smp.h> |
@@ -1116,34 +1116,35 @@ out_unlock: | |||
1116 | /* | 1116 | /* |
1117 | * Sysfs interface functions | 1117 | * Sysfs interface functions |
1118 | */ | 1118 | */ |
1119 | static struct sysdev_class etr_sysclass = { | 1119 | static struct bus_type etr_subsys = { |
1120 | .name = "etr", | 1120 | .name = "etr", |
1121 | .dev_name = "etr", | ||
1121 | }; | 1122 | }; |
1122 | 1123 | ||
1123 | static struct sys_device etr_port0_dev = { | 1124 | static struct device etr_port0_dev = { |
1124 | .id = 0, | 1125 | .id = 0, |
1125 | .cls = &etr_sysclass, | 1126 | .bus = &etr_subsys, |
1126 | }; | 1127 | }; |
1127 | 1128 | ||
1128 | static struct sys_device etr_port1_dev = { | 1129 | static struct device etr_port1_dev = { |
1129 | .id = 1, | 1130 | .id = 1, |
1130 | .cls = &etr_sysclass, | 1131 | .bus = &etr_subsys, |
1131 | }; | 1132 | }; |
1132 | 1133 | ||
1133 | /* | 1134 | /* |
1134 | * ETR class attributes | 1135 | * ETR subsys attributes |
1135 | */ | 1136 | */ |
1136 | static ssize_t etr_stepping_port_show(struct sysdev_class *class, | 1137 | static ssize_t etr_stepping_port_show(struct device *dev, |
1137 | struct sysdev_class_attribute *attr, | 1138 | struct device_attribute *attr, |
1138 | char *buf) | 1139 | char *buf) |
1139 | { | 1140 | { |
1140 | return sprintf(buf, "%i\n", etr_port0.esw.p); | 1141 | return sprintf(buf, "%i\n", etr_port0.esw.p); |
1141 | } | 1142 | } |
1142 | 1143 | ||
1143 | static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); | 1144 | static DEVICE_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); |
1144 | 1145 | ||
1145 | static ssize_t etr_stepping_mode_show(struct sysdev_class *class, | 1146 | static ssize_t etr_stepping_mode_show(struct device *dev, |
1146 | struct sysdev_class_attribute *attr, | 1147 | struct device_attribute *attr, |
1147 | char *buf) | 1148 | char *buf) |
1148 | { | 1149 | { |
1149 | char *mode_str; | 1150 | char *mode_str; |
@@ -1157,12 +1158,12 @@ static ssize_t etr_stepping_mode_show(struct sysdev_class *class, | |||
1157 | return sprintf(buf, "%s\n", mode_str); | 1158 | return sprintf(buf, "%s\n", mode_str); |
1158 | } | 1159 | } |
1159 | 1160 | ||
1160 | static SYSDEV_CLASS_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL); | 1161 | static DEVICE_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL); |
1161 | 1162 | ||
1162 | /* | 1163 | /* |
1163 | * ETR port attributes | 1164 | * ETR port attributes |
1164 | */ | 1165 | */ |
1165 | static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) | 1166 | static inline struct etr_aib *etr_aib_from_dev(struct device *dev) |
1166 | { | 1167 | { |
1167 | if (dev == &etr_port0_dev) | 1168 | if (dev == &etr_port0_dev) |
1168 | return etr_port0_online ? &etr_port0 : NULL; | 1169 | return etr_port0_online ? &etr_port0 : NULL; |
@@ -1170,8 +1171,8 @@ static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) | |||
1170 | return etr_port1_online ? &etr_port1 : NULL; | 1171 | return etr_port1_online ? &etr_port1 : NULL; |
1171 | } | 1172 | } |
1172 | 1173 | ||
1173 | static ssize_t etr_online_show(struct sys_device *dev, | 1174 | static ssize_t etr_online_show(struct device *dev, |
1174 | struct sysdev_attribute *attr, | 1175 | struct device_attribute *attr, |
1175 | char *buf) | 1176 | char *buf) |
1176 | { | 1177 | { |
1177 | unsigned int online; | 1178 | unsigned int online; |
@@ -1180,8 +1181,8 @@ static ssize_t etr_online_show(struct sys_device *dev, | |||
1180 | return sprintf(buf, "%i\n", online); | 1181 | return sprintf(buf, "%i\n", online); |
1181 | } | 1182 | } |
1182 | 1183 | ||
1183 | static ssize_t etr_online_store(struct sys_device *dev, | 1184 | static ssize_t etr_online_store(struct device *dev, |
1184 | struct sysdev_attribute *attr, | 1185 | struct device_attribute *attr, |
1185 | const char *buf, size_t count) | 1186 | const char *buf, size_t count) |
1186 | { | 1187 | { |
1187 | unsigned int value; | 1188 | unsigned int value; |
@@ -1218,20 +1219,20 @@ out: | |||
1218 | return count; | 1219 | return count; |
1219 | } | 1220 | } |
1220 | 1221 | ||
1221 | static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); | 1222 | static DEVICE_ATTR(online, 0600, etr_online_show, etr_online_store); |
1222 | 1223 | ||
1223 | static ssize_t etr_stepping_control_show(struct sys_device *dev, | 1224 | static ssize_t etr_stepping_control_show(struct device *dev, |
1224 | struct sysdev_attribute *attr, | 1225 | struct device_attribute *attr, |
1225 | char *buf) | 1226 | char *buf) |
1226 | { | 1227 | { |
1227 | return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? | 1228 | return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? |
1228 | etr_eacr.e0 : etr_eacr.e1); | 1229 | etr_eacr.e0 : etr_eacr.e1); |
1229 | } | 1230 | } |
1230 | 1231 | ||
1231 | static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); | 1232 | static DEVICE_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); |
1232 | 1233 | ||
1233 | static ssize_t etr_mode_code_show(struct sys_device *dev, | 1234 | static ssize_t etr_mode_code_show(struct device *dev, |
1234 | struct sysdev_attribute *attr, char *buf) | 1235 | struct device_attribute *attr, char *buf) |
1235 | { | 1236 | { |
1236 | if (!etr_port0_online && !etr_port1_online) | 1237 | if (!etr_port0_online && !etr_port1_online) |
1237 | /* Status word is not uptodate if both ports are offline. */ | 1238 | /* Status word is not uptodate if both ports are offline. */ |
@@ -1240,10 +1241,10 @@ static ssize_t etr_mode_code_show(struct sys_device *dev, | |||
1240 | etr_port0.esw.psc0 : etr_port0.esw.psc1); | 1241 | etr_port0.esw.psc0 : etr_port0.esw.psc1); |
1241 | } | 1242 | } |
1242 | 1243 | ||
1243 | static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); | 1244 | static DEVICE_ATTR(state_code, 0400, etr_mode_code_show, NULL); |
1244 | 1245 | ||
1245 | static ssize_t etr_untuned_show(struct sys_device *dev, | 1246 | static ssize_t etr_untuned_show(struct device *dev, |
1246 | struct sysdev_attribute *attr, char *buf) | 1247 | struct device_attribute *attr, char *buf) |
1247 | { | 1248 | { |
1248 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1249 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1249 | 1250 | ||
@@ -1252,10 +1253,10 @@ static ssize_t etr_untuned_show(struct sys_device *dev, | |||
1252 | return sprintf(buf, "%i\n", aib->edf1.u); | 1253 | return sprintf(buf, "%i\n", aib->edf1.u); |
1253 | } | 1254 | } |
1254 | 1255 | ||
1255 | static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); | 1256 | static DEVICE_ATTR(untuned, 0400, etr_untuned_show, NULL); |
1256 | 1257 | ||
1257 | static ssize_t etr_network_id_show(struct sys_device *dev, | 1258 | static ssize_t etr_network_id_show(struct device *dev, |
1258 | struct sysdev_attribute *attr, char *buf) | 1259 | struct device_attribute *attr, char *buf) |
1259 | { | 1260 | { |
1260 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1261 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1261 | 1262 | ||
@@ -1264,10 +1265,10 @@ static ssize_t etr_network_id_show(struct sys_device *dev, | |||
1264 | return sprintf(buf, "%i\n", aib->edf1.net_id); | 1265 | return sprintf(buf, "%i\n", aib->edf1.net_id); |
1265 | } | 1266 | } |
1266 | 1267 | ||
1267 | static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); | 1268 | static DEVICE_ATTR(network, 0400, etr_network_id_show, NULL); |
1268 | 1269 | ||
1269 | static ssize_t etr_id_show(struct sys_device *dev, | 1270 | static ssize_t etr_id_show(struct device *dev, |
1270 | struct sysdev_attribute *attr, char *buf) | 1271 | struct device_attribute *attr, char *buf) |
1271 | { | 1272 | { |
1272 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1273 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1273 | 1274 | ||
@@ -1276,10 +1277,10 @@ static ssize_t etr_id_show(struct sys_device *dev, | |||
1276 | return sprintf(buf, "%i\n", aib->edf1.etr_id); | 1277 | return sprintf(buf, "%i\n", aib->edf1.etr_id); |
1277 | } | 1278 | } |
1278 | 1279 | ||
1279 | static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); | 1280 | static DEVICE_ATTR(id, 0400, etr_id_show, NULL); |
1280 | 1281 | ||
1281 | static ssize_t etr_port_number_show(struct sys_device *dev, | 1282 | static ssize_t etr_port_number_show(struct device *dev, |
1282 | struct sysdev_attribute *attr, char *buf) | 1283 | struct device_attribute *attr, char *buf) |
1283 | { | 1284 | { |
1284 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1285 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1285 | 1286 | ||
@@ -1288,10 +1289,10 @@ static ssize_t etr_port_number_show(struct sys_device *dev, | |||
1288 | return sprintf(buf, "%i\n", aib->edf1.etr_pn); | 1289 | return sprintf(buf, "%i\n", aib->edf1.etr_pn); |
1289 | } | 1290 | } |
1290 | 1291 | ||
1291 | static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); | 1292 | static DEVICE_ATTR(port, 0400, etr_port_number_show, NULL); |
1292 | 1293 | ||
1293 | static ssize_t etr_coupled_show(struct sys_device *dev, | 1294 | static ssize_t etr_coupled_show(struct device *dev, |
1294 | struct sysdev_attribute *attr, char *buf) | 1295 | struct device_attribute *attr, char *buf) |
1295 | { | 1296 | { |
1296 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1297 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1297 | 1298 | ||
@@ -1300,10 +1301,10 @@ static ssize_t etr_coupled_show(struct sys_device *dev, | |||
1300 | return sprintf(buf, "%i\n", aib->edf3.c); | 1301 | return sprintf(buf, "%i\n", aib->edf3.c); |
1301 | } | 1302 | } |
1302 | 1303 | ||
1303 | static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); | 1304 | static DEVICE_ATTR(coupled, 0400, etr_coupled_show, NULL); |
1304 | 1305 | ||
1305 | static ssize_t etr_local_time_show(struct sys_device *dev, | 1306 | static ssize_t etr_local_time_show(struct device *dev, |
1306 | struct sysdev_attribute *attr, char *buf) | 1307 | struct device_attribute *attr, char *buf) |
1307 | { | 1308 | { |
1308 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1309 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1309 | 1310 | ||
@@ -1312,10 +1313,10 @@ static ssize_t etr_local_time_show(struct sys_device *dev, | |||
1312 | return sprintf(buf, "%i\n", aib->edf3.blto); | 1313 | return sprintf(buf, "%i\n", aib->edf3.blto); |
1313 | } | 1314 | } |
1314 | 1315 | ||
1315 | static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); | 1316 | static DEVICE_ATTR(local_time, 0400, etr_local_time_show, NULL); |
1316 | 1317 | ||
1317 | static ssize_t etr_utc_offset_show(struct sys_device *dev, | 1318 | static ssize_t etr_utc_offset_show(struct device *dev, |
1318 | struct sysdev_attribute *attr, char *buf) | 1319 | struct device_attribute *attr, char *buf) |
1319 | { | 1320 | { |
1320 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1321 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1321 | 1322 | ||
@@ -1324,64 +1325,64 @@ static ssize_t etr_utc_offset_show(struct sys_device *dev, | |||
1324 | return sprintf(buf, "%i\n", aib->edf3.buo); | 1325 | return sprintf(buf, "%i\n", aib->edf3.buo); |
1325 | } | 1326 | } |
1326 | 1327 | ||
1327 | static SYSDEV_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL); | 1328 | static DEVICE_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL); |
1328 | 1329 | ||
1329 | static struct sysdev_attribute *etr_port_attributes[] = { | 1330 | static struct device_attribute *etr_port_attributes[] = { |
1330 | &attr_online, | 1331 | &dev_attr_online, |
1331 | &attr_stepping_control, | 1332 | &dev_attr_stepping_control, |
1332 | &attr_state_code, | 1333 | &dev_attr_state_code, |
1333 | &attr_untuned, | 1334 | &dev_attr_untuned, |
1334 | &attr_network, | 1335 | &dev_attr_network, |
1335 | &attr_id, | 1336 | &dev_attr_id, |
1336 | &attr_port, | 1337 | &dev_attr_port, |
1337 | &attr_coupled, | 1338 | &dev_attr_coupled, |
1338 | &attr_local_time, | 1339 | &dev_attr_local_time, |
1339 | &attr_utc_offset, | 1340 | &dev_attr_utc_offset, |
1340 | NULL | 1341 | NULL |
1341 | }; | 1342 | }; |
1342 | 1343 | ||
1343 | static int __init etr_register_port(struct sys_device *dev) | 1344 | static int __init etr_register_port(struct device *dev) |
1344 | { | 1345 | { |
1345 | struct sysdev_attribute **attr; | 1346 | struct device_attribute **attr; |
1346 | int rc; | 1347 | int rc; |
1347 | 1348 | ||
1348 | rc = sysdev_register(dev); | 1349 | rc = device_register(dev); |
1349 | if (rc) | 1350 | if (rc) |
1350 | goto out; | 1351 | goto out; |
1351 | for (attr = etr_port_attributes; *attr; attr++) { | 1352 | for (attr = etr_port_attributes; *attr; attr++) { |
1352 | rc = sysdev_create_file(dev, *attr); | 1353 | rc = device_create_file(dev, *attr); |
1353 | if (rc) | 1354 | if (rc) |
1354 | goto out_unreg; | 1355 | goto out_unreg; |
1355 | } | 1356 | } |
1356 | return 0; | 1357 | return 0; |
1357 | out_unreg: | 1358 | out_unreg: |
1358 | for (; attr >= etr_port_attributes; attr--) | 1359 | for (; attr >= etr_port_attributes; attr--) |
1359 | sysdev_remove_file(dev, *attr); | 1360 | device_remove_file(dev, *attr); |
1360 | sysdev_unregister(dev); | 1361 | device_unregister(dev); |
1361 | out: | 1362 | out: |
1362 | return rc; | 1363 | return rc; |
1363 | } | 1364 | } |
1364 | 1365 | ||
1365 | static void __init etr_unregister_port(struct sys_device *dev) | 1366 | static void __init etr_unregister_port(struct device *dev) |
1366 | { | 1367 | { |
1367 | struct sysdev_attribute **attr; | 1368 | struct device_attribute **attr; |
1368 | 1369 | ||
1369 | for (attr = etr_port_attributes; *attr; attr++) | 1370 | for (attr = etr_port_attributes; *attr; attr++) |
1370 | sysdev_remove_file(dev, *attr); | 1371 | device_remove_file(dev, *attr); |
1371 | sysdev_unregister(dev); | 1372 | device_unregister(dev); |
1372 | } | 1373 | } |
1373 | 1374 | ||
1374 | static int __init etr_init_sysfs(void) | 1375 | static int __init etr_init_sysfs(void) |
1375 | { | 1376 | { |
1376 | int rc; | 1377 | int rc; |
1377 | 1378 | ||
1378 | rc = sysdev_class_register(&etr_sysclass); | 1379 | rc = subsys_system_register(&etr_subsys, NULL); |
1379 | if (rc) | 1380 | if (rc) |
1380 | goto out; | 1381 | goto out; |
1381 | rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_port); | 1382 | rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_port); |
1382 | if (rc) | 1383 | if (rc) |
1383 | goto out_unreg_class; | 1384 | goto out_unreg_subsys; |
1384 | rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_mode); | 1385 | rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_mode); |
1385 | if (rc) | 1386 | if (rc) |
1386 | goto out_remove_stepping_port; | 1387 | goto out_remove_stepping_port; |
1387 | rc = etr_register_port(&etr_port0_dev); | 1388 | rc = etr_register_port(&etr_port0_dev); |
@@ -1395,11 +1396,11 @@ static int __init etr_init_sysfs(void) | |||
1395 | out_remove_port0: | 1396 | out_remove_port0: |
1396 | etr_unregister_port(&etr_port0_dev); | 1397 | etr_unregister_port(&etr_port0_dev); |
1397 | out_remove_stepping_mode: | 1398 | out_remove_stepping_mode: |
1398 | sysdev_class_remove_file(&etr_sysclass, &attr_stepping_mode); | 1399 | device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_mode); |
1399 | out_remove_stepping_port: | 1400 | out_remove_stepping_port: |
1400 | sysdev_class_remove_file(&etr_sysclass, &attr_stepping_port); | 1401 | device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_port); |
1401 | out_unreg_class: | 1402 | out_unreg_subsys: |
1402 | sysdev_class_unregister(&etr_sysclass); | 1403 | bus_unregister(&etr_subsys); |
1403 | out: | 1404 | out: |
1404 | return rc; | 1405 | return rc; |
1405 | } | 1406 | } |
@@ -1599,14 +1600,15 @@ out_unlock: | |||
1599 | } | 1600 | } |
1600 | 1601 | ||
1601 | /* | 1602 | /* |
1602 | * STP class sysfs interface functions | 1603 | * STP subsys sysfs interface functions |
1603 | */ | 1604 | */ |
1604 | static struct sysdev_class stp_sysclass = { | 1605 | static struct bus_type stp_subsys = { |
1605 | .name = "stp", | 1606 | .name = "stp", |
1607 | .dev_name = "stp", | ||
1606 | }; | 1608 | }; |
1607 | 1609 | ||
1608 | static ssize_t stp_ctn_id_show(struct sysdev_class *class, | 1610 | static ssize_t stp_ctn_id_show(struct device *dev, |
1609 | struct sysdev_class_attribute *attr, | 1611 | struct device_attribute *attr, |
1610 | char *buf) | 1612 | char *buf) |
1611 | { | 1613 | { |
1612 | if (!stp_online) | 1614 | if (!stp_online) |
@@ -1615,10 +1617,10 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class, | |||
1615 | *(unsigned long long *) stp_info.ctnid); | 1617 | *(unsigned long long *) stp_info.ctnid); |
1616 | } | 1618 | } |
1617 | 1619 | ||
1618 | static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); | 1620 | static DEVICE_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); |
1619 | 1621 | ||
1620 | static ssize_t stp_ctn_type_show(struct sysdev_class *class, | 1622 | static ssize_t stp_ctn_type_show(struct device *dev, |
1621 | struct sysdev_class_attribute *attr, | 1623 | struct device_attribute *attr, |
1622 | char *buf) | 1624 | char *buf) |
1623 | { | 1625 | { |
1624 | if (!stp_online) | 1626 | if (!stp_online) |
@@ -1626,10 +1628,10 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class, | |||
1626 | return sprintf(buf, "%i\n", stp_info.ctn); | 1628 | return sprintf(buf, "%i\n", stp_info.ctn); |
1627 | } | 1629 | } |
1628 | 1630 | ||
1629 | static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); | 1631 | static DEVICE_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); |
1630 | 1632 | ||
1631 | static ssize_t stp_dst_offset_show(struct sysdev_class *class, | 1633 | static ssize_t stp_dst_offset_show(struct device *dev, |
1632 | struct sysdev_class_attribute *attr, | 1634 | struct device_attribute *attr, |
1633 | char *buf) | 1635 | char *buf) |
1634 | { | 1636 | { |
1635 | if (!stp_online || !(stp_info.vbits & 0x2000)) | 1637 | if (!stp_online || !(stp_info.vbits & 0x2000)) |
@@ -1637,10 +1639,10 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class, | |||
1637 | return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto); | 1639 | return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto); |
1638 | } | 1640 | } |
1639 | 1641 | ||
1640 | static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); | 1642 | static DEVICE_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); |
1641 | 1643 | ||
1642 | static ssize_t stp_leap_seconds_show(struct sysdev_class *class, | 1644 | static ssize_t stp_leap_seconds_show(struct device *dev, |
1643 | struct sysdev_class_attribute *attr, | 1645 | struct device_attribute *attr, |
1644 | char *buf) | 1646 | char *buf) |
1645 | { | 1647 | { |
1646 | if (!stp_online || !(stp_info.vbits & 0x8000)) | 1648 | if (!stp_online || !(stp_info.vbits & 0x8000)) |
@@ -1648,10 +1650,10 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class, | |||
1648 | return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps); | 1650 | return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps); |
1649 | } | 1651 | } |
1650 | 1652 | ||
1651 | static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); | 1653 | static DEVICE_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); |
1652 | 1654 | ||
1653 | static ssize_t stp_stratum_show(struct sysdev_class *class, | 1655 | static ssize_t stp_stratum_show(struct device *dev, |
1654 | struct sysdev_class_attribute *attr, | 1656 | struct device_attribute *attr, |
1655 | char *buf) | 1657 | char *buf) |
1656 | { | 1658 | { |
1657 | if (!stp_online) | 1659 | if (!stp_online) |
@@ -1659,10 +1661,10 @@ static ssize_t stp_stratum_show(struct sysdev_class *class, | |||
1659 | return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum); | 1661 | return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum); |
1660 | } | 1662 | } |
1661 | 1663 | ||
1662 | static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); | 1664 | static DEVICE_ATTR(stratum, 0400, stp_stratum_show, NULL); |
1663 | 1665 | ||
1664 | static ssize_t stp_time_offset_show(struct sysdev_class *class, | 1666 | static ssize_t stp_time_offset_show(struct device *dev, |
1665 | struct sysdev_class_attribute *attr, | 1667 | struct device_attribute *attr, |
1666 | char *buf) | 1668 | char *buf) |
1667 | { | 1669 | { |
1668 | if (!stp_online || !(stp_info.vbits & 0x0800)) | 1670 | if (!stp_online || !(stp_info.vbits & 0x0800)) |
@@ -1670,10 +1672,10 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class, | |||
1670 | return sprintf(buf, "%i\n", (int) stp_info.tto); | 1672 | return sprintf(buf, "%i\n", (int) stp_info.tto); |
1671 | } | 1673 | } |
1672 | 1674 | ||
1673 | static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); | 1675 | static DEVICE_ATTR(time_offset, 0400, stp_time_offset_show, NULL); |
1674 | 1676 | ||
1675 | static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, | 1677 | static ssize_t stp_time_zone_offset_show(struct device *dev, |
1676 | struct sysdev_class_attribute *attr, | 1678 | struct device_attribute *attr, |
1677 | char *buf) | 1679 | char *buf) |
1678 | { | 1680 | { |
1679 | if (!stp_online || !(stp_info.vbits & 0x4000)) | 1681 | if (!stp_online || !(stp_info.vbits & 0x4000)) |
@@ -1681,11 +1683,11 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, | |||
1681 | return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo); | 1683 | return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo); |
1682 | } | 1684 | } |
1683 | 1685 | ||
1684 | static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, | 1686 | static DEVICE_ATTR(time_zone_offset, 0400, |
1685 | stp_time_zone_offset_show, NULL); | 1687 | stp_time_zone_offset_show, NULL); |
1686 | 1688 | ||
1687 | static ssize_t stp_timing_mode_show(struct sysdev_class *class, | 1689 | static ssize_t stp_timing_mode_show(struct device *dev, |
1688 | struct sysdev_class_attribute *attr, | 1690 | struct device_attribute *attr, |
1689 | char *buf) | 1691 | char *buf) |
1690 | { | 1692 | { |
1691 | if (!stp_online) | 1693 | if (!stp_online) |
@@ -1693,10 +1695,10 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class, | |||
1693 | return sprintf(buf, "%i\n", stp_info.tmd); | 1695 | return sprintf(buf, "%i\n", stp_info.tmd); |
1694 | } | 1696 | } |
1695 | 1697 | ||
1696 | static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); | 1698 | static DEVICE_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); |
1697 | 1699 | ||
1698 | static ssize_t stp_timing_state_show(struct sysdev_class *class, | 1700 | static ssize_t stp_timing_state_show(struct device *dev, |
1699 | struct sysdev_class_attribute *attr, | 1701 | struct device_attribute *attr, |
1700 | char *buf) | 1702 | char *buf) |
1701 | { | 1703 | { |
1702 | if (!stp_online) | 1704 | if (!stp_online) |
@@ -1704,17 +1706,17 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class, | |||
1704 | return sprintf(buf, "%i\n", stp_info.tst); | 1706 | return sprintf(buf, "%i\n", stp_info.tst); |
1705 | } | 1707 | } |
1706 | 1708 | ||
1707 | static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); | 1709 | static DEVICE_ATTR(timing_state, 0400, stp_timing_state_show, NULL); |
1708 | 1710 | ||
1709 | static ssize_t stp_online_show(struct sysdev_class *class, | 1711 | static ssize_t stp_online_show(struct device *dev, |
1710 | struct sysdev_class_attribute *attr, | 1712 | struct device_attribute *attr, |
1711 | char *buf) | 1713 | char *buf) |
1712 | { | 1714 | { |
1713 | return sprintf(buf, "%i\n", stp_online); | 1715 | return sprintf(buf, "%i\n", stp_online); |
1714 | } | 1716 | } |
1715 | 1717 | ||
1716 | static ssize_t stp_online_store(struct sysdev_class *class, | 1718 | static ssize_t stp_online_store(struct device *dev, |
1717 | struct sysdev_class_attribute *attr, | 1719 | struct device_attribute *attr, |
1718 | const char *buf, size_t count) | 1720 | const char *buf, size_t count) |
1719 | { | 1721 | { |
1720 | unsigned int value; | 1722 | unsigned int value; |
@@ -1736,47 +1738,47 @@ static ssize_t stp_online_store(struct sysdev_class *class, | |||
1736 | } | 1738 | } |
1737 | 1739 | ||
1738 | /* | 1740 | /* |
1739 | * Can't use SYSDEV_CLASS_ATTR because the attribute should be named | 1741 | * Can't use DEVICE_ATTR because the attribute should be named |
1740 | * stp/online but attr_online already exists in this file .. | 1742 | * stp/online but dev_attr_online already exists in this file .. |
1741 | */ | 1743 | */ |
1742 | static struct sysdev_class_attribute attr_stp_online = { | 1744 | static struct device_attribute dev_attr_stp_online = { |
1743 | .attr = { .name = "online", .mode = 0600 }, | 1745 | .attr = { .name = "online", .mode = 0600 }, |
1744 | .show = stp_online_show, | 1746 | .show = stp_online_show, |
1745 | .store = stp_online_store, | 1747 | .store = stp_online_store, |
1746 | }; | 1748 | }; |
1747 | 1749 | ||
1748 | static struct sysdev_class_attribute *stp_attributes[] = { | 1750 | static struct device_attribute *stp_attributes[] = { |
1749 | &attr_ctn_id, | 1751 | &dev_attr_ctn_id, |
1750 | &attr_ctn_type, | 1752 | &dev_attr_ctn_type, |
1751 | &attr_dst_offset, | 1753 | &dev_attr_dst_offset, |
1752 | &attr_leap_seconds, | 1754 | &dev_attr_leap_seconds, |
1753 | &attr_stp_online, | 1755 | &dev_attr_stp_online, |
1754 | &attr_stratum, | 1756 | &dev_attr_stratum, |
1755 | &attr_time_offset, | 1757 | &dev_attr_time_offset, |
1756 | &attr_time_zone_offset, | 1758 | &dev_attr_time_zone_offset, |
1757 | &attr_timing_mode, | 1759 | &dev_attr_timing_mode, |
1758 | &attr_timing_state, | 1760 | &dev_attr_timing_state, |
1759 | NULL | 1761 | NULL |
1760 | }; | 1762 | }; |
1761 | 1763 | ||
1762 | static int __init stp_init_sysfs(void) | 1764 | static int __init stp_init_sysfs(void) |
1763 | { | 1765 | { |
1764 | struct sysdev_class_attribute **attr; | 1766 | struct device_attribute **attr; |
1765 | int rc; | 1767 | int rc; |
1766 | 1768 | ||
1767 | rc = sysdev_class_register(&stp_sysclass); | 1769 | rc = subsys_system_register(&stp_subsys, NULL); |
1768 | if (rc) | 1770 | if (rc) |
1769 | goto out; | 1771 | goto out; |
1770 | for (attr = stp_attributes; *attr; attr++) { | 1772 | for (attr = stp_attributes; *attr; attr++) { |
1771 | rc = sysdev_class_create_file(&stp_sysclass, *attr); | 1773 | rc = device_create_file(stp_subsys.dev_root, *attr); |
1772 | if (rc) | 1774 | if (rc) |
1773 | goto out_unreg; | 1775 | goto out_unreg; |
1774 | } | 1776 | } |
1775 | return 0; | 1777 | return 0; |
1776 | out_unreg: | 1778 | out_unreg: |
1777 | for (; attr >= stp_attributes; attr--) | 1779 | for (; attr >= stp_attributes; attr--) |
1778 | sysdev_class_remove_file(&stp_sysclass, *attr); | 1780 | device_remove_file(stp_subsys.dev_root, *attr); |
1779 | sysdev_class_unregister(&stp_sysclass); | 1781 | bus_unregister(&stp_subsys); |
1780 | out: | 1782 | out: |
1781 | return rc; | 1783 | return rc; |
1782 | } | 1784 | } |
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index fdb5b8cb260f..6e0e29b29a7b 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -261,7 +261,7 @@ void store_topology(struct sysinfo_15_1_x *info) | |||
261 | int arch_update_cpu_topology(void) | 261 | int arch_update_cpu_topology(void) |
262 | { | 262 | { |
263 | struct sysinfo_15_1_x *info = tl_info; | 263 | struct sysinfo_15_1_x *info = tl_info; |
264 | struct sys_device *sysdev; | 264 | struct device *dev; |
265 | int cpu; | 265 | int cpu; |
266 | 266 | ||
267 | if (!MACHINE_HAS_TOPOLOGY) { | 267 | if (!MACHINE_HAS_TOPOLOGY) { |
@@ -273,8 +273,8 @@ int arch_update_cpu_topology(void) | |||
273 | tl_to_cores(info); | 273 | tl_to_cores(info); |
274 | update_cpu_core_map(); | 274 | update_cpu_core_map(); |
275 | for_each_online_cpu(cpu) { | 275 | for_each_online_cpu(cpu) { |
276 | sysdev = get_cpu_sysdev(cpu); | 276 | dev = get_cpu_device(cpu); |
277 | kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); | 277 | kobject_uevent(&dev->kobj, KOBJ_CHANGE); |
278 | } | 278 | } |
279 | return 1; | 279 | return 1; |
280 | } | 280 | } |
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c index 87cedd61be04..8943e82cd4d9 100644 --- a/arch/s390/kvm/diag.c +++ b/arch/s390/kvm/diag.c | |||
@@ -70,7 +70,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu) | |||
70 | return -EOPNOTSUPP; | 70 | return -EOPNOTSUPP; |
71 | } | 71 | } |
72 | 72 | ||
73 | atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | 73 | atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); |
74 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM; | 74 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM; |
75 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL; | 75 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL; |
76 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT; | 76 | vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT; |
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index c7c51898984e..02434543eabb 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c | |||
@@ -132,7 +132,6 @@ static int handle_stop(struct kvm_vcpu *vcpu) | |||
132 | int rc = 0; | 132 | int rc = 0; |
133 | 133 | ||
134 | vcpu->stat.exit_stop_request++; | 134 | vcpu->stat.exit_stop_request++; |
135 | atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | ||
136 | spin_lock_bh(&vcpu->arch.local_int.lock); | 135 | spin_lock_bh(&vcpu->arch.local_int.lock); |
137 | if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) { | 136 | if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) { |
138 | vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP; | 137 | vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP; |
@@ -149,6 +148,8 @@ static int handle_stop(struct kvm_vcpu *vcpu) | |||
149 | } | 148 | } |
150 | 149 | ||
151 | if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) { | 150 | if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) { |
151 | atomic_set_mask(CPUSTAT_STOPPED, | ||
152 | &vcpu->arch.sie_block->cpuflags); | ||
152 | vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP; | 153 | vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP; |
153 | VCPU_EVENT(vcpu, 3, "%s", "cpu stopped"); | 154 | VCPU_EVENT(vcpu, 3, "%s", "cpu stopped"); |
154 | rc = -EOPNOTSUPP; | 155 | rc = -EOPNOTSUPP; |
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 87c16705b381..278ee009ce65 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -252,6 +252,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, | |||
252 | offsetof(struct _lowcore, restart_psw), sizeof(psw_t)); | 252 | offsetof(struct _lowcore, restart_psw), sizeof(psw_t)); |
253 | if (rc == -EFAULT) | 253 | if (rc == -EFAULT) |
254 | exception = 1; | 254 | exception = 1; |
255 | atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); | ||
255 | break; | 256 | break; |
256 | 257 | ||
257 | case KVM_S390_PROGRAM_INT: | 258 | case KVM_S390_PROGRAM_INT: |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 0bd3bea1e4cd..d1c445732451 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -65,6 +65,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
65 | { "instruction_stfl", VCPU_STAT(instruction_stfl) }, | 65 | { "instruction_stfl", VCPU_STAT(instruction_stfl) }, |
66 | { "instruction_tprot", VCPU_STAT(instruction_tprot) }, | 66 | { "instruction_tprot", VCPU_STAT(instruction_tprot) }, |
67 | { "instruction_sigp_sense", VCPU_STAT(instruction_sigp_sense) }, | 67 | { "instruction_sigp_sense", VCPU_STAT(instruction_sigp_sense) }, |
68 | { "instruction_sigp_sense_running", VCPU_STAT(instruction_sigp_sense_running) }, | ||
68 | { "instruction_sigp_external_call", VCPU_STAT(instruction_sigp_external_call) }, | 69 | { "instruction_sigp_external_call", VCPU_STAT(instruction_sigp_external_call) }, |
69 | { "instruction_sigp_emergency", VCPU_STAT(instruction_sigp_emergency) }, | 70 | { "instruction_sigp_emergency", VCPU_STAT(instruction_sigp_emergency) }, |
70 | { "instruction_sigp_stop", VCPU_STAT(instruction_sigp_stop) }, | 71 | { "instruction_sigp_stop", VCPU_STAT(instruction_sigp_stop) }, |
@@ -127,6 +128,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
127 | switch (ext) { | 128 | switch (ext) { |
128 | case KVM_CAP_S390_PSW: | 129 | case KVM_CAP_S390_PSW: |
129 | case KVM_CAP_S390_GMAP: | 130 | case KVM_CAP_S390_GMAP: |
131 | case KVM_CAP_SYNC_MMU: | ||
130 | r = 1; | 132 | r = 1; |
131 | break; | 133 | break; |
132 | default: | 134 | default: |
@@ -270,10 +272,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
270 | restore_fp_regs(&vcpu->arch.guest_fpregs); | 272 | restore_fp_regs(&vcpu->arch.guest_fpregs); |
271 | restore_access_regs(vcpu->arch.guest_acrs); | 273 | restore_access_regs(vcpu->arch.guest_acrs); |
272 | gmap_enable(vcpu->arch.gmap); | 274 | gmap_enable(vcpu->arch.gmap); |
275 | atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | ||
273 | } | 276 | } |
274 | 277 | ||
275 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | 278 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) |
276 | { | 279 | { |
280 | atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | ||
277 | gmap_disable(vcpu->arch.gmap); | 281 | gmap_disable(vcpu->arch.gmap); |
278 | save_fp_regs(&vcpu->arch.guest_fpregs); | 282 | save_fp_regs(&vcpu->arch.guest_fpregs); |
279 | save_access_regs(vcpu->arch.guest_acrs); | 283 | save_access_regs(vcpu->arch.guest_acrs); |
@@ -301,7 +305,9 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) | |||
301 | 305 | ||
302 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | 306 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) |
303 | { | 307 | { |
304 | atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | CPUSTAT_SM); | 308 | atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | |
309 | CPUSTAT_SM | | ||
310 | CPUSTAT_STOPPED); | ||
305 | vcpu->arch.sie_block->ecb = 6; | 311 | vcpu->arch.sie_block->ecb = 6; |
306 | vcpu->arch.sie_block->eca = 0xC1002001U; | 312 | vcpu->arch.sie_block->eca = 0xC1002001U; |
307 | vcpu->arch.sie_block->fac = (int) (long) facilities; | 313 | vcpu->arch.sie_block->fac = (int) (long) facilities; |
@@ -428,7 +434,7 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw) | |||
428 | { | 434 | { |
429 | int rc = 0; | 435 | int rc = 0; |
430 | 436 | ||
431 | if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING) | 437 | if (!(atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_STOPPED)) |
432 | rc = -EBUSY; | 438 | rc = -EBUSY; |
433 | else { | 439 | else { |
434 | vcpu->run->psw_mask = psw.mask; | 440 | vcpu->run->psw_mask = psw.mask; |
@@ -501,7 +507,7 @@ rerun_vcpu: | |||
501 | if (vcpu->sigset_active) | 507 | if (vcpu->sigset_active) |
502 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | 508 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); |
503 | 509 | ||
504 | atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags); | 510 | atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); |
505 | 511 | ||
506 | BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL); | 512 | BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL); |
507 | 513 | ||
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 391626361084..d02638959922 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -336,6 +336,7 @@ static int handle_tprot(struct kvm_vcpu *vcpu) | |||
336 | u64 address1 = disp1 + base1 ? vcpu->arch.guest_gprs[base1] : 0; | 336 | u64 address1 = disp1 + base1 ? vcpu->arch.guest_gprs[base1] : 0; |
337 | u64 address2 = disp2 + base2 ? vcpu->arch.guest_gprs[base2] : 0; | 337 | u64 address2 = disp2 + base2 ? vcpu->arch.guest_gprs[base2] : 0; |
338 | struct vm_area_struct *vma; | 338 | struct vm_area_struct *vma; |
339 | unsigned long user_address; | ||
339 | 340 | ||
340 | vcpu->stat.instruction_tprot++; | 341 | vcpu->stat.instruction_tprot++; |
341 | 342 | ||
@@ -349,9 +350,14 @@ static int handle_tprot(struct kvm_vcpu *vcpu) | |||
349 | return -EOPNOTSUPP; | 350 | return -EOPNOTSUPP; |
350 | 351 | ||
351 | 352 | ||
353 | /* we must resolve the address without holding the mmap semaphore. | ||
354 | * This is ok since the userspace hypervisor is not supposed to change | ||
355 | * the mapping while the guest queries the memory. Otherwise the guest | ||
356 | * might crash or get wrong info anyway. */ | ||
357 | user_address = (unsigned long) __guestaddr_to_user(vcpu, address1); | ||
358 | |||
352 | down_read(¤t->mm->mmap_sem); | 359 | down_read(¤t->mm->mmap_sem); |
353 | vma = find_vma(current->mm, | 360 | vma = find_vma(current->mm, user_address); |
354 | (unsigned long) __guestaddr_to_user(vcpu, address1)); | ||
355 | if (!vma) { | 361 | if (!vma) { |
356 | up_read(¤t->mm->mmap_sem); | 362 | up_read(¤t->mm->mmap_sem); |
357 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 363 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index f815118835f3..0a7941d74bc6 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
@@ -31,9 +31,11 @@ | |||
31 | #define SIGP_SET_PREFIX 0x0d | 31 | #define SIGP_SET_PREFIX 0x0d |
32 | #define SIGP_STORE_STATUS_ADDR 0x0e | 32 | #define SIGP_STORE_STATUS_ADDR 0x0e |
33 | #define SIGP_SET_ARCH 0x12 | 33 | #define SIGP_SET_ARCH 0x12 |
34 | #define SIGP_SENSE_RUNNING 0x15 | ||
34 | 35 | ||
35 | /* cpu status bits */ | 36 | /* cpu status bits */ |
36 | #define SIGP_STAT_EQUIPMENT_CHECK 0x80000000UL | 37 | #define SIGP_STAT_EQUIPMENT_CHECK 0x80000000UL |
38 | #define SIGP_STAT_NOT_RUNNING 0x00000400UL | ||
37 | #define SIGP_STAT_INCORRECT_STATE 0x00000200UL | 39 | #define SIGP_STAT_INCORRECT_STATE 0x00000200UL |
38 | #define SIGP_STAT_INVALID_PARAMETER 0x00000100UL | 40 | #define SIGP_STAT_INVALID_PARAMETER 0x00000100UL |
39 | #define SIGP_STAT_EXT_CALL_PENDING 0x00000080UL | 41 | #define SIGP_STAT_EXT_CALL_PENDING 0x00000080UL |
@@ -57,8 +59,8 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, | |||
57 | spin_lock(&fi->lock); | 59 | spin_lock(&fi->lock); |
58 | if (fi->local_int[cpu_addr] == NULL) | 60 | if (fi->local_int[cpu_addr] == NULL) |
59 | rc = 3; /* not operational */ | 61 | rc = 3; /* not operational */ |
60 | else if (atomic_read(fi->local_int[cpu_addr]->cpuflags) | 62 | else if (!(atomic_read(fi->local_int[cpu_addr]->cpuflags) |
61 | & CPUSTAT_RUNNING) { | 63 | & CPUSTAT_STOPPED)) { |
62 | *reg &= 0xffffffff00000000UL; | 64 | *reg &= 0xffffffff00000000UL; |
63 | rc = 1; /* status stored */ | 65 | rc = 1; /* status stored */ |
64 | } else { | 66 | } else { |
@@ -251,7 +253,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address, | |||
251 | 253 | ||
252 | spin_lock_bh(&li->lock); | 254 | spin_lock_bh(&li->lock); |
253 | /* cpu must be in stopped state */ | 255 | /* cpu must be in stopped state */ |
254 | if (atomic_read(li->cpuflags) & CPUSTAT_RUNNING) { | 256 | if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) { |
255 | rc = 1; /* incorrect state */ | 257 | rc = 1; /* incorrect state */ |
256 | *reg &= SIGP_STAT_INCORRECT_STATE; | 258 | *reg &= SIGP_STAT_INCORRECT_STATE; |
257 | kfree(inti); | 259 | kfree(inti); |
@@ -275,6 +277,38 @@ out_fi: | |||
275 | return rc; | 277 | return rc; |
276 | } | 278 | } |
277 | 279 | ||
280 | static int __sigp_sense_running(struct kvm_vcpu *vcpu, u16 cpu_addr, | ||
281 | unsigned long *reg) | ||
282 | { | ||
283 | int rc; | ||
284 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; | ||
285 | |||
286 | if (cpu_addr >= KVM_MAX_VCPUS) | ||
287 | return 3; /* not operational */ | ||
288 | |||
289 | spin_lock(&fi->lock); | ||
290 | if (fi->local_int[cpu_addr] == NULL) | ||
291 | rc = 3; /* not operational */ | ||
292 | else { | ||
293 | if (atomic_read(fi->local_int[cpu_addr]->cpuflags) | ||
294 | & CPUSTAT_RUNNING) { | ||
295 | /* running */ | ||
296 | rc = 1; | ||
297 | } else { | ||
298 | /* not running */ | ||
299 | *reg &= 0xffffffff00000000UL; | ||
300 | *reg |= SIGP_STAT_NOT_RUNNING; | ||
301 | rc = 0; | ||
302 | } | ||
303 | } | ||
304 | spin_unlock(&fi->lock); | ||
305 | |||
306 | VCPU_EVENT(vcpu, 4, "sensed running status of cpu %x rc %x", cpu_addr, | ||
307 | rc); | ||
308 | |||
309 | return rc; | ||
310 | } | ||
311 | |||
278 | int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) | 312 | int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) |
279 | { | 313 | { |
280 | int r1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; | 314 | int r1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; |
@@ -331,6 +365,11 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) | |||
331 | rc = __sigp_set_prefix(vcpu, cpu_addr, parameter, | 365 | rc = __sigp_set_prefix(vcpu, cpu_addr, parameter, |
332 | &vcpu->arch.guest_gprs[r1]); | 366 | &vcpu->arch.guest_gprs[r1]); |
333 | break; | 367 | break; |
368 | case SIGP_SENSE_RUNNING: | ||
369 | vcpu->stat.instruction_sigp_sense_running++; | ||
370 | rc = __sigp_sense_running(vcpu, cpu_addr, | ||
371 | &vcpu->arch.guest_gprs[r1]); | ||
372 | break; | ||
334 | case SIGP_RESTART: | 373 | case SIGP_RESTART: |
335 | vcpu->stat.instruction_sigp_restart++; | 374 | vcpu->stat.instruction_sigp_restart++; |
336 | /* user space must know about restart */ | 375 | /* user space must know about restart */ |
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c index f43c0e4282af..9daee91e6c3f 100644 --- a/arch/s390/oprofile/hwsampler.c +++ b/arch/s390/oprofile/hwsampler.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
23 | 23 | ||
24 | #include "hwsampler.h" | 24 | #include "hwsampler.h" |
25 | #include "op_counter.h" | ||
25 | 26 | ||
26 | #define MAX_NUM_SDB 511 | 27 | #define MAX_NUM_SDB 511 |
27 | #define MIN_NUM_SDB 1 | 28 | #define MIN_NUM_SDB 1 |
@@ -896,6 +897,8 @@ static void add_samples_to_oprofile(unsigned int cpu, unsigned long *sdbt, | |||
896 | if (sample_data_ptr->P == 1) { | 897 | if (sample_data_ptr->P == 1) { |
897 | /* userspace sample */ | 898 | /* userspace sample */ |
898 | unsigned int pid = sample_data_ptr->prim_asn; | 899 | unsigned int pid = sample_data_ptr->prim_asn; |
900 | if (!counter_config.user) | ||
901 | goto skip_sample; | ||
899 | rcu_read_lock(); | 902 | rcu_read_lock(); |
900 | tsk = pid_task(find_vpid(pid), PIDTYPE_PID); | 903 | tsk = pid_task(find_vpid(pid), PIDTYPE_PID); |
901 | if (tsk) | 904 | if (tsk) |
@@ -903,6 +906,8 @@ static void add_samples_to_oprofile(unsigned int cpu, unsigned long *sdbt, | |||
903 | rcu_read_unlock(); | 906 | rcu_read_unlock(); |
904 | } else { | 907 | } else { |
905 | /* kernelspace sample */ | 908 | /* kernelspace sample */ |
909 | if (!counter_config.kernel) | ||
910 | goto skip_sample; | ||
906 | regs = task_pt_regs(current); | 911 | regs = task_pt_regs(current); |
907 | } | 912 | } |
908 | 913 | ||
@@ -910,7 +915,7 @@ static void add_samples_to_oprofile(unsigned int cpu, unsigned long *sdbt, | |||
910 | oprofile_add_ext_hw_sample(sample_data_ptr->ia, regs, 0, | 915 | oprofile_add_ext_hw_sample(sample_data_ptr->ia, regs, 0, |
911 | !sample_data_ptr->P, tsk); | 916 | !sample_data_ptr->P, tsk); |
912 | mutex_unlock(&hws_sem); | 917 | mutex_unlock(&hws_sem); |
913 | 918 | skip_sample: | |
914 | sample_data_ptr++; | 919 | sample_data_ptr++; |
915 | } | 920 | } |
916 | } | 921 | } |
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index 6efc18b5e60a..2297be406c61 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c | |||
@@ -2,10 +2,11 @@ | |||
2 | * arch/s390/oprofile/init.c | 2 | * arch/s390/oprofile/init.c |
3 | * | 3 | * |
4 | * S390 Version | 4 | * S390 Version |
5 | * Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation | 5 | * Copyright (C) 2002-2011 IBM Deutschland Entwicklung GmbH, IBM Corporation |
6 | * Author(s): Thomas Spatzier (tspat@de.ibm.com) | 6 | * Author(s): Thomas Spatzier (tspat@de.ibm.com) |
7 | * Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com) | 7 | * Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com) |
8 | * Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com) | 8 | * Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com) |
9 | * Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com) | ||
9 | * | 10 | * |
10 | * @remark Copyright 2002-2011 OProfile authors | 11 | * @remark Copyright 2002-2011 OProfile authors |
11 | */ | 12 | */ |
@@ -14,6 +15,8 @@ | |||
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
16 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/module.h> | ||
19 | #include <asm/processor.h> | ||
17 | 20 | ||
18 | #include "../../../drivers/oprofile/oprof.h" | 21 | #include "../../../drivers/oprofile/oprof.h" |
19 | 22 | ||
@@ -22,6 +25,7 @@ extern void s390_backtrace(struct pt_regs * const regs, unsigned int depth); | |||
22 | #ifdef CONFIG_64BIT | 25 | #ifdef CONFIG_64BIT |
23 | 26 | ||
24 | #include "hwsampler.h" | 27 | #include "hwsampler.h" |
28 | #include "op_counter.h" | ||
25 | 29 | ||
26 | #define DEFAULT_INTERVAL 4127518 | 30 | #define DEFAULT_INTERVAL 4127518 |
27 | 31 | ||
@@ -35,16 +39,41 @@ static unsigned long oprofile_max_interval; | |||
35 | static unsigned long oprofile_sdbt_blocks = DEFAULT_SDBT_BLOCKS; | 39 | static unsigned long oprofile_sdbt_blocks = DEFAULT_SDBT_BLOCKS; |
36 | static unsigned long oprofile_sdb_blocks = DEFAULT_SDB_BLOCKS; | 40 | static unsigned long oprofile_sdb_blocks = DEFAULT_SDB_BLOCKS; |
37 | 41 | ||
38 | static int hwsampler_file; | 42 | static int hwsampler_enabled; |
39 | static int hwsampler_running; /* start_mutex must be held to change */ | 43 | static int hwsampler_running; /* start_mutex must be held to change */ |
44 | static int hwsampler_available; | ||
40 | 45 | ||
41 | static struct oprofile_operations timer_ops; | 46 | static struct oprofile_operations timer_ops; |
42 | 47 | ||
48 | struct op_counter_config counter_config; | ||
49 | |||
50 | enum __force_cpu_type { | ||
51 | reserved = 0, /* do not force */ | ||
52 | timer, | ||
53 | }; | ||
54 | static int force_cpu_type; | ||
55 | |||
56 | static int set_cpu_type(const char *str, struct kernel_param *kp) | ||
57 | { | ||
58 | if (!strcmp(str, "timer")) { | ||
59 | force_cpu_type = timer; | ||
60 | printk(KERN_INFO "oprofile: forcing timer to be returned " | ||
61 | "as cpu type\n"); | ||
62 | } else { | ||
63 | force_cpu_type = 0; | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | module_param_call(cpu_type, set_cpu_type, NULL, NULL, 0); | ||
69 | MODULE_PARM_DESC(cpu_type, "Force legacy basic mode sampling" | ||
70 | "(report cpu_type \"timer\""); | ||
71 | |||
43 | static int oprofile_hwsampler_start(void) | 72 | static int oprofile_hwsampler_start(void) |
44 | { | 73 | { |
45 | int retval; | 74 | int retval; |
46 | 75 | ||
47 | hwsampler_running = hwsampler_file; | 76 | hwsampler_running = hwsampler_enabled; |
48 | 77 | ||
49 | if (!hwsampler_running) | 78 | if (!hwsampler_running) |
50 | return timer_ops.start(); | 79 | return timer_ops.start(); |
@@ -72,10 +101,16 @@ static void oprofile_hwsampler_stop(void) | |||
72 | return; | 101 | return; |
73 | } | 102 | } |
74 | 103 | ||
104 | /* | ||
105 | * File ops used for: | ||
106 | * /dev/oprofile/0/enabled | ||
107 | * /dev/oprofile/hwsampling/hwsampler (cpu_type = timer) | ||
108 | */ | ||
109 | |||
75 | static ssize_t hwsampler_read(struct file *file, char __user *buf, | 110 | static ssize_t hwsampler_read(struct file *file, char __user *buf, |
76 | size_t count, loff_t *offset) | 111 | size_t count, loff_t *offset) |
77 | { | 112 | { |
78 | return oprofilefs_ulong_to_user(hwsampler_file, buf, count, offset); | 113 | return oprofilefs_ulong_to_user(hwsampler_enabled, buf, count, offset); |
79 | } | 114 | } |
80 | 115 | ||
81 | static ssize_t hwsampler_write(struct file *file, char const __user *buf, | 116 | static ssize_t hwsampler_write(struct file *file, char const __user *buf, |
@@ -88,9 +123,12 @@ static ssize_t hwsampler_write(struct file *file, char const __user *buf, | |||
88 | return -EINVAL; | 123 | return -EINVAL; |
89 | 124 | ||
90 | retval = oprofilefs_ulong_from_user(&val, buf, count); | 125 | retval = oprofilefs_ulong_from_user(&val, buf, count); |
91 | if (retval) | 126 | if (retval <= 0) |
92 | return retval; | 127 | return retval; |
93 | 128 | ||
129 | if (val != 0 && val != 1) | ||
130 | return -EINVAL; | ||
131 | |||
94 | if (oprofile_started) | 132 | if (oprofile_started) |
95 | /* | 133 | /* |
96 | * save to do without locking as we set | 134 | * save to do without locking as we set |
@@ -99,7 +137,7 @@ static ssize_t hwsampler_write(struct file *file, char const __user *buf, | |||
99 | */ | 137 | */ |
100 | return -EBUSY; | 138 | return -EBUSY; |
101 | 139 | ||
102 | hwsampler_file = val; | 140 | hwsampler_enabled = val; |
103 | 141 | ||
104 | return count; | 142 | return count; |
105 | } | 143 | } |
@@ -109,38 +147,311 @@ static const struct file_operations hwsampler_fops = { | |||
109 | .write = hwsampler_write, | 147 | .write = hwsampler_write, |
110 | }; | 148 | }; |
111 | 149 | ||
150 | /* | ||
151 | * File ops used for: | ||
152 | * /dev/oprofile/0/count | ||
153 | * /dev/oprofile/hwsampling/hw_interval (cpu_type = timer) | ||
154 | * | ||
155 | * Make sure that the value is within the hardware range. | ||
156 | */ | ||
157 | |||
158 | static ssize_t hw_interval_read(struct file *file, char __user *buf, | ||
159 | size_t count, loff_t *offset) | ||
160 | { | ||
161 | return oprofilefs_ulong_to_user(oprofile_hw_interval, buf, | ||
162 | count, offset); | ||
163 | } | ||
164 | |||
165 | static ssize_t hw_interval_write(struct file *file, char const __user *buf, | ||
166 | size_t count, loff_t *offset) | ||
167 | { | ||
168 | unsigned long val; | ||
169 | int retval; | ||
170 | |||
171 | if (*offset) | ||
172 | return -EINVAL; | ||
173 | retval = oprofilefs_ulong_from_user(&val, buf, count); | ||
174 | if (retval) | ||
175 | return retval; | ||
176 | if (val < oprofile_min_interval) | ||
177 | oprofile_hw_interval = oprofile_min_interval; | ||
178 | else if (val > oprofile_max_interval) | ||
179 | oprofile_hw_interval = oprofile_max_interval; | ||
180 | else | ||
181 | oprofile_hw_interval = val; | ||
182 | |||
183 | return count; | ||
184 | } | ||
185 | |||
186 | static const struct file_operations hw_interval_fops = { | ||
187 | .read = hw_interval_read, | ||
188 | .write = hw_interval_write, | ||
189 | }; | ||
190 | |||
191 | /* | ||
192 | * File ops used for: | ||
193 | * /dev/oprofile/0/event | ||
194 | * Only a single event with number 0 is supported with this counter. | ||
195 | * | ||
196 | * /dev/oprofile/0/unit_mask | ||
197 | * This is a dummy file needed by the user space tools. | ||
198 | * No value other than 0 is accepted or returned. | ||
199 | */ | ||
200 | |||
201 | static ssize_t hwsampler_zero_read(struct file *file, char __user *buf, | ||
202 | size_t count, loff_t *offset) | ||
203 | { | ||
204 | return oprofilefs_ulong_to_user(0, buf, count, offset); | ||
205 | } | ||
206 | |||
207 | static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf, | ||
208 | size_t count, loff_t *offset) | ||
209 | { | ||
210 | unsigned long val; | ||
211 | int retval; | ||
212 | |||
213 | if (*offset) | ||
214 | return -EINVAL; | ||
215 | |||
216 | retval = oprofilefs_ulong_from_user(&val, buf, count); | ||
217 | if (retval) | ||
218 | return retval; | ||
219 | if (val != 0) | ||
220 | return -EINVAL; | ||
221 | return count; | ||
222 | } | ||
223 | |||
224 | static const struct file_operations zero_fops = { | ||
225 | .read = hwsampler_zero_read, | ||
226 | .write = hwsampler_zero_write, | ||
227 | }; | ||
228 | |||
229 | /* /dev/oprofile/0/kernel file ops. */ | ||
230 | |||
231 | static ssize_t hwsampler_kernel_read(struct file *file, char __user *buf, | ||
232 | size_t count, loff_t *offset) | ||
233 | { | ||
234 | return oprofilefs_ulong_to_user(counter_config.kernel, | ||
235 | buf, count, offset); | ||
236 | } | ||
237 | |||
238 | static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf, | ||
239 | size_t count, loff_t *offset) | ||
240 | { | ||
241 | unsigned long val; | ||
242 | int retval; | ||
243 | |||
244 | if (*offset) | ||
245 | return -EINVAL; | ||
246 | |||
247 | retval = oprofilefs_ulong_from_user(&val, buf, count); | ||
248 | if (retval) | ||
249 | return retval; | ||
250 | |||
251 | if (val != 0 && val != 1) | ||
252 | return -EINVAL; | ||
253 | |||
254 | counter_config.kernel = val; | ||
255 | |||
256 | return count; | ||
257 | } | ||
258 | |||
259 | static const struct file_operations kernel_fops = { | ||
260 | .read = hwsampler_kernel_read, | ||
261 | .write = hwsampler_kernel_write, | ||
262 | }; | ||
263 | |||
264 | /* /dev/oprofile/0/user file ops. */ | ||
265 | |||
266 | static ssize_t hwsampler_user_read(struct file *file, char __user *buf, | ||
267 | size_t count, loff_t *offset) | ||
268 | { | ||
269 | return oprofilefs_ulong_to_user(counter_config.user, | ||
270 | buf, count, offset); | ||
271 | } | ||
272 | |||
273 | static ssize_t hwsampler_user_write(struct file *file, char const __user *buf, | ||
274 | size_t count, loff_t *offset) | ||
275 | { | ||
276 | unsigned long val; | ||
277 | int retval; | ||
278 | |||
279 | if (*offset) | ||
280 | return -EINVAL; | ||
281 | |||
282 | retval = oprofilefs_ulong_from_user(&val, buf, count); | ||
283 | if (retval) | ||
284 | return retval; | ||
285 | |||
286 | if (val != 0 && val != 1) | ||
287 | return -EINVAL; | ||
288 | |||
289 | counter_config.user = val; | ||
290 | |||
291 | return count; | ||
292 | } | ||
293 | |||
294 | static const struct file_operations user_fops = { | ||
295 | .read = hwsampler_user_read, | ||
296 | .write = hwsampler_user_write, | ||
297 | }; | ||
298 | |||
299 | |||
300 | /* | ||
301 | * File ops used for: /dev/oprofile/timer/enabled | ||
302 | * The value always has to be the inverted value of hwsampler_enabled. So | ||
303 | * no separate variable is created. That way we do not need locking. | ||
304 | */ | ||
305 | |||
306 | static ssize_t timer_enabled_read(struct file *file, char __user *buf, | ||
307 | size_t count, loff_t *offset) | ||
308 | { | ||
309 | return oprofilefs_ulong_to_user(!hwsampler_enabled, buf, count, offset); | ||
310 | } | ||
311 | |||
312 | static ssize_t timer_enabled_write(struct file *file, char const __user *buf, | ||
313 | size_t count, loff_t *offset) | ||
314 | { | ||
315 | unsigned long val; | ||
316 | int retval; | ||
317 | |||
318 | if (*offset) | ||
319 | return -EINVAL; | ||
320 | |||
321 | retval = oprofilefs_ulong_from_user(&val, buf, count); | ||
322 | if (retval) | ||
323 | return retval; | ||
324 | |||
325 | if (val != 0 && val != 1) | ||
326 | return -EINVAL; | ||
327 | |||
328 | /* Timer cannot be disabled without having hardware sampling. */ | ||
329 | if (val == 0 && !hwsampler_available) | ||
330 | return -EINVAL; | ||
331 | |||
332 | if (oprofile_started) | ||
333 | /* | ||
334 | * save to do without locking as we set | ||
335 | * hwsampler_running in start() when start_mutex is | ||
336 | * held | ||
337 | */ | ||
338 | return -EBUSY; | ||
339 | |||
340 | hwsampler_enabled = !val; | ||
341 | |||
342 | return count; | ||
343 | } | ||
344 | |||
345 | static const struct file_operations timer_enabled_fops = { | ||
346 | .read = timer_enabled_read, | ||
347 | .write = timer_enabled_write, | ||
348 | }; | ||
349 | |||
350 | |||
112 | static int oprofile_create_hwsampling_files(struct super_block *sb, | 351 | static int oprofile_create_hwsampling_files(struct super_block *sb, |
113 | struct dentry *root) | 352 | struct dentry *root) |
114 | { | 353 | { |
115 | struct dentry *hw_dir; | 354 | struct dentry *dir; |
355 | |||
356 | dir = oprofilefs_mkdir(sb, root, "timer"); | ||
357 | if (!dir) | ||
358 | return -EINVAL; | ||
359 | |||
360 | oprofilefs_create_file(sb, dir, "enabled", &timer_enabled_fops); | ||
361 | |||
362 | if (!hwsampler_available) | ||
363 | return 0; | ||
116 | 364 | ||
117 | /* reinitialize default values */ | 365 | /* reinitialize default values */ |
118 | hwsampler_file = 1; | 366 | hwsampler_enabled = 1; |
367 | counter_config.kernel = 1; | ||
368 | counter_config.user = 1; | ||
119 | 369 | ||
120 | hw_dir = oprofilefs_mkdir(sb, root, "hwsampling"); | 370 | if (!force_cpu_type) { |
121 | if (!hw_dir) | 371 | /* |
122 | return -EINVAL; | 372 | * Create the counter file system. A single virtual |
373 | * counter is created which can be used to | ||
374 | * enable/disable hardware sampling dynamically from | ||
375 | * user space. The user space will configure a single | ||
376 | * counter with a single event. The value of 'event' | ||
377 | * and 'unit_mask' are not evaluated by the kernel code | ||
378 | * and can only be set to 0. | ||
379 | */ | ||
380 | |||
381 | dir = oprofilefs_mkdir(sb, root, "0"); | ||
382 | if (!dir) | ||
383 | return -EINVAL; | ||
123 | 384 | ||
124 | oprofilefs_create_file(sb, hw_dir, "hwsampler", &hwsampler_fops); | 385 | oprofilefs_create_file(sb, dir, "enabled", &hwsampler_fops); |
125 | oprofilefs_create_ulong(sb, hw_dir, "hw_interval", | 386 | oprofilefs_create_file(sb, dir, "event", &zero_fops); |
126 | &oprofile_hw_interval); | 387 | oprofilefs_create_file(sb, dir, "count", &hw_interval_fops); |
127 | oprofilefs_create_ro_ulong(sb, hw_dir, "hw_min_interval", | 388 | oprofilefs_create_file(sb, dir, "unit_mask", &zero_fops); |
128 | &oprofile_min_interval); | 389 | oprofilefs_create_file(sb, dir, "kernel", &kernel_fops); |
129 | oprofilefs_create_ro_ulong(sb, hw_dir, "hw_max_interval", | 390 | oprofilefs_create_file(sb, dir, "user", &user_fops); |
130 | &oprofile_max_interval); | 391 | oprofilefs_create_ulong(sb, dir, "hw_sdbt_blocks", |
131 | oprofilefs_create_ulong(sb, hw_dir, "hw_sdbt_blocks", | 392 | &oprofile_sdbt_blocks); |
132 | &oprofile_sdbt_blocks); | ||
133 | 393 | ||
394 | } else { | ||
395 | /* | ||
396 | * Hardware sampling can be used but the cpu_type is | ||
397 | * forced to timer in order to deal with legacy user | ||
398 | * space tools. The /dev/oprofile/hwsampling fs is | ||
399 | * provided in that case. | ||
400 | */ | ||
401 | dir = oprofilefs_mkdir(sb, root, "hwsampling"); | ||
402 | if (!dir) | ||
403 | return -EINVAL; | ||
404 | |||
405 | oprofilefs_create_file(sb, dir, "hwsampler", | ||
406 | &hwsampler_fops); | ||
407 | oprofilefs_create_file(sb, dir, "hw_interval", | ||
408 | &hw_interval_fops); | ||
409 | oprofilefs_create_ro_ulong(sb, dir, "hw_min_interval", | ||
410 | &oprofile_min_interval); | ||
411 | oprofilefs_create_ro_ulong(sb, dir, "hw_max_interval", | ||
412 | &oprofile_max_interval); | ||
413 | oprofilefs_create_ulong(sb, dir, "hw_sdbt_blocks", | ||
414 | &oprofile_sdbt_blocks); | ||
415 | } | ||
134 | return 0; | 416 | return 0; |
135 | } | 417 | } |
136 | 418 | ||
137 | static int oprofile_hwsampler_init(struct oprofile_operations *ops) | 419 | static int oprofile_hwsampler_init(struct oprofile_operations *ops) |
138 | { | 420 | { |
421 | /* | ||
422 | * Initialize the timer mode infrastructure as well in order | ||
423 | * to be able to switch back dynamically. oprofile_timer_init | ||
424 | * is not supposed to fail. | ||
425 | */ | ||
426 | if (oprofile_timer_init(ops)) | ||
427 | BUG(); | ||
428 | |||
429 | memcpy(&timer_ops, ops, sizeof(timer_ops)); | ||
430 | ops->create_files = oprofile_create_hwsampling_files; | ||
431 | |||
432 | /* | ||
433 | * If the user space tools do not support newer cpu types, | ||
434 | * the force_cpu_type module parameter | ||
435 | * can be used to always return \"timer\" as cpu type. | ||
436 | */ | ||
437 | if (force_cpu_type != timer) { | ||
438 | struct cpuid id; | ||
439 | |||
440 | get_cpu_id (&id); | ||
441 | |||
442 | switch (id.machine) { | ||
443 | case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; | ||
444 | case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; | ||
445 | default: return -ENODEV; | ||
446 | } | ||
447 | } | ||
448 | |||
139 | if (hwsampler_setup()) | 449 | if (hwsampler_setup()) |
140 | return -ENODEV; | 450 | return -ENODEV; |
141 | 451 | ||
142 | /* | 452 | /* |
143 | * create hwsampler files only if hwsampler_setup() succeeds. | 453 | * Query the range for the sampling interval from the |
454 | * hardware. | ||
144 | */ | 455 | */ |
145 | oprofile_min_interval = hwsampler_query_min_interval(); | 456 | oprofile_min_interval = hwsampler_query_min_interval(); |
146 | if (oprofile_min_interval == 0) | 457 | if (oprofile_min_interval == 0) |
@@ -155,23 +466,17 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops) | |||
155 | if (oprofile_hw_interval > oprofile_max_interval) | 466 | if (oprofile_hw_interval > oprofile_max_interval) |
156 | oprofile_hw_interval = oprofile_max_interval; | 467 | oprofile_hw_interval = oprofile_max_interval; |
157 | 468 | ||
158 | if (oprofile_timer_init(ops)) | 469 | printk(KERN_INFO "oprofile: System z hardware sampling " |
159 | return -ENODEV; | 470 | "facility found.\n"); |
160 | |||
161 | printk(KERN_INFO "oprofile: using hardware sampling\n"); | ||
162 | |||
163 | memcpy(&timer_ops, ops, sizeof(timer_ops)); | ||
164 | 471 | ||
165 | ops->start = oprofile_hwsampler_start; | 472 | ops->start = oprofile_hwsampler_start; |
166 | ops->stop = oprofile_hwsampler_stop; | 473 | ops->stop = oprofile_hwsampler_stop; |
167 | ops->create_files = oprofile_create_hwsampling_files; | ||
168 | 474 | ||
169 | return 0; | 475 | return 0; |
170 | } | 476 | } |
171 | 477 | ||
172 | static void oprofile_hwsampler_exit(void) | 478 | static void oprofile_hwsampler_exit(void) |
173 | { | 479 | { |
174 | oprofile_timer_exit(); | ||
175 | hwsampler_shutdown(); | 480 | hwsampler_shutdown(); |
176 | } | 481 | } |
177 | 482 | ||
@@ -182,7 +487,15 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
182 | ops->backtrace = s390_backtrace; | 487 | ops->backtrace = s390_backtrace; |
183 | 488 | ||
184 | #ifdef CONFIG_64BIT | 489 | #ifdef CONFIG_64BIT |
185 | return oprofile_hwsampler_init(ops); | 490 | |
491 | /* | ||
492 | * -ENODEV is not reported to the caller. The module itself | ||
493 | * will use the timer mode sampling as fallback and this is | ||
494 | * always available. | ||
495 | */ | ||
496 | hwsampler_available = oprofile_hwsampler_init(ops) == 0; | ||
497 | |||
498 | return 0; | ||
186 | #else | 499 | #else |
187 | return -ENODEV; | 500 | return -ENODEV; |
188 | #endif | 501 | #endif |
diff --git a/arch/s390/oprofile/op_counter.h b/arch/s390/oprofile/op_counter.h new file mode 100644 index 000000000000..1a8d3ca09014 --- /dev/null +++ b/arch/s390/oprofile/op_counter.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /** | ||
2 | * arch/s390/oprofile/op_counter.h | ||
3 | * | ||
4 | * Copyright (C) 2011 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
5 | * Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com) | ||
6 | * | ||
7 | * @remark Copyright 2011 OProfile authors | ||
8 | */ | ||
9 | |||
10 | #ifndef OP_COUNTER_H | ||
11 | #define OP_COUNTER_H | ||
12 | |||
13 | struct op_counter_config { | ||
14 | /* `enabled' maps to the hwsampler_file variable. */ | ||
15 | /* `count' maps to the oprofile_hw_interval variable. */ | ||
16 | /* `event' and `unit_mask' are unused. */ | ||
17 | unsigned long kernel; | ||
18 | unsigned long user; | ||
19 | }; | ||
20 | |||
21 | extern struct op_counter_config counter_config; | ||
22 | |||
23 | #endif /* OP_COUNTER_H */ | ||