Commit 958c0ba4 authored by Jan Glauber's avatar Jan Glauber Committed by Martin Schwidefsky

[S390] qdio: use proper QEBSM operand for SIGA-R and SIGA-S

If QIOASSIST is enabled for a qdio device the SIGA instruction requires
a modified function code. This function code modifier was missing for
SIGA-R and SIGA-S which can lead to a kernel panic caused by an
operand exception.

Cc: stable@kernel.org
Signed-off-by: default avatarJan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 0195843b
...@@ -91,6 +91,12 @@ enum qdio_irq_states { ...@@ -91,6 +91,12 @@ enum qdio_irq_states {
#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ #define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */
#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ #define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */
/* SIGA flags */
#define QDIO_SIGA_WRITE 0x00
#define QDIO_SIGA_READ 0x01
#define QDIO_SIGA_SYNC 0x02
#define QDIO_SIGA_QEBSM_FLAG 0x80
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
static inline int do_sqbs(u64 token, unsigned char state, int queue, static inline int do_sqbs(u64 token, unsigned char state, int queue,
int *start, int *count) int *start, int *count)
......
...@@ -30,11 +30,12 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\ ...@@ -30,11 +30,12 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\
MODULE_DESCRIPTION("QDIO base support"); MODULE_DESCRIPTION("QDIO base support");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static inline int do_siga_sync(struct subchannel_id schid, static inline int do_siga_sync(unsigned long schid,
unsigned int out_mask, unsigned int in_mask) unsigned int out_mask, unsigned int in_mask,
unsigned int fc)
{ {
register unsigned long __fc asm ("0") = 2; register unsigned long __fc asm ("0") = fc;
register struct subchannel_id __schid asm ("1") = schid; register unsigned long __schid asm ("1") = schid;
register unsigned long out asm ("2") = out_mask; register unsigned long out asm ("2") = out_mask;
register unsigned long in asm ("3") = in_mask; register unsigned long in asm ("3") = in_mask;
int cc; int cc;
...@@ -48,10 +49,11 @@ static inline int do_siga_sync(struct subchannel_id schid, ...@@ -48,10 +49,11 @@ static inline int do_siga_sync(struct subchannel_id schid,
return cc; return cc;
} }
static inline int do_siga_input(struct subchannel_id schid, unsigned int mask) static inline int do_siga_input(unsigned long schid, unsigned int mask,
unsigned int fc)
{ {
register unsigned long __fc asm ("0") = 1; register unsigned long __fc asm ("0") = fc;
register struct subchannel_id __schid asm ("1") = schid; register unsigned long __schid asm ("1") = schid;
register unsigned long __mask asm ("2") = mask; register unsigned long __mask asm ("2") = mask;
int cc; int cc;
...@@ -280,6 +282,8 @@ void qdio_init_buf_states(struct qdio_irq *irq_ptr) ...@@ -280,6 +282,8 @@ void qdio_init_buf_states(struct qdio_irq *irq_ptr)
static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output,
unsigned int input) unsigned int input)
{ {
unsigned long schid = *((u32 *) &q->irq_ptr->schid);
unsigned int fc = QDIO_SIGA_SYNC;
int cc; int cc;
if (!need_siga_sync(q)) if (!need_siga_sync(q))
...@@ -288,7 +292,12 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, ...@@ -288,7 +292,12 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output,
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr);
qperf_inc(q, siga_sync); qperf_inc(q, siga_sync);
cc = do_siga_sync(q->irq_ptr->schid, output, input); if (is_qebsm(q)) {
schid = q->irq_ptr->sch_token;
fc |= QDIO_SIGA_QEBSM_FLAG;
}
cc = do_siga_sync(schid, output, input, fc);
if (cc) if (cc)
DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc); DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc);
return cc; return cc;
...@@ -314,8 +323,8 @@ static inline int qdio_siga_sync_all(struct qdio_q *q) ...@@ -314,8 +323,8 @@ static inline int qdio_siga_sync_all(struct qdio_q *q)
static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit)
{ {
unsigned long schid; unsigned long schid = *((u32 *) &q->irq_ptr->schid);
unsigned int fc = 0; unsigned int fc = QDIO_SIGA_WRITE;
u64 start_time = 0; u64 start_time = 0;
int cc; int cc;
...@@ -324,11 +333,8 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) ...@@ -324,11 +333,8 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit)
if (is_qebsm(q)) { if (is_qebsm(q)) {
schid = q->irq_ptr->sch_token; schid = q->irq_ptr->sch_token;
fc |= 0x80; fc |= QDIO_SIGA_QEBSM_FLAG;
} }
else
schid = *((u32 *)&q->irq_ptr->schid);
again: again:
cc = do_siga_output(schid, q->mask, busy_bit, fc); cc = do_siga_output(schid, q->mask, busy_bit, fc);
...@@ -348,12 +354,19 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) ...@@ -348,12 +354,19 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit)
static inline int qdio_siga_input(struct qdio_q *q) static inline int qdio_siga_input(struct qdio_q *q)
{ {
unsigned long schid = *((u32 *) &q->irq_ptr->schid);
unsigned int fc = QDIO_SIGA_READ;
int cc; int cc;
DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr);
qperf_inc(q, siga_read); qperf_inc(q, siga_read);
cc = do_siga_input(q->irq_ptr->schid, q->mask); if (is_qebsm(q)) {
schid = q->irq_ptr->sch_token;
fc |= QDIO_SIGA_QEBSM_FLAG;
}
cc = do_siga_input(schid, q->mask, fc);
if (cc) if (cc)
DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc); DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc);
return cc; return cc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment