Skip to content

Commit fb6958a

Browse files
Cornelia HuckLinus Torvalds
authored andcommitted
[PATCH] s390: multiple subchannel sets support
Add support for multiple subchannel sets. Works with arbitrary devices in subchannel set 1 and is transparent to device drivers. Although currently only two subchannel sets are available, this will work with the architectured maximum number of subchannel sets as well. Signed-off-by: Cornelia Huck <cohuck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 678a395 commit fb6958a

16 files changed

Lines changed: 354 additions & 165 deletions

File tree

‎drivers/s390/cio/blacklist.c‎

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* drivers/s390/cio/blacklist.c
33
* S/390 common I/O routines -- blacklisting of specific devices
4-
* $Revision: 1.35 $
4+
* $Revision: 1.39 $
55
*
66
* Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
77
* IBM Corporation
@@ -35,32 +35,34 @@
3535
* These can be single devices or ranges of devices
3636
*/
3737

38-
/* 65536 bits to indicate if a devno is blacklisted or not */
38+
/* 65536 bits for each set to indicate if a devno is blacklisted or not */
3939
#define __BL_DEV_WORDS ((__MAX_SUBCHANNEL + (8*sizeof(long) - 1)) / \
4040
(8*sizeof(long)))
41-
static unsigned long bl_dev[__BL_DEV_WORDS];
41+
static unsigned long bl_dev[__MAX_SSID + 1][__BL_DEV_WORDS];
4242
typedef enum {add, free} range_action;
4343

4444
/*
4545
* Function: blacklist_range
4646
* (Un-)blacklist the devices from-to
4747
*/
4848
static inline void
49-
blacklist_range (range_action action, unsigned int from, unsigned int to)
49+
blacklist_range (range_action action, unsigned int from, unsigned int to,
50+
unsigned int ssid)
5051
{
5152
if (!to)
5253
to = from;
5354

54-
if (from > to || to > __MAX_SUBCHANNEL) {
55+
if (from > to || to > __MAX_SUBCHANNEL || ssid > __MAX_SSID) {
5556
printk (KERN_WARNING "Invalid blacklist range "
56-
"0x%04x to 0x%04x, skipping\n", from, to);
57+
"0.%x.%04x to 0.%x.%04x, skipping\n",
58+
ssid, from, ssid, to);
5759
return;
5860
}
5961
for (; from <= to; from++) {
6062
if (action == add)
61-
set_bit (from, bl_dev);
63+
set_bit (from, bl_dev[ssid]);
6264
else
63-
clear_bit (from, bl_dev);
65+
clear_bit (from, bl_dev[ssid]);
6466
}
6567
}
6668

@@ -70,7 +72,7 @@ blacklist_range (range_action action, unsigned int from, unsigned int to)
7072
* Shamelessly grabbed from dasd_devmap.c.
7173
*/
7274
static inline int
73-
blacklist_busid(char **str, int *id0, int *id1, int *devno)
75+
blacklist_busid(char **str, int *id0, int *ssid, int *devno)
7476
{
7577
int val, old_style;
7678
char *sav;
@@ -87,7 +89,7 @@ blacklist_busid(char **str, int *id0, int *id1, int *devno)
8789
goto confused;
8890
val = simple_strtoul(*str, str, 16);
8991
if (old_style || (*str)[0] != '.') {
90-
*id0 = *id1 = 0;
92+
*id0 = *ssid = 0;
9193
if (val < 0 || val > 0xffff)
9294
goto confused;
9395
*devno = val;
@@ -106,7 +108,7 @@ blacklist_busid(char **str, int *id0, int *id1, int *devno)
106108
val = simple_strtoul(*str, str, 16);
107109
if (val < 0 || val > 0xff || (*str)++[0] != '.')
108110
goto confused;
109-
*id1 = val;
111+
*ssid = val;
110112
if (!isxdigit((*str)[0])) /* We require at least one hex digit */
111113
goto confused;
112114
val = simple_strtoul(*str, str, 16);
@@ -126,7 +128,7 @@ blacklist_busid(char **str, int *id0, int *id1, int *devno)
126128
static inline int
127129
blacklist_parse_parameters (char *str, range_action action)
128130
{
129-
unsigned int from, to, from_id0, to_id0, from_id1, to_id1;
131+
unsigned int from, to, from_id0, to_id0, from_ssid, to_ssid;
130132

131133
while (*str != 0 && *str != '\n') {
132134
range_action ra = action;
@@ -143,23 +145,25 @@ blacklist_parse_parameters (char *str, range_action action)
143145
*/
144146
if (strncmp(str,"all,",4) == 0 || strcmp(str,"all") == 0 ||
145147
strncmp(str,"all\n",4) == 0 || strncmp(str,"all ",4) == 0) {
146-
from = 0;
147-
to = __MAX_SUBCHANNEL;
148+
int j;
149+
148150
str += 3;
151+
for (j=0; j <= __MAX_SSID; j++)
152+
blacklist_range(ra, 0, __MAX_SUBCHANNEL, j);
149153
} else {
150154
int rc;
151155

152156
rc = blacklist_busid(&str, &from_id0,
153-
&from_id1, &from);
157+
&from_ssid, &from);
154158
if (rc)
155159
continue;
156160
to = from;
157161
to_id0 = from_id0;
158-
to_id1 = from_id1;
162+
to_ssid = from_ssid;
159163
if (*str == '-') {
160164
str++;
161165
rc = blacklist_busid(&str, &to_id0,
162-
&to_id1, &to);
166+
&to_ssid, &to);
163167
if (rc)
164168
continue;
165169
}
@@ -169,18 +173,19 @@ blacklist_parse_parameters (char *str, range_action action)
169173
strsep(&str, ",\n"));
170174
continue;
171175
}
172-
if ((from_id0 != to_id0) || (from_id1 != to_id1)) {
176+
if ((from_id0 != to_id0) ||
177+
(from_ssid != to_ssid)) {
173178
printk(KERN_WARNING "invalid cio_ignore range "
174179
"%x.%x.%04x-%x.%x.%04x\n",
175-
from_id0, from_id1, from,
176-
to_id0, to_id1, to);
180+
from_id0, from_ssid, from,
181+
to_id0, to_ssid, to);
177182
continue;
178183
}
184+
pr_debug("blacklist_setup: adding range "
185+
"from %x.%x.%04x to %x.%x.%04x\n",
186+
from_id0, from_ssid, from, to_id0, to_ssid, to);
187+
blacklist_range (ra, from, to, to_ssid);
179188
}
180-
/* FIXME: ignoring id0 and id1 here. */
181-
pr_debug("blacklist_setup: adding range "
182-
"from 0.0.%04x to 0.0.%04x\n", from, to);
183-
blacklist_range (ra, from, to);
184189
}
185190
return 1;
186191
}
@@ -214,9 +219,9 @@ __setup ("cio_ignore=", blacklist_setup);
214219
* Used by validate_subchannel()
215220
*/
216221
int
217-
is_blacklisted (int devno)
222+
is_blacklisted (int ssid, int devno)
218223
{
219-
return test_bit (devno, bl_dev);
224+
return test_bit (devno, bl_dev[ssid]);
220225
}
221226

222227
#ifdef CONFIG_PROC_FS
@@ -283,6 +288,7 @@ blacklist_parse_proc_parameters (char *buf)
283288
/* Iterator struct for all devices. */
284289
struct ccwdev_iter {
285290
int devno;
291+
int ssid;
286292
int in_range;
287293
};
288294

@@ -291,13 +297,14 @@ cio_ignore_proc_seq_start(struct seq_file *s, loff_t *offset)
291297
{
292298
struct ccwdev_iter *iter;
293299

294-
if (*offset > __MAX_SUBCHANNEL)
300+
if (*offset >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
295301
return NULL;
296302
iter = kmalloc(sizeof(struct ccwdev_iter), GFP_KERNEL);
297303
if (!iter)
298304
return ERR_PTR(-ENOMEM);
299305
memset(iter, 0, sizeof(struct ccwdev_iter));
300-
iter->devno = *offset;
306+
iter->ssid = *offset / (__MAX_SUBCHANNEL + 1);
307+
iter->devno = *offset % (__MAX_SUBCHANNEL + 1);
301308
return iter;
302309
}
303310

@@ -313,10 +320,16 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
313320
{
314321
struct ccwdev_iter *iter;
315322

316-
if (*offset > __MAX_SUBCHANNEL)
323+
if (*offset >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
317324
return NULL;
318325
iter = (struct ccwdev_iter *)it;
319-
iter->devno++;
326+
if (iter->devno == __MAX_SUBCHANNEL) {
327+
iter->devno = 0;
328+
iter->ssid++;
329+
if (iter->ssid > __MAX_SSID)
330+
return NULL;
331+
} else
332+
iter->devno++;
320333
(*offset)++;
321334
return iter;
322335
}
@@ -327,23 +340,24 @@ cio_ignore_proc_seq_show(struct seq_file *s, void *it)
327340
struct ccwdev_iter *iter;
328341

329342
iter = (struct ccwdev_iter *)it;
330-
if (!is_blacklisted(iter->devno))
343+
if (!is_blacklisted(iter->ssid, iter->devno))
331344
/* Not blacklisted, nothing to output. */
332345
return 0;
333346
if (!iter->in_range) {
334347
/* First device in range. */
335348
if ((iter->devno == __MAX_SUBCHANNEL) ||
336-
!is_blacklisted(iter->devno + 1))
349+
!is_blacklisted(iter->ssid, iter->devno + 1))
337350
/* Singular device. */
338-
return seq_printf(s, "0.0.%04x\n", iter->devno);
351+
return seq_printf(s, "0.%x.%04x\n",
352+
iter->ssid, iter->devno);
339353
iter->in_range = 1;
340-
return seq_printf(s, "0.0.%04x-", iter->devno);
354+
return seq_printf(s, "0.%x.%04x-", iter->ssid, iter->devno);
341355
}
342356
if ((iter->devno == __MAX_SUBCHANNEL) ||
343-
!is_blacklisted(iter->devno + 1)) {
357+
!is_blacklisted(iter->ssid, iter->devno + 1)) {
344358
/* Last device in range. */
345359
iter->in_range = 0;
346-
return seq_printf(s, "0.0.%04x\n", iter->devno);
360+
return seq_printf(s, "0.%x.%04x\n", iter->ssid, iter->devno);
347361
}
348362
return 0;
349363
}

‎drivers/s390/cio/blacklist.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef S390_BLACKLIST_H
22
#define S390_BLACKLIST_H
33

4-
extern int is_blacklisted (int devno);
4+
extern int is_blacklisted (int ssid, int devno);
55

66
#endif

‎drivers/s390/cio/chsc.c‎

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* drivers/s390/cio/chsc.c
33
* S/390 common I/O routines -- channel subsystem call
4-
* $Revision: 1.120 $
4+
* $Revision: 1.126 $
55
*
66
* Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
77
* IBM Corporation
@@ -75,7 +75,9 @@ chsc_get_sch_desc_irq(struct subchannel *sch, void *page)
7575

7676
struct {
7777
struct chsc_header request;
78-
u16 reserved1;
78+
u16 reserved1a:10;
79+
u16 ssid:2;
80+
u16 reserved1b:4;
7981
u16 f_sch; /* first subchannel */
8082
u16 reserved2;
8183
u16 l_sch; /* last subchannel */
@@ -102,6 +104,7 @@ chsc_get_sch_desc_irq(struct subchannel *sch, void *page)
102104
.code = 0x0004,
103105
};
104106

107+
ssd_area->ssid = sch->schid.ssid;
105108
ssd_area->f_sch = sch->schid.sch_no;
106109
ssd_area->l_sch = sch->schid.sch_no;
107110

@@ -145,8 +148,8 @@ chsc_get_sch_desc_irq(struct subchannel *sch, void *page)
145148
*/
146149
if (ssd_area->st > 3) { /* uhm, that looks strange... */
147150
CIO_CRW_EVENT(0, "Strange subchannel type %d"
148-
" for sch %04x\n", ssd_area->st,
149-
sch->schid.sch_no);
151+
" for sch 0.%x.%04x\n", ssd_area->st,
152+
sch->schid.ssid, sch->schid.sch_no);
150153
/*
151154
* There may have been a new subchannel type defined in the
152155
* time since this code was written; since we don't know which
@@ -155,8 +158,9 @@ chsc_get_sch_desc_irq(struct subchannel *sch, void *page)
155158
return 0;
156159
} else {
157160
const char *type[4] = {"I/O", "chsc", "message", "ADM"};
158-
CIO_CRW_EVENT(6, "ssd: sch %04x is %s subchannel\n",
159-
sch->schid.sch_no, type[ssd_area->st]);
161+
CIO_CRW_EVENT(6, "ssd: sch 0.%x.%04x is %s subchannel\n",
162+
sch->schid.ssid, sch->schid.sch_no,
163+
type[ssd_area->st]);
160164

161165
sch->ssd_info.valid = 1;
162166
sch->ssd_info.type = ssd_area->st;
@@ -364,7 +368,7 @@ s390_process_res_acc_new_sch(struct subchannel_id schid)
364368
* that beast may be on we'll have to do a stsch
365369
* on all devices, grr...
366370
*/
367-
if (stsch(schid, &schib))
371+
if (stsch_err(schid, &schib))
368372
/* We're through */
369373
return need_rescan ? -EAGAIN : -ENXIO;
370374

@@ -818,7 +822,7 @@ __s390_vary_chpid_on(struct subchannel_id schid, void *data)
818822
put_device(&sch->dev);
819823
return 0;
820824
}
821-
if (stsch(schid, &schib))
825+
if (stsch_err(schid, &schib))
822826
/* We're through */
823827
return -ENXIO;
824828
/* Put it on the slow path. */
@@ -1078,6 +1082,54 @@ chsc_alloc_sei_area(void)
10781082
return (sei_page ? 0 : -ENOMEM);
10791083
}
10801084

1085+
int __init
1086+
chsc_enable_facility(int operation_code)
1087+
{
1088+
int ret;
1089+
struct {
1090+
struct chsc_header request;
1091+
u8 reserved1:4;
1092+
u8 format:4;
1093+
u8 reserved2;
1094+
u16 operation_code;
1095+
u32 reserved3;
1096+
u32 reserved4;
1097+
u32 operation_data_area[252];
1098+
struct chsc_header response;
1099+
u32 reserved5:4;
1100+
u32 format2:4;
1101+
u32 reserved6:24;
1102+
} *sda_area;
1103+
1104+
sda_area = (void *)get_zeroed_page(GFP_KERNEL|GFP_DMA);
1105+
if (!sda_area)
1106+
return -ENOMEM;
1107+
sda_area->request = (struct chsc_header) {
1108+
.length = 0x0400,
1109+
.code = 0x0031,
1110+
};
1111+
sda_area->operation_code = operation_code;
1112+
1113+
ret = chsc(sda_area);
1114+
if (ret > 0) {
1115+
ret = (ret == 3) ? -ENODEV : -EBUSY;
1116+
goto out;
1117+
}
1118+
switch (sda_area->response.code) {
1119+
case 0x0003: /* invalid request block */
1120+
case 0x0007:
1121+
ret = -EINVAL;
1122+
break;
1123+
case 0x0004: /* command not provided */
1124+
case 0x0101: /* facility not provided */
1125+
ret = -EOPNOTSUPP;
1126+
break;
1127+
}
1128+
out:
1129+
free_page((unsigned long)sda_area);
1130+
return ret;
1131+
}
1132+
10811133
subsys_initcall(chsc_alloc_sei_area);
10821134

10831135
struct css_general_char css_general_characteristics;

‎drivers/s390/cio/chsc.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#define CHSC_SEI_ACC_LINKADDR 2
66
#define CHSC_SEI_ACC_FULLLINKADDR 3
77

8+
#define CHSC_SDA_OC_MSS 0x2
9+
810
struct chsc_header {
911
u16 length;
1012
u16 code;
@@ -64,6 +66,8 @@ extern int css_characteristics_avail;
6466

6567
extern void *chsc_get_chp_desc(struct subchannel*, int);
6668

69+
extern int chsc_enable_facility(int);
70+
6771
#define to_channelpath(dev) container_of(dev, struct channel_path, dev)
6872

6973
#endif

0 commit comments

Comments
 (0)