public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ipr: fix transition to operational for new adapters
       [not found] <20100714174038.137807350@linux.vnet.ibm.com>
@ 2010-07-14 17:49 ` Wayne Boyer
  2010-07-14 20:18   ` Brian King
  0 siblings, 1 reply; 2+ messages in thread
From: Wayne Boyer @ 2010-07-14 17:49 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, Brian King, Kleber Sacilotto de Souza

The method of transitioning to operational for new adapters includes using
initialization stages.  The current stage is indicated via a register read.
The final good stage in the sequence is "operational" but does not necessarily
indicate that the driver can proceed.  There is another bit that gets set in the
adapter->host interrupt register when the adapter has completed enough of its
bringup such that it can accept commands.  The driver was not checking that
bit before proceeding which led to intermittent errors and adapter resets.

The fix is to check the "transition to operational" bit in the interrupt
register after detecting that the initialization stage is "operational" and
only proceed if both are set.

Signed-off-by: Wayne Boyer <wayneb@linux.vnet.ibm.com>
---
 drivers/scsi/ipr.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Index: b/drivers/scsi/ipr.c
===================================================================
--- a/drivers/scsi/ipr.c	2010-07-08 17:16:09.000000000 -0700
+++ b/drivers/scsi/ipr.c	2010-07-08 17:17:15.000000000 -0700
@@ -7166,12 +7166,15 @@ static int ipr_reset_next_stage(struct i
 		stage_time = ioa_cfg->transop_timeout;
 		ipr_cmd->job_step = ipr_ioafp_identify_hrrq;
 	} else if (stage == IPR_IPL_INIT_STAGE_TRANSOP) {
-		ipr_cmd->job_step = ipr_ioafp_identify_hrrq;
-		maskval = IPR_PCII_IPL_STAGE_CHANGE;
-		maskval = (maskval << 32) | IPR_PCII_IOA_TRANS_TO_OPER;
-		writeq(maskval, ioa_cfg->regs.set_interrupt_mask_reg);
-		int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
-		return IPR_RC_JOB_CONTINUE;
+		int_reg = readl(ioa_cfg->regs.sense_interrupt_reg32);
+		if (int_reg & IPR_PCII_IOA_TRANS_TO_OPER) {
+			ipr_cmd->job_step = ipr_ioafp_identify_hrrq;
+			maskval = IPR_PCII_IPL_STAGE_CHANGE;
+			maskval = (maskval << 32) | IPR_PCII_IOA_TRANS_TO_OPER;
+			writeq(maskval, ioa_cfg->regs.set_interrupt_mask_reg);
+			int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
+			return IPR_RC_JOB_CONTINUE;
+		}
 	}

 	ipr_cmd->timer.data = (unsigned long) ipr_cmd;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] ipr: fix transition to operational for new adapters
  2010-07-14 17:49 ` [PATCH 1/2] ipr: fix transition to operational for new adapters Wayne Boyer
@ 2010-07-14 20:18   ` Brian King
  0 siblings, 0 replies; 2+ messages in thread
From: Brian King @ 2010-07-14 20:18 UTC (permalink / raw)
  To: Wayne Boyer; +Cc: James Bottomley, linux-scsi, Kleber Sacilotto de Souza

Acked-by: Brian King <brking@linux.vnet.ibm.com>

On 07/14/2010 12:49 PM, Wayne Boyer wrote:
> The method of transitioning to operational for new adapters includes using
> initialization stages.  The current stage is indicated via a register read.
> The final good stage in the sequence is "operational" but does not necessarily
> indicate that the driver can proceed.  There is another bit that gets set in the
> adapter->host interrupt register when the adapter has completed enough of its
> bringup such that it can accept commands.  The driver was not checking that
> bit before proceeding which led to intermittent errors and adapter resets.
> 
> The fix is to check the "transition to operational" bit in the interrupt
> register after detecting that the initialization stage is "operational" and
> only proceed if both are set.
> 
> Signed-off-by: Wayne Boyer <wayneb@linux.vnet.ibm.com>
> ---
>  drivers/scsi/ipr.c |   15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> Index: b/drivers/scsi/ipr.c
> ===================================================================
> --- a/drivers/scsi/ipr.c	2010-07-08 17:16:09.000000000 -0700
> +++ b/drivers/scsi/ipr.c	2010-07-08 17:17:15.000000000 -0700
> @@ -7166,12 +7166,15 @@ static int ipr_reset_next_stage(struct i
>  		stage_time = ioa_cfg->transop_timeout;
>  		ipr_cmd->job_step = ipr_ioafp_identify_hrrq;
>  	} else if (stage == IPR_IPL_INIT_STAGE_TRANSOP) {
> -		ipr_cmd->job_step = ipr_ioafp_identify_hrrq;
> -		maskval = IPR_PCII_IPL_STAGE_CHANGE;
> -		maskval = (maskval << 32) | IPR_PCII_IOA_TRANS_TO_OPER;
> -		writeq(maskval, ioa_cfg->regs.set_interrupt_mask_reg);
> -		int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
> -		return IPR_RC_JOB_CONTINUE;
> +		int_reg = readl(ioa_cfg->regs.sense_interrupt_reg32);
> +		if (int_reg & IPR_PCII_IOA_TRANS_TO_OPER) {
> +			ipr_cmd->job_step = ipr_ioafp_identify_hrrq;
> +			maskval = IPR_PCII_IPL_STAGE_CHANGE;
> +			maskval = (maskval << 32) | IPR_PCII_IOA_TRANS_TO_OPER;
> +			writeq(maskval, ioa_cfg->regs.set_interrupt_mask_reg);
> +			int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
> +			return IPR_RC_JOB_CONTINUE;
> +		}
>  	}
> 
>  	ipr_cmd->timer.data = (unsigned long) ipr_cmd;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Brian King
Linux on Power Virtualization
IBM Linux Technology Center



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-14 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100714174038.137807350@linux.vnet.ibm.com>
2010-07-14 17:49 ` [PATCH 1/2] ipr: fix transition to operational for new adapters Wayne Boyer
2010-07-14 20:18   ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox