2008-07-17 09:16:48 -06:00
|
|
|
/*
|
|
|
|
* linux/drivers/s390/cio/qdio_main.c
|
|
|
|
*
|
|
|
|
* Linux for s390 qdio support, buffer handling, qdio API and module support.
|
|
|
|
*
|
|
|
|
* Copyright 2000,2008 IBM Corp.
|
|
|
|
* Author(s): Utz Bacher <utz.bacher@de.ibm.com>
|
|
|
|
* Jan Glauber <jang@linux.vnet.ibm.com>
|
|
|
|
* 2.6 cio integration by Cornelia Huck <cornelia.huck@de.ibm.com>
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/delay.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 02:04:11 -06:00
|
|
|
#include <linux/gfp.h>
|
2011-08-07 19:33:55 -06:00
|
|
|
#include <linux/io.h>
|
2011-01-05 04:47:29 -07:00
|
|
|
#include <linux/kernel_stat.h>
|
2011-07-26 17:09:06 -06:00
|
|
|
#include <linux/atomic.h>
|
2008-07-17 09:16:48 -06:00
|
|
|
#include <asm/debug.h>
|
|
|
|
#include <asm/qdio.h>
|
|
|
|
|
|
|
|
#include "cio.h"
|
|
|
|
#include "css.h"
|
|
|
|
#include "device.h"
|
|
|
|
#include "qdio.h"
|
|
|
|
#include "qdio_debug.h"
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\
|
|
|
|
"Jan Glauber <jang@linux.vnet.ibm.com>");
|
|
|
|
MODULE_DESCRIPTION("QDIO base support");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2011-01-05 04:47:52 -07:00
|
|
|
static inline int do_siga_sync(unsigned long schid,
|
|
|
|
unsigned int out_mask, unsigned int in_mask,
|
|
|
|
unsigned int fc)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-01-05 04:47:52 -07:00
|
|
|
register unsigned long __fc asm ("0") = fc;
|
|
|
|
register unsigned long __schid asm ("1") = schid;
|
2008-07-17 09:16:48 -06:00
|
|
|
register unsigned long out asm ("2") = out_mask;
|
|
|
|
register unsigned long in asm ("3") = in_mask;
|
|
|
|
int cc;
|
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
" siga 0\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
|
|
|
: "=d" (cc)
|
|
|
|
: "d" (__fc), "d" (__schid), "d" (out), "d" (in) : "cc");
|
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
2011-01-05 04:47:52 -07:00
|
|
|
static inline int do_siga_input(unsigned long schid, unsigned int mask,
|
|
|
|
unsigned int fc)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-01-05 04:47:52 -07:00
|
|
|
register unsigned long __fc asm ("0") = fc;
|
|
|
|
register unsigned long __schid asm ("1") = schid;
|
2008-07-17 09:16:48 -06:00
|
|
|
register unsigned long __mask asm ("2") = mask;
|
|
|
|
int cc;
|
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
" siga 0\n"
|
|
|
|
" ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
|
|
|
: "=d" (cc)
|
|
|
|
: "d" (__fc), "d" (__schid), "d" (__mask) : "cc", "memory");
|
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* do_siga_output - perform SIGA-w/wt function
|
|
|
|
* @schid: subchannel id or in case of QEBSM the subchannel token
|
|
|
|
* @mask: which output queues to process
|
|
|
|
* @bb: busy bit indicator, set only if SIGA-w/wt could not access a buffer
|
|
|
|
* @fc: function code to perform
|
|
|
|
*
|
|
|
|
* Returns cc or QDIO_ERROR_SIGA_ACCESS_EXCEPTION.
|
|
|
|
* Note: For IQDC unicast queues only the highest priority queue is processed.
|
|
|
|
*/
|
|
|
|
static inline int do_siga_output(unsigned long schid, unsigned long mask,
|
2011-08-07 19:33:55 -06:00
|
|
|
unsigned int *bb, unsigned int fc,
|
|
|
|
unsigned long aob)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
register unsigned long __fc asm("0") = fc;
|
|
|
|
register unsigned long __schid asm("1") = schid;
|
|
|
|
register unsigned long __mask asm("2") = mask;
|
2011-08-07 19:33:55 -06:00
|
|
|
register unsigned long __aob asm("3") = aob;
|
2008-07-17 09:16:48 -06:00
|
|
|
int cc = QDIO_ERROR_SIGA_ACCESS_EXCEPTION;
|
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
" siga 0\n"
|
|
|
|
"0: ipm %0\n"
|
|
|
|
" srl %0,28\n"
|
|
|
|
"1:\n"
|
|
|
|
EX_TABLE(0b, 1b)
|
2011-08-07 19:33:55 -06:00
|
|
|
: "+d" (cc), "+d" (__fc), "+d" (__schid), "+d" (__mask),
|
|
|
|
"+d" (__aob)
|
2008-07-17 09:16:48 -06:00
|
|
|
: : "cc", "memory");
|
|
|
|
*bb = ((unsigned int) __fc) >> 31;
|
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qdio_check_ccq(struct qdio_q *q, unsigned int ccq)
|
|
|
|
{
|
|
|
|
/* all done or next buffer state different */
|
|
|
|
if (ccq == 0 || ccq == 32)
|
|
|
|
return 0;
|
|
|
|
/* not all buffers processed */
|
|
|
|
if (ccq == 96 || ccq == 97)
|
|
|
|
return 1;
|
|
|
|
/* notify devices immediately */
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x ccq:%3d", SCH_NO(q), ccq);
|
2008-07-17 09:16:48 -06:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_do_eqbs - extract buffer states for QEBSM
|
|
|
|
* @q: queue to manipulate
|
|
|
|
* @state: state of the extracted buffers
|
|
|
|
* @start: buffer number to start at
|
|
|
|
* @count: count of buffers to examine
|
2008-12-25 05:38:47 -07:00
|
|
|
* @auto_ack: automatically acknowledge buffers
|
2008-07-17 09:16:48 -06:00
|
|
|
*
|
2009-01-07 19:09:16 -07:00
|
|
|
* Returns the number of successfully extracted equal buffer states.
|
2008-07-17 09:16:48 -06:00
|
|
|
* Stops processing if a state is different from the last buffers state.
|
|
|
|
*/
|
|
|
|
static int qdio_do_eqbs(struct qdio_q *q, unsigned char *state,
|
2008-12-25 05:38:47 -07:00
|
|
|
int start, int count, int auto_ack)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
unsigned int ccq = 0;
|
|
|
|
int tmp_count = count, tmp_start = start;
|
|
|
|
int nr = q->nr;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
BUG_ON(!q->irq_ptr->sch_token);
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, eqbs);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (!q->is_input_q)
|
|
|
|
nr += q->irq_ptr->nr_input_qs;
|
|
|
|
again:
|
2008-12-25 05:38:47 -07:00
|
|
|
ccq = do_eqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count,
|
|
|
|
auto_ack);
|
2008-07-17 09:16:48 -06:00
|
|
|
rc = qdio_check_ccq(q, ccq);
|
|
|
|
|
|
|
|
/* At least one buffer was processed, return and extract the remaining
|
|
|
|
* buffers later.
|
|
|
|
*/
|
2008-12-25 05:38:44 -07:00
|
|
|
if ((ccq == 96) && (count != tmp_count)) {
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, eqbs_partial);
|
2008-07-17 09:16:48 -06:00
|
|
|
return (count - tmp_count);
|
2008-12-25 05:38:44 -07:00
|
|
|
}
|
2008-12-25 05:38:46 -07:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
if (rc == 1) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "EQBS again:%2d", ccq);
|
2008-07-17 09:16:48 -06:00
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rc < 0) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x EQBS ERROR", SCH_NO(q));
|
|
|
|
DBF_ERROR("%3d%3d%2d", count, tmp_count, nr);
|
2008-07-17 09:16:48 -06:00
|
|
|
q->handler(q->irq_ptr->cdev,
|
|
|
|
QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
|
|
|
|
0, -1, -1, q->irq_ptr->int_parm);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return count - tmp_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_do_sqbs - set buffer states for QEBSM
|
|
|
|
* @q: queue to manipulate
|
|
|
|
* @state: new state of the buffers
|
|
|
|
* @start: first buffer number to change
|
|
|
|
* @count: how many buffers to change
|
|
|
|
*
|
|
|
|
* Returns the number of successfully changed buffers.
|
|
|
|
* Does retrying until the specified count of buffer states is set or an
|
|
|
|
* error occurs.
|
|
|
|
*/
|
|
|
|
static int qdio_do_sqbs(struct qdio_q *q, unsigned char state, int start,
|
|
|
|
int count)
|
|
|
|
{
|
|
|
|
unsigned int ccq = 0;
|
|
|
|
int tmp_count = count, tmp_start = start;
|
|
|
|
int nr = q->nr;
|
|
|
|
int rc;
|
|
|
|
|
2008-12-25 05:38:47 -07:00
|
|
|
if (!count)
|
|
|
|
return 0;
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
BUG_ON(!q->irq_ptr->sch_token);
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, sqbs);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (!q->is_input_q)
|
|
|
|
nr += q->irq_ptr->nr_input_qs;
|
|
|
|
again:
|
|
|
|
ccq = do_sqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count);
|
|
|
|
rc = qdio_check_ccq(q, ccq);
|
|
|
|
if (rc == 1) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq);
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, sqbs_partial);
|
2008-07-17 09:16:48 -06:00
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
if (rc < 0) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x SQBS ERROR", SCH_NO(q));
|
|
|
|
DBF_ERROR("%3d%3d%2d", count, tmp_count, nr);
|
2008-07-17 09:16:48 -06:00
|
|
|
q->handler(q->irq_ptr->cdev,
|
|
|
|
QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
|
|
|
|
0, -1, -1, q->irq_ptr->int_parm);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
WARN_ON(tmp_count);
|
|
|
|
return count - tmp_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns number of examined buffers and their common state in *state */
|
|
|
|
static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr,
|
2008-12-25 05:38:47 -07:00
|
|
|
unsigned char *state, unsigned int count,
|
2011-08-07 19:33:55 -06:00
|
|
|
int auto_ack, int merge_pending)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
unsigned char __state = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
BUG_ON(bufnr > QDIO_MAX_BUFFERS_MASK);
|
|
|
|
BUG_ON(count > QDIO_MAX_BUFFERS_PER_Q);
|
|
|
|
|
|
|
|
if (is_qebsm(q))
|
2008-12-25 05:38:47 -07:00
|
|
|
return qdio_do_eqbs(q, state, bufnr, count, auto_ack);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
2011-08-07 19:33:55 -06:00
|
|
|
if (!__state) {
|
2008-07-17 09:16:48 -06:00
|
|
|
__state = q->slsb.val[bufnr];
|
2011-08-07 19:33:55 -06:00
|
|
|
if (merge_pending && __state == SLSB_P_OUTPUT_PENDING)
|
|
|
|
__state = SLSB_P_OUTPUT_EMPTY;
|
|
|
|
} else if (merge_pending) {
|
|
|
|
if ((q->slsb.val[bufnr] & __state) != __state)
|
|
|
|
break;
|
|
|
|
} else if (q->slsb.val[bufnr] != __state)
|
2008-07-17 09:16:48 -06:00
|
|
|
break;
|
|
|
|
bufnr = next_buf(bufnr);
|
|
|
|
}
|
|
|
|
*state = __state;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static inline int get_buf_state(struct qdio_q *q, unsigned int bufnr,
|
|
|
|
unsigned char *state, int auto_ack)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-08-07 19:33:55 -06:00
|
|
|
return get_buf_states(q, bufnr, state, 1, auto_ack, 0);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* wrap-around safe setting of slsb states, returns number of changed buffers */
|
|
|
|
static inline int set_buf_states(struct qdio_q *q, int bufnr,
|
|
|
|
unsigned char state, int count)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
BUG_ON(bufnr > QDIO_MAX_BUFFERS_MASK);
|
|
|
|
BUG_ON(count > QDIO_MAX_BUFFERS_PER_Q);
|
|
|
|
|
|
|
|
if (is_qebsm(q))
|
|
|
|
return qdio_do_sqbs(q, state, bufnr, count);
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
xchg(&q->slsb.val[bufnr], state);
|
|
|
|
bufnr = next_buf(bufnr);
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int set_buf_state(struct qdio_q *q, int bufnr,
|
|
|
|
unsigned char state)
|
|
|
|
{
|
|
|
|
return set_buf_states(q, bufnr, state, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set slsb states to initial state */
|
|
|
|
void qdio_init_buf_states(struct qdio_irq *irq_ptr)
|
|
|
|
{
|
|
|
|
struct qdio_q *q;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for_each_input_queue(irq_ptr, q, i)
|
|
|
|
set_buf_states(q, 0, SLSB_P_INPUT_NOT_INIT,
|
|
|
|
QDIO_MAX_BUFFERS_PER_Q);
|
|
|
|
for_each_output_queue(irq_ptr, q, i)
|
|
|
|
set_buf_states(q, 0, SLSB_P_OUTPUT_NOT_INIT,
|
|
|
|
QDIO_MAX_BUFFERS_PER_Q);
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output,
|
2008-07-17 09:16:48 -06:00
|
|
|
unsigned int input)
|
|
|
|
{
|
2011-01-05 04:47:52 -07:00
|
|
|
unsigned long schid = *((u32 *) &q->irq_ptr->schid);
|
|
|
|
unsigned int fc = QDIO_SIGA_SYNC;
|
2008-07-17 09:16:48 -06:00
|
|
|
int cc;
|
|
|
|
|
2008-12-25 05:38:48 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr);
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, siga_sync);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2011-01-05 04:47:52 -07:00
|
|
|
if (is_qebsm(q)) {
|
|
|
|
schid = q->irq_ptr->sch_token;
|
|
|
|
fc |= QDIO_SIGA_QEBSM_FLAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
cc = do_siga_sync(schid, output, input, fc);
|
2011-01-05 04:47:53 -07:00
|
|
|
if (unlikely(cc))
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc);
|
2008-07-17 09:16:48 -06:00
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static inline int qdio_siga_sync_q(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
if (q->is_input_q)
|
|
|
|
return qdio_siga_sync(q, 0, q->mask);
|
|
|
|
else
|
|
|
|
return qdio_siga_sync(q, q->mask, 0);
|
|
|
|
}
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit,
|
|
|
|
unsigned long aob)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-01-05 04:47:52 -07:00
|
|
|
unsigned long schid = *((u32 *) &q->irq_ptr->schid);
|
|
|
|
unsigned int fc = QDIO_SIGA_WRITE;
|
2008-12-25 05:38:48 -07:00
|
|
|
u64 start_time = 0;
|
2011-08-03 08:44:17 -06:00
|
|
|
int retries = 0, cc;
|
2011-08-07 19:33:55 -06:00
|
|
|
unsigned long laob = 0;
|
|
|
|
|
|
|
|
if (q->u.out.use_cq && aob != 0) {
|
|
|
|
fc = QDIO_SIGA_WRITEQ;
|
|
|
|
laob = aob;
|
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2008-12-25 05:38:48 -07:00
|
|
|
if (is_qebsm(q)) {
|
2008-07-17 09:16:48 -06:00
|
|
|
schid = q->irq_ptr->sch_token;
|
2011-01-05 04:47:52 -07:00
|
|
|
fc |= QDIO_SIGA_QEBSM_FLAG;
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
again:
|
2011-08-07 19:33:55 -06:00
|
|
|
WARN_ON_ONCE((aob && queue_type(q) != QDIO_IQDIO_QFMT) ||
|
|
|
|
(aob && fc != QDIO_SIGA_WRITEQ));
|
|
|
|
cc = do_siga_output(schid, q->mask, busy_bit, fc, laob);
|
2008-12-25 05:38:48 -07:00
|
|
|
|
|
|
|
/* hipersocket busy condition */
|
2011-01-05 04:47:53 -07:00
|
|
|
if (unlikely(*busy_bit)) {
|
2008-12-25 05:38:48 -07:00
|
|
|
WARN_ON(queue_type(q) != QDIO_IQDIO_QFMT || cc != 2);
|
2011-08-03 08:44:17 -06:00
|
|
|
retries++;
|
2008-08-21 11:46:34 -06:00
|
|
|
|
2008-12-25 05:38:48 -07:00
|
|
|
if (!start_time) {
|
2010-05-17 02:00:17 -06:00
|
|
|
start_time = get_clock();
|
2008-12-25 05:38:48 -07:00
|
|
|
goto again;
|
|
|
|
}
|
2010-05-17 02:00:17 -06:00
|
|
|
if ((get_clock() - start_time) < QDIO_BUSY_BIT_PATIENCE)
|
2008-07-17 09:16:48 -06:00
|
|
|
goto again;
|
|
|
|
}
|
2011-08-03 08:44:17 -06:00
|
|
|
if (retries) {
|
|
|
|
DBF_DEV_EVENT(DBF_WARN, q->irq_ptr,
|
|
|
|
"%4x cc2 BB1:%1d", SCH_NO(q), q->nr);
|
|
|
|
DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "count:%u", retries);
|
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qdio_siga_input(struct qdio_q *q)
|
|
|
|
{
|
2011-01-05 04:47:52 -07:00
|
|
|
unsigned long schid = *((u32 *) &q->irq_ptr->schid);
|
|
|
|
unsigned int fc = QDIO_SIGA_READ;
|
2008-07-17 09:16:48 -06:00
|
|
|
int cc;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr);
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, siga_read);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2011-01-05 04:47:52 -07:00
|
|
|
if (is_qebsm(q)) {
|
|
|
|
schid = q->irq_ptr->sch_token;
|
|
|
|
fc |= QDIO_SIGA_QEBSM_FLAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
cc = do_siga_input(schid, q->mask, fc);
|
2011-01-05 04:47:53 -07:00
|
|
|
if (unlikely(cc))
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc);
|
2008-07-17 09:16:48 -06:00
|
|
|
return cc;
|
|
|
|
}
|
|
|
|
|
2011-01-05 04:47:54 -07:00
|
|
|
#define qdio_siga_sync_out(q) qdio_siga_sync(q, ~0U, 0)
|
|
|
|
#define qdio_siga_sync_all(q) qdio_siga_sync(q, ~0U, ~0U)
|
|
|
|
|
|
|
|
static inline void qdio_sync_queues(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-01-05 04:47:54 -07:00
|
|
|
/* PCI capable outbound queues will also be scanned so sync them too */
|
|
|
|
if (pci_out_supported(q))
|
|
|
|
qdio_siga_sync_all(q);
|
|
|
|
else
|
2008-07-17 09:16:48 -06:00
|
|
|
qdio_siga_sync_q(q);
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
int debug_get_buf_state(struct qdio_q *q, unsigned int bufnr,
|
|
|
|
unsigned char *state)
|
|
|
|
{
|
2011-01-05 04:47:54 -07:00
|
|
|
if (need_siga_sync(q))
|
|
|
|
qdio_siga_sync_q(q);
|
2011-08-07 19:33:55 -06:00
|
|
|
return get_buf_states(q, bufnr, state, 1, 0, 0);
|
2009-06-22 04:08:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qdio_stop_polling(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2008-12-25 05:38:47 -07:00
|
|
|
if (!q->u.in.polling)
|
2008-07-17 09:16:48 -06:00
|
|
|
return;
|
2008-12-25 05:38:47 -07:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
q->u.in.polling = 0;
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, stop_polling);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
/* show the card that we are not polling anymore */
|
2008-12-25 05:38:47 -07:00
|
|
|
if (is_qebsm(q)) {
|
2009-03-26 08:24:29 -06:00
|
|
|
set_buf_states(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT,
|
2008-12-25 05:38:47 -07:00
|
|
|
q->u.in.ack_count);
|
|
|
|
q->u.in.ack_count = 0;
|
|
|
|
} else
|
2009-03-26 08:24:29 -06:00
|
|
|
set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
2010-02-26 14:37:36 -07:00
|
|
|
static inline void account_sbals(struct qdio_q *q, int count)
|
|
|
|
{
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
q->q_stats.nr_sbal_total += count;
|
|
|
|
if (count == QDIO_MAX_BUFFERS_MASK) {
|
|
|
|
q->q_stats.nr_sbals[7]++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
while (count >>= 1)
|
|
|
|
pos++;
|
|
|
|
q->q_stats.nr_sbals[pos]++;
|
|
|
|
}
|
|
|
|
|
2011-04-20 02:15:33 -06:00
|
|
|
static void process_buffer_error(struct qdio_q *q, int count)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-04-20 02:15:33 -06:00
|
|
|
unsigned char state = (q->is_input_q) ? SLSB_P_INPUT_NOT_INIT :
|
|
|
|
SLSB_P_OUTPUT_NOT_INIT;
|
|
|
|
|
2008-12-25 05:38:48 -07:00
|
|
|
q->qdio_error |= QDIO_ERROR_SLSB_STATE;
|
2008-12-25 05:38:47 -07:00
|
|
|
|
|
|
|
/* special handling for no target buffer empty */
|
|
|
|
if ((!q->is_input_q &&
|
2011-06-06 06:14:40 -06:00
|
|
|
(q->sbal[q->first_to_check]->element[15].sflags) == 0x10)) {
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, target_full);
|
2009-09-22 14:58:39 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x",
|
2008-12-25 05:38:47 -07:00
|
|
|
q->first_to_check);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x BUF ERROR", SCH_NO(q));
|
|
|
|
DBF_ERROR((q->is_input_q) ? "IN:%2d" : "OUT:%2d", q->nr);
|
2008-12-25 05:38:47 -07:00
|
|
|
DBF_ERROR("FTC:%3d C:%3d", q->first_to_check, count);
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("F14:%2x F15:%2x",
|
2011-06-06 06:14:40 -06:00
|
|
|
q->sbal[q->first_to_check]->element[14].sflags,
|
|
|
|
q->sbal[q->first_to_check]->element[15].sflags);
|
2011-04-20 02:15:33 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Interrupts may be avoided as long as the error is present
|
|
|
|
* so change the buffer state immediately to avoid starvation.
|
|
|
|
*/
|
|
|
|
set_buf_states(q, q->first_to_check, state, count);
|
2008-12-25 05:38:47 -07:00
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2008-12-25 05:38:47 -07:00
|
|
|
static inline void inbound_primed(struct qdio_q *q, int count)
|
|
|
|
{
|
|
|
|
int new;
|
|
|
|
|
2009-09-22 14:58:39 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in prim: %02x", count);
|
2008-12-25 05:38:47 -07:00
|
|
|
|
|
|
|
/* for QEBSM the ACK was already set by EQBS */
|
|
|
|
if (is_qebsm(q)) {
|
|
|
|
if (!q->u.in.polling) {
|
|
|
|
q->u.in.polling = 1;
|
|
|
|
q->u.in.ack_count = count;
|
2009-03-26 08:24:29 -06:00
|
|
|
q->u.in.ack_start = q->first_to_check;
|
2008-12-25 05:38:47 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* delete the previous ACK's */
|
2009-03-26 08:24:29 -06:00
|
|
|
set_buf_states(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT,
|
2008-12-25 05:38:47 -07:00
|
|
|
q->u.in.ack_count);
|
|
|
|
q->u.in.ack_count = count;
|
2009-03-26 08:24:29 -06:00
|
|
|
q->u.in.ack_start = q->first_to_check;
|
2008-12-25 05:38:47 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACK the newest buffer. The ACK will be removed in qdio_stop_polling
|
|
|
|
* or by the next inbound run.
|
|
|
|
*/
|
|
|
|
new = add_buf(q->first_to_check, count - 1);
|
|
|
|
if (q->u.in.polling) {
|
|
|
|
/* reset the previous ACK but first set the new one */
|
|
|
|
set_buf_state(q, new, SLSB_P_INPUT_ACK);
|
2009-03-26 08:24:29 -06:00
|
|
|
set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT);
|
2009-03-26 08:24:28 -06:00
|
|
|
} else {
|
2008-12-25 05:38:47 -07:00
|
|
|
q->u.in.polling = 1;
|
2009-03-26 08:24:28 -06:00
|
|
|
set_buf_state(q, new, SLSB_P_INPUT_ACK);
|
2008-12-25 05:38:47 -07:00
|
|
|
}
|
|
|
|
|
2009-03-26 08:24:29 -06:00
|
|
|
q->u.in.ack_start = new;
|
2008-12-25 05:38:47 -07:00
|
|
|
count--;
|
|
|
|
if (!count)
|
|
|
|
return;
|
2009-09-22 14:58:40 -06:00
|
|
|
/* need to change ALL buffers to get more interrupts */
|
|
|
|
set_buf_states(q, q->first_to_check, SLSB_P_INPUT_NOT_INIT, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int get_inbound_buffer_frontier(struct qdio_q *q)
|
|
|
|
{
|
|
|
|
int count, stop;
|
2011-01-31 03:30:08 -07:00
|
|
|
unsigned char state = 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't check 128 buffers, as otherwise qdio_inbound_q_moved
|
|
|
|
* would return 0.
|
|
|
|
*/
|
|
|
|
count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
|
|
|
|
stop = add_buf(q->first_to_check, count);
|
|
|
|
|
|
|
|
if (q->first_to_check == stop)
|
|
|
|
goto out;
|
|
|
|
|
2009-06-22 04:08:12 -06:00
|
|
|
/*
|
|
|
|
* No siga sync here, as a PCI or we after a thin interrupt
|
|
|
|
* already sync'ed the queues.
|
|
|
|
*/
|
2011-08-07 19:33:55 -06:00
|
|
|
count = get_buf_states(q, q->first_to_check, &state, count, 1, 0);
|
2008-07-17 09:16:48 -06:00
|
|
|
if (!count)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case SLSB_P_INPUT_PRIMED:
|
2008-12-25 05:38:47 -07:00
|
|
|
inbound_primed(q, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
q->first_to_check = add_buf(q->first_to_check, count);
|
2009-12-18 09:43:26 -07:00
|
|
|
if (atomic_sub(count, &q->nr_buf_used) == 0)
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, inbound_queue_full);
|
2010-02-26 14:37:36 -07:00
|
|
|
if (q->irq_ptr->perf_stat_enabled)
|
|
|
|
account_sbals(q, count);
|
2009-06-22 04:08:12 -06:00
|
|
|
break;
|
2008-07-17 09:16:48 -06:00
|
|
|
case SLSB_P_INPUT_ERROR:
|
2011-04-20 02:15:33 -06:00
|
|
|
process_buffer_error(q, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
q->first_to_check = add_buf(q->first_to_check, count);
|
|
|
|
atomic_sub(count, &q->nr_buf_used);
|
2010-02-26 14:37:36 -07:00
|
|
|
if (q->irq_ptr->perf_stat_enabled)
|
|
|
|
account_sbals_error(q, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
break;
|
|
|
|
case SLSB_CU_INPUT_EMPTY:
|
|
|
|
case SLSB_P_INPUT_NOT_INIT:
|
|
|
|
case SLSB_P_INPUT_ACK:
|
2010-02-26 14:37:36 -07:00
|
|
|
if (q->irq_ptr->perf_stat_enabled)
|
|
|
|
q->q_stats.nr_sbal_nop++;
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in nop");
|
2008-07-17 09:16:48 -06:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
return q->first_to_check;
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static int qdio_inbound_q_moved(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
int bufnr;
|
|
|
|
|
|
|
|
bufnr = get_inbound_buffer_frontier(q);
|
|
|
|
|
2009-03-26 08:24:29 -06:00
|
|
|
if ((bufnr != q->last_move) || q->qdio_error) {
|
|
|
|
q->last_move = bufnr;
|
2010-02-26 14:37:38 -07:00
|
|
|
if (!is_thinint_irq(q->irq_ptr) && MACHINE_IS_LPAR)
|
2010-05-17 02:00:17 -06:00
|
|
|
q->u.in.timestamp = get_clock();
|
2008-07-17 09:16:48 -06:00
|
|
|
return 1;
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:11 -06:00
|
|
|
static inline int qdio_inbound_q_done(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2008-12-25 05:38:45 -07:00
|
|
|
unsigned char state = 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (!atomic_read(&q->nr_buf_used))
|
|
|
|
return 1;
|
|
|
|
|
2011-01-05 04:47:54 -07:00
|
|
|
if (need_siga_sync(q))
|
|
|
|
qdio_siga_sync_q(q);
|
2008-12-25 05:38:47 -07:00
|
|
|
get_buf_state(q, q->first_to_check, &state, 0);
|
2009-06-22 04:08:11 -06:00
|
|
|
|
2010-02-09 01:46:07 -07:00
|
|
|
if (state == SLSB_P_INPUT_PRIMED || state == SLSB_P_INPUT_ERROR)
|
2009-06-22 04:08:11 -06:00
|
|
|
/* more work coming */
|
2008-07-17 09:16:48 -06:00
|
|
|
return 0;
|
|
|
|
|
2009-06-22 04:08:11 -06:00
|
|
|
if (is_thinint_irq(q->irq_ptr))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* don't poll under z/VM */
|
|
|
|
if (MACHINE_IS_VM)
|
2008-07-17 09:16:48 -06:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* At this point we know, that inbound first_to_check
|
|
|
|
* has (probably) not moved (see qdio_inbound_processing).
|
|
|
|
*/
|
2010-05-17 02:00:17 -06:00
|
|
|
if (get_clock() > q->u.in.timestamp + QDIO_INPUT_THRESHOLD) {
|
2009-09-22 14:58:39 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "in done:%02x",
|
2008-12-25 05:38:46 -07:00
|
|
|
q->first_to_check);
|
2008-07-17 09:16:48 -06:00
|
|
|
return 1;
|
2009-06-22 04:08:11 -06:00
|
|
|
} else
|
2009-06-22 04:08:10 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
static inline int contains_aobs(struct qdio_q *q)
|
|
|
|
{
|
|
|
|
return !q->is_input_q && q->u.out.use_cq;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qdio_trace_aob(struct qdio_irq *irq, struct qdio_q *q,
|
|
|
|
int i, struct qaob *aob)
|
|
|
|
{
|
|
|
|
int tmp;
|
|
|
|
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "AOB%d:%lx", i,
|
|
|
|
(unsigned long) virt_to_phys(aob));
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES00:%lx",
|
|
|
|
(unsigned long) aob->res0[0]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES01:%lx",
|
|
|
|
(unsigned long) aob->res0[1]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES02:%lx",
|
|
|
|
(unsigned long) aob->res0[2]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES03:%lx",
|
|
|
|
(unsigned long) aob->res0[3]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES04:%lx",
|
|
|
|
(unsigned long) aob->res0[4]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES05:%lx",
|
|
|
|
(unsigned long) aob->res0[5]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES1:%x", aob->res1);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES2:%x", aob->res2);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES3:%x", aob->res3);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "AORC:%u", aob->aorc);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "FLAGS:%u", aob->flags);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "CBTBS:%u", aob->cbtbs);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "SBC:%u", aob->sb_count);
|
|
|
|
for (tmp = 0; tmp < QDIO_MAX_ELEMENTS_PER_BUFFER; ++tmp) {
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "SBA%d:%lx", tmp,
|
|
|
|
(unsigned long) aob->sba[tmp]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "rSBA%d:%lx", tmp,
|
|
|
|
(unsigned long) q->sbal[i]->element[tmp].addr);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "DC%d:%u", tmp, aob->dcount[tmp]);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "rDC%d:%u", tmp,
|
|
|
|
q->sbal[i]->element[tmp].length);
|
|
|
|
}
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "USER0:%lx", (unsigned long) aob->user0);
|
|
|
|
for (tmp = 0; tmp < 2; ++tmp) {
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "RES4%d:%lx", tmp,
|
|
|
|
(unsigned long) aob->res4[tmp]);
|
|
|
|
}
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "USER1:%lx", (unsigned long) aob->user1);
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq, "USER2:%lx", (unsigned long) aob->user2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void qdio_handle_aobs(struct qdio_q *q, int start, int count)
|
|
|
|
{
|
|
|
|
unsigned char state = 0;
|
|
|
|
int j, b = start;
|
|
|
|
|
|
|
|
if (!contains_aobs(q))
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (j = 0; j < count; ++j) {
|
|
|
|
get_buf_state(q, b, &state, 0);
|
|
|
|
if (state == SLSB_P_OUTPUT_PENDING) {
|
|
|
|
struct qaob *aob = q->u.out.aobs[b];
|
|
|
|
if (aob == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
BUG_ON(q->u.out.sbal_state == NULL);
|
|
|
|
q->u.out.sbal_state[b].flags |=
|
|
|
|
QDIO_OUTBUF_STATE_FLAG_PENDING;
|
|
|
|
q->u.out.aobs[b] = NULL;
|
|
|
|
} else if (state == SLSB_P_OUTPUT_EMPTY) {
|
|
|
|
BUG_ON(q->u.out.sbal_state == NULL);
|
|
|
|
q->u.out.sbal_state[b].aob = NULL;
|
|
|
|
}
|
|
|
|
b = next_buf(b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long qdio_aob_for_buffer(struct qdio_output_q *q,
|
|
|
|
int bufnr)
|
|
|
|
{
|
|
|
|
unsigned long phys_aob = 0;
|
|
|
|
|
|
|
|
if (!q->use_cq)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (!q->aobs[bufnr]) {
|
|
|
|
struct qaob *aob = qdio_allocate_aob();
|
|
|
|
q->aobs[bufnr] = aob;
|
|
|
|
}
|
|
|
|
if (q->aobs[bufnr]) {
|
|
|
|
BUG_ON(q->sbal_state == NULL);
|
|
|
|
q->sbal_state[bufnr].flags = QDIO_OUTBUF_STATE_FLAG_NONE;
|
|
|
|
q->sbal_state[bufnr].aob = q->aobs[bufnr];
|
|
|
|
q->aobs[bufnr]->user1 = (u64) q->sbal_state[bufnr].user;
|
|
|
|
phys_aob = virt_to_phys(q->aobs[bufnr]);
|
|
|
|
BUG_ON(phys_aob & 0xFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
return phys_aob;
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static void qdio_kick_handler(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2009-03-26 08:24:32 -06:00
|
|
|
int start = q->first_to_kick;
|
|
|
|
int end = q->first_to_check;
|
|
|
|
int count;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE))
|
|
|
|
return;
|
|
|
|
|
2009-03-26 08:24:32 -06:00
|
|
|
count = sub_buf(end, start);
|
|
|
|
|
|
|
|
if (q->is_input_q) {
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, inbound_handler);
|
2009-09-22 14:58:39 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count);
|
2010-03-08 04:25:18 -07:00
|
|
|
} else {
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, outbound_handler);
|
2009-09-22 14:58:39 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x",
|
|
|
|
start, count);
|
2010-03-08 04:25:18 -07:00
|
|
|
}
|
2009-03-26 08:24:32 -06:00
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
qdio_handle_aobs(q, start, count);
|
|
|
|
|
2009-03-26 08:24:32 -06:00
|
|
|
q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count,
|
|
|
|
q->irq_ptr->int_parm);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
/* for the next time */
|
2009-03-26 08:24:32 -06:00
|
|
|
q->first_to_kick = end;
|
2008-07-17 09:16:48 -06:00
|
|
|
q->qdio_error = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __qdio_inbound_processing(struct qdio_q *q)
|
|
|
|
{
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, tasklet_inbound);
|
2010-05-17 02:00:15 -06:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
if (!qdio_inbound_q_moved(q))
|
|
|
|
return;
|
|
|
|
|
2009-03-26 08:24:32 -06:00
|
|
|
qdio_kick_handler(q);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2010-01-04 01:05:42 -07:00
|
|
|
if (!qdio_inbound_q_done(q)) {
|
2008-07-17 09:16:48 -06:00
|
|
|
/* means poll time is not yet over */
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, tasklet_inbound_resched);
|
2010-05-17 02:00:15 -06:00
|
|
|
if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) {
|
|
|
|
tasklet_schedule(&q->tasklet);
|
|
|
|
return;
|
|
|
|
}
|
2010-01-04 01:05:42 -07:00
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
qdio_stop_polling(q);
|
|
|
|
/*
|
|
|
|
* We need to check again to not lose initiative after
|
|
|
|
* resetting the ACK state.
|
|
|
|
*/
|
2010-01-04 01:05:42 -07:00
|
|
|
if (!qdio_inbound_q_done(q)) {
|
|
|
|
qperf_inc(q, tasklet_inbound_resched2);
|
2010-05-17 02:00:15 -06:00
|
|
|
if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED))
|
|
|
|
tasklet_schedule(&q->tasklet);
|
2010-01-04 01:05:42 -07:00
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void qdio_inbound_processing(unsigned long data)
|
|
|
|
{
|
|
|
|
struct qdio_q *q = (struct qdio_q *)data;
|
|
|
|
__qdio_inbound_processing(q);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_outbound_buffer_frontier(struct qdio_q *q)
|
|
|
|
{
|
|
|
|
int count, stop;
|
2011-01-31 03:30:08 -07:00
|
|
|
unsigned char state = 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2011-01-05 04:47:54 -07:00
|
|
|
if (need_siga_sync(q))
|
|
|
|
if (((queue_type(q) != QDIO_IQDIO_QFMT) &&
|
|
|
|
!pci_out_supported(q)) ||
|
|
|
|
(queue_type(q) == QDIO_IQDIO_QFMT &&
|
|
|
|
multicast_outbound(q)))
|
|
|
|
qdio_siga_sync_q(q);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't check 128 buffers, as otherwise qdio_inbound_q_moved
|
|
|
|
* would return 0.
|
|
|
|
*/
|
|
|
|
count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
|
|
|
|
stop = add_buf(q->first_to_check, count);
|
|
|
|
if (q->first_to_check == stop)
|
2011-08-07 19:33:55 -06:00
|
|
|
goto out;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
count = get_buf_states(q, q->first_to_check, &state, count, 0, 1);
|
2008-07-17 09:16:48 -06:00
|
|
|
if (!count)
|
2011-08-07 19:33:55 -06:00
|
|
|
goto out;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
switch (state) {
|
2011-08-07 19:33:55 -06:00
|
|
|
case SLSB_P_OUTPUT_PENDING:
|
|
|
|
BUG();
|
2008-07-17 09:16:48 -06:00
|
|
|
case SLSB_P_OUTPUT_EMPTY:
|
|
|
|
/* the adapter got it */
|
2011-08-07 19:33:55 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr,
|
|
|
|
"out empty:%1d %02x", q->nr, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
atomic_sub(count, &q->nr_buf_used);
|
|
|
|
q->first_to_check = add_buf(q->first_to_check, count);
|
2010-02-26 14:37:36 -07:00
|
|
|
if (q->irq_ptr->perf_stat_enabled)
|
|
|
|
account_sbals(q, count);
|
2011-08-07 19:33:55 -06:00
|
|
|
|
2009-06-22 04:08:12 -06:00
|
|
|
break;
|
2008-07-17 09:16:48 -06:00
|
|
|
case SLSB_P_OUTPUT_ERROR:
|
2011-04-20 02:15:33 -06:00
|
|
|
process_buffer_error(q, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
q->first_to_check = add_buf(q->first_to_check, count);
|
|
|
|
atomic_sub(count, &q->nr_buf_used);
|
2010-02-26 14:37:36 -07:00
|
|
|
if (q->irq_ptr->perf_stat_enabled)
|
|
|
|
account_sbals_error(q, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
break;
|
|
|
|
case SLSB_CU_OUTPUT_PRIMED:
|
|
|
|
/* the adapter has not fetched the output yet */
|
2010-02-26 14:37:36 -07:00
|
|
|
if (q->irq_ptr->perf_stat_enabled)
|
|
|
|
q->q_stats.nr_sbal_nop++;
|
2011-08-07 19:33:55 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "out primed:%1d",
|
|
|
|
q->nr);
|
2008-07-17 09:16:48 -06:00
|
|
|
break;
|
|
|
|
case SLSB_P_OUTPUT_NOT_INIT:
|
|
|
|
case SLSB_P_OUTPUT_HALTED:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BUG();
|
|
|
|
}
|
2011-08-07 19:33:55 -06:00
|
|
|
|
|
|
|
out:
|
2008-07-17 09:16:48 -06:00
|
|
|
return q->first_to_check;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* all buffers processed? */
|
|
|
|
static inline int qdio_outbound_q_done(struct qdio_q *q)
|
|
|
|
{
|
|
|
|
return atomic_read(&q->nr_buf_used) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int qdio_outbound_q_moved(struct qdio_q *q)
|
|
|
|
{
|
|
|
|
int bufnr;
|
|
|
|
|
|
|
|
bufnr = get_outbound_buffer_frontier(q);
|
|
|
|
|
2009-03-26 08:24:29 -06:00
|
|
|
if ((bufnr != q->last_move) || q->qdio_error) {
|
|
|
|
q->last_move = bufnr;
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "out moved:%1d", q->nr);
|
2008-07-17 09:16:48 -06:00
|
|
|
return 1;
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
static int qdio_kick_outbound_q(struct qdio_q *q, unsigned long aob)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-08-03 08:44:17 -06:00
|
|
|
int retries = 0, cc;
|
2008-12-25 05:38:48 -07:00
|
|
|
unsigned int busy_bit;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (!need_siga_out(q))
|
2009-03-26 08:24:31 -06:00
|
|
|
return 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2008-12-25 05:38:48 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr);
|
2011-08-03 08:44:17 -06:00
|
|
|
retry:
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, siga_write);
|
2008-12-25 05:38:48 -07:00
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
cc = qdio_siga_output(q, &busy_bit, aob);
|
2008-12-25 05:38:48 -07:00
|
|
|
switch (cc) {
|
2008-07-17 09:16:48 -06:00
|
|
|
case 0:
|
|
|
|
break;
|
2008-12-25 05:38:48 -07:00
|
|
|
case 2:
|
|
|
|
if (busy_bit) {
|
2011-08-03 08:44:17 -06:00
|
|
|
while (++retries < QDIO_BUSY_BIT_RETRIES) {
|
|
|
|
mdelay(QDIO_BUSY_BIT_RETRY_DELAY);
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
DBF_ERROR("%4x cc2 BBC:%1d", SCH_NO(q), q->nr);
|
2009-03-26 08:24:31 -06:00
|
|
|
cc |= QDIO_ERROR_SIGA_BUSY;
|
|
|
|
} else
|
|
|
|
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w cc2:%1d", q->nr);
|
2008-12-25 05:38:48 -07:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
DBF_ERROR("%4x SIGA-W:%1d", SCH_NO(q), cc);
|
|
|
|
break;
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
2011-08-03 08:44:17 -06:00
|
|
|
if (retries) {
|
|
|
|
DBF_ERROR("%4x cc2 BB2:%1d", SCH_NO(q), q->nr);
|
|
|
|
DBF_ERROR("count:%u", retries);
|
|
|
|
}
|
2009-03-26 08:24:31 -06:00
|
|
|
return cc;
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __qdio_outbound_processing(struct qdio_q *q)
|
|
|
|
{
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, tasklet_outbound);
|
2008-07-17 09:16:48 -06:00
|
|
|
BUG_ON(atomic_read(&q->nr_buf_used) < 0);
|
|
|
|
|
|
|
|
if (qdio_outbound_q_moved(q))
|
2009-03-26 08:24:32 -06:00
|
|
|
qdio_kick_handler(q);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
if (queue_type(q) == QDIO_ZFCP_QFMT)
|
2008-07-17 09:16:48 -06:00
|
|
|
if (!pci_out_supported(q) && !qdio_outbound_q_done(q))
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
goto sched;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
/* bail out for HiperSockets unicast queues */
|
|
|
|
if (queue_type(q) == QDIO_IQDIO_QFMT && !multicast_outbound(q))
|
|
|
|
return;
|
|
|
|
|
2008-10-10 13:33:04 -06:00
|
|
|
if ((queue_type(q) == QDIO_IQDIO_QFMT) &&
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
(atomic_read(&q->nr_buf_used)) > QDIO_IQDIO_POLL_LVL)
|
|
|
|
goto sched;
|
2008-10-10 13:33:04 -06:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
if (q->u.out.pci_out_enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now we know that queue type is either qeth without pci enabled
|
|
|
|
* or HiperSockets multicast. Make sure buffer switch from PRIMED to
|
|
|
|
* EMPTY is noticed and outbound_handler is called after some time.
|
|
|
|
*/
|
|
|
|
if (qdio_outbound_q_done(q))
|
|
|
|
del_timer(&q->u.out.timer);
|
2010-01-04 01:05:42 -07:00
|
|
|
else
|
|
|
|
if (!timer_pending(&q->u.out.timer))
|
2008-07-17 09:16:48 -06:00
|
|
|
mod_timer(&q->u.out.timer, jiffies + 10 * HZ);
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
return;
|
|
|
|
|
|
|
|
sched:
|
|
|
|
if (unlikely(q->irq_ptr->state == QDIO_IRQ_STATE_STOPPED))
|
|
|
|
return;
|
|
|
|
tasklet_schedule(&q->tasklet);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* outbound tasklet */
|
|
|
|
void qdio_outbound_processing(unsigned long data)
|
|
|
|
{
|
|
|
|
struct qdio_q *q = (struct qdio_q *)data;
|
|
|
|
__qdio_outbound_processing(q);
|
|
|
|
}
|
|
|
|
|
|
|
|
void qdio_outbound_timer(unsigned long data)
|
|
|
|
{
|
|
|
|
struct qdio_q *q = (struct qdio_q *)data;
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
|
|
|
|
if (unlikely(q->irq_ptr->state == QDIO_IRQ_STATE_STOPPED))
|
|
|
|
return;
|
2008-07-17 09:16:48 -06:00
|
|
|
tasklet_schedule(&q->tasklet);
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static inline void qdio_check_outbound_after_thinint(struct qdio_q *q)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
struct qdio_q *out;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!pci_out_supported(q))
|
|
|
|
return;
|
|
|
|
|
|
|
|
for_each_output_queue(q->irq_ptr, out, i)
|
|
|
|
if (!qdio_outbound_q_done(out))
|
|
|
|
tasklet_schedule(&out->tasklet);
|
|
|
|
}
|
|
|
|
|
2009-06-22 04:08:10 -06:00
|
|
|
static void __tiqdio_inbound_processing(struct qdio_q *q)
|
|
|
|
{
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, tasklet_inbound);
|
2011-01-05 04:47:54 -07:00
|
|
|
if (need_siga_sync(q) && need_siga_sync_after_ai(q))
|
|
|
|
qdio_sync_queues(q);
|
2009-06-22 04:08:10 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The interrupt could be caused by a PCI request. Check the
|
|
|
|
* PCI capable outbound queues.
|
|
|
|
*/
|
|
|
|
qdio_check_outbound_after_thinint(q);
|
|
|
|
|
|
|
|
if (!qdio_inbound_q_moved(q))
|
|
|
|
return;
|
|
|
|
|
|
|
|
qdio_kick_handler(q);
|
|
|
|
|
2009-06-22 04:08:11 -06:00
|
|
|
if (!qdio_inbound_q_done(q)) {
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, tasklet_inbound_resched);
|
2009-09-11 02:28:19 -06:00
|
|
|
if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) {
|
2009-06-22 04:08:10 -06:00
|
|
|
tasklet_schedule(&q->tasklet);
|
2009-09-11 02:28:19 -06:00
|
|
|
return;
|
|
|
|
}
|
2009-06-22 04:08:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
qdio_stop_polling(q);
|
|
|
|
/*
|
|
|
|
* We need to check again to not lose initiative after
|
|
|
|
* resetting the ACK state.
|
|
|
|
*/
|
2009-06-22 04:08:11 -06:00
|
|
|
if (!qdio_inbound_q_done(q)) {
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, tasklet_inbound_resched2);
|
2009-06-22 04:08:10 -06:00
|
|
|
if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED))
|
|
|
|
tasklet_schedule(&q->tasklet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void tiqdio_inbound_processing(unsigned long data)
|
|
|
|
{
|
|
|
|
struct qdio_q *q = (struct qdio_q *)data;
|
|
|
|
__tiqdio_inbound_processing(q);
|
|
|
|
}
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
static inline void qdio_set_state(struct qdio_irq *irq_ptr,
|
|
|
|
enum qdio_irq_states state)
|
|
|
|
{
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq_ptr, "newstate: %1d", state);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
irq_ptr->state = state;
|
|
|
|
mb();
|
|
|
|
}
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
static void qdio_irq_check_sense(struct qdio_irq *irq_ptr, struct irb *irb)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
if (irb->esw.esw0.erw.cons) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x sense:", irq_ptr->schid.sch_no);
|
|
|
|
DBF_ERROR_HEX(irb, 64);
|
|
|
|
DBF_ERROR_HEX(irb->ecw, 64);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PCI interrupt handler */
|
|
|
|
static void qdio_int_handler_pci(struct qdio_irq *irq_ptr)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct qdio_q *q;
|
|
|
|
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
if (unlikely(irq_ptr->state == QDIO_IRQ_STATE_STOPPED))
|
|
|
|
return;
|
|
|
|
|
2010-09-07 15:14:39 -06:00
|
|
|
for_each_input_queue(irq_ptr, q, i) {
|
|
|
|
if (q->u.in.queue_start_poll) {
|
|
|
|
/* skip if polling is enabled or already in work */
|
|
|
|
if (test_and_set_bit(QDIO_QUEUE_IRQS_DISABLED,
|
|
|
|
&q->u.in.queue_irq_state)) {
|
|
|
|
qperf_inc(q, int_discarded);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
q->u.in.queue_start_poll(q->irq_ptr->cdev, q->nr,
|
|
|
|
q->irq_ptr->int_parm);
|
2011-08-07 19:33:55 -06:00
|
|
|
} else {
|
2010-09-07 15:14:39 -06:00
|
|
|
tasklet_schedule(&q->tasklet);
|
2011-08-07 19:33:55 -06:00
|
|
|
}
|
2010-09-07 15:14:39 -06:00
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2011-01-05 04:47:54 -07:00
|
|
|
if (!pci_out_supported(q))
|
2008-07-17 09:16:48 -06:00
|
|
|
return;
|
|
|
|
|
|
|
|
for_each_output_queue(irq_ptr, q, i) {
|
|
|
|
if (qdio_outbound_q_done(q))
|
|
|
|
continue;
|
2011-01-05 04:47:54 -07:00
|
|
|
if (need_siga_sync(q) && need_siga_sync_out_after_pci(q))
|
2008-07-17 09:16:48 -06:00
|
|
|
qdio_siga_sync_q(q);
|
|
|
|
tasklet_schedule(&q->tasklet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void qdio_handle_activate_check(struct ccw_device *cdev,
|
|
|
|
unsigned long intparm, int cstat, int dstat)
|
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
struct qdio_q *q;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x ACT CHECK", irq_ptr->schid.sch_no);
|
|
|
|
DBF_ERROR("intp :%lx", intparm);
|
|
|
|
DBF_ERROR("ds: %2x cs:%2x", dstat, cstat);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (irq_ptr->nr_input_qs) {
|
|
|
|
q = irq_ptr->input_qs[0];
|
|
|
|
} else if (irq_ptr->nr_output_qs) {
|
|
|
|
q = irq_ptr->output_qs[0];
|
|
|
|
} else {
|
|
|
|
dump_stack();
|
|
|
|
goto no_handler;
|
|
|
|
}
|
|
|
|
q->handler(q->irq_ptr->cdev, QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
|
|
|
|
0, -1, -1, irq_ptr->int_parm);
|
|
|
|
no_handler:
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_STOPPED);
|
|
|
|
}
|
|
|
|
|
2009-06-12 02:26:28 -06:00
|
|
|
static void qdio_establish_handle_irq(struct ccw_device *cdev, int cstat,
|
|
|
|
int dstat)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
|
2009-06-12 02:26:28 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq_ptr, "qest irq");
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2009-06-12 02:26:28 -06:00
|
|
|
if (cstat)
|
2008-07-17 09:16:48 -06:00
|
|
|
goto error;
|
2009-06-12 02:26:28 -06:00
|
|
|
if (dstat & ~(DEV_STAT_DEV_END | DEV_STAT_CHN_END))
|
2008-07-17 09:16:48 -06:00
|
|
|
goto error;
|
2009-06-12 02:26:28 -06:00
|
|
|
if (!(dstat & DEV_STAT_DEV_END))
|
|
|
|
goto error;
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ESTABLISHED);
|
|
|
|
return;
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
error:
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x EQ:error", irq_ptr->schid.sch_no);
|
|
|
|
DBF_ERROR("ds: %2x cs:%2x", dstat, cstat);
|
2008-07-17 09:16:48 -06:00
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* qdio interrupt handler */
|
|
|
|
void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
|
|
|
|
struct irb *irb)
|
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
int cstat, dstat;
|
|
|
|
|
|
|
|
if (!intparm || !irq_ptr) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("qint:%4x", cdev->private->schid.sch_no);
|
2008-07-17 09:16:48 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-05 04:47:29 -07:00
|
|
|
kstat_cpu(smp_processor_id()).irqs[IOINT_QDI]++;
|
2010-05-17 02:00:14 -06:00
|
|
|
if (irq_ptr->perf_stat_enabled)
|
|
|
|
irq_ptr->perf_stat.qdio_int++;
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
if (IS_ERR(irb)) {
|
|
|
|
switch (PTR_ERR(irb)) {
|
|
|
|
case -EIO:
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x IO error", irq_ptr->schid.sch_no);
|
2009-04-14 07:36:22 -06:00
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
|
|
|
|
wake_up(&cdev->private->wait_q);
|
2008-07-17 09:16:48 -06:00
|
|
|
return;
|
|
|
|
default:
|
|
|
|
WARN_ON(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-12-25 05:38:46 -07:00
|
|
|
qdio_irq_check_sense(irq_ptr, irb);
|
2008-07-17 09:16:48 -06:00
|
|
|
cstat = irb->scsw.cmd.cstat;
|
|
|
|
dstat = irb->scsw.cmd.dstat;
|
|
|
|
|
|
|
|
switch (irq_ptr->state) {
|
|
|
|
case QDIO_IRQ_STATE_INACTIVE:
|
|
|
|
qdio_establish_handle_irq(cdev, cstat, dstat);
|
|
|
|
break;
|
|
|
|
case QDIO_IRQ_STATE_CLEANUP:
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
|
|
|
|
break;
|
|
|
|
case QDIO_IRQ_STATE_ESTABLISHED:
|
|
|
|
case QDIO_IRQ_STATE_ACTIVE:
|
|
|
|
if (cstat & SCHN_STAT_PCI) {
|
|
|
|
qdio_int_handler_pci(irq_ptr);
|
|
|
|
return;
|
|
|
|
}
|
2009-06-12 02:26:28 -06:00
|
|
|
if (cstat || dstat)
|
2008-07-17 09:16:48 -06:00
|
|
|
qdio_handle_activate_check(cdev, intparm, cstat,
|
|
|
|
dstat);
|
2009-06-12 02:26:28 -06:00
|
|
|
break;
|
2010-02-09 01:46:08 -07:00
|
|
|
case QDIO_IRQ_STATE_STOPPED:
|
|
|
|
break;
|
2008-07-17 09:16:48 -06:00
|
|
|
default:
|
|
|
|
WARN_ON(1);
|
|
|
|
}
|
|
|
|
wake_up(&cdev->private->wait_q);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_get_ssqd_desc - get qdio subchannel description
|
|
|
|
* @cdev: ccw device to get description for
|
2008-12-25 05:38:43 -07:00
|
|
|
* @data: where to store the ssqd
|
2008-07-17 09:16:48 -06:00
|
|
|
*
|
2008-12-25 05:38:43 -07:00
|
|
|
* Returns 0 or an error code. The results of the chsc are stored in the
|
|
|
|
* specified structure.
|
2008-07-17 09:16:48 -06:00
|
|
|
*/
|
2008-12-25 05:38:43 -07:00
|
|
|
int qdio_get_ssqd_desc(struct ccw_device *cdev,
|
|
|
|
struct qdio_ssqd_desc *data)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
|
2008-12-25 05:38:43 -07:00
|
|
|
if (!cdev || !cdev->private)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("get ssqd:%4x", cdev->private->schid.sch_no);
|
2008-12-25 05:38:43 -07:00
|
|
|
return qdio_setup_get_ssqd(NULL, &cdev->private->schid, data);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(qdio_get_ssqd_desc);
|
|
|
|
|
|
|
|
static void qdio_shutdown_queues(struct ccw_device *cdev)
|
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
struct qdio_q *q;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for_each_input_queue(irq_ptr, q, i)
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
tasklet_kill(&q->tasklet);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
for_each_output_queue(irq_ptr, q, i) {
|
|
|
|
del_timer(&q->u.out.timer);
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
tasklet_kill(&q->tasklet);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_shutdown - shut down a qdio subchannel
|
|
|
|
* @cdev: associated ccw device
|
|
|
|
* @how: use halt or clear to shutdown
|
|
|
|
*/
|
|
|
|
int qdio_shutdown(struct ccw_device *cdev, int how)
|
|
|
|
{
|
2008-12-25 05:38:46 -07:00
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
2008-07-17 09:16:48 -06:00
|
|
|
int rc;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2009-03-26 08:24:24 -06:00
|
|
|
BUG_ON(irqs_disabled());
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("qshutdown:%4x", cdev->private->schid.sch_no);
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
mutex_lock(&irq_ptr->setup_mutex);
|
|
|
|
/*
|
|
|
|
* Subchannel was already shot down. We cannot prevent being called
|
|
|
|
* twice since cio may trigger a shutdown asynchronously.
|
|
|
|
*/
|
|
|
|
if (irq_ptr->state == QDIO_IRQ_STATE_INACTIVE) {
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[S390] qdio: proper kill of qdio tasklets
The queue tasklets were stopped with tasklet_disable. Although tasklet_disable
prevents the tasklet from beeing executed it is still possible that a tasklet
is scheduled on a CPU at that point. A following qdio_establish calls
tasklet_init which clears the tasklet count and the tasklet state leading to
the following Oops:
<2>kernel BUG at kernel/softirq.c:392!
<4>illegal operation: 0001 [#1] SMP
<4>Modules linked in: iptable_filter ip_tables x_tables dm_round_robin dm_multipath scsi_dh sg sd_mod crc_t10dif nfs lockd nfs
_acl sunrpc fuse loop dm_mod qeth_l3 ipv6 zfcp qeth scsi_transport_fc qdio scsi_tgt scsi_mod chsc_sch ccwgroup dasd_eckd_mod dasdm
od ext3 mbcache jbd
<4>Supported: Yes
<4>CPU: 0 Not tainted 2.6.27.13-1.1.mz13-default #1
<4>Process blast.LzS_64 (pid: 16445, task: 000000006cc02538, ksp: 000000006cb67998)
<4>Krnl PSW : 0704c00180000000 00000000001399f4 (tasklet_action+0xc8/0x1d4)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
<4>Krnl GPRS: ffffffff00000030 0000000000000002 0000000000000002 fffffffffffffffe
<4> 000000000013aabe 00000000003b6a18 fffffffffffffffd 0000000000000000
<4> 00000000006705a8 000000007d0914a8 000000007d0914b0 000000007fecfd30
<4> 0000000000000000 00000000003b63e8 000000007fecfd90 000000007fecfd30
<4>Krnl Code: 00000000001399e8: b9200021 cgr %r2,%r1
<4> 00000000001399ec: a7740004 brc 7,1399f4
<4> 00000000001399f0: a7f40001 brc 15,1399f2
<4> >00000000001399f4: c0100027e8ee larl %r1,636bd0
<4> 00000000001399fa: bf1f1008 icm %r1,15,8(%r1)
<4> 00000000001399fe: a7840019 brc 8,139a30
<4> 0000000000139a02: c0300027e8ef larl %r3,636be0
<4> 0000000000139a08: e3c030000004 lg %r12,0(%r3)
<4>Call Trace:
<4>([<0000000000139c12>] tasklet_hi_action+0x112/0x1d4)
<4> [<000000000013aabe>] __do_softirq+0xde/0x1c4
<4> [<000000000010fa2e>] do_softirq+0x96/0xb0
<4> [<000000000013a8d8>] irq_exit+0x70/0xcc
<4> [<000000000010d1d8>] do_extint+0xf0/0x110
<4> [<0000000000113b10>] ext_no_vtime+0x16/0x1a
<4> [<000003e0000a3662>] ext3_dirty_inode+0xe6/0xe8 [ext3]
<4>([<00000000001f6cf2>] __mark_inode_dirty+0x52/0x1d4)
<4> [<000003e0000a44f0>] ext3_ordered_write_end+0x138/0x190 [ext3]
<4> [<000000000018d5ec>] generic_perform_write+0x174/0x230
<4> [<0000000000190144>] generic_file_buffered_write+0xb4/0x194
<4> [<0000000000190864>] __generic_file_aio_write_nolock+0x418/0x454
<4> [<0000000000190ee2>] generic_file_aio_write+0x76/0xe4
<4> [<000003e0000a05c2>] ext3_file_write+0x3e/0xc8 [ext3]
<4> [<00000000001cc2fe>] do_sync_write+0xd6/0x120
<4> [<00000000001ccfc8>] vfs_write+0xac/0x184
<4> [<00000000001cd218>] SyS_write+0x68/0xe0
<4> [<0000000000113402>] sysc_noemu+0x10/0x16
<4> [<0000020000043188>] 0x20000043188
<4>Last Breaking-Event-Address:
<4> [<00000000001399f0>] tasklet_action+0xc4/0x1d4
<6>qdio: 0.0.c61b ZFCP on SC f67 using AI:1 QEBSM:0 PCI:1 TDD:1 SIGA: W AOP
<4> <0>Kernel panic - not syncing: Fatal exception in interrupt
Use tasklet_kill instead of tasklet_disbale. Since tasklet_schedule must not be
called after tasklet_kill use the QDIO_IRQ_STATE_STOPPED to inidicate that a
queue is going down and prevent further tasklet schedules in that case.
Remove superflous tasklet_schedule from input queue setup, at that time
the queues are not ready so the schedule results in a NOP.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 08:24:26 -06:00
|
|
|
/*
|
|
|
|
* Indicate that the device is going down. Scheduling the queue
|
|
|
|
* tasklets is forbidden from here on.
|
|
|
|
*/
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_STOPPED);
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
tiqdio_remove_input_queues(irq_ptr);
|
|
|
|
qdio_shutdown_queues(cdev);
|
|
|
|
qdio_shutdown_debug_entries(irq_ptr, cdev);
|
|
|
|
|
|
|
|
/* cleanup subchannel */
|
|
|
|
spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
|
|
|
|
|
|
|
|
if (how & QDIO_FLAG_CLEANUP_USING_CLEAR)
|
|
|
|
rc = ccw_device_clear(cdev, QDIO_DOING_CLEANUP);
|
|
|
|
else
|
|
|
|
/* default behaviour is halt */
|
|
|
|
rc = ccw_device_halt(cdev, QDIO_DOING_CLEANUP);
|
|
|
|
if (rc) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x SHUTD ERR", irq_ptr->schid.sch_no);
|
|
|
|
DBF_ERROR("rc:%4d", rc);
|
2008-07-17 09:16:48 -06:00
|
|
|
goto no_cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP);
|
|
|
|
spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
|
|
|
|
wait_event_interruptible_timeout(cdev->private->wait_q,
|
|
|
|
irq_ptr->state == QDIO_IRQ_STATE_INACTIVE ||
|
|
|
|
irq_ptr->state == QDIO_IRQ_STATE_ERR,
|
|
|
|
10 * HZ);
|
|
|
|
spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
|
|
|
|
|
|
|
|
no_cleanup:
|
|
|
|
qdio_shutdown_thinint(irq_ptr);
|
|
|
|
|
|
|
|
/* restore interrupt handler */
|
|
|
|
if ((void *)cdev->handler == (void *)qdio_int_handler)
|
|
|
|
cdev->handler = irq_ptr->orig_handler;
|
|
|
|
spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
|
|
|
|
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(qdio_shutdown);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_free - free data structures for a qdio subchannel
|
|
|
|
* @cdev: associated ccw device
|
|
|
|
*/
|
|
|
|
int qdio_free(struct ccw_device *cdev)
|
|
|
|
{
|
2008-12-25 05:38:46 -07:00
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
2008-08-21 11:46:34 -06:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("qfree:%4x", cdev->private->schid.sch_no);
|
2008-07-17 09:16:48 -06:00
|
|
|
mutex_lock(&irq_ptr->setup_mutex);
|
2008-12-25 05:38:46 -07:00
|
|
|
|
|
|
|
if (irq_ptr->debug_area != NULL) {
|
|
|
|
debug_unregister(irq_ptr->debug_area);
|
|
|
|
irq_ptr->debug_area = NULL;
|
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
cdev->private->qdio_data = NULL;
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
|
|
|
|
qdio_release_memory(irq_ptr);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(qdio_free);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_allocate - allocate qdio queues and associated data
|
|
|
|
* @init_data: initialization data
|
|
|
|
*/
|
|
|
|
int qdio_allocate(struct qdio_initialize *init_data)
|
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("qallocate:%4x", init_data->cdev->private->schid.sch_no);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if ((init_data->no_input_qs && !init_data->input_handler) ||
|
|
|
|
(init_data->no_output_qs && !init_data->output_handler))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if ((init_data->no_input_qs > QDIO_MAX_QUEUES_PER_IRQ) ||
|
|
|
|
(init_data->no_output_qs > QDIO_MAX_QUEUES_PER_IRQ))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if ((!init_data->input_sbal_addr_array) ||
|
|
|
|
(!init_data->output_sbal_addr_array))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* irq_ptr must be in GFP_DMA since it contains ccw1.cda */
|
|
|
|
irq_ptr = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
|
|
|
|
if (!irq_ptr)
|
|
|
|
goto out_err;
|
|
|
|
|
|
|
|
mutex_init(&irq_ptr->setup_mutex);
|
2008-12-25 05:38:46 -07:00
|
|
|
qdio_allocate_dbf(init_data, irq_ptr);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate a page for the chsc calls in qdio_establish.
|
|
|
|
* Must be pre-allocated since a zfcp recovery will call
|
|
|
|
* qdio_establish. In case of low memory and swap on a zfcp disk
|
|
|
|
* we may not be able to allocate memory otherwise.
|
|
|
|
*/
|
|
|
|
irq_ptr->chsc_page = get_zeroed_page(GFP_KERNEL);
|
|
|
|
if (!irq_ptr->chsc_page)
|
|
|
|
goto out_rel;
|
|
|
|
|
|
|
|
/* qdr is used in ccw1.cda which is u32 */
|
2008-08-01 08:39:17 -06:00
|
|
|
irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
|
2008-07-17 09:16:48 -06:00
|
|
|
if (!irq_ptr->qdr)
|
|
|
|
goto out_rel;
|
|
|
|
WARN_ON((unsigned long)irq_ptr->qdr & 0xfff);
|
|
|
|
|
|
|
|
if (qdio_allocate_qs(irq_ptr, init_data->no_input_qs,
|
|
|
|
init_data->no_output_qs))
|
|
|
|
goto out_rel;
|
|
|
|
|
|
|
|
init_data->cdev->private->qdio_data = irq_ptr;
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
|
|
|
|
return 0;
|
|
|
|
out_rel:
|
|
|
|
qdio_release_memory(irq_ptr);
|
|
|
|
out_err:
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(qdio_allocate);
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
static void qdio_detect_hsicq(struct qdio_irq *irq_ptr)
|
|
|
|
{
|
|
|
|
struct qdio_q *q = irq_ptr->input_qs[0];
|
|
|
|
int i, use_cq = 0;
|
|
|
|
|
|
|
|
if (irq_ptr->nr_input_qs > 1 && queue_type(q) == QDIO_IQDIO_QFMT)
|
|
|
|
use_cq = 1;
|
|
|
|
|
|
|
|
for_each_output_queue(irq_ptr, q, i) {
|
|
|
|
if (use_cq) {
|
|
|
|
if (qdio_enable_async_operation(&q->u.out) < 0) {
|
|
|
|
use_cq = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
qdio_disable_async_operation(&q->u.out);
|
|
|
|
}
|
|
|
|
DBF_EVENT("use_cq:%d", use_cq);
|
|
|
|
}
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
/**
|
|
|
|
* qdio_establish - establish queues on a qdio subchannel
|
|
|
|
* @init_data: initialization data
|
|
|
|
*/
|
|
|
|
int qdio_establish(struct qdio_initialize *init_data)
|
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr;
|
|
|
|
struct ccw_device *cdev = init_data->cdev;
|
|
|
|
unsigned long saveflags;
|
|
|
|
int rc;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("qestablish:%4x", cdev->private->schid.sch_no);
|
2008-08-21 11:46:34 -06:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
irq_ptr = cdev->private->qdio_data;
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
if (cdev->private->state != DEV_STATE_ONLINE)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
mutex_lock(&irq_ptr->setup_mutex);
|
|
|
|
qdio_setup_irq(init_data);
|
|
|
|
|
|
|
|
rc = qdio_establish_thinint(irq_ptr);
|
|
|
|
if (rc) {
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* establish q */
|
|
|
|
irq_ptr->ccw.cmd_code = irq_ptr->equeue.cmd;
|
|
|
|
irq_ptr->ccw.flags = CCW_FLAG_SLI;
|
|
|
|
irq_ptr->ccw.count = irq_ptr->equeue.count;
|
|
|
|
irq_ptr->ccw.cda = (u32)((addr_t)irq_ptr->qdr);
|
|
|
|
|
|
|
|
spin_lock_irqsave(get_ccwdev_lock(cdev), saveflags);
|
|
|
|
ccw_device_set_options_mask(cdev, 0);
|
|
|
|
|
|
|
|
rc = ccw_device_start(cdev, &irq_ptr->ccw, QDIO_DOING_ESTABLISH, 0, 0);
|
|
|
|
if (rc) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x est IO ERR", irq_ptr->schid.sch_no);
|
|
|
|
DBF_ERROR("rc:%4x", rc);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(get_ccwdev_lock(cdev), saveflags);
|
|
|
|
|
|
|
|
if (rc) {
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_event_interruptible_timeout(cdev->private->wait_q,
|
|
|
|
irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED ||
|
|
|
|
irq_ptr->state == QDIO_IRQ_STATE_ERR, HZ);
|
|
|
|
|
|
|
|
if (irq_ptr->state != QDIO_IRQ_STATE_ESTABLISHED) {
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
qdio_setup_ssqd_info(irq_ptr);
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("qib ac:%4x", irq_ptr->qib.ac);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
qdio_detect_hsicq(irq_ptr);
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
/* qebsm is now setup if available, initialize buffer states */
|
|
|
|
qdio_init_buf_states(irq_ptr);
|
|
|
|
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
qdio_print_subchannel_info(irq_ptr, cdev);
|
|
|
|
qdio_setup_debug_entries(irq_ptr, cdev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(qdio_establish);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_activate - activate queues on a qdio subchannel
|
|
|
|
* @cdev: associated cdev
|
|
|
|
*/
|
|
|
|
int qdio_activate(struct ccw_device *cdev)
|
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr;
|
|
|
|
int rc;
|
|
|
|
unsigned long saveflags;
|
|
|
|
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_EVENT("qactivate:%4x", cdev->private->schid.sch_no);
|
2008-08-21 11:46:34 -06:00
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
irq_ptr = cdev->private->qdio_data;
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
if (cdev->private->state != DEV_STATE_ONLINE)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
mutex_lock(&irq_ptr->setup_mutex);
|
|
|
|
if (irq_ptr->state == QDIO_IRQ_STATE_INACTIVE) {
|
|
|
|
rc = -EBUSY;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd;
|
|
|
|
irq_ptr->ccw.flags = CCW_FLAG_SLI;
|
|
|
|
irq_ptr->ccw.count = irq_ptr->aqueue.count;
|
|
|
|
irq_ptr->ccw.cda = 0;
|
|
|
|
|
|
|
|
spin_lock_irqsave(get_ccwdev_lock(cdev), saveflags);
|
|
|
|
ccw_device_set_options(cdev, CCWDEV_REPORT_ALL);
|
|
|
|
|
|
|
|
rc = ccw_device_start(cdev, &irq_ptr->ccw, QDIO_DOING_ACTIVATE,
|
|
|
|
0, DOIO_DENY_PREFETCH);
|
|
|
|
if (rc) {
|
2008-12-25 05:38:46 -07:00
|
|
|
DBF_ERROR("%4x act IO ERR", irq_ptr->schid.sch_no);
|
|
|
|
DBF_ERROR("rc:%4x", rc);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(get_ccwdev_lock(cdev), saveflags);
|
|
|
|
|
|
|
|
if (rc)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (is_thinint_irq(irq_ptr))
|
|
|
|
tiqdio_add_input_queues(irq_ptr);
|
|
|
|
|
|
|
|
/* wait for subchannel to become active */
|
|
|
|
msleep(5);
|
|
|
|
|
|
|
|
switch (irq_ptr->state) {
|
|
|
|
case QDIO_IRQ_STATE_STOPPED:
|
|
|
|
case QDIO_IRQ_STATE_ERR:
|
2009-03-26 08:24:25 -06:00
|
|
|
rc = -EIO;
|
|
|
|
break;
|
2008-07-17 09:16:48 -06:00
|
|
|
default:
|
|
|
|
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ACTIVE);
|
|
|
|
rc = 0;
|
|
|
|
}
|
|
|
|
out:
|
|
|
|
mutex_unlock(&irq_ptr->setup_mutex);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(qdio_activate);
|
|
|
|
|
|
|
|
static inline int buf_in_between(int bufnr, int start, int count)
|
|
|
|
{
|
|
|
|
int end = add_buf(start, count);
|
|
|
|
|
|
|
|
if (end > start) {
|
|
|
|
if (bufnr >= start && bufnr < end)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wrap-around case */
|
|
|
|
if ((bufnr >= start && bufnr <= QDIO_MAX_BUFFERS_PER_Q) ||
|
|
|
|
(bufnr < end))
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* handle_inbound - reset processed input buffers
|
|
|
|
* @q: queue containing the buffers
|
|
|
|
* @callflags: flags
|
|
|
|
* @bufnr: first buffer to process
|
|
|
|
* @count: how many buffers are emptied
|
|
|
|
*/
|
2009-03-26 08:24:31 -06:00
|
|
|
static int handle_inbound(struct qdio_q *q, unsigned int callflags,
|
|
|
|
int bufnr, int count)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2009-03-26 08:24:31 -06:00
|
|
|
int used, diff;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, inbound_call);
|
|
|
|
|
2008-12-25 05:38:47 -07:00
|
|
|
if (!q->u.in.polling)
|
|
|
|
goto set;
|
|
|
|
|
|
|
|
/* protect against stop polling setting an ACK for an emptied slsb */
|
|
|
|
if (count == QDIO_MAX_BUFFERS_PER_Q) {
|
|
|
|
/* overwriting everything, just delete polling status */
|
|
|
|
q->u.in.polling = 0;
|
|
|
|
q->u.in.ack_count = 0;
|
|
|
|
goto set;
|
2009-03-26 08:24:29 -06:00
|
|
|
} else if (buf_in_between(q->u.in.ack_start, bufnr, count)) {
|
2008-12-25 05:38:47 -07:00
|
|
|
if (is_qebsm(q)) {
|
2009-03-26 08:24:29 -06:00
|
|
|
/* partial overwrite, just update ack_start */
|
2008-12-25 05:38:47 -07:00
|
|
|
diff = add_buf(bufnr, count);
|
2009-03-26 08:24:29 -06:00
|
|
|
diff = sub_buf(diff, q->u.in.ack_start);
|
2008-12-25 05:38:47 -07:00
|
|
|
q->u.in.ack_count -= diff;
|
|
|
|
if (q->u.in.ack_count <= 0) {
|
|
|
|
q->u.in.polling = 0;
|
|
|
|
q->u.in.ack_count = 0;
|
|
|
|
goto set;
|
|
|
|
}
|
2009-03-26 08:24:29 -06:00
|
|
|
q->u.in.ack_start = add_buf(q->u.in.ack_start, diff);
|
2008-12-25 05:38:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
/* the only ACK will be deleted, so stop polling */
|
2008-07-17 09:16:48 -06:00
|
|
|
q->u.in.polling = 0;
|
2008-12-25 05:38:47 -07:00
|
|
|
}
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2008-12-25 05:38:47 -07:00
|
|
|
set:
|
2008-07-17 09:16:48 -06:00
|
|
|
count = set_buf_states(q, bufnr, SLSB_CU_INPUT_EMPTY, count);
|
|
|
|
|
|
|
|
used = atomic_add_return(count, &q->nr_buf_used) - count;
|
|
|
|
BUG_ON(used + count > QDIO_MAX_BUFFERS_PER_Q);
|
|
|
|
|
|
|
|
/* no need to signal as long as the adapter had free buffers */
|
|
|
|
if (used)
|
2009-03-26 08:24:31 -06:00
|
|
|
return 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2009-03-26 08:24:31 -06:00
|
|
|
if (need_siga_in(q))
|
|
|
|
return qdio_siga_input(q);
|
|
|
|
return 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* handle_outbound - process filled outbound buffers
|
|
|
|
* @q: queue containing the buffers
|
|
|
|
* @callflags: flags
|
|
|
|
* @bufnr: first buffer to process
|
|
|
|
* @count: how many buffers are filled
|
|
|
|
*/
|
2009-03-26 08:24:31 -06:00
|
|
|
static int handle_outbound(struct qdio_q *q, unsigned int callflags,
|
|
|
|
int bufnr, int count)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
2011-05-23 02:24:38 -06:00
|
|
|
unsigned char state = 0;
|
2009-03-26 08:24:31 -06:00
|
|
|
int used, rc = 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, outbound_call);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
count = set_buf_states(q, bufnr, SLSB_CU_OUTPUT_PRIMED, count);
|
|
|
|
used = atomic_add_return(count, &q->nr_buf_used);
|
|
|
|
BUG_ON(used > QDIO_MAX_BUFFERS_PER_Q);
|
|
|
|
|
2011-01-05 04:47:51 -07:00
|
|
|
if (used == QDIO_MAX_BUFFERS_PER_Q)
|
|
|
|
qperf_inc(q, outbound_queue_full);
|
|
|
|
|
2010-01-04 01:05:42 -07:00
|
|
|
if (callflags & QDIO_FLAG_PCI_OUT) {
|
2008-07-17 09:16:48 -06:00
|
|
|
q->u.out.pci_out_enabled = 1;
|
2010-01-04 01:05:42 -07:00
|
|
|
qperf_inc(q, pci_request_int);
|
2011-01-05 04:47:53 -07:00
|
|
|
} else
|
2008-07-17 09:16:48 -06:00
|
|
|
q->u.out.pci_out_enabled = 0;
|
|
|
|
|
|
|
|
if (queue_type(q) == QDIO_IQDIO_QFMT) {
|
2011-08-07 19:33:55 -06:00
|
|
|
unsigned long phys_aob = 0;
|
|
|
|
|
|
|
|
/* One SIGA-W per buffer required for unicast HSI */
|
2011-01-05 04:47:53 -07:00
|
|
|
WARN_ON_ONCE(count > 1 && !multicast_outbound(q));
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
phys_aob = qdio_aob_for_buffer(&q->u.out, bufnr);
|
|
|
|
|
|
|
|
rc = qdio_kick_outbound_q(q, phys_aob);
|
2011-01-05 04:47:54 -07:00
|
|
|
} else if (need_siga_sync(q)) {
|
2011-01-05 04:47:53 -07:00
|
|
|
rc = qdio_siga_sync_q(q);
|
|
|
|
} else {
|
|
|
|
/* try to fast requeue buffers */
|
|
|
|
get_buf_state(q, prev_buf(bufnr), &state, 0);
|
|
|
|
if (state != SLSB_CU_OUTPUT_PRIMED)
|
2011-08-07 19:33:55 -06:00
|
|
|
rc = qdio_kick_outbound_q(q, 0);
|
2008-07-17 09:16:48 -06:00
|
|
|
else
|
2011-01-05 04:47:53 -07:00
|
|
|
qperf_inc(q, fast_requeue);
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
2011-01-05 04:47:50 -07:00
|
|
|
/* in case of SIGA errors we must process the error immediately */
|
|
|
|
if (used >= q->u.out.scan_threshold || rc)
|
|
|
|
tasklet_schedule(&q->tasklet);
|
|
|
|
else
|
|
|
|
/* free the SBALs in case of no further traffic */
|
|
|
|
if (!timer_pending(&q->u.out.timer))
|
|
|
|
mod_timer(&q->u.out.timer, jiffies + HZ);
|
2009-03-26 08:24:31 -06:00
|
|
|
return rc;
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* do_QDIO - process input or output buffers
|
|
|
|
* @cdev: associated ccw_device for the qdio subchannel
|
|
|
|
* @callflags: input or output and special flags from the program
|
|
|
|
* @q_nr: queue number
|
|
|
|
* @bufnr: buffer number
|
|
|
|
* @count: how many buffers to process
|
|
|
|
*/
|
|
|
|
int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
|
2009-06-22 04:08:15 -06:00
|
|
|
int q_nr, unsigned int bufnr, unsigned int count)
|
2008-07-17 09:16:48 -06:00
|
|
|
{
|
|
|
|
struct qdio_irq *irq_ptr;
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
|
2009-06-22 04:08:15 -06:00
|
|
|
if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q)
|
2008-07-17 09:16:48 -06:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
irq_ptr = cdev->private->qdio_data;
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2009-09-22 14:58:39 -06:00
|
|
|
DBF_DEV_EVENT(DBF_INFO, irq_ptr,
|
|
|
|
"do%02x b:%02x c:%02x", callflags, bufnr, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
|
|
|
|
if (irq_ptr->state != QDIO_IRQ_STATE_ACTIVE)
|
|
|
|
return -EBUSY;
|
2011-03-23 03:16:01 -06:00
|
|
|
if (!count)
|
|
|
|
return 0;
|
2008-07-17 09:16:48 -06:00
|
|
|
if (callflags & QDIO_FLAG_SYNC_INPUT)
|
2009-03-26 08:24:31 -06:00
|
|
|
return handle_inbound(irq_ptr->input_qs[q_nr],
|
|
|
|
callflags, bufnr, count);
|
2008-07-17 09:16:48 -06:00
|
|
|
else if (callflags & QDIO_FLAG_SYNC_OUTPUT)
|
2009-03-26 08:24:31 -06:00
|
|
|
return handle_outbound(irq_ptr->output_qs[q_nr],
|
|
|
|
callflags, bufnr, count);
|
|
|
|
return -EINVAL;
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(do_QDIO);
|
|
|
|
|
2010-09-07 15:14:39 -06:00
|
|
|
/**
|
|
|
|
* qdio_start_irq - process input buffers
|
|
|
|
* @cdev: associated ccw_device for the qdio subchannel
|
|
|
|
* @nr: input queue number
|
|
|
|
*
|
|
|
|
* Return codes
|
|
|
|
* 0 - success
|
|
|
|
* 1 - irqs not started since new data is available
|
|
|
|
*/
|
|
|
|
int qdio_start_irq(struct ccw_device *cdev, int nr)
|
|
|
|
{
|
|
|
|
struct qdio_q *q;
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
q = irq_ptr->input_qs[nr];
|
|
|
|
|
|
|
|
WARN_ON(queue_irqs_enabled(q));
|
|
|
|
|
2011-08-07 19:33:55 -06:00
|
|
|
if (!shared_ind(q))
|
2010-09-07 15:14:39 -06:00
|
|
|
xchg(q->irq_ptr->dsci, 0);
|
|
|
|
|
|
|
|
qdio_stop_polling(q);
|
|
|
|
clear_bit(QDIO_QUEUE_IRQS_DISABLED, &q->u.in.queue_irq_state);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We need to check again to not lose initiative after
|
|
|
|
* resetting the ACK state.
|
|
|
|
*/
|
2011-08-07 19:33:55 -06:00
|
|
|
if (!shared_ind(q) && *q->irq_ptr->dsci)
|
2010-09-07 15:14:39 -06:00
|
|
|
goto rescan;
|
|
|
|
if (!qdio_inbound_q_done(q))
|
|
|
|
goto rescan;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
rescan:
|
|
|
|
if (test_and_set_bit(QDIO_QUEUE_IRQS_DISABLED,
|
|
|
|
&q->u.in.queue_irq_state))
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(qdio_start_irq);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_get_next_buffers - process input buffers
|
|
|
|
* @cdev: associated ccw_device for the qdio subchannel
|
|
|
|
* @nr: input queue number
|
|
|
|
* @bufnr: first filled buffer number
|
|
|
|
* @error: buffers are in error state
|
|
|
|
*
|
|
|
|
* Return codes
|
|
|
|
* < 0 - error
|
|
|
|
* = 0 - no new buffers found
|
|
|
|
* > 0 - number of processed buffers
|
|
|
|
*/
|
|
|
|
int qdio_get_next_buffers(struct ccw_device *cdev, int nr, int *bufnr,
|
|
|
|
int *error)
|
|
|
|
{
|
|
|
|
struct qdio_q *q;
|
|
|
|
int start, end;
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
q = irq_ptr->input_qs[nr];
|
|
|
|
WARN_ON(queue_irqs_enabled(q));
|
|
|
|
|
|
|
|
/*
|
2011-01-05 04:47:54 -07:00
|
|
|
* Cannot rely on automatic sync after interrupt since queues may
|
|
|
|
* also be examined without interrupt.
|
2010-09-07 15:14:39 -06:00
|
|
|
*/
|
2011-01-05 04:47:54 -07:00
|
|
|
if (need_siga_sync(q))
|
|
|
|
qdio_sync_queues(q);
|
|
|
|
|
|
|
|
/* check the PCI capable outbound queues. */
|
2010-09-07 15:14:39 -06:00
|
|
|
qdio_check_outbound_after_thinint(q);
|
|
|
|
|
|
|
|
if (!qdio_inbound_q_moved(q))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Note: upper-layer MUST stop processing immediately here ... */
|
|
|
|
if (unlikely(q->irq_ptr->state != QDIO_IRQ_STATE_ACTIVE))
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
start = q->first_to_kick;
|
|
|
|
end = q->first_to_check;
|
|
|
|
*bufnr = start;
|
|
|
|
*error = q->qdio_error;
|
|
|
|
|
|
|
|
/* for the next time */
|
|
|
|
q->first_to_kick = end;
|
|
|
|
q->qdio_error = 0;
|
|
|
|
return sub_buf(end, start);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(qdio_get_next_buffers);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qdio_stop_irq - disable interrupt processing for the device
|
|
|
|
* @cdev: associated ccw_device for the qdio subchannel
|
|
|
|
* @nr: input queue number
|
|
|
|
*
|
|
|
|
* Return codes
|
|
|
|
* 0 - interrupts were already disabled
|
|
|
|
* 1 - interrupts successfully disabled
|
|
|
|
*/
|
|
|
|
int qdio_stop_irq(struct ccw_device *cdev, int nr)
|
|
|
|
{
|
|
|
|
struct qdio_q *q;
|
|
|
|
struct qdio_irq *irq_ptr = cdev->private->qdio_data;
|
|
|
|
|
|
|
|
if (!irq_ptr)
|
|
|
|
return -ENODEV;
|
|
|
|
q = irq_ptr->input_qs[nr];
|
|
|
|
|
|
|
|
if (test_and_set_bit(QDIO_QUEUE_IRQS_DISABLED,
|
|
|
|
&q->u.in.queue_irq_state))
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(qdio_stop_irq);
|
|
|
|
|
2008-07-17 09:16:48 -06:00
|
|
|
static int __init init_QDIO(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2011-04-04 01:43:31 -06:00
|
|
|
rc = qdio_debug_init();
|
2008-07-17 09:16:48 -06:00
|
|
|
if (rc)
|
|
|
|
return rc;
|
2011-04-04 01:43:31 -06:00
|
|
|
rc = qdio_setup_init();
|
|
|
|
if (rc)
|
|
|
|
goto out_debug;
|
2008-07-17 09:16:48 -06:00
|
|
|
rc = tiqdio_allocate_memory();
|
|
|
|
if (rc)
|
|
|
|
goto out_cache;
|
|
|
|
rc = tiqdio_register_thinints();
|
|
|
|
if (rc)
|
2011-04-04 01:43:31 -06:00
|
|
|
goto out_ti;
|
2008-07-17 09:16:48 -06:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_ti:
|
|
|
|
tiqdio_free_memory();
|
|
|
|
out_cache:
|
|
|
|
qdio_setup_exit();
|
2011-04-04 01:43:31 -06:00
|
|
|
out_debug:
|
|
|
|
qdio_debug_exit();
|
2008-07-17 09:16:48 -06:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit exit_QDIO(void)
|
|
|
|
{
|
|
|
|
tiqdio_unregister_thinints();
|
|
|
|
tiqdio_free_memory();
|
|
|
|
qdio_setup_exit();
|
2011-04-04 01:43:31 -06:00
|
|
|
qdio_debug_exit();
|
2008-07-17 09:16:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(init_QDIO);
|
|
|
|
module_exit(exit_QDIO);
|