Commit 8129ee164267dc030b8e1d541ee3643c0b9f2fa1

Authored by Frank Pavlic
Committed by Linus Torvalds
1 parent 05f29fcdb0

[PATCH] s390: qdio V=V pass-through

New feature V=V qdio pass-through.

QDIO and HiperSockets processing in z/VM V=V guest environments (as well as
V=R with z/VM running in LPAR mode) requires shadowing of all QDIO
architecture queue elements.  Especially the shadowing of SBALs and SLSBs
structures in the hypervisor, and the need to issue SIGA SYNC operations to
observe state changes, eventually causes significant CPU processing overhead
in the hypervisor.

The QDIO pass-through support for V=V guests avoids the shadowing of SBALs and
SLSBs.  This significantly reduces the hypervisor overhead for QDIO based I/O.

Signed-off-by: Frank Pavlic <pavlic@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>

Showing 5 changed files with 556 additions and 156 deletions Side-by-side Diff

... ... @@ -240,8 +240,8 @@
240 240 config QDIO
241 241 tristate "QDIO support"
242 242 ---help---
243   - This driver provides the Queued Direct I/O base support for the
244   - IBM S/390 (G5 and G6) and eServer zSeries (z800, z890, z900 and z990).
  243 + This driver provides the Queued Direct I/O base support for
  244 + IBM mainframes.
245 245  
246 246 For details please refer to the documentation provided by IBM at
247 247 <http://www10.software.ibm.com/developerworks/opensource/linux390>
... ... @@ -263,7 +263,8 @@
263 263 bool "Extended debugging information"
264 264 depends on QDIO
265 265 help
266   - Say Y here to get extended debugging output in /proc/s390dbf/qdio...
  266 + Say Y here to get extended debugging output in
  267 + /sys/kernel/debug/s390dbf/qdio...
267 268 Warning: this option reduces the performance of the QDIO module.
268 269  
269 270 If unsure, say N.
drivers/s390/cio/chsc.h
... ... @@ -43,7 +43,9 @@
43 43 u32 ext_mb : 1; /* bit 48 */
44 44 u32 : 7;
45 45 u32 aif_tdd : 1; /* bit 56 */
46   - u32 : 10;
  46 + u32 : 1;
  47 + u32 qebsm : 1; /* bit 58 */
  48 + u32 : 8;
47 49 u32 aif_osa : 1; /* bit 67 */
48 50 u32 : 28;
49 51 }__attribute__((packed));
drivers/s390/cio/qdio.c
... ... @@ -56,7 +56,7 @@
56 56 #include "ioasm.h"
57 57 #include "chsc.h"
58 58  
59   -#define VERSION_QDIO_C "$Revision: 1.108 $"
  59 +#define VERSION_QDIO_C "$Revision: 1.113 $"
60 60  
61 61 /****************** MODULE PARAMETER VARIABLES ********************/
62 62 MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>");
... ... @@ -76,6 +76,7 @@
76 76 #endif /* QDIO_PERFORMANCE_STATS */
77 77  
78 78 static int hydra_thinints;
  79 +static int is_passthrough = 0;
79 80 static int omit_svs;
80 81  
81 82 static int indicator_used[INDICATORS_PER_CACHELINE];
82 83  
83 84  
84 85  
... ... @@ -136,12 +137,126 @@
136 137 atomic_dec(&q->use_count);
137 138 }
138 139  
139   -static volatile inline void
140   -qdio_set_slsb(volatile char *slsb, unsigned char value)
  140 +/*check ccq */
  141 +static inline int
  142 +qdio_check_ccq(struct qdio_q *q, unsigned int ccq)
141 143 {
142   - xchg((char*)slsb,value);
  144 + char dbf_text[15];
  145 +
  146 + if (ccq == 0 || ccq == 32 || ccq == 96)
  147 + return 0;
  148 + if (ccq == 97)
  149 + return 1;
  150 + /*notify devices immediately*/
  151 + sprintf(dbf_text,"%d", ccq);
  152 + QDIO_DBF_TEXT2(1,trace,dbf_text);
  153 + return -EIO;
143 154 }
  155 +/* EQBS: extract buffer states */
  156 +static inline int
  157 +qdio_do_eqbs(struct qdio_q *q, unsigned char *state,
  158 + unsigned int *start, unsigned int *cnt)
  159 +{
  160 + struct qdio_irq *irq;
  161 + unsigned int tmp_cnt, q_no, ccq;
  162 + int rc ;
  163 + char dbf_text[15];
144 164  
  165 + ccq = 0;
  166 + tmp_cnt = *cnt;
  167 + irq = (struct qdio_irq*)q->irq_ptr;
  168 + q_no = q->q_no;
  169 + if(!q->is_input_q)
  170 + q_no += irq->no_input_qs;
  171 + ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt);
  172 + rc = qdio_check_ccq(q, ccq);
  173 + if (rc < 0) {
  174 + QDIO_DBF_TEXT2(1,trace,"eqberr");
  175 + sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt, *cnt, ccq, q_no);
  176 + QDIO_DBF_TEXT2(1,trace,dbf_text);
  177 + q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION|
  178 + QDIO_STATUS_LOOK_FOR_ERROR,
  179 + 0, 0, 0, -1, -1, q->int_parm);
  180 + return 0;
  181 + }
  182 + return (tmp_cnt - *cnt);
  183 +}
  184 +
  185 +/* SQBS: set buffer states */
  186 +static inline int
  187 +qdio_do_sqbs(struct qdio_q *q, unsigned char state,
  188 + unsigned int *start, unsigned int *cnt)
  189 +{
  190 + struct qdio_irq *irq;
  191 + unsigned int tmp_cnt, q_no, ccq;
  192 + int rc;
  193 + char dbf_text[15];
  194 +
  195 + ccq = 0;
  196 + tmp_cnt = *cnt;
  197 + irq = (struct qdio_irq*)q->irq_ptr;
  198 + q_no = q->q_no;
  199 + if(!q->is_input_q)
  200 + q_no += irq->no_input_qs;
  201 + ccq = do_sqbs(irq->sch_token, state, q_no, start, cnt);
  202 + rc = qdio_check_ccq(q, ccq);
  203 + if (rc < 0) {
  204 + QDIO_DBF_TEXT3(1,trace,"sqberr");
  205 + sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no);
  206 + QDIO_DBF_TEXT3(1,trace,dbf_text);
  207 + q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION|
  208 + QDIO_STATUS_LOOK_FOR_ERROR,
  209 + 0, 0, 0, -1, -1, q->int_parm);
  210 + return 0;
  211 + }
  212 + return (tmp_cnt - *cnt);
  213 +}
  214 +
  215 +static inline int
  216 +qdio_set_slsb(struct qdio_q *q, unsigned int *bufno,
  217 + unsigned char state, unsigned int *count)
  218 +{
  219 + volatile char *slsb;
  220 + struct qdio_irq *irq;
  221 +
  222 + irq = (struct qdio_irq*)q->irq_ptr;
  223 + if (!irq->is_qebsm) {
  224 + slsb = (char *)&q->slsb.acc.val[(*bufno)];
  225 + xchg(slsb, state);
  226 + return 1;
  227 + }
  228 + return qdio_do_sqbs(q, state, bufno, count);
  229 +}
  230 +
  231 +#ifdef CONFIG_QDIO_DEBUG
  232 +static inline void
  233 +qdio_trace_slsb(struct qdio_q *q)
  234 +{
  235 + if (q->queue_type==QDIO_TRACE_QTYPE) {
  236 + if (q->is_input_q)
  237 + QDIO_DBF_HEX2(0,slsb_in,&q->slsb,
  238 + QDIO_MAX_BUFFERS_PER_Q);
  239 + else
  240 + QDIO_DBF_HEX2(0,slsb_out,&q->slsb,
  241 + QDIO_MAX_BUFFERS_PER_Q);
  242 + }
  243 +}
  244 +#endif
  245 +
  246 +static inline int
  247 +set_slsb(struct qdio_q *q, unsigned int *bufno,
  248 + unsigned char state, unsigned int *count)
  249 +{
  250 + int rc;
  251 +#ifdef CONFIG_QDIO_DEBUG
  252 + qdio_trace_slsb(q);
  253 +#endif
  254 + rc = qdio_set_slsb(q, bufno, state, count);
  255 +#ifdef CONFIG_QDIO_DEBUG
  256 + qdio_trace_slsb(q);
  257 +#endif
  258 + return rc;
  259 +}
145 260 static inline int
146 261 qdio_siga_sync(struct qdio_q *q, unsigned int gpr2,
147 262 unsigned int gpr3)
... ... @@ -155,7 +270,7 @@
155 270 perf_stats.siga_syncs++;
156 271 #endif /* QDIO_PERFORMANCE_STATS */
157 272  
158   - cc = do_siga_sync(q->irq, gpr2, gpr3);
  273 + cc = do_siga_sync(0x10000|q->irq, gpr2, gpr3);
159 274 if (cc)
160 275 QDIO_DBF_HEX3(0,trace,&cc,sizeof(int*));
161 276  
... ... @@ -170,6 +285,19 @@
170 285 return qdio_siga_sync(q, q->mask, 0);
171 286 }
172 287  
  288 +static int
  289 +__do_siga_output(struct qdio_q *q, unsigned int *busy_bit)
  290 +{
  291 + struct qdio_irq *irq;
  292 + unsigned int fc = 0;
  293 +
  294 + irq = (struct qdio_irq *) q->irq_ptr;
  295 + if (!irq->is_qebsm)
  296 + return do_siga_output(0x10000|q->irq, q->mask, busy_bit, fc);
  297 + fc |= 0x80;
  298 + return do_siga_output(irq->sch_token, q->mask, busy_bit, fc);
  299 +}
  300 +
173 301 /*
174 302 * returns QDIO_SIGA_ERROR_ACCESS_EXCEPTION as cc, when SIGA returns
175 303 * an access exception
... ... @@ -189,7 +317,7 @@
189 317 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
190 318  
191 319 for (;;) {
192   - cc = do_siga_output(q->irq, q->mask, &busy_bit);
  320 + cc = __do_siga_output(q, &busy_bit);
193 321 //QDIO_PRINT_ERR("cc=%x, busy=%x\n",cc,busy_bit);
194 322 if ((cc==2) && (busy_bit) && (q->is_iqdio_q)) {
195 323 if (!start_time)
... ... @@ -221,7 +349,7 @@
221 349 perf_stats.siga_ins++;
222 350 #endif /* QDIO_PERFORMANCE_STATS */
223 351  
224   - cc = do_siga_input(q->irq, q->mask);
  352 + cc = do_siga_input(0x10000|q->irq, q->mask);
225 353  
226 354 if (cc)
227 355 QDIO_DBF_HEX3(0,trace,&cc,sizeof(int*));
... ... @@ -230,7 +358,7 @@
230 358 }
231 359  
232 360 /* locked by the locks in qdio_activate and qdio_cleanup */
233   -static __u32 volatile *
  361 +static __u32 *
234 362 qdio_get_indicator(void)
235 363 {
236 364 int i;
... ... @@ -258,7 +386,7 @@
258 386 atomic_dec(&spare_indicator_usecount);
259 387 }
260 388  
261   -static inline volatile void
  389 +static inline void
262 390 tiqdio_clear_summary_bit(__u32 *location)
263 391 {
264 392 QDIO_DBF_TEXT5(0,trace,"clrsummb");
... ... @@ -267,7 +395,7 @@
267 395 xchg(location,0);
268 396 }
269 397  
270   -static inline volatile void
  398 +static inline void
271 399 tiqdio_set_summary_bit(__u32 *location)
272 400 {
273 401 QDIO_DBF_TEXT5(0,trace,"setsummb");
... ... @@ -336,7 +464,9 @@
336 464 qdio_stop_polling(struct qdio_q *q)
337 465 {
338 466 #ifdef QDIO_USE_PROCESSING_STATE
339   - int gsf;
  467 + unsigned int tmp, gsf, count = 1;
  468 + unsigned char state = 0;
  469 + struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
340 470  
341 471 if (!atomic_swap(&q->polling,0))
342 472 return 1;
343 473  
... ... @@ -348,17 +478,22 @@
348 478 if (!q->is_input_q)
349 479 return 1;
350 480  
351   - gsf=GET_SAVED_FRONTIER(q);
352   - set_slsb(&q->slsb.acc.val[(gsf+QDIO_MAX_BUFFERS_PER_Q-1)&
353   - (QDIO_MAX_BUFFERS_PER_Q-1)],
354   - SLSB_P_INPUT_NOT_INIT);
  481 + tmp = gsf = GET_SAVED_FRONTIER(q);
  482 + tmp = ((tmp + QDIO_MAX_BUFFERS_PER_Q-1) & (QDIO_MAX_BUFFERS_PER_Q-1) );
  483 + set_slsb(q, &tmp, SLSB_P_INPUT_NOT_INIT, &count);
  484 +
355 485 /*
356 486 * we don't issue this SYNC_MEMORY, as we trust Rick T and
357 487 * moreover will not use the PROCESSING state under VM, so
358 488 * q->polling was 0 anyway
359 489 */
360 490 /*SYNC_MEMORY;*/
361   - if (q->slsb.acc.val[gsf]!=SLSB_P_INPUT_PRIMED)
  491 + if (irq->is_qebsm) {
  492 + count = 1;
  493 + qdio_do_eqbs(q, &state, &gsf, &count);
  494 + } else
  495 + state = q->slsb.acc.val[gsf];
  496 + if (state != SLSB_P_INPUT_PRIMED)
362 497 return 1;
363 498 /*
364 499 * set our summary bit again, as otherwise there is a
365 500  
366 501  
367 502  
... ... @@ -431,18 +566,136 @@
431 566  
432 567  
433 568 /************************* OUTBOUND ROUTINES *******************************/
  569 +static int
  570 +qdio_qebsm_get_outbound_buffer_frontier(struct qdio_q *q)
  571 +{
  572 + struct qdio_irq *irq;
  573 + unsigned char state;
  574 + unsigned int cnt, count, ftc;
434 575  
  576 + irq = (struct qdio_irq *) q->irq_ptr;
  577 + if ((!q->is_iqdio_q) && (!q->hydra_gives_outbound_pcis))
  578 + SYNC_MEMORY;
  579 +
  580 + ftc = q->first_to_check;
  581 + count = qdio_min(atomic_read(&q->number_of_buffers_used),
  582 + (QDIO_MAX_BUFFERS_PER_Q-1));
  583 + if (count == 0)
  584 + return q->first_to_check;
  585 + cnt = qdio_do_eqbs(q, &state, &ftc, &count);
  586 + if (cnt == 0)
  587 + return q->first_to_check;
  588 + switch (state) {
  589 + case SLSB_P_OUTPUT_ERROR:
  590 + QDIO_DBF_TEXT3(0,trace,"outperr");
  591 + atomic_sub(cnt , &q->number_of_buffers_used);
  592 + if (q->qdio_error)
  593 + q->error_status_flags |=
  594 + QDIO_STATUS_MORE_THAN_ONE_QDIO_ERROR;
  595 + q->qdio_error = SLSB_P_OUTPUT_ERROR;
  596 + q->error_status_flags |= QDIO_STATUS_LOOK_FOR_ERROR;
  597 + q->first_to_check = ftc;
  598 + break;
  599 + case SLSB_P_OUTPUT_EMPTY:
  600 + QDIO_DBF_TEXT5(0,trace,"outpempt");
  601 + atomic_sub(cnt, &q->number_of_buffers_used);
  602 + q->first_to_check = ftc;
  603 + break;
  604 + case SLSB_CU_OUTPUT_PRIMED:
  605 + /* all buffers primed */
  606 + QDIO_DBF_TEXT5(0,trace,"outpprim");
  607 + break;
  608 + default:
  609 + break;
  610 + }
  611 + QDIO_DBF_HEX4(0,trace,&q->first_to_check,sizeof(int));
  612 + return q->first_to_check;
  613 +}
  614 +
  615 +static int
  616 +qdio_qebsm_get_inbound_buffer_frontier(struct qdio_q *q)
  617 +{
  618 + struct qdio_irq *irq;
  619 + unsigned char state;
  620 + int tmp, ftc, count, cnt;
  621 + char dbf_text[15];
  622 +
  623 +
  624 + irq = (struct qdio_irq *) q->irq_ptr;
  625 + ftc = q->first_to_check;
  626 + count = qdio_min(atomic_read(&q->number_of_buffers_used),
  627 + (QDIO_MAX_BUFFERS_PER_Q-1));
  628 + if (count == 0)
  629 + return q->first_to_check;
  630 + cnt = qdio_do_eqbs(q, &state, &ftc, &count);
  631 + if (cnt == 0)
  632 + return q->first_to_check;
  633 + switch (state) {
  634 + case SLSB_P_INPUT_ERROR :
  635 +#ifdef CONFIG_QDIO_DEBUG
  636 + QDIO_DBF_TEXT3(1,trace,"inperr");
  637 + sprintf(dbf_text,"%2x,%2x",ftc,count);
  638 + QDIO_DBF_TEXT3(1,trace,dbf_text);
  639 +#endif /* CONFIG_QDIO_DEBUG */
  640 + if (q->qdio_error)
  641 + q->error_status_flags |=
  642 + QDIO_STATUS_MORE_THAN_ONE_QDIO_ERROR;
  643 + q->qdio_error = SLSB_P_INPUT_ERROR;
  644 + q->error_status_flags |= QDIO_STATUS_LOOK_FOR_ERROR;
  645 + atomic_sub(cnt, &q->number_of_buffers_used);
  646 + q->first_to_check = ftc;
  647 + break;
  648 + case SLSB_P_INPUT_PRIMED :
  649 + QDIO_DBF_TEXT3(0,trace,"inptprim");
  650 + sprintf(dbf_text,"%2x,%2x",ftc,count);
  651 + QDIO_DBF_TEXT3(1,trace,dbf_text);
  652 + tmp = 0;
  653 + ftc = q->first_to_check;
  654 +#ifdef QDIO_USE_PROCESSING_STATE
  655 + if (cnt > 1) {
  656 + cnt -= 1;
  657 + tmp = set_slsb(q, &ftc, SLSB_P_INPUT_NOT_INIT, &cnt);
  658 + if (!tmp)
  659 + break;
  660 + }
  661 + cnt = 1;
  662 + tmp += set_slsb(q, &ftc,
  663 + SLSB_P_INPUT_PROCESSING, &cnt);
  664 + atomic_set(&q->polling, 1);
  665 +#else
  666 + tmp = set_slsb(q, &ftc, SLSB_P_INPUT_NOT_INIT, &cnt);
  667 +#endif
  668 + atomic_sub(tmp, &q->number_of_buffers_used);
  669 + q->first_to_check = ftc;
  670 + break;
  671 + case SLSB_CU_INPUT_EMPTY:
  672 + case SLSB_P_INPUT_NOT_INIT:
  673 + case SLSB_P_INPUT_PROCESSING:
  674 + QDIO_DBF_TEXT5(0,trace,"inpnipro");
  675 + break;
  676 + default:
  677 + break;
  678 + }
  679 + QDIO_DBF_HEX4(0,trace,&q->first_to_check,sizeof(int));
  680 + return q->first_to_check;
  681 +}
  682 +
435 683 static inline int
436 684 qdio_get_outbound_buffer_frontier(struct qdio_q *q)
437 685 {
438   - int f,f_mod_no;
439   - volatile char *slsb;
440   - int first_not_to_check;
  686 + struct qdio_irq *irq;
  687 + volatile char *slsb;
  688 + unsigned int count = 1;
  689 + int first_not_to_check, f, f_mod_no;
441 690 char dbf_text[15];
442 691  
443 692 QDIO_DBF_TEXT4(0,trace,"getobfro");
444 693 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
445 694  
  695 + irq = (struct qdio_irq *) q->irq_ptr;
  696 + if (irq->is_qebsm)
  697 + return qdio_qebsm_get_outbound_buffer_frontier(q);
  698 +
446 699 slsb=&q->slsb.acc.val[0];
447 700 f_mod_no=f=q->first_to_check;
448 701 /*
... ... @@ -484,7 +737,7 @@
484 737 QDIO_DBF_HEX2(1,sbal,q->sbal[f_mod_no],256);
485 738  
486 739 /* kind of process the buffer */
487   - set_slsb(&q->slsb.acc.val[f_mod_no], SLSB_P_OUTPUT_NOT_INIT);
  740 + set_slsb(q, &f_mod_no, SLSB_P_OUTPUT_NOT_INIT, &count);
488 741  
489 742 /*
490 743 * we increment the frontier, as this buffer
491 744  
492 745  
493 746  
494 747  
495 748  
496 749  
497 750  
... ... @@ -597,48 +850,48 @@
597 850  
598 851 result=qdio_siga_output(q);
599 852  
600   - switch (result) {
601   - case 0:
602   - /* went smooth this time, reset timestamp */
  853 + switch (result) {
  854 + case 0:
  855 + /* went smooth this time, reset timestamp */
603 856 #ifdef CONFIG_QDIO_DEBUG
604   - QDIO_DBF_TEXT3(0,trace,"cc2reslv");
605   - sprintf(dbf_text,"%4x%2x%2x",q->irq,q->q_no,
606   - atomic_read(&q->busy_siga_counter));
607   - QDIO_DBF_TEXT3(0,trace,dbf_text);
  857 + QDIO_DBF_TEXT3(0,trace,"cc2reslv");
  858 + sprintf(dbf_text,"%4x%2x%2x",q->irq,q->q_no,
  859 + atomic_read(&q->busy_siga_counter));
  860 + QDIO_DBF_TEXT3(0,trace,dbf_text);
608 861 #endif /* CONFIG_QDIO_DEBUG */
609   - q->timing.busy_start=0;
610   - break;
611   - case (2|QDIO_SIGA_ERROR_B_BIT_SET):
612   - /* cc=2 and busy bit: */
613   - atomic_inc(&q->busy_siga_counter);
  862 + q->timing.busy_start=0;
  863 + break;
  864 + case (2|QDIO_SIGA_ERROR_B_BIT_SET):
  865 + /* cc=2 and busy bit: */
  866 + atomic_inc(&q->busy_siga_counter);
614 867  
615   - /* if the last siga was successful, save
616   - * timestamp here */
617   - if (!q->timing.busy_start)
618   - q->timing.busy_start=NOW;
  868 + /* if the last siga was successful, save
  869 + * timestamp here */
  870 + if (!q->timing.busy_start)
  871 + q->timing.busy_start=NOW;
619 872  
620   - /* if we're in time, don't touch error_status_flags
621   - * and siga_error */
622   - if (NOW-q->timing.busy_start<QDIO_BUSY_BIT_GIVE_UP) {
623   - qdio_mark_q(q);
624   - break;
625   - }
626   - QDIO_DBF_TEXT2(0,trace,"cc2REPRT");
  873 + /* if we're in time, don't touch error_status_flags
  874 + * and siga_error */
  875 + if (NOW-q->timing.busy_start<QDIO_BUSY_BIT_GIVE_UP) {
  876 + qdio_mark_q(q);
  877 + break;
  878 + }
  879 + QDIO_DBF_TEXT2(0,trace,"cc2REPRT");
627 880 #ifdef CONFIG_QDIO_DEBUG
628   - sprintf(dbf_text,"%4x%2x%2x",q->irq,q->q_no,
629   - atomic_read(&q->busy_siga_counter));
630   - QDIO_DBF_TEXT3(0,trace,dbf_text);
  881 + sprintf(dbf_text,"%4x%2x%2x",q->irq,q->q_no,
  882 + atomic_read(&q->busy_siga_counter));
  883 + QDIO_DBF_TEXT3(0,trace,dbf_text);
631 884 #endif /* CONFIG_QDIO_DEBUG */
632   - /* else fallthrough and report error */
633   - default:
634   - /* for plain cc=1, 2 or 3: */
635   - if (q->siga_error)
636   - q->error_status_flags|=
637   - QDIO_STATUS_MORE_THAN_ONE_SIGA_ERROR;
  885 + /* else fallthrough and report error */
  886 + default:
  887 + /* for plain cc=1, 2 or 3: */
  888 + if (q->siga_error)
638 889 q->error_status_flags|=
639   - QDIO_STATUS_LOOK_FOR_ERROR;
640   - q->siga_error=result;
641   - }
  890 + QDIO_STATUS_MORE_THAN_ONE_SIGA_ERROR;
  891 + q->error_status_flags|=
  892 + QDIO_STATUS_LOOK_FOR_ERROR;
  893 + q->siga_error=result;
  894 + }
642 895 }
643 896  
644 897 static inline void
645 898  
... ... @@ -743,8 +996,10 @@
743 996 static inline int
744 997 qdio_get_inbound_buffer_frontier(struct qdio_q *q)
745 998 {
  999 + struct qdio_irq *irq;
746 1000 int f,f_mod_no;
747 1001 volatile char *slsb;
  1002 + unsigned int count = 1;
748 1003 int first_not_to_check;
749 1004 #ifdef CONFIG_QDIO_DEBUG
750 1005 char dbf_text[15];
... ... @@ -756,6 +1011,10 @@
756 1011 QDIO_DBF_TEXT4(0,trace,"getibfro");
757 1012 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
758 1013  
  1014 + irq = (struct qdio_irq *) q->irq_ptr;
  1015 + if (irq->is_qebsm)
  1016 + return qdio_qebsm_get_inbound_buffer_frontier(q);
  1017 +
759 1018 slsb=&q->slsb.acc.val[0];
760 1019 f_mod_no=f=q->first_to_check;
761 1020 /*
762 1021  
763 1022  
... ... @@ -792,19 +1051,19 @@
792 1051 * kill VM in terms of CP overhead
793 1052 */
794 1053 if (q->siga_sync) {
795   - set_slsb(&slsb[f_mod_no],SLSB_P_INPUT_NOT_INIT);
  1054 + set_slsb(q, &f_mod_no, SLSB_P_INPUT_NOT_INIT, &count);
796 1055 } else {
797 1056 /* set the previous buffer to NOT_INIT. The current
798 1057 * buffer will be set to PROCESSING at the end of
799 1058 * this function to avoid further interrupts. */
800 1059 if (last_position>=0)
801   - set_slsb(&slsb[last_position],
802   - SLSB_P_INPUT_NOT_INIT);
  1060 + set_slsb(q, &last_position,
  1061 + SLSB_P_INPUT_NOT_INIT, &count);
803 1062 atomic_set(&q->polling,1);
804 1063 last_position=f_mod_no;
805 1064 }
806 1065 #else /* QDIO_USE_PROCESSING_STATE */
807   - set_slsb(&slsb[f_mod_no],SLSB_P_INPUT_NOT_INIT);
  1066 + set_slsb(q, &f_mod_no, SLSB_P_INPUT_NOT_INIT, &count);
808 1067 #endif /* QDIO_USE_PROCESSING_STATE */
809 1068 /*
810 1069 * not needed, as the inbound queue will be synced on the next
... ... @@ -829,7 +1088,7 @@
829 1088 QDIO_DBF_HEX2(1,sbal,q->sbal[f_mod_no],256);
830 1089  
831 1090 /* kind of process the buffer */
832   - set_slsb(&slsb[f_mod_no],SLSB_P_INPUT_NOT_INIT);
  1091 + set_slsb(q, &f_mod_no, SLSB_P_INPUT_NOT_INIT, &count);
833 1092  
834 1093 if (q->qdio_error)
835 1094 q->error_status_flags|=
... ... @@ -857,7 +1116,7 @@
857 1116  
858 1117 #ifdef QDIO_USE_PROCESSING_STATE
859 1118 if (last_position>=0)
860   - set_slsb(&slsb[last_position],SLSB_P_INPUT_PROCESSING);
  1119 + set_slsb(q, &last_position, SLSB_P_INPUT_NOT_INIT, &count);
861 1120 #endif /* QDIO_USE_PROCESSING_STATE */
862 1121  
863 1122 QDIO_DBF_HEX4(0,trace,&q->first_to_check,sizeof(int));
... ... @@ -902,6 +1161,10 @@
902 1161 tiqdio_is_inbound_q_done(struct qdio_q *q)
903 1162 {
904 1163 int no_used;
  1164 + unsigned int start_buf, count;
  1165 + unsigned char state = 0;
  1166 + struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
  1167 +
905 1168 #ifdef CONFIG_QDIO_DEBUG
906 1169 char dbf_text[15];
907 1170 #endif
... ... @@ -927,8 +1190,13 @@
927 1190 if (!q->siga_sync)
928 1191 /* we'll check for more primed buffers in qeth_stop_polling */
929 1192 return 0;
930   -
931   - if (q->slsb.acc.val[q->first_to_check]!=SLSB_P_INPUT_PRIMED)
  1193 + if (irq->is_qebsm) {
  1194 + count = 1;
  1195 + start_buf = q->first_to_check;
  1196 + qdio_do_eqbs(q, &state, &start_buf, &count);
  1197 + } else
  1198 + state = q->slsb.acc.val[q->first_to_check];
  1199 + if (state != SLSB_P_INPUT_PRIMED)
932 1200 /*
933 1201 * nothing more to do, if next buffer is not PRIMED.
934 1202 * note that we did a SYNC_MEMORY before, that there
... ... @@ -955,6 +1223,10 @@
955 1223 qdio_is_inbound_q_done(struct qdio_q *q)
956 1224 {
957 1225 int no_used;
  1226 + unsigned int start_buf, count;
  1227 + unsigned char state = 0;
  1228 + struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
  1229 +
958 1230 #ifdef CONFIG_QDIO_DEBUG
959 1231 char dbf_text[15];
960 1232 #endif
... ... @@ -973,8 +1245,13 @@
973 1245 QDIO_DBF_TEXT4(0,trace,dbf_text);
974 1246 return 1;
975 1247 }
976   -
977   - if (q->slsb.acc.val[q->first_to_check]==SLSB_P_INPUT_PRIMED) {
  1248 + if (irq->is_qebsm) {
  1249 + count = 1;
  1250 + start_buf = q->first_to_check;
  1251 + qdio_do_eqbs(q, &state, &start_buf, &count);
  1252 + } else
  1253 + state = q->slsb.acc.val[q->first_to_check];
  1254 + if (state == SLSB_P_INPUT_PRIMED) {
978 1255 /* we got something to do */
979 1256 QDIO_DBF_TEXT4(0,trace,"inqisntA");
980 1257 QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
... ... @@ -1523,11 +1800,11 @@
1523 1800 QDIO_DBF_HEX2(0,setup,&ptr,sizeof(void*));
1524 1801  
1525 1802 /* fill in slsb */
1526   - for (j=0;j<QDIO_MAX_BUFFERS_PER_Q;j++) {
1527   - set_slsb(&q->slsb.acc.val[j],
1528   - SLSB_P_INPUT_NOT_INIT);
1529   -/* q->sbal[j]->element[1].sbalf.i1.key=QDIO_STORAGE_KEY;*/
1530   - }
  1803 + if (!irq_ptr->is_qebsm) {
  1804 + unsigned int count = 1;
  1805 + for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++)
  1806 + set_slsb(q, &j, SLSB_P_INPUT_NOT_INIT, &count);
  1807 + }
1531 1808 }
1532 1809  
1533 1810 for (i=0;i<no_output_qs;i++) {
... ... @@ -1584,11 +1861,11 @@
1584 1861 QDIO_DBF_HEX2(0,setup,&ptr,sizeof(void*));
1585 1862  
1586 1863 /* fill in slsb */
1587   - for (j=0;j<QDIO_MAX_BUFFERS_PER_Q;j++) {
1588   - set_slsb(&q->slsb.acc.val[j],
1589   - SLSB_P_OUTPUT_NOT_INIT);
1590   -/* q->sbal[j]->element[1].sbalf.i1.key=QDIO_STORAGE_KEY;*/
1591   - }
  1864 + if (!irq_ptr->is_qebsm) {
  1865 + unsigned int count = 1;
  1866 + for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++)
  1867 + set_slsb(q, &j, SLSB_P_OUTPUT_NOT_INIT, &count);
  1868 + }
1592 1869 }
1593 1870 }
1594 1871  
... ... @@ -1905,7 +2182,7 @@
1905 2182 qdio_synchronize(struct ccw_device *cdev, unsigned int flags,
1906 2183 unsigned int queue_number)
1907 2184 {
1908   - int cc;
  2185 + int cc = 0;
1909 2186 struct qdio_q *q;
1910 2187 struct qdio_irq *irq_ptr;
1911 2188 void *ptr;
1912 2189  
... ... @@ -1929,12 +2206,14 @@
1929 2206 q=irq_ptr->input_qs[queue_number];
1930 2207 if (!q)
1931 2208 return -EINVAL;
1932   - cc = do_siga_sync(q->irq, 0, q->mask);
  2209 + if (!(irq_ptr->is_qebsm))
  2210 + cc = do_siga_sync(0x10000|q->irq, 0, q->mask);
1933 2211 } else if (flags&QDIO_FLAG_SYNC_OUTPUT) {
1934 2212 q=irq_ptr->output_qs[queue_number];
1935 2213 if (!q)
1936 2214 return -EINVAL;
1937   - cc = do_siga_sync(q->irq, q->mask, 0);
  2215 + if (!(irq_ptr->is_qebsm))
  2216 + cc = do_siga_sync(0x10000|q->irq, q->mask, 0);
1938 2217 } else
1939 2218 return -EINVAL;
1940 2219  
1941 2220  
1942 2221  
... ... @@ -1945,12 +2224,49 @@
1945 2224 return cc;
1946 2225 }
1947 2226  
1948   -static unsigned char
1949   -qdio_check_siga_needs(int sch)
  2227 +static inline void
  2228 +qdio_check_subchannel_qebsm(struct qdio_irq *irq_ptr, unsigned char qdioac,
  2229 + unsigned long token)
1950 2230 {
  2231 + struct qdio_q *q;
  2232 + int i;
  2233 + unsigned int count, start_buf;
  2234 + char dbf_text[15];
  2235 +
  2236 + /*check if QEBSM is disabled */
  2237 + if (!(irq_ptr->is_qebsm) || !(qdioac & 0x01)) {
  2238 + irq_ptr->is_qebsm = 0;
  2239 + irq_ptr->sch_token = 0;
  2240 + irq_ptr->qib.rflags &= ~QIB_RFLAGS_ENABLE_QEBSM;
  2241 + QDIO_DBF_TEXT0(0,setup,"noV=V");
  2242 + return;
  2243 + }
  2244 + irq_ptr->sch_token = token;
  2245 + /*input queue*/
  2246 + for (i = 0; i < irq_ptr->no_input_qs;i++) {
  2247 + q = irq_ptr->input_qs[i];
  2248 + count = QDIO_MAX_BUFFERS_PER_Q;
  2249 + start_buf = 0;
  2250 + set_slsb(q, &start_buf, SLSB_P_INPUT_NOT_INIT, &count);
  2251 + }
  2252 + sprintf(dbf_text,"V=V:%2x",irq_ptr->is_qebsm);
  2253 + QDIO_DBF_TEXT0(0,setup,dbf_text);
  2254 + sprintf(dbf_text,"%8lx",irq_ptr->sch_token);
  2255 + QDIO_DBF_TEXT0(0,setup,dbf_text);
  2256 + /*output queue*/
  2257 + for (i = 0; i < irq_ptr->no_output_qs; i++) {
  2258 + q = irq_ptr->output_qs[i];
  2259 + count = QDIO_MAX_BUFFERS_PER_Q;
  2260 + start_buf = 0;
  2261 + set_slsb(q, &start_buf, SLSB_P_OUTPUT_NOT_INIT, &count);
  2262 + }
  2263 +}
  2264 +
  2265 +static void
  2266 +qdio_get_ssqd_information(struct qdio_irq *irq_ptr)
  2267 +{
1951 2268 int result;
1952 2269 unsigned char qdioac;
1953   -
1954 2270 struct {
1955 2271 struct chsc_header request;
1956 2272 u16 reserved1;
1957 2273  
1958 2274  
1959 2275  
1960 2276  
1961 2277  
1962 2278  
1963 2279  
1964 2280  
1965 2281  
1966 2282  
1967 2283  
1968 2284  
1969 2285  
1970 2286  
1971 2287  
1972 2288  
... ... @@ -1964,67 +2280,80 @@
1964 2280 u8 reserved5;
1965 2281 u16 sch;
1966 2282 u8 qfmt;
1967   - u8 reserved6;
1968   - u8 qdioac;
  2283 + u8 parm;
  2284 + u8 qdioac1;
1969 2285 u8 sch_class;
1970 2286 u8 reserved7;
1971 2287 u8 icnt;
1972 2288 u8 reserved8;
1973 2289 u8 ocnt;
  2290 + u8 reserved9;
  2291 + u8 mbccnt;
  2292 + u16 qdioac2;
  2293 + u64 sch_token;
1974 2294 } *ssqd_area;
1975 2295  
  2296 + QDIO_DBF_TEXT0(0,setup,"getssqd");
  2297 + qdioac = 0;
1976 2298 ssqd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
1977 2299 if (!ssqd_area) {
1978 2300 QDIO_PRINT_WARN("Could not get memory for chsc. Using all " \
1979   - "SIGAs for sch x%x.\n", sch);
1980   - return CHSC_FLAG_SIGA_INPUT_NECESSARY ||
1981   - CHSC_FLAG_SIGA_OUTPUT_NECESSARY ||
1982   - CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */
  2301 + "SIGAs for sch x%x.\n", irq_ptr->irq);
  2302 + irq_ptr->qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY ||
  2303 + CHSC_FLAG_SIGA_OUTPUT_NECESSARY ||
  2304 + CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */
  2305 + irq_ptr->is_qebsm = 0;
  2306 + irq_ptr->sch_token = 0;
  2307 + irq_ptr->qib.rflags &= ~QIB_RFLAGS_ENABLE_QEBSM;
  2308 + return;
1983 2309 }
  2310 +
1984 2311 ssqd_area->request = (struct chsc_header) {
1985 2312 .length = 0x0010,
1986 2313 .code = 0x0024,
1987 2314 };
  2315 + ssqd_area->first_sch = irq_ptr->irq;
  2316 + ssqd_area->last_sch = irq_ptr->irq;
  2317 + result = chsc(ssqd_area);
1988 2318  
1989   - ssqd_area->first_sch = sch;
1990   - ssqd_area->last_sch = sch;
1991   -
1992   - result=chsc(ssqd_area);
1993   -
1994 2319 if (result) {
1995 2320 QDIO_PRINT_WARN("CHSC returned cc %i. Using all " \
1996 2321 "SIGAs for sch x%x.\n",
1997   - result,sch);
  2322 + result, irq_ptr->irq);
1998 2323 qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY ||
1999 2324 CHSC_FLAG_SIGA_OUTPUT_NECESSARY ||
2000 2325 CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */
  2326 + irq_ptr->is_qebsm = 0;
2001 2327 goto out;
2002 2328 }
2003 2329  
2004 2330 if (ssqd_area->response.code != QDIO_CHSC_RESPONSE_CODE_OK) {
2005 2331 QDIO_PRINT_WARN("response upon checking SIGA needs " \
2006 2332 "is 0x%x. Using all SIGAs for sch x%x.\n",
2007   - ssqd_area->response.code, sch);
  2333 + ssqd_area->response.code, irq_ptr->irq);
2008 2334 qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY ||
2009 2335 CHSC_FLAG_SIGA_OUTPUT_NECESSARY ||
2010 2336 CHSC_FLAG_SIGA_SYNC_NECESSARY; /* all flags set */
  2337 + irq_ptr->is_qebsm = 0;
2011 2338 goto out;
2012 2339 }
2013 2340 if (!(ssqd_area->flags & CHSC_FLAG_QDIO_CAPABILITY) ||
2014 2341 !(ssqd_area->flags & CHSC_FLAG_VALIDITY) ||
2015   - (ssqd_area->sch != sch)) {
  2342 + (ssqd_area->sch != irq_ptr->irq)) {
2016 2343 QDIO_PRINT_WARN("huh? problems checking out sch x%x... " \
2017   - "using all SIGAs.\n",sch);
  2344 + "using all SIGAs.\n",irq_ptr->irq);
2018 2345 qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY |
2019 2346 CHSC_FLAG_SIGA_OUTPUT_NECESSARY |
2020 2347 CHSC_FLAG_SIGA_SYNC_NECESSARY; /* worst case */
  2348 + irq_ptr->is_qebsm = 0;
2021 2349 goto out;
2022 2350 }
2023   -
2024   - qdioac = ssqd_area->qdioac;
  2351 + qdioac = ssqd_area->qdioac1;
2025 2352 out:
  2353 + qdio_check_subchannel_qebsm(irq_ptr, qdioac,
  2354 + ssqd_area->sch_token);
2026 2355 free_page ((unsigned long) ssqd_area);
2027   - return qdioac;
  2356 + irq_ptr->qdioac = qdioac;
2028 2357 }
2029 2358  
2030 2359 static unsigned int
... ... @@ -2055,6 +2384,13 @@
2055 2384 sprintf(dbf_text,"hydrati%1x", hydra_thinints);
2056 2385 QDIO_DBF_TEXT0(0,setup,dbf_text);
2057 2386  
  2387 +#ifdef CONFIG_ARCH_S390X
  2388 + /* Check for QEBSM support in general (bit 58). */
  2389 + is_passthrough = css_general_characteristics.qebsm;
  2390 +#endif
  2391 + sprintf(dbf_text,"cssQBS:%1x", is_passthrough);
  2392 + QDIO_DBF_TEXT0(0,setup,dbf_text);
  2393 +
2058 2394 /* Check for aif time delay disablement fac (bit 56). If installed,
2059 2395 * omit svs even under lpar (good point by rick again) */
2060 2396 omit_svs = css_general_characteristics.aif_tdd;
... ... @@ -2698,7 +3034,7 @@
2698 3034 QDIO_DBF_TEXT2(0,setup,dbf_text);
2699 3035  
2700 3036 if (irq_ptr->is_thinint_irq) {
2701   - irq_ptr->dev_st_chg_ind=qdio_get_indicator();
  3037 + irq_ptr->dev_st_chg_ind = qdio_get_indicator();
2702 3038 QDIO_DBF_HEX1(0,setup,&irq_ptr->dev_st_chg_ind,sizeof(void*));
2703 3039 if (!irq_ptr->dev_st_chg_ind) {
2704 3040 QDIO_PRINT_WARN("no indicator location available " \
... ... @@ -2747,6 +3083,10 @@
2747 3083 irq_ptr->qdr->qkey=QDIO_STORAGE_KEY;
2748 3084  
2749 3085 /* fill in qib */
  3086 + irq_ptr->is_qebsm = is_passthrough;
  3087 + if (irq_ptr->is_qebsm)
  3088 + irq_ptr->qib.rflags |= QIB_RFLAGS_ENABLE_QEBSM;
  3089 +
2750 3090 irq_ptr->qib.qfmt=init_data->q_format;
2751 3091 if (init_data->no_input_qs)
2752 3092 irq_ptr->qib.isliba=(unsigned long)(irq_ptr->input_qs[0]->slib);
... ... @@ -2884,7 +3224,7 @@
2884 3224 return -EIO;
2885 3225 }
2886 3226  
2887   - irq_ptr->qdioac=qdio_check_siga_needs(irq_ptr->irq);
  3227 + qdio_get_ssqd_information(irq_ptr);
2888 3228 /* if this gets set once, we're running under VM and can omit SVSes */
2889 3229 if (irq_ptr->qdioac&CHSC_FLAG_SIGA_SYNC_NECESSARY)
2890 3230 omit_svs=1;
2891 3231  
2892 3232  
2893 3233  
2894 3234  
2895 3235  
2896 3236  
2897 3237  
... ... @@ -3015,30 +3355,40 @@
3015 3355 qdio_do_qdio_fill_input(struct qdio_q *q, unsigned int qidx,
3016 3356 unsigned int count, struct qdio_buffer *buffers)
3017 3357 {
  3358 + struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
  3359 + qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1);
  3360 + if (irq->is_qebsm) {
  3361 + while (count)
  3362 + set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count);
  3363 + return;
  3364 + }
3018 3365 for (;;) {
3019   - set_slsb(&q->slsb.acc.val[qidx],SLSB_CU_INPUT_EMPTY);
  3366 + set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count);
3020 3367 count--;
3021 3368 if (!count) break;
3022   - qidx=(qidx+1)&(QDIO_MAX_BUFFERS_PER_Q-1);
  3369 + qidx = (qidx + 1) & (QDIO_MAX_BUFFERS_PER_Q - 1);
3023 3370 }
3024   -
3025   - /* not necessary, as the queues are synced during the SIGA read */
3026   - /*SYNC_MEMORY;*/
3027 3371 }
3028 3372  
3029 3373 static inline void
3030 3374 qdio_do_qdio_fill_output(struct qdio_q *q, unsigned int qidx,
3031 3375 unsigned int count, struct qdio_buffer *buffers)
3032 3376 {
  3377 + struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
  3378 +
  3379 + qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1);
  3380 + if (irq->is_qebsm) {
  3381 + while (count)
  3382 + set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count);
  3383 + return;
  3384 + }
  3385 +
3033 3386 for (;;) {
3034   - set_slsb(&q->slsb.acc.val[qidx],SLSB_CU_OUTPUT_PRIMED);
  3387 + set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count);
3035 3388 count--;
3036 3389 if (!count) break;
3037   - qidx=(qidx+1)&(QDIO_MAX_BUFFERS_PER_Q-1);
  3390 + qidx = (qidx + 1) & (QDIO_MAX_BUFFERS_PER_Q - 1);
3038 3391 }
3039   -
3040   - /* SIGA write will sync the queues */
3041   - /*SYNC_MEMORY;*/
3042 3392 }
3043 3393  
3044 3394 static inline void
... ... @@ -3083,6 +3433,9 @@
3083 3433 struct qdio_buffer *buffers)
3084 3434 {
3085 3435 int used_elements;
  3436 + unsigned int cnt, start_buf;
  3437 + unsigned char state = 0;
  3438 + struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr;
3086 3439  
3087 3440 /* This is the outbound handling of queues */
3088 3441 #ifdef QDIO_PERFORMANCE_STATS
... ... @@ -3115,9 +3468,15 @@
3115 3468 * SYNC_MEMORY :-/ ), we try to
3116 3469 * fast-requeue buffers
3117 3470 */
3118   - if (q->slsb.acc.val[(qidx+QDIO_MAX_BUFFERS_PER_Q-1)
3119   - &(QDIO_MAX_BUFFERS_PER_Q-1)]!=
3120   - SLSB_CU_OUTPUT_PRIMED) {
  3471 + if (irq->is_qebsm) {
  3472 + cnt = 1;
  3473 + start_buf = ((qidx+QDIO_MAX_BUFFERS_PER_Q-1) &
  3474 + (QDIO_MAX_BUFFERS_PER_Q-1));
  3475 + qdio_do_eqbs(q, &state, &start_buf, &cnt);
  3476 + } else
  3477 + state = q->slsb.acc.val[(qidx+QDIO_MAX_BUFFERS_PER_Q-1)
  3478 + &(QDIO_MAX_BUFFERS_PER_Q-1) ];
  3479 + if (state != SLSB_CU_OUTPUT_PRIMED) {
3121 3480 qdio_kick_outbound_q(q);
3122 3481 } else {
3123 3482 QDIO_DBF_TEXT3(0,trace, "fast-req");
drivers/s390/cio/qdio.h
... ... @@ -3,14 +3,13 @@
3 3  
4 4 #include <asm/page.h>
5 5  
6   -#define VERSION_CIO_QDIO_H "$Revision: 1.33 $"
  6 +#define VERSION_CIO_QDIO_H "$Revision: 1.37 $"
7 7  
8 8 #ifdef CONFIG_QDIO_DEBUG
9 9 #define QDIO_VERBOSE_LEVEL 9
10 10 #else /* CONFIG_QDIO_DEBUG */
11 11 #define QDIO_VERBOSE_LEVEL 5
12 12 #endif /* CONFIG_QDIO_DEBUG */
13   -
14 13 #define QDIO_USE_PROCESSING_STATE
15 14  
16 15 #ifdef CONFIG_QDIO_PERF_STATS
17 16  
... ... @@ -265,7 +264,59 @@
265 264 /*
266 265 * Some instructions as assembly
267 266 */
  267 +
268 268 static inline int
  269 +do_sqbs(unsigned long sch, unsigned char state, int queue,
  270 + unsigned int *start, unsigned int *count)
  271 +{
  272 +#ifdef CONFIG_ARCH_S390X
  273 + register unsigned long _ccq asm ("0") = *count;
  274 + register unsigned long _sch asm ("1") = sch;
  275 + unsigned long _queuestart = ((unsigned long)queue << 32) | *start;
  276 +
  277 + asm volatile (
  278 + " .insn rsy,0xeb000000008A,%1,0,0(%2)\n\t"
  279 + : "+d" (_ccq), "+d" (_queuestart)
  280 + : "d" ((unsigned long)state), "d" (_sch)
  281 + : "memory", "cc"
  282 + );
  283 + *count = _ccq & 0xff;
  284 + *start = _queuestart & 0xff;
  285 +
  286 + return (_ccq >> 32) & 0xff;
  287 +#else
  288 + return 0;
  289 +#endif
  290 +}
  291 +
  292 +static inline int
  293 +do_eqbs(unsigned long sch, unsigned char *state, int queue,
  294 + unsigned int *start, unsigned int *count)
  295 +{
  296 +#ifdef CONFIG_ARCH_S390X
  297 + register unsigned long _ccq asm ("0") = *count;
  298 + register unsigned long _sch asm ("1") = sch;
  299 + unsigned long _queuestart = ((unsigned long)queue << 32) | *start;
  300 + unsigned long _state = 0;
  301 +
  302 + asm volatile (
  303 + " .insn rrf,0xB99c0000,%1,%2,0,0 \n\t"
  304 + : "+d" (_ccq), "+d" (_queuestart), "+d" (_state)
  305 + : "d" (_sch)
  306 + : "memory", "cc"
  307 + );
  308 + *count = _ccq & 0xff;
  309 + *start = _queuestart & 0xff;
  310 + *state = _state & 0xff;
  311 +
  312 + return (_ccq >> 32) & 0xff;
  313 +#else
  314 + return 0;
  315 +#endif
  316 +}
  317 +
  318 +
  319 +static inline int
269 320 do_siga_sync(unsigned int irq, unsigned int mask1, unsigned int mask2)
270 321 {
271 322 int cc;
... ... @@ -280,7 +331,7 @@
280 331 "ipm %0 \n\t"
281 332 "srl %0,28 \n\t"
282 333 : "=d" (cc)
283   - : "d" (0x10000|irq), "d" (mask1), "d" (mask2)
  334 + : "d" (irq), "d" (mask1), "d" (mask2)
284 335 : "cc", "0", "1", "2", "3"
285 336 );
286 337 #else /* CONFIG_ARCH_S390X */
... ... @@ -293,7 +344,7 @@
293 344 "ipm %0 \n\t"
294 345 "srl %0,28 \n\t"
295 346 : "=d" (cc)
296   - : "d" (0x10000|irq), "d" (mask1), "d" (mask2)
  347 + : "d" (irq), "d" (mask1), "d" (mask2)
297 348 : "cc", "0", "1", "2", "3"
298 349 );
299 350 #endif /* CONFIG_ARCH_S390X */
... ... @@ -314,7 +365,7 @@
314 365 "ipm %0 \n\t"
315 366 "srl %0,28 \n\t"
316 367 : "=d" (cc)
317   - : "d" (0x10000|irq), "d" (mask)
  368 + : "d" (irq), "d" (mask)
318 369 : "cc", "0", "1", "2", "memory"
319 370 );
320 371 #else /* CONFIG_ARCH_S390X */
... ... @@ -326,7 +377,7 @@
326 377 "ipm %0 \n\t"
327 378 "srl %0,28 \n\t"
328 379 : "=d" (cc)
329   - : "d" (0x10000|irq), "d" (mask)
  380 + : "d" (irq), "d" (mask)
330 381 : "cc", "0", "1", "2", "memory"
331 382 );
332 383 #endif /* CONFIG_ARCH_S390X */
... ... @@ -335,7 +386,8 @@
335 386 }
336 387  
337 388 static inline int
338   -do_siga_output(unsigned long irq, unsigned long mask, __u32 *bb)
  389 +do_siga_output(unsigned long irq, unsigned long mask, __u32 *bb,
  390 + unsigned int fc)
339 391 {
340 392 int cc;
341 393 __u32 busy_bit;
342 394  
... ... @@ -366,14 +418,14 @@
366 418 ".long 0b,2b \n\t"
367 419 ".previous \n\t"
368 420 : "=d" (cc), "=d" (busy_bit)
369   - : "d" (0x10000|irq), "d" (mask),
  421 + : "d" (irq), "d" (mask),
370 422 "i" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION)
371 423 : "cc", "0", "1", "2", "memory"
372 424 );
373 425 #else /* CONFIG_ARCH_S390X */
374 426 asm volatile (
375   - "lghi 0,0 \n\t"
376   - "llgfr 1,%2 \n\t"
  427 + "llgfr 0,%5 \n\t"
  428 + "lgr 1,%2 \n\t"
377 429 "llgfr 2,%3 \n\t"
378 430 "siga 0 \n\t"
379 431 "0:"
... ... @@ -391,8 +443,8 @@
391 443 ".quad 0b,1b \n\t"
392 444 ".previous \n\t"
393 445 : "=d" (cc), "=d" (busy_bit)
394   - : "d" (0x10000|irq), "d" (mask),
395   - "i" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION)
  446 + : "d" (irq), "d" (mask),
  447 + "i" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION), "d" (fc)
396 448 : "cc", "0", "1", "2", "memory"
397 449 );
398 450 #endif /* CONFIG_ARCH_S390X */
399 451  
... ... @@ -494,33 +546,12 @@
494 546 #define QDIO_GET_ADDR(x) ((__u32)(long)x)
495 547 #endif /* CONFIG_ARCH_S390X */
496 548  
497   -#ifdef CONFIG_QDIO_DEBUG
498   -#define set_slsb(x,y) \
499   - if(q->queue_type==QDIO_TRACE_QTYPE) { \
500   - if(q->is_input_q) { \
501   - QDIO_DBF_HEX2(0,slsb_in,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
502   - } else { \
503   - QDIO_DBF_HEX2(0,slsb_out,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
504   - } \
505   - } \
506   - qdio_set_slsb(x,y); \
507   - if(q->queue_type==QDIO_TRACE_QTYPE) { \
508   - if(q->is_input_q) { \
509   - QDIO_DBF_HEX2(0,slsb_in,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
510   - } else { \
511   - QDIO_DBF_HEX2(0,slsb_out,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
512   - } \
513   - }
514   -#else /* CONFIG_QDIO_DEBUG */
515   -#define set_slsb(x,y) qdio_set_slsb(x,y)
516   -#endif /* CONFIG_QDIO_DEBUG */
517   -
518 549 struct qdio_q {
519 550 volatile struct slsb slsb;
520 551  
521 552 char unused[QDIO_MAX_BUFFERS_PER_Q];
522 553  
523   - __u32 * volatile dev_st_chg_ind;
  554 + __u32 * dev_st_chg_ind;
524 555  
525 556 int is_input_q;
526 557 int irq;
... ... @@ -568,6 +599,7 @@
568 599 struct tasklet_struct tasklet;
569 600 #endif /* QDIO_USE_TIMERS_FOR_POLLING */
570 601  
  602 +
571 603 enum qdio_irq_states state;
572 604  
573 605 /* used to store the error condition during a data transfer */
... ... @@ -623,6 +655,10 @@
623 655 unsigned int is_thinint_irq;
624 656 unsigned int hydra_gives_outbound_pcis;
625 657 unsigned int sync_done_on_outb_pcis;
  658 +
  659 + /* QEBSM facility */
  660 + unsigned int is_qebsm;
  661 + unsigned long sch_token;
626 662  
627 663 enum qdio_irq_states state;
628 664  
include/asm-s390/qdio.h
... ... @@ -195,12 +195,14 @@
195 195 /*
196 196 * queue information block (QIB)
197 197 */
198   -#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
199   -#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
  198 +#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
  199 +#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
  200 +#define QIB_RFLAGS_ENABLE_QEBSM 0x80
  201 +
200 202 struct qib {
201 203 unsigned int qfmt : 8; /* queue format */
202 204 unsigned int pfmt : 8; /* impl. dep. parameter format */
203   - unsigned int res1 : 8; /* reserved */
  205 + unsigned int rflags : 8; /* QEBSM */
204 206 unsigned int ac : 8; /* adapter characteristics */
205 207 unsigned int res2; /* reserved */
206 208 #ifdef QDIO_32_BIT