diff options
-rw-r--r-- | arch/s390/include/asm/sysinfo.h | 16 | ||||
-rw-r--r-- | arch/s390/kernel/early.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/lgr.c | 29 | ||||
-rw-r--r-- | arch/s390/kernel/sysinfo.c | 43 | ||||
-rw-r--r-- | arch/s390/kvm/priv.c | 4 | ||||
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 15 |
6 files changed, 52 insertions, 61 deletions
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h index 04e6e9774708..f92428e459f8 100644 --- a/arch/s390/include/asm/sysinfo.h +++ b/arch/s390/include/asm/sysinfo.h | |||
@@ -153,21 +153,7 @@ struct sysinfo_15_1_x { | |||
153 | union topology_entry tle[0]; | 153 | union topology_entry tle[0]; |
154 | }; | 154 | }; |
155 | 155 | ||
156 | static inline int stsi(void *sysinfo, int fc, int sel1, int sel2) | 156 | int stsi(void *sysinfo, int fc, int sel1, int sel2); |
157 | { | ||
158 | register int r0 asm("0") = (fc << 28) | sel1; | ||
159 | register int r1 asm("1") = sel2; | ||
160 | |||
161 | asm volatile( | ||
162 | " stsi 0(%2)\n" | ||
163 | "0: jz 2f\n" | ||
164 | "1: lhi %0,%3\n" | ||
165 | "2:\n" | ||
166 | EX_TABLE(0b, 1b) | ||
167 | : "+d" (r0) : "d" (r1), "a" (sysinfo), "K" (-ENOSYS) | ||
168 | : "cc", "memory"); | ||
169 | return r0; | ||
170 | } | ||
171 | 157 | ||
172 | /* | 158 | /* |
173 | * Service level reporting interface. | 159 | * Service level reporting interface. |
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index e8000d5ff533..7f4717675c19 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -222,12 +222,12 @@ static noinline __init void detect_machine_type(void) | |||
222 | struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page; | 222 | struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page; |
223 | 223 | ||
224 | /* Check current-configuration-level */ | 224 | /* Check current-configuration-level */ |
225 | if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) { | 225 | if (stsi(NULL, 0, 0, 0) <= 2) { |
226 | S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR; | 226 | S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR; |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | /* Get virtual-machine cpu information. */ | 229 | /* Get virtual-machine cpu information. */ |
230 | if (stsi(vmms, 3, 2, 2) == -ENOSYS || !vmms->count) | 230 | if (stsi(vmms, 3, 2, 2) || !vmms->count) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | /* Running under KVM? If not we assume z/VM */ | 233 | /* Running under KVM? If not we assume z/VM */ |
@@ -246,7 +246,7 @@ static __init void setup_topology(void) | |||
246 | return; | 246 | return; |
247 | S390_lowcore.machine_flags |= MACHINE_FLAG_TOPOLOGY; | 247 | S390_lowcore.machine_flags |= MACHINE_FLAG_TOPOLOGY; |
248 | for (max_mnest = 6; max_mnest > 1; max_mnest--) { | 248 | for (max_mnest = 6; max_mnest > 1; max_mnest--) { |
249 | if (stsi(&sysinfo_page, 15, 1, max_mnest) != -ENOSYS) | 249 | if (stsi(&sysinfo_page, 15, 1, max_mnest) == 0) |
250 | break; | 250 | break; |
251 | } | 251 | } |
252 | topology_max_mnest = max_mnest; | 252 | topology_max_mnest = max_mnest; |
diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c index eca94e74d19a..6ea6d69339b5 100644 --- a/arch/s390/kernel/lgr.c +++ b/arch/s390/kernel/lgr.c | |||
@@ -51,16 +51,6 @@ static struct lgr_info lgr_info_cur; | |||
51 | static struct debug_info *lgr_dbf; | 51 | static struct debug_info *lgr_dbf; |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Return number of valid stsi levels | ||
55 | */ | ||
56 | static inline int stsi_0(void) | ||
57 | { | ||
58 | int rc = stsi(NULL, 0, 0, 0); | ||
59 | |||
60 | return rc == -ENOSYS ? rc : (((unsigned int) rc) >> 28); | ||
61 | } | ||
62 | |||
63 | /* | ||
64 | * Copy buffer and then convert it to ASCII | 54 | * Copy buffer and then convert it to ASCII |
65 | */ | 55 | */ |
66 | static void cpascii(char *dst, char *src, int size) | 56 | static void cpascii(char *dst, char *src, int size) |
@@ -76,7 +66,7 @@ static void lgr_stsi_1_1_1(struct lgr_info *lgr_info) | |||
76 | { | 66 | { |
77 | struct sysinfo_1_1_1 *si = (void *) lgr_page; | 67 | struct sysinfo_1_1_1 *si = (void *) lgr_page; |
78 | 68 | ||
79 | if (stsi(si, 1, 1, 1) == -ENOSYS) | 69 | if (stsi(si, 1, 1, 1)) |
80 | return; | 70 | return; |
81 | cpascii(lgr_info->manufacturer, si->manufacturer, | 71 | cpascii(lgr_info->manufacturer, si->manufacturer, |
82 | sizeof(si->manufacturer)); | 72 | sizeof(si->manufacturer)); |
@@ -93,7 +83,7 @@ static void lgr_stsi_2_2_2(struct lgr_info *lgr_info) | |||
93 | { | 83 | { |
94 | struct sysinfo_2_2_2 *si = (void *) lgr_page; | 84 | struct sysinfo_2_2_2 *si = (void *) lgr_page; |
95 | 85 | ||
96 | if (stsi(si, 2, 2, 2) == -ENOSYS) | 86 | if (stsi(si, 2, 2, 2)) |
97 | return; | 87 | return; |
98 | cpascii(lgr_info->name, si->name, sizeof(si->name)); | 88 | cpascii(lgr_info->name, si->name, sizeof(si->name)); |
99 | memcpy(&lgr_info->lpar_number, &si->lpar_number, | 89 | memcpy(&lgr_info->lpar_number, &si->lpar_number, |
@@ -108,7 +98,7 @@ static void lgr_stsi_3_2_2(struct lgr_info *lgr_info) | |||
108 | struct sysinfo_3_2_2 *si = (void *) lgr_page; | 98 | struct sysinfo_3_2_2 *si = (void *) lgr_page; |
109 | int i; | 99 | int i; |
110 | 100 | ||
111 | if (stsi(si, 3, 2, 2) == -ENOSYS) | 101 | if (stsi(si, 3, 2, 2)) |
112 | return; | 102 | return; |
113 | for (i = 0; i < min_t(u8, si->count, VM_LEVEL_MAX); i++) { | 103 | for (i = 0; i < min_t(u8, si->count, VM_LEVEL_MAX); i++) { |
114 | cpascii(lgr_info->vm[i].name, si->vm[i].name, | 104 | cpascii(lgr_info->vm[i].name, si->vm[i].name, |
@@ -124,16 +114,17 @@ static void lgr_stsi_3_2_2(struct lgr_info *lgr_info) | |||
124 | */ | 114 | */ |
125 | static void lgr_info_get(struct lgr_info *lgr_info) | 115 | static void lgr_info_get(struct lgr_info *lgr_info) |
126 | { | 116 | { |
117 | int level; | ||
118 | |||
127 | memset(lgr_info, 0, sizeof(*lgr_info)); | 119 | memset(lgr_info, 0, sizeof(*lgr_info)); |
128 | stfle(lgr_info->stfle_fac_list, ARRAY_SIZE(lgr_info->stfle_fac_list)); | 120 | stfle(lgr_info->stfle_fac_list, ARRAY_SIZE(lgr_info->stfle_fac_list)); |
129 | lgr_info->level = stsi_0(); | 121 | level = stsi(NULL, 0, 0, 0); |
130 | if (lgr_info->level == -ENOSYS) | 122 | lgr_info->level = level; |
131 | return; | 123 | if (level >= 1) |
132 | if (lgr_info->level >= 1) | ||
133 | lgr_stsi_1_1_1(lgr_info); | 124 | lgr_stsi_1_1_1(lgr_info); |
134 | if (lgr_info->level >= 2) | 125 | if (level >= 2) |
135 | lgr_stsi_2_2_2(lgr_info); | 126 | lgr_stsi_2_2_2(lgr_info); |
136 | if (lgr_info->level >= 3) | 127 | if (level >= 3) |
137 | lgr_stsi_3_2_2(lgr_info); | 128 | lgr_stsi_3_2_2(lgr_info); |
138 | } | 129 | } |
139 | 130 | ||
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c index 2af4ee67fe52..62f89d98e880 100644 --- a/arch/s390/kernel/sysinfo.c +++ b/arch/s390/kernel/sysinfo.c | |||
@@ -24,18 +24,38 @@ | |||
24 | 24 | ||
25 | int topology_max_mnest; | 25 | int topology_max_mnest; |
26 | 26 | ||
27 | static inline int stsi_0(void) | 27 | /* |
28 | * stsi - store system information | ||
29 | * | ||
30 | * Returns the current configuration level if function code 0 was specified. | ||
31 | * Otherwise returns 0 on success or a negative value on error. | ||
32 | */ | ||
33 | int stsi(void *sysinfo, int fc, int sel1, int sel2) | ||
28 | { | 34 | { |
29 | int rc = stsi(NULL, 0, 0, 0); | 35 | register int r0 asm("0") = (fc << 28) | sel1; |
30 | 36 | register int r1 asm("1") = sel2; | |
31 | return rc == -ENOSYS ? rc : (((unsigned int) rc) >> 28); | 37 | int rc = 0; |
38 | |||
39 | asm volatile( | ||
40 | " stsi 0(%3)\n" | ||
41 | "0: jz 2f\n" | ||
42 | "1: lhi %1,%4\n" | ||
43 | "2:\n" | ||
44 | EX_TABLE(0b, 1b) | ||
45 | : "+d" (r0), "+d" (rc) | ||
46 | : "d" (r1), "a" (sysinfo), "K" (-EOPNOTSUPP) | ||
47 | : "cc", "memory"); | ||
48 | if (rc) | ||
49 | return rc; | ||
50 | return fc ? 0 : ((unsigned int) r0) >> 28; | ||
32 | } | 51 | } |
52 | EXPORT_SYMBOL(stsi); | ||
33 | 53 | ||
34 | static void stsi_1_1_1(struct seq_file *m, struct sysinfo_1_1_1 *info) | 54 | static void stsi_1_1_1(struct seq_file *m, struct sysinfo_1_1_1 *info) |
35 | { | 55 | { |
36 | int i; | 56 | int i; |
37 | 57 | ||
38 | if (stsi(info, 1, 1, 1) == -ENOSYS) | 58 | if (stsi(info, 1, 1, 1)) |
39 | return; | 59 | return; |
40 | EBCASC(info->manufacturer, sizeof(info->manufacturer)); | 60 | EBCASC(info->manufacturer, sizeof(info->manufacturer)); |
41 | EBCASC(info->type, sizeof(info->type)); | 61 | EBCASC(info->type, sizeof(info->type)); |
@@ -97,7 +117,8 @@ static void stsi_15_1_x(struct seq_file *m, struct sysinfo_15_1_x *info) | |||
97 | seq_putc(m, '\n'); | 117 | seq_putc(m, '\n'); |
98 | if (!MACHINE_HAS_TOPOLOGY) | 118 | if (!MACHINE_HAS_TOPOLOGY) |
99 | return; | 119 | return; |
100 | stsi(info, 15, 1, topology_max_mnest); | 120 | if (stsi(info, 15, 1, topology_max_mnest)) |
121 | return; | ||
101 | seq_printf(m, "CPU Topology HW: "); | 122 | seq_printf(m, "CPU Topology HW: "); |
102 | for (i = 0; i < TOPOLOGY_NR_MAG; i++) | 123 | for (i = 0; i < TOPOLOGY_NR_MAG; i++) |
103 | seq_printf(m, " %d", info->mag[i]); | 124 | seq_printf(m, " %d", info->mag[i]); |
@@ -116,7 +137,7 @@ static void stsi_1_2_2(struct seq_file *m, struct sysinfo_1_2_2 *info) | |||
116 | struct sysinfo_1_2_2_extension *ext; | 137 | struct sysinfo_1_2_2_extension *ext; |
117 | int i; | 138 | int i; |
118 | 139 | ||
119 | if (stsi(info, 1, 2, 2) == -ENOSYS) | 140 | if (stsi(info, 1, 2, 2)) |
120 | return; | 141 | return; |
121 | ext = (struct sysinfo_1_2_2_extension *) | 142 | ext = (struct sysinfo_1_2_2_extension *) |
122 | ((unsigned long) info + info->acc_offset); | 143 | ((unsigned long) info + info->acc_offset); |
@@ -152,7 +173,7 @@ static void stsi_1_2_2(struct seq_file *m, struct sysinfo_1_2_2 *info) | |||
152 | 173 | ||
153 | static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info) | 174 | static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info) |
154 | { | 175 | { |
155 | if (stsi(info, 2, 2, 2) == -ENOSYS) | 176 | if (stsi(info, 2, 2, 2)) |
156 | return; | 177 | return; |
157 | EBCASC(info->name, sizeof(info->name)); | 178 | EBCASC(info->name, sizeof(info->name)); |
158 | seq_putc(m, '\n'); | 179 | seq_putc(m, '\n'); |
@@ -179,7 +200,7 @@ static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info) | |||
179 | { | 200 | { |
180 | int i; | 201 | int i; |
181 | 202 | ||
182 | if (stsi(info, 3, 2, 2) == -ENOSYS) | 203 | if (stsi(info, 3, 2, 2)) |
183 | return; | 204 | return; |
184 | for (i = 0; i < info->count; i++) { | 205 | for (i = 0; i < info->count; i++) { |
185 | EBCASC(info->vm[i].name, sizeof(info->vm[i].name)); | 206 | EBCASC(info->vm[i].name, sizeof(info->vm[i].name)); |
@@ -202,7 +223,7 @@ static int sysinfo_show(struct seq_file *m, void *v) | |||
202 | 223 | ||
203 | if (!info) | 224 | if (!info) |
204 | return 0; | 225 | return 0; |
205 | level = stsi_0(); | 226 | level = stsi(NULL, 0, 0, 0); |
206 | if (level >= 1) | 227 | if (level >= 1) |
207 | stsi_1_1_1(m, info); | 228 | stsi_1_1_1(m, info); |
208 | if (level >= 1) | 229 | if (level >= 1) |
@@ -365,7 +386,7 @@ void s390_adjust_jiffies(void) | |||
365 | if (!info) | 386 | if (!info) |
366 | return; | 387 | return; |
367 | 388 | ||
368 | if (stsi(info, 1, 2, 2) != -ENOSYS) { | 389 | if (stsi(info, 1, 2, 2) == 0) { |
369 | /* | 390 | /* |
370 | * Major sigh. The cpu capability encoding is "special". | 391 | * Major sigh. The cpu capability encoding is "special". |
371 | * If the first 9 bits of info->capability are 0 then it | 392 | * If the first 9 bits of info->capability are 0 then it |
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 60da903d6f3e..310be61bead7 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -211,7 +211,7 @@ static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem) | |||
211 | spin_unlock(&fi->lock); | 211 | spin_unlock(&fi->lock); |
212 | 212 | ||
213 | /* deal with other level 3 hypervisors */ | 213 | /* deal with other level 3 hypervisors */ |
214 | if (stsi(mem, 3, 2, 2) == -ENOSYS) | 214 | if (stsi(mem, 3, 2, 2)) |
215 | mem->count = 0; | 215 | mem->count = 0; |
216 | if (mem->count < 8) | 216 | if (mem->count < 8) |
217 | mem->count++; | 217 | mem->count++; |
@@ -259,7 +259,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
259 | mem = get_zeroed_page(GFP_KERNEL); | 259 | mem = get_zeroed_page(GFP_KERNEL); |
260 | if (!mem) | 260 | if (!mem) |
261 | goto out_fail; | 261 | goto out_fail; |
262 | if (stsi((void *) mem, fc, sel1, sel2) == -ENOSYS) | 262 | if (stsi((void *) mem, fc, sel1, sel2)) |
263 | goto out_mem; | 263 | goto out_mem; |
264 | break; | 264 | break; |
265 | case 3: | 265 | case 3: |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 7a8b09612c41..cf6da7fafe54 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -2993,7 +2993,7 @@ static void qeth_get_trap_id(struct qeth_card *card, struct qeth_trap_id *tid) | |||
2993 | struct sysinfo_2_2_2 *info222 = (struct sysinfo_2_2_2 *)info; | 2993 | struct sysinfo_2_2_2 *info222 = (struct sysinfo_2_2_2 *)info; |
2994 | struct sysinfo_3_2_2 *info322 = (struct sysinfo_3_2_2 *)info; | 2994 | struct sysinfo_3_2_2 *info322 = (struct sysinfo_3_2_2 *)info; |
2995 | struct ccw_dev_id ccwid; | 2995 | struct ccw_dev_id ccwid; |
2996 | int level, rc; | 2996 | int level; |
2997 | 2997 | ||
2998 | tid->chpid = card->info.chpid; | 2998 | tid->chpid = card->info.chpid; |
2999 | ccw_device_get_id(CARD_RDEV(card), &ccwid); | 2999 | ccw_device_get_id(CARD_RDEV(card), &ccwid); |
@@ -3001,17 +3001,10 @@ static void qeth_get_trap_id(struct qeth_card *card, struct qeth_trap_id *tid) | |||
3001 | tid->devno = ccwid.devno; | 3001 | tid->devno = ccwid.devno; |
3002 | if (!info) | 3002 | if (!info) |
3003 | return; | 3003 | return; |
3004 | 3004 | level = stsi(NULL, 0, 0, 0); | |
3005 | rc = stsi(NULL, 0, 0, 0); | 3005 | if ((level >= 2) && (stsi(info222, 2, 2, 2) == 0)) |
3006 | if (rc == -ENOSYS) | ||
3007 | level = rc; | ||
3008 | else | ||
3009 | level = (((unsigned int) rc) >> 28); | ||
3010 | |||
3011 | if ((level >= 2) && (stsi(info222, 2, 2, 2) != -ENOSYS)) | ||
3012 | tid->lparnr = info222->lpar_number; | 3006 | tid->lparnr = info222->lpar_number; |
3013 | 3007 | if ((level >= 3) && (stsi(info322, 3, 2, 2) == 0)) { | |
3014 | if ((level >= 3) && (stsi(info322, 3, 2, 2) != -ENOSYS)) { | ||
3015 | EBCASC(info322->vm[0].name, sizeof(info322->vm[0].name)); | 3008 | EBCASC(info322->vm[0].name, sizeof(info322->vm[0].name)); |
3016 | memcpy(tid->vmname, info322->vm[0].name, sizeof(tid->vmname)); | 3009 | memcpy(tid->vmname, info322->vm[0].name, sizeof(tid->vmname)); |
3017 | } | 3010 | } |