Message ID | 20170707160558.2383-2-victora@br.ibm.com |
---|---|
State | New |
Headers | show |
On 07.07.2017 18:05, Victor Aoqui wrote: > From: "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com> > > BugLink: http://bugs.launchpad.net/bugs/1702521 > > As staging for supporting hardware with different context reset > registers but a similar reset procedure, refactor the existing context > reset routine to move the reset logic to a common routine. This will > allow hardware with a different reset register to leverage existing > code. > > Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com> > Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com> > Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> > (cherry picked from commit 9c7d1ee5f13a7130f6d3df307ec010e9e003fa98) > Signed-off-by: Victor Aoqui <victora@linux.vnet.ibm.com> > --- > drivers/scsi/cxlflash/main.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c > index b17ebf6d0a7e..a990efb27197 100644 > --- a/drivers/scsi/cxlflash/main.c > +++ b/drivers/scsi/cxlflash/main.c > @@ -188,10 +188,11 @@ static void cmd_complete(struct afu_cmd *cmd) > } > > /** > - * context_reset_ioarrin() - reset command owner context via IOARRIN register > + * context_reset() - reset command owner context via specified register > * @cmd: AFU command that timed out. > + * @reset_reg: MMIO register to perform reset. > */ > -static void context_reset_ioarrin(struct afu_cmd *cmd) > +static void context_reset(struct afu_cmd *cmd, __be64 __iomem *reset_reg) > { > int nretry = 0; > u64 rrin = 0x1; > @@ -201,9 +202,9 @@ static void context_reset_ioarrin(struct afu_cmd *cmd) > > pr_debug("%s: cmd=%p\n", __func__, cmd); > > - writeq_be(rrin, &afu->host_map->ioarrin); > + writeq_be(rrin, reset_reg); > do { > - rrin = readq_be(&afu->host_map->ioarrin); > + rrin = readq_be(reset_reg); > if (rrin != 0x1) > break; > /* Double delay each time */ > @@ -215,6 +216,17 @@ static void context_reset_ioarrin(struct afu_cmd *cmd) > } > > /** > + * context_reset_ioarrin() - reset command owner context via IOARRIN register > + * @cmd: AFU command that timed out. > + */ > +static void context_reset_ioarrin(struct afu_cmd *cmd) > +{ > + struct afu *afu = cmd->parent; > + > + context_reset(cmd, &afu->host_map->ioarrin); > +} > + > +/** > * send_cmd_ioarrin() - sends an AFU command via IOARRIN register > * @afu: AFU associated with the host. > * @cmd: AFU command to send. > Acked-by: Stefan Bader <stefan.bader@canonical.com> good testing on specific hw. -Stefan
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index b17ebf6d0a7e..a990efb27197 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -188,10 +188,11 @@ static void cmd_complete(struct afu_cmd *cmd) } /** - * context_reset_ioarrin() - reset command owner context via IOARRIN register + * context_reset() - reset command owner context via specified register * @cmd: AFU command that timed out. + * @reset_reg: MMIO register to perform reset. */ -static void context_reset_ioarrin(struct afu_cmd *cmd) +static void context_reset(struct afu_cmd *cmd, __be64 __iomem *reset_reg) { int nretry = 0; u64 rrin = 0x1; @@ -201,9 +202,9 @@ static void context_reset_ioarrin(struct afu_cmd *cmd) pr_debug("%s: cmd=%p\n", __func__, cmd); - writeq_be(rrin, &afu->host_map->ioarrin); + writeq_be(rrin, reset_reg); do { - rrin = readq_be(&afu->host_map->ioarrin); + rrin = readq_be(reset_reg); if (rrin != 0x1) break; /* Double delay each time */ @@ -215,6 +216,17 @@ static void context_reset_ioarrin(struct afu_cmd *cmd) } /** + * context_reset_ioarrin() - reset command owner context via IOARRIN register + * @cmd: AFU command that timed out. + */ +static void context_reset_ioarrin(struct afu_cmd *cmd) +{ + struct afu *afu = cmd->parent; + + context_reset(cmd, &afu->host_map->ioarrin); +} + +/** * send_cmd_ioarrin() - sends an AFU command via IOARRIN register * @afu: AFU associated with the host. * @cmd: AFU command to send.