Re: [PATCH 2/3] qla2xxx: fx00 copypaste typo

2018-03-19 Thread Madhani, Himanshu

> On Mar 8, 2018, at 5:44 AM, Meelis Roos  wrote:
> 
> Fix an obvious copy-paste error in freeing QLAFX00 response queue - the code
> checked for rsp->ring but freed rsp->ring_fx00.
> 
> Signed-off-by: Meelis Roos 
> 
> ---
> drivers/scsi/qla2xxx/qla_os.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index afcb5567..3c7bc2d 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -490,7 +490,7 @@ static void qla2x00_free_req_que(struct qla_hw_data *ha, 
> struct req_que *req)
> static void qla2x00_free_rsp_que(struct qla_hw_data *ha, struct rsp_que *rsp)
> {
>   if (IS_QLAFX00(ha)) {
> - if (rsp && rsp->ring)
> + if (rsp && rsp->ring_fx00)
>   dma_free_coherent(>pdev->dev,
>   (rsp->length_fx00 + 1) * sizeof(request_t),
>   rsp->ring_fx00, rsp->dma_fx00);
> -- 
> 2.1.4
> 

Looks good

Acked-by: Himanshu Madhani 

Thanks,
- Himanshu



Re: [PATCH 1/3] qla2xxx: fix error message on

2018-03-19 Thread Madhani, Himanshu

> On Mar 8, 2018, at 5:44 AM, Meelis Roos  wrote:
> 
> This patch fixes IO traps caught by hardware when mailbox command fails on
> qla2200. The error handler assumes newer firmware that is available on 2400 
> and
> newer HBA-s.
> 
> This causes ugly crashes on sparc64.
> 
> Fix it with separate debug prints on different firmware generations like most
> other places do.
> 
> Note: the debug line identifier is the same 0x1198 for both cases. Maybe it
> needs to be renumbered in the new case?
> 
> Signed-off-by: Meelis Roos 
> 
> ---
> drivers/scsi/qla2xxx/qla_mbx.c | 18 +-
> 1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
> index 7397aed..3a81555 100644
> --- a/drivers/scsi/qla2xxx/qla_mbx.c
> +++ b/drivers/scsi/qla2xxx/qla_mbx.c
> @@ -503,11 +503,19 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t 
> *mcp)
>   }
>   pr_warn(" cmd=%x \n", command);
>   }
> - ql_dbg(ql_dbg_mbx, vha, 0x1198,
> - "host_status=%#x intr_ctrl=%#x intr_status=%#x\n",
> - RD_REG_DWORD(>isp24.host_status),
> - RD_REG_DWORD(>isp24.ictrl),
> - RD_REG_DWORD(>isp24.istatus));
> + if (IS_FWI2_CAPABLE(ha) && !(IS_P3P_TYPE(ha))) {
> + ql_dbg(ql_dbg_mbx, vha, 0x1198,
> + "host_status=%#x intr_ctrl=%#x intr_status=%#x\n",
> + RD_REG_DWORD(>isp24.host_status),
> + RD_REG_DWORD(>isp24.ictrl),
> + RD_REG_DWORD(>isp24.istatus));
> + } else {
> + ql_dbg(ql_dbg_mbx, vha, 0x1198,

use 0x1206 here for numbering. 

> + "ctrl_status=%#x ictrl=%#x istatus=%#x\n",
> + RD_REG_WORD(>isp.ctrl_status),
> + RD_REG_WORD(>isp.ictrl),
> + RD_REG_WORD(>isp.istatus));
> + }
>   } else {
>   ql_dbg(ql_dbg_mbx, base_vha, 0x1021, "Done %s.\n", __func__);
>   }
> -- 
> 2.1.4
> 

Also, you need to update qla_dbg.c with this number

Here’s diff will look like 

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 1abc8a9064b3..5fd44c50bbac 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,7 +14,7 @@
  * | Module Init and Probe|   0x0193   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e
|
- * | Mailbox commands |   0x1205   | 0x11a2-0x11ff |
+ * | Mailbox commands |   0x1206   | 0x11a2-0x11ff |
  * | Device Discovery |   0x2134   | 0x210e-0x2116  |
  * | || 0x211a |
  * |  || 0x211c-0x2128  |


With these changes, you can add 

Acked-by: Himanshu Madhani 

Thanks,
- Himanshu



Re: [PATCH 1/3] qla2xxx: fix error message on

2018-03-19 Thread Martin K. Petersen

Meelis,

> This patch fixes IO traps caught by hardware when mailbox command fails on
> qla2200. The error handler assumes newer firmware that is available on 2400 
> and
> newer HBA-s.
>
> This causes ugly crashes on sparc64.
>
> Fix it with separate debug prints on different firmware generations like most
> other places do.
>
> Note: the debug line identifier is the same 0x1198 for both cases. Maybe it
> needs to be renumbered in the new case?

QLogic folks: Please review the following patches.

https://patchwork.kernel.org/patch/10268119/
https://patchwork.kernel.org/patch/10268121/

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: devinfo: remove DF arrays from HP

2018-03-19 Thread Martin K. Petersen

Xose,

> Matthias did confirm that there are no such devices.

Applied to 4.17/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: iscsi_tcp: set BDI_CAP_STABLE_WRITES when data digest enabled

2018-03-19 Thread Martin K. Petersen

Jianchao,

> iscsi tcp will first send out data, then calculate and send data
> digest. If we don't have BDI_CAP_STABLE_WRITES, the page cache will
> be written in spite of the on going writeback. Consequently, wrong
> digest will be got and sent to target.
>
> To fix this, set BDI_CAP_STABLE_WRITES when data digest is enabled
> in iscsi_tcp .slave_configure callback.

Applied to 4.16/scsi-fixes. Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH v2 00/13] qla2xxx: Fixes for FC-NVMe

2018-03-19 Thread Martin K. Petersen

Himanshu,

> Please apply this series to 4.17/scsi-queue at your earliest
> convenience.

Patch 12 does not apply to 4.17/scsi-queue. Please fix and resubmit.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH V5 1/5] scsi: hpsa: fix selection of reply queue

2018-03-19 Thread Martin K. Petersen

Artem,

> we have this patch-set and it fixes megaraid regression in v4.16. Do
> you plan to mege it to v4.16-rcX? I am worried - there seem to be no
> sight that this is going to me merged. They are not in the linux-next.

I merged them into scsi-fixes last week.

It happens push a combined fixes+queue to linux-next to get more zeroday
coverage. However, most of the time linux-next is one 4.x+1 material
only.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: qla2xxx: fix spelling mistake: "existant" -> "existent"

2018-03-19 Thread Martin K. Petersen

Colin,

> Trivial fix to spelling mistake in debug message text

Applied to 4.17/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 1/2] scsi: dpt_i2o: use after free in adpt_release()

2018-03-19 Thread Martin K. Petersen

Dan,

> The scsi_host_put() function frees "pHba" and then we dereference it on
> the next line when we do "scsi_host_put(pHba->host);".

Applied to 4.17/scsi-queue, thank you.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: remove obsolete drivers and scsi_module.c V2

2018-03-19 Thread Martin K. Petersen

Christoph,

> this series removes the obsolete scsi_module.c infratructure that has
> been obsolete for 15 years, and the remaining drivers that depend on
> them.

Applied to 4.17/scsi-queue. Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 2/2] scsi: dpt_i2o: use after free in __adpt_reset()

2018-03-19 Thread Martin K. Petersen

Dan,

> In __adpt_reset() the problem is that adpt_hba_reset() frees "pHba" on
> error but we dereference it to print the name in the error message.

Applied to 4.17/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: unexport scsi_host_set_state

2018-03-19 Thread Martin K. Petersen

Christoph,

> This function is only used inside the SCSI midlayer, so remove the
> export for it.

Applied to 4.17/scsi-queue. Thank you!

-- 
Martin K. Petersen  Oracle Linux Engineering


[PATCH v4 3/7] scsi: dpt_i2o: eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes barrier() followed by writel(). writel() already has a
barrier
on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/dpt_i2o.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index fd172b0..3c1e64a 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1300,7 +1300,7 @@ static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, 
int len)
wmb();
 
//post message
-   writel(m, pHba->post_port);
+   writel_relaxed(m, pHba->post_port);
wmb();
 
return 0;
@@ -1390,7 +1390,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
 
memcpy_toio(pHba->msg_addr_virt+m, msg, sizeof(msg));
wmb();
-   writel(m, pHba->post_port);
+   writel_relaxed(m, pHba->post_port);
wmb();
 
while(*status == 0){
@@ -2797,7 +2797,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
writel( 0,[2]);
wmb();
 
-   writel(m, pHba->post_port);
+   writel_relaxed(m, pHba->post_port);
wmb();
return 0;
 }
-- 
2.7.4



[PATCH v4 2/7] scsi: megaraid: eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes barrier() followed by writel(). writel() already has a
barrier
on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Create a new wrapper function with relaxed write operator. Use the new
wrapper when a write is following a barrier().

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/megaraid/megaraid_mbox.c   | 8 
 drivers/scsi/megaraid/megaraid_mbox.h   | 2 ++
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
index 530358c..8c4fc6e 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1439,7 +1439,7 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb)
mbox->ack   = 0;
wmb();
 
-   WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1);
+   WRINDOOR_RELAXED(raid_dev, raid_dev->mbox_dma | 0x1);
 
spin_unlock_irqrestore(MAILBOX_LOCK(raid_dev), flags);
 
@@ -2752,7 +2752,7 @@ mbox_post_sync_cmd(adapter_t *adapter, uint8_t raw_mbox[])
mbox->status= 0xFF;
 
wmb();
-   WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1);
+   WRINDOOR_RELAXED(raid_dev, raid_dev->mbox_dma | 0x1);
 
// wait for maximum 1 second for status to post. If the status is not
// available within 1 second, assume FW is initializing and wait
@@ -2877,7 +2877,7 @@ mbox_post_sync_cmd_fast(adapter_t *adapter, uint8_t 
raw_mbox[])
mbox->status= 0xFF;
 
wmb();
-   WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1);
+   WRINDOOR_RELAXED(raid_dev, raid_dev->mbox_dma | 0x1);
 
for (i = 0; i < MBOX_SYNC_WAIT_CNT; i++) {
if (mbox->numstatus != 0xFF) break;
@@ -3329,7 +3329,7 @@ megaraid_mbox_fire_sync_cmd(adapter_t *adapter)
mbox->status= 0;
 
wmb();
-   WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1);
+   WRINDOOR_RELAXED(raid_dev, raid_dev->mbox_dma | 0x1);
 
/* Wait for maximum 1 min for status to post.
 * If the Firmware SUPPORTS the ABOVE COMMAND,
diff --git a/drivers/scsi/megaraid/megaraid_mbox.h 
b/drivers/scsi/megaraid/megaraid_mbox.h
index c1d86d9..641cbd4 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.h
+++ b/drivers/scsi/megaraid/megaraid_mbox.h
@@ -230,6 +230,8 @@ typedef struct {
 
 #define RDINDOOR(rdev) readl((rdev)->baseaddr + 0x20)
 #define RDOUTDOOR(rdev)readl((rdev)->baseaddr + 0x2C)
+#define WRINDOOR_RELAXED(rdev, value)  \
+   writel_relaxed(value, (rdev)->baseaddr + 0x20)
 #define WRINDOOR(rdev, value)  writel(value, (rdev)->baseaddr + 0x20)
 #define WROUTDOOR(rdev, value) writel(value, (rdev)->baseaddr + 0x2C)
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 073ced0..f560496 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3479,11 +3479,11 @@ complete_cmd_fusion(struct megasas_instance *instance, 
u32 MSIxIndex)
 
wmb();
if (instance->msix_combined)
-   writel(((MSIxIndex & 0x7) << 24) |
+   writel_relaxed(((MSIxIndex & 0x7) << 24) |
fusion->last_reply_idx[MSIxIndex],
instance->reply_post_host_index_addr[MSIxIndex/8]);
else
-   writel((MSIxIndex << 24) |
+   writel_relaxed((MSIxIndex << 24) |
fusion->last_reply_idx[MSIxIndex],
instance->reply_post_host_index_addr[0]);
megasas_check_and_restore_queue_depth(instance);
-- 
2.7.4



[PATCH v4 6/7] scsi: bnx2i: Eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes barrier() followed by writel(). writel() already has a
barrier
on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 8f03a86..075735b 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -278,7 +278,7 @@ static void bnx2i_ring_sq_dbell(struct bnx2i_conn 
*bnx2i_conn, int count)
sq_db->prod_idx = ep->qp.sq_prod_idx;
bnx2i_ring_577xx_doorbell(bnx2i_conn);
} else
-   writew(count, ep->qp.ctx_base + CNIC_SEND_DOORBELL);
+   writew_relaxed(count, ep->qp.ctx_base + CNIC_SEND_DOORBELL);
 
mmiowb(); /* flush posted PCI writes */
 }
-- 
2.7.4



[PATCH v4 7/7] scsi: csiostor: Eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes barrier() followed by writel(). writel() already has a
barrier
on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Create a new wrapper function with relaxed write operator. Use the new
wrapper when a write is following a barrier().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/csiostor/csio_hw.h | 4 
 drivers/scsi/csiostor/csio_wr.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
index 30f5f52..9fd8b00 100644
--- a/drivers/scsi/csiostor/csio_hw.h
+++ b/drivers/scsi/csiostor/csio_hw.h
@@ -512,6 +512,10 @@ struct csio_hw {
csio_reg((_h)->regstart, (_r)))
 #definecsio_wr_reg16(_h, _v, _r)   writew((_v), \
csio_reg((_h)->regstart, (_r)))
+
+#definecsio_wr_reg32_relaxed(_h, _v, _r) \
+   writel_relaxed((_v), csio_reg((_h)->regstart, (_r)))
+
 #definecsio_wr_reg32(_h, _v, _r)   writel((_v), \
csio_reg((_h)->regstart, (_r)))
 #definecsio_wr_reg64(_h, _v, _r)   writeq((_v), \
diff --git a/drivers/scsi/csiostor/csio_wr.c b/drivers/scsi/csiostor/csio_wr.c
index c0a1778..db26222 100644
--- a/drivers/scsi/csiostor/csio_wr.c
+++ b/drivers/scsi/csiostor/csio_wr.c
@@ -984,7 +984,7 @@ csio_wr_issue(struct csio_hw *hw, int qidx, bool prio)
 
wmb();
/* Ring SGE Doorbell writing q->pidx into it */
-   csio_wr_reg32(hw, DBPRIO_V(prio) | QID_V(q->un.eq.physeqid) |
+   csio_wr_reg32_relaxed(hw, DBPRIO_V(prio) | QID_V(q->un.eq.physeqid) |
  PIDX_T5_V(q->inc_idx) | DBTYPE_F,
  MYPF_REG(SGE_PF_KDOORBELL_A));
q->inc_idx = 0;
-- 
2.7.4



[PATCH v4 5/7] scsi: ipr: Eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes barrier() followed by writel(). writel() already has a
barrier
on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Since code already has an explicit barrier call, changing writeX() to
writeX_relaxed().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/ipr.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e07dd99..209adac 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -762,9 +762,9 @@ static void ipr_mask_and_clear_interrupts(struct 
ipr_ioa_cfg *ioa_cfg,
 
/* Set interrupt mask to stop all new interrupts */
if (ioa_cfg->sis64)
-   writeq(~0, ioa_cfg->regs.set_interrupt_mask_reg);
+   writeq_relaxed(~0, ioa_cfg->regs.set_interrupt_mask_reg);
else
-   writel(~0, ioa_cfg->regs.set_interrupt_mask_reg);
+   writel_relaxed(~0, ioa_cfg->regs.set_interrupt_mask_reg);
 
/* Clear any pending interrupts */
if (ioa_cfg->sis64)
@@ -8435,7 +8435,8 @@ static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd)
wmb();
if (ioa_cfg->sis64) {
/* Set the adapter to the correct endian mode. */
-   writel(IPR_ENDIAN_SWAP_KEY, ioa_cfg->regs.endian_swap_reg);
+   writel_relaxed(IPR_ENDIAN_SWAP_KEY,
+  ioa_cfg->regs.endian_swap_reg);
int_reg = readl(ioa_cfg->regs.endian_swap_reg);
}
 
-- 
2.7.4



[PATCH v4 4/7] scsi: lpfc: Eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes barrier() followed by writel(). writel() already has a
barrier
on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/lpfc/lpfc_sli.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 5f5528a..7dae7d3 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1647,7 +1647,7 @@ lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct 
lpfc_sli_ring *pring)
 * Set ring 'ringno' to SET R0CE_REQ in Chip Att register.
 * The HBA will tell us when an IOCB entry is available.
 */
-   writel((CA_R0ATT|CA_R0CE_REQ) << (ringno*4), phba->CAregaddr);
+   writel_relaxed((CA_R0ATT|CA_R0CE_REQ) << (ringno*4), phba->CAregaddr);
readl(phba->CAregaddr); /* flush */
 
pring->stats.iocb_cmd_full++;
@@ -1672,7 +1672,7 @@ lpfc_sli_update_ring(struct lpfc_hba *phba, struct 
lpfc_sli_ring *pring)
 */
if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) {
wmb();
-   writel(CA_R0ATT << (ringno * 4), phba->CAregaddr);
+   writel_relaxed(CA_R0ATT << (ringno * 4), phba->CAregaddr);
readl(phba->CAregaddr); /* flush */
}
 }
-- 
2.7.4



[PATCH v4 1/7] scsi: hpsa: Eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes wmb() followed by writel(). writel() already has a
barrier on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing
the register write.

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

Signed-off-by: Sinan Kaya 
---
 drivers/scsi/hpsa.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 018f980..c7d7e6a 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -599,7 +599,7 @@ static unsigned long SA5_ioaccel_mode1_completed(struct 
ctlr_info *h, u8 q)
 * but with current driver design this is easiest.
 */
wmb();
-   writel((q << 24) | rq->current_entry, h->vaddr +
+   writel_relaxed((q << 24) | rq->current_entry, h->vaddr +
IOACCEL_MODE1_CONSUMER_INDEX);
atomic_dec(>commands_outstanding);
}
-- 
2.7.4



[PATCH v4 0/7] scsi: Eliminate duplicate barriers on weakly-ordered archs

2018-03-19 Thread Sinan Kaya
Code includes wmb() followed by writel() in multiple places. writel()
already has a barrier on some architectures like arm64.

This ends up CPU observing two barriers back to back before executing the
register write.

Since code already has an explicit barrier call, changing writel() to
writel_relaxed().

I did a regex search for wmb() followed by writel() in each drivers
directory.
I scrubbed the ones I care about in this series.

I considered "ease of change", "popular usage" and "performance critical
path" as the determining criteria for my filtering.

We used relaxed API heavily on ARM for a long time but
it did not exist on other architectures. For this reason, relaxed
architectures have been paying double penalty in order to use the common
drivers.

Now that relaxed API is present on all architectures, we can go and scrub
all drivers to see what needs to change and what can remain.

We start with mostly used ones and hope to increase the coverage over time.
It will take a while to cover all drivers.

Feel free to apply patches individually.

Changes since v3:
- https://www.spinics.net/lists/arm-kernel/msg641851.html
- group patches together into subsystems scsi:...
- collect reviewed and tested bys
- scrub barrier()

Sinan Kaya (7):
  scsi: hpsa: Eliminate duplicate barriers on weakly-ordered archs
  scsi: megaraid: eliminate duplicate barriers on weakly-ordered archs
  scsi: dpt_i2o: eliminate duplicate barriers on weakly-ordered archs
  scsi: lpfc: Eliminate duplicate barriers on weakly-ordered archs
  scsi: ipr: Eliminate duplicate barriers on weakly-ordered archs
  scsi: bnx2i: Eliminate duplicate barriers on weakly-ordered archs
  scsi: csiostor: Eliminate duplicate barriers on weakly-ordered archs

 drivers/scsi/bnx2i/bnx2i_hwi.c  | 2 +-
 drivers/scsi/csiostor/csio_hw.h | 4 
 drivers/scsi/csiostor/csio_wr.c | 2 +-
 drivers/scsi/dpt_i2o.c  | 6 +++---
 drivers/scsi/hpsa.h | 2 +-
 drivers/scsi/ipr.c  | 7 ---
 drivers/scsi/lpfc/lpfc_sli.c| 4 ++--
 drivers/scsi/megaraid/megaraid_mbox.c   | 8 
 drivers/scsi/megaraid/megaraid_mbox.h   | 2 ++
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++--
 10 files changed, 24 insertions(+), 17 deletions(-)

-- 
2.7.4



[PATCH 3.18 53/68] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

2018-03-19 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Xose Vazquez Perez 


[ Upstream commit b369a0471503130cfc74f9f62071db97f48948c3 ]

Commit 56f3d383f37b ("scsi: scsi_devinfo: Add TRY_VPD_PAGES to HITACHI
OPEN-V blacklist entry") modified some Hitachi entries:

HITACHI is always supporting VPD pages, even though it's claiming to
support SCSI Revision 3 only.

The same should have been done also for HP-rebranded.

[mkp: checkpatch and tweaked commit message]

Cc: Hannes Reinecke 
Cc: Takahiro Yasui 
Cc: Matthias Rudolph 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_devinfo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -180,7 +180,7 @@ static struct {
{"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN},   /* HP 
VA7400 */
-   {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
+   {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP 
Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
{"HP", "C1557A", NULL, BLIST_FORCELUN},




Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread Bart Van Assche
On Mon, 2018-03-19 at 10:02 -0700, t...@kernel.org wrote:
> On Mon, Mar 19, 2018 at 04:57:45PM +, Bart Van Assche wrote:
> > For synchronization primitives that wait having a stronger synchronization
> > primitive nested inside a more relaxed one can lead to a deadlock. But since
> > the rcu read lock primitives do not wait it could be safe to use that kind
> > of nesting with RCU. Do you perhaps know whether any documentation is
> > available about that kind of nesting or whether it is already used elsewhere
> > in the kernel?
> 
> Oh, we nest them all the time.  They're like (and sometimes literally
> are) preempt_disable() and don't care about nest ordering.

Hello Martin,

This was probably already clear to you, but anyway: please drop the patch at the
start of this thread.

Thanks,

Bart.




[PATCH 4.4 098/134] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

2018-03-19 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Xose Vazquez Perez 


[ Upstream commit b369a0471503130cfc74f9f62071db97f48948c3 ]

Commit 56f3d383f37b ("scsi: scsi_devinfo: Add TRY_VPD_PAGES to HITACHI
OPEN-V blacklist entry") modified some Hitachi entries:

HITACHI is always supporting VPD pages, even though it's claiming to
support SCSI Revision 3 only.

The same should have been done also for HP-rebranded.

[mkp: checkpatch and tweaked commit message]

Cc: Hannes Reinecke 
Cc: Takahiro Yasui 
Cc: Matthias Rudolph 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_devinfo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -180,7 +180,7 @@ static struct {
{"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN},   /* HP 
VA7400 */
-   {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
+   {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP 
Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
{"HP", "C1557A", NULL, BLIST_FORCELUN},




[PATCH 4.4 099/134] scsi: dh: add new rdac devices

2018-03-19 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Xose Vazquez Perez 


[ Upstream commit 4b3aec2bbbce1c35f50e7475a9fd78d24b9ea4ea ]

Add IBM 3542 and 3552, arrays: FAStT200 and FAStT500.

Add full STK OPENstorage family, arrays: 9176, D173, D178, D210, D220,
D240 and D280.

Add STK BladeCtlr family, arrays: B210, B220, B240 and B280.

These changes were done in multipath-tools time ago.

Cc: NetApp RDAC team 
Cc: Hannes Reinecke 
Cc: Christophe Varoqui 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Cc: device-mapper development 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_dh.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -56,10 +56,13 @@ static const struct scsi_dh_blist scsi_d
{"IBM", "1815", "rdac", },
{"IBM", "1818", "rdac", },
{"IBM", "3526", "rdac", },
+   {"IBM", "3542", "rdac", },
+   {"IBM", "3552", "rdac", },
{"SGI", "TP9",  "rdac", },
{"SGI", "IS",   "rdac", },
-   {"STK", "OPENstorage D280", "rdac", },
+   {"STK", "OPENstorage",  "rdac", },
{"STK", "FLEXLINE 380", "rdac", },
+   {"STK", "BladeCtlr","rdac", },
{"SUN", "CSM",  "rdac", },
{"SUN", "LCSM100",  "rdac", },
{"SUN", "STK6580_6780", "rdac", },




[PATCH 4.9 195/241] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

2018-03-19 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Xose Vazquez Perez 


[ Upstream commit b369a0471503130cfc74f9f62071db97f48948c3 ]

Commit 56f3d383f37b ("scsi: scsi_devinfo: Add TRY_VPD_PAGES to HITACHI
OPEN-V blacklist entry") modified some Hitachi entries:

HITACHI is always supporting VPD pages, even though it's claiming to
support SCSI Revision 3 only.

The same should have been done also for HP-rebranded.

[mkp: checkpatch and tweaked commit message]

Cc: Hannes Reinecke 
Cc: Takahiro Yasui 
Cc: Matthias Rudolph 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_devinfo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -180,7 +180,7 @@ static struct {
{"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN},   /* HP 
VA7400 */
-   {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
+   {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP 
Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
{"HP", "C1557A", NULL, BLIST_FORCELUN},




[PATCH 4.9 196/241] scsi: dh: add new rdac devices

2018-03-19 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Xose Vazquez Perez 


[ Upstream commit 4b3aec2bbbce1c35f50e7475a9fd78d24b9ea4ea ]

Add IBM 3542 and 3552, arrays: FAStT200 and FAStT500.

Add full STK OPENstorage family, arrays: 9176, D173, D178, D210, D220,
D240 and D280.

Add STK BladeCtlr family, arrays: B210, B220, B240 and B280.

These changes were done in multipath-tools time ago.

Cc: NetApp RDAC team 
Cc: Hannes Reinecke 
Cc: Christophe Varoqui 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Cc: device-mapper development 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_dh.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -56,10 +56,13 @@ static const struct scsi_dh_blist scsi_d
{"IBM", "1815", "rdac", },
{"IBM", "1818", "rdac", },
{"IBM", "3526", "rdac", },
+   {"IBM", "3542", "rdac", },
+   {"IBM", "3552", "rdac", },
{"SGI", "TP9",  "rdac", },
{"SGI", "IS",   "rdac", },
-   {"STK", "OPENstorage D280", "rdac", },
+   {"STK", "OPENstorage",  "rdac", },
{"STK", "FLEXLINE 380", "rdac", },
+   {"STK", "BladeCtlr","rdac", },
{"SUN", "CSM",  "rdac", },
{"SUN", "LCSM100",  "rdac", },
{"SUN", "STK6580_6780", "rdac", },




Re: [PATCH] scsi: unexport scsi_host_set_state

2018-03-19 Thread Bart Van Assche
On Mon, 2018-03-19 at 08:34 +0100, Christoph Hellwig wrote:
> This function is only used inside the SCSI midlayer, so remove the
> export for it.

Reviewed-by: Bart Van Assche 




Re: How to Locate drive directly attached to mpt3sas HBA

2018-03-19 Thread James Bottomley
On Mon, 2018-03-19 at 17:30 +0100, Jack Wang wrote:
> > 
> > 
> > > 
> > > And I think either mpt2sas and/or mpt3sas HBAs (I don't have my
> > > hardware
> > > nearby) have a SMP target hidden away somewhere. Perhaps someone
> > > from
> > > LSI/Avago/Broadcom could supply more information about that.
> 
> Indeed, mpt3sas has internal enclosure some how.
> snip from  "sas3ircu 0 display" output:
> Device is a Hard disk
>   Enclosure # : 1
>   Slot #  : 4
>   SAS Address : 4433221-1-0400-
>   State   : Ready (RDY)
> 
> And it's possible to locate it using "sas3ircu 0 locate 1:4 ON" to
> locate the drive.

The fat firmware eats pretty much all trace of the enclosure.  I think
it could be exposed as a device, but that would disrupt the mpt3sas
internal handling if our Linux enclosure service also binds to it.

James



Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread t...@kernel.org
Hey,

On Mon, Mar 19, 2018 at 04:57:45PM +, Bart Van Assche wrote:
> For synchronization primitives that wait having a stronger synchronization
> primitive nested inside a more relaxed one can lead to a deadlock. But since
> the rcu read lock primitives do not wait it could be safe to use that kind
> of nesting with RCU. Do you perhaps know whether any documentation is
> available about that kind of nesting or whether it is already used elsewhere
> in the kernel?

Oh, we nest them all the time.  They're like (and sometimes literally
are) preempt_disable() and don't care about nest ordering.

Thanks.

-- 
tejun


Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread Bart Van Assche
On Mon, 2018-03-19 at 09:29 -0700, t...@kernel.org wrote:
> This could be me being slow but can you explain how what
> percpu_ref_tryget_live() uses internally affects whether we can use
> regular RCU around it?

Hello Tejun,

For synchronization primitives that wait having a stronger synchronization
primitive nested inside a more relaxed one can lead to a deadlock. But since
the rcu read lock primitives do not wait it could be safe to use that kind
of nesting with RCU. Do you perhaps know whether any documentation is
available about that kind of nesting or whether it is already used elsewhere
in the kernel?

Thanks,

Bart.



Re: How to Locate drive directly attached to mpt3sas HBA

2018-03-19 Thread Jack Wang
>
>> And I think either mpt2sas and/or mpt3sas HBAs (I don't have my hardware
>> nearby) have a SMP target hidden away somewhere. Perhaps someone from
>> LSI/Avago/Broadcom could supply more information about that.

Indeed, mpt3sas has internal enclosure some how.
snip from  "sas3ircu 0 display" output:
Device is a Hard disk
  Enclosure # : 1
  Slot #  : 4
  SAS Address : 4433221-1-0400-
  State   : Ready (RDY)

And it's possible to locate it using "sas3ircu 0 locate 1:4 ON" to
locate the drive.

Thanks,
Jack


Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread t...@kernel.org
Hello,

On Mon, Mar 19, 2018 at 04:18:54PM +, Bart Van Assche wrote:
> The algorithm explained above does not depend on sched-rcu. But because
> percpu_ref_tryget_live() uses sched-rcu and because we need to add an RCU lock
> around that call we are forced to use sched-rcu. I hope this makes it clear.

This could be me being slow but can you explain how what
percpu_ref_tryget_live() uses internally affects whether we can use
regular RCU around it?

Thanks.

-- 
tejun


Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread Bart Van Assche
On Mon, 2018-03-19 at 08:21 -0700, t...@kernel.org wrote:
> On Mon, Mar 19, 2018 at 03:16:07PM +, Bart Van Assche wrote:
> > As explained in the comment in scsi_device_quiesce(), the effect of
> > blk_set_preempt_only() must be visible for percpu_ref_tryget() calls that
> > occur after the queue unfreeze triggered by scsi_device_quiesce(). Hence the
> > RCU read lock calls in blk_queue_enter(). Since these RCU read lock calls
> > surround a function call that uses rcu_read_lock_sched(), namely
> > percpu_ref_tryget_live(), we have to use sched-RCU in both blk_queue_enter()
> > and scsi_device_quiesce().
> 
> Let's please not depend on rcu_read_lock_sched() in
> percpu_ref_tryget_live().  That's an implementation detail.  If the
> code needs RCU based synchronization, it should perform them
> explicitly.

Hello Tejun,

The algorithm explained above does not depend on sched-rcu. But because
percpu_ref_tryget_live() uses sched-rcu and because we need to add an RCU lock
around that call we are forced to use sched-rcu. I hope this makes it clear.

Bart.




Re: [PATCH V5 1/5] scsi: hpsa: fix selection of reply queue

2018-03-19 Thread Ming Lei
On Mon, Mar 19, 2018 at 04:42:09PM +0200, Artem Bityutskiy wrote:
> On Mon, 2018-03-19 at 08:31 -0600, Jens Axboe wrote:
> > I'm assuming that Martin will eventually queue this up. But probably
> > for 4.17, then we can always flag it for a backport to stable once
> > it's been thoroughly tested.
> 
> Jens, thanks for reply.
> 
> I wonder if folks agree that in this case we should revert 
> 
> 84676c1f21e8 genirq/affinity: assign vectors to all possible CPUs
> 
> for v4.16.

Even 84676c1f21e8 is reverted, IO failure or hang can still be triggered
easily when doing CPU online/offline test.

So this patchset is really needed.

Thanks,
Ming


Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread t...@kernel.org
Hello,

On Mon, Mar 19, 2018 at 03:16:07PM +, Bart Van Assche wrote:
> As explained in the comment in scsi_device_quiesce(), the effect of
> blk_set_preempt_only() must be visible for percpu_ref_tryget() calls that
> occur after the queue unfreeze triggered by scsi_device_quiesce(). Hence the
> RCU read lock calls in blk_queue_enter(). Since these RCU read lock calls
> surround a function call that uses rcu_read_lock_sched(), namely
> percpu_ref_tryget_live(), we have to use sched-RCU in both blk_queue_enter()
> and scsi_device_quiesce().

Let's please not depend on rcu_read_lock_sched() in
percpu_ref_tryget_live().  That's an implementation detail.  If the
code needs RCU based synchronization, it should perform them
explicitly.

Thanks.

-- 
tejun


Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread Bart Van Assche
On Mon, 2018-03-19 at 07:31 -0700, Tejun Heo wrote:
> On Fri, Mar 16, 2018 at 10:35:16AM -0700, Bart Van Assche wrote:
> > Since blk_queue_enter() uses rcu_read_lock_sched() scsi_device_quiesce()
> > must use synchronize_sched().
> 
> Is there a reason to use sched-RCU here instead of the regular one?
> If not, it'd be better to switch to regular RCU than the other way
> around.

Hello Tejun,

As explained in the comment in scsi_device_quiesce(), the effect of
blk_set_preempt_only() must be visible for percpu_ref_tryget() calls that
occur after the queue unfreeze triggered by scsi_device_quiesce(). Hence the
RCU read lock calls in blk_queue_enter(). Since these RCU read lock calls
surround a function call that uses rcu_read_lock_sched(), namely
percpu_ref_tryget_live(), we have to use sched-RCU in both blk_queue_enter()
and scsi_device_quiesce().

Bart.





RE: [PATCH V5 1/5] scsi: hpsa: fix selection of reply queue

2018-03-19 Thread Kashyap Desai
> -Original Message-
> From: Artem Bityutskiy [mailto:dedeki...@gmail.com]
> Sent: Monday, March 19, 2018 8:12 PM
> To: h...@lst.de; Thomas Gleixner
> Cc: linux-bl...@vger.kernel.org; snit...@redhat.com; h...@suse.de;
> mr...@linux.ee; linux-scsi@vger.kernel.org; don.br...@microsemi.com;
> pbonz...@redhat.com; lober...@redhat.com;
> kashyap.de...@broadcom.com; Jens Axboe; martin.peter...@oracle.com;
> james.bottom...@hansenpartnership.com; ming@redhat.com
> Subject: Re: [PATCH V5 1/5] scsi: hpsa: fix selection of reply queue
>
> On Mon, 2018-03-19 at 08:31 -0600, Jens Axboe wrote:
> > I'm assuming that Martin will eventually queue this up. But probably
> > for 4.17, then we can always flag it for a backport to stable once
> > it's been thoroughly tested.
>
> Jens, thanks for reply.
>
> I wonder if folks agree that in this case we should revert
>
> 84676c1f21e8 genirq/affinity: assign vectors to all possible CPUs
>
> for v4.16.
>
> If this was a minor niche use-case regression the -stable scenario would
> probably be OK. But the patch seem to miss the fact that kernel's
> "possible
> CPUs" notion may be way off and side effects are bad.

Also it is performance issue as posted at below link, if we just use
"84676c1f21e8 genirq/affinity: assign vectors to all possible CPUs".

https://www.spinics.net/lists/linux-scsi/msg118301.html

Performance drop was resolved using patch set (available at below link)under
discussion posted by Ming.

https://marc.info/?l=linux-block=152050646332092=2

Kashyap

>
> Christoph, Thomas, what do you think?
>
> Thanks,
> Artem.


Re: How to Locate drive directly attached to mpt3sas HBA

2018-03-19 Thread Jack Wang
2018-03-19 15:20 GMT+01:00 Douglas Gilbert :
> On 2018-03-19 11:40 AM, Jack Wang wrote:
>>
>> Hi list,
>>
>> Any one knows how can I locate a HDD directly attached to mpt3sas,
>> sas3ircu only supports LOCATE commd to locates driver installed in a
>> disk enclosure, but not directly attached.
>>
>> I know microsemi/PMCs supports SGPIO interface to locate drive eg:
>>   Adp80xxapp sgpio 0 set 0 1
>>
>> I searched in latest upstream mpt3sas code, didn't find such
>> interface. Do I miss something?
>
>
> Hi,
> If its a SAS disk, it might have an onboard LED.
>
> In the sdparm package there is a script called "sas_disk_blink"
> that will flash that LED.
>
>

> And I think either mpt2sas and/or mpt3sas HBAs (I don't have my hardware
> nearby) have a SMP target hidden away somewhere. Perhaps someone from
> LSI/Avago/Broadcom could supply more information about that.
>
> Doug Gilbert
>
Thanks Doug for your information, we're interested mainly on SATA  SSD
from Intel.
I hope Broadcom could shed some light.

The HBA is Serial Attached SCSI controller: LSI Logic / Symbios Logic
SAS3008 PCI-Express Fusion-MPT SAS-3 (rev 02)

Regards,
Jack


Re: How to Locate drive directly attached to mpt3sas HBA

2018-03-19 Thread James Bottomley
On Mon, 2018-03-19 at 15:20 +0100, Douglas Gilbert wrote:
> On 2018-03-19 11:40 AM, Jack Wang wrote:
> > 
> > Hi list,
> > 
> > Any one knows how can I locate a HDD directly attached to mpt3sas,
> > sas3ircu only supports LOCATE commd to locates driver installed in
> > a
> > disk enclosure, but not directly attached.
> > 
> > I know microsemi/PMCs supports SGPIO interface to locate drive eg:
> >   Adp80xxapp sgpio 0 set 0 1
> > 
> > I searched in latest upstream mpt3sas code, didn't find such
> > interface. Do I miss something?
> 
> Hi,
> If its a SAS disk, it might have an onboard LED.
> 
> In the sdparm package there is a script called "sas_disk_blink"
> that will flash that LED.
> 
> 
> And I think either mpt2sas and/or mpt3sas HBAs (I don't have my
> hardware nearby) have a SMP target hidden away somewhere. Perhaps
> someone from LSI/Avago/Broadcom could supply more information about
> that.

And if mpt3sas just used the standard Linux SES infrastructure, you'd
find the disk in sysfs linked to the slot along with a nice sysfs file
you can write to to flash the locator light.

James



Re: [PATCH V5 1/5] scsi: hpsa: fix selection of reply queue

2018-03-19 Thread Artem Bityutskiy
On Mon, 2018-03-19 at 08:31 -0600, Jens Axboe wrote:
> I'm assuming that Martin will eventually queue this up. But probably
> for 4.17, then we can always flag it for a backport to stable once
> it's been thoroughly tested.

Jens, thanks for reply.

I wonder if folks agree that in this case we should revert 

84676c1f21e8 genirq/affinity: assign vectors to all possible CPUs

for v4.16.

If this was a minor niche use-case regression the -stable scenario
would probably be OK. But the patch seem to miss the fact that kernel's
"possible CPUs" notion may be way off and side effects are bad.

Christoph, Thomas, what do you think?

Thanks,
Artem.


Re: [PATCH V5 1/5] scsi: hpsa: fix selection of reply queue

2018-03-19 Thread Jens Axboe
On 3/19/18 5:48 AM, Bityutskiy, Artem wrote:
> On Tue, 2018-03-13 at 17:42 +0800, Ming Lei wrote:
>> From 84676c1f21 (genirq/affinity: assign vectors to all possible CPUs),
>> one msix vector can be created without any online CPU mapped, then one
>> command's completion may not be notified.
> 
> Hello Martin, James,
> 
> we have this patch-set and it fixes megaraid regression in v4.16. Do
> you plan to mege it to v4.16-rcX? I am worried - there seem to be no
> sight that this is going to me merged. They are not in the linux-next.

I'm assuming that Martin will eventually queue this up. But probably
for 4.17, then we can always flag it for a backport to stable once
it's been thoroughly tested.

-- 
Jens Axboe



Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread Tejun Heo
On Fri, Mar 16, 2018 at 10:35:16AM -0700, Bart Van Assche wrote:
> Since blk_queue_enter() uses rcu_read_lock_sched() scsi_device_quiesce()
> must use synchronize_sched().

Is there a reason to use sched-RCU here instead of the regular one?
If not, it'd be better to switch to regular RCU than the other way
around.

Thanks.

-- 
tejun


Re: How to Locate drive directly attached to mpt3sas HBA

2018-03-19 Thread Douglas Gilbert

On 2018-03-19 11:40 AM, Jack Wang wrote:

Hi list,

Any one knows how can I locate a HDD directly attached to mpt3sas,
sas3ircu only supports LOCATE commd to locates driver installed in a
disk enclosure, but not directly attached.

I know microsemi/PMCs supports SGPIO interface to locate drive eg:
  Adp80xxapp sgpio 0 set 0 1

I searched in latest upstream mpt3sas code, didn't find such
interface. Do I miss something?


Hi,
If its a SAS disk, it might have an onboard LED.

In the sdparm package there is a script called "sas_disk_blink"
that will flash that LED.


And I think either mpt2sas and/or mpt3sas HBAs (I don't have my hardware
nearby) have a SMP target hidden away somewhere. Perhaps someone from
LSI/Avago/Broadcom could supply more information about that.

Doug Gilbert



Re: mpt3sas: sleeping function called from invalid context

2018-03-19 Thread Jaco Kroon
Hi All,

On 14/03/2018 03:29, Bart Van Assche wrote:
> (+Jaco)
Bart, thanks for adding me.
>
> On Tue, 2018-03-13 at 16:18 +0530, Suganath Prabu Subramani wrote:
>> We have root caused the issue and it is same as you mentioned.
>> "_scsih_get_enclosure_logicalid_chassis_slot()" is called with interrupts
>> disabled and this function
>> "_scsih_get_enclosure_logicalid_chassis_slot" again calls
>> _config_request(), with mutex_lock().
>>
>> We have patch ready along with few other change and we ll be posting
>> it by tomorrow after covering BST.
Has there been any progress?  We're currently seeing our server going
down again, and we'd like to eliminate this as the cause.  Currently IO
is still flowing but some IO has started to deadlock.

Kind Regards,
Jaco


How to Locate drive directly attached to mpt3sas HBA

2018-03-19 Thread Jack Wang
Hi list,

Any one knows how can I locate a HDD directly attached to mpt3sas,
sas3ircu only supports LOCATE commd to locates driver installed in a
disk enclosure, but not directly attached.

I know microsemi/PMCs supports SGPIO interface to locate drive eg:
 Adp80xxapp sgpio 0 set 0 1

I searched in latest upstream mpt3sas code, didn't find such
interface. Do I miss something?

Thanks,
Jack


[PATCH 1/2] scsi: dpt_i2o: use after free in adpt_release()

2018-03-19 Thread Dan Carpenter
The scsi_host_put() function frees "pHba" and then we dereference it on
the next line when we do "scsi_host_put(pHba->host);".

Fixes: 38e09e3bb056 ("scsi: dpt_i2o: stop using scsi_unregister")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 3c667b23a801..ac2f40d9963b 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -306,8 +306,8 @@ static void adpt_release(adpt_hba *pHba)
 {
scsi_remove_host(pHba->host);
 // adpt_i2o_quiesce_hba(pHba);
-   adpt_i2o_delete_hba(pHba);
scsi_host_put(pHba->host);
+   adpt_i2o_delete_hba(pHba);
 }
 
 


Patch "scsi: devinfo: apply to HP XP the same flags as Hitachi VSP" has been added to the 3.18-stable tree

2018-03-19 Thread gregkh

This is a note to let you know that I've just added the patch titled

scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

to the 3.18-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 scsi-devinfo-apply-to-hp-xp-the-same-flags-as-hitachi-vsp.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From foo@baz Mon Mar 19 10:11:52 CET 2018
From: Xose Vazquez Perez 
Date: Fri, 17 Nov 2017 21:31:36 +0100
Subject: scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

From: Xose Vazquez Perez 


[ Upstream commit b369a0471503130cfc74f9f62071db97f48948c3 ]

Commit 56f3d383f37b ("scsi: scsi_devinfo: Add TRY_VPD_PAGES to HITACHI
OPEN-V blacklist entry") modified some Hitachi entries:

HITACHI is always supporting VPD pages, even though it's claiming to
support SCSI Revision 3 only.

The same should have been done also for HP-rebranded.

[mkp: checkpatch and tweaked commit message]

Cc: Hannes Reinecke 
Cc: Takahiro Yasui 
Cc: Matthias Rudolph 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_devinfo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -180,7 +180,7 @@ static struct {
{"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN},   /* HP 
VA7400 */
-   {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
+   {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP 
Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
{"HP", "C1557A", NULL, BLIST_FORCELUN},


Patches currently in stable-queue which might be from xose.vazq...@gmail.com are

queue-3.18/scsi-devinfo-apply-to-hp-xp-the-same-flags-as-hitachi-vsp.patch


Patch "scsi: dh: add new rdac devices" has been added to the 4.4-stable tree

2018-03-19 Thread gregkh

This is a note to let you know that I've just added the patch titled

scsi: dh: add new rdac devices

to the 4.4-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 scsi-dh-add-new-rdac-devices.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From foo@baz Mon Mar 19 09:58:12 CET 2018
From: Xose Vazquez Perez 
Date: Fri, 17 Nov 2017 22:05:13 +0100
Subject: scsi: dh: add new rdac devices

From: Xose Vazquez Perez 


[ Upstream commit 4b3aec2bbbce1c35f50e7475a9fd78d24b9ea4ea ]

Add IBM 3542 and 3552, arrays: FAStT200 and FAStT500.

Add full STK OPENstorage family, arrays: 9176, D173, D178, D210, D220,
D240 and D280.

Add STK BladeCtlr family, arrays: B210, B220, B240 and B280.

These changes were done in multipath-tools time ago.

Cc: NetApp RDAC team 
Cc: Hannes Reinecke 
Cc: Christophe Varoqui 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Cc: device-mapper development 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_dh.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -56,10 +56,13 @@ static const struct scsi_dh_blist scsi_d
{"IBM", "1815", "rdac", },
{"IBM", "1818", "rdac", },
{"IBM", "3526", "rdac", },
+   {"IBM", "3542", "rdac", },
+   {"IBM", "3552", "rdac", },
{"SGI", "TP9",  "rdac", },
{"SGI", "IS",   "rdac", },
-   {"STK", "OPENstorage D280", "rdac", },
+   {"STK", "OPENstorage",  "rdac", },
{"STK", "FLEXLINE 380", "rdac", },
+   {"STK", "BladeCtlr","rdac", },
{"SUN", "CSM",  "rdac", },
{"SUN", "LCSM100",  "rdac", },
{"SUN", "STK6580_6780", "rdac", },


Patches currently in stable-queue which might be from xose.vazq...@gmail.com are

queue-4.4/scsi-devinfo-apply-to-hp-xp-the-same-flags-as-hitachi-vsp.patch
queue-4.4/scsi-dh-add-new-rdac-devices.patch


Patch "scsi: devinfo: apply to HP XP the same flags as Hitachi VSP" has been added to the 4.4-stable tree

2018-03-19 Thread gregkh

This is a note to let you know that I've just added the patch titled

scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

to the 4.4-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 scsi-devinfo-apply-to-hp-xp-the-same-flags-as-hitachi-vsp.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From foo@baz Mon Mar 19 09:58:12 CET 2018
From: Xose Vazquez Perez 
Date: Fri, 17 Nov 2017 21:31:36 +0100
Subject: scsi: devinfo: apply to HP XP the same flags as Hitachi VSP

From: Xose Vazquez Perez 


[ Upstream commit b369a0471503130cfc74f9f62071db97f48948c3 ]

Commit 56f3d383f37b ("scsi: scsi_devinfo: Add TRY_VPD_PAGES to HITACHI
OPEN-V blacklist entry") modified some Hitachi entries:

HITACHI is always supporting VPD pages, even though it's claiming to
support SCSI Revision 3 only.

The same should have been done also for HP-rebranded.

[mkp: checkpatch and tweaked commit message]

Cc: Hannes Reinecke 
Cc: Takahiro Yasui 
Cc: Matthias Rudolph 
Cc: Martin K. Petersen 
Cc: James E.J. Bottomley 
Cc: SCSI ML 
Signed-off-by: Xose Vazquez Perez 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/scsi_devinfo.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -180,7 +180,7 @@ static struct {
{"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
{"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN},   /* HP 
VA7400 */
-   {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
+   {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP 
Arrays */
{"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
{"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
{"HP", "C1557A", NULL, BLIST_FORCELUN},


Patches currently in stable-queue which might be from xose.vazq...@gmail.com are

queue-4.4/scsi-devinfo-apply-to-hp-xp-the-same-flags-as-hitachi-vsp.patch
queue-4.4/scsi-dh-add-new-rdac-devices.patch


Re: [PATCH] Change synchronize_rcu() in scsi_device_quiesce() into synchronize_sched()

2018-03-19 Thread Martin Steigerwald
Hi Bart.

Bart Van Assche - 16.03.18, 22:51:
> On 03/16/18 14:42, Martin Steigerwald wrote:
> > What is this one about?
> > 
> > Fix for the regression I (and others?) reported?¹
> > 
> > [1] [Bug 199077] [Possible REGRESSION, 4.16-rc4] Error updating SMART data
> > during runtime and boot failures with blk_mq_terminate_expired in
> > backtrace
> > 
> > https://bugzilla.kernel.org/show_bug.cgi?id=199077
[…]
> This patch is a fix for the fix for the bug that you and others had
> reported. See also "I/O hangs after resuming from suspend-to-ram"
> (https://marc.info/?l=linux-block=150340235201348).
> 
> This patch fixes an API violation. For those users for which suspend and
> resume works fine with commit 3a0a529971ec applied it should still work
> fine with this patch applied since this patch may cause
> scsi_device_quiesce() to wait longer.

Okay, so if I understand you correctly, this is not related to the regression 
I mentioned above.

Testing anyway.

Thanks,
-- 
Martin


Re: [PATCH v2 6/6] scsi_io_completion convert BUGs to WARNs

2018-03-19 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


Re: [PATCH 2/6] mvme147: stop using scsi_module.c

2018-03-19 Thread John Paul Adrian Glaubitz
Hi Christoph!

On 03/19/2018 04:37 PM, Christoph Hellwig wrote:
> Convert the driver to modern style probing.  Given that there only is a
> single instance for a given board that can be done using a global
> struct Scsi_Host instance easily.
> 
> Also fix the removal path by passing the correct cookie to free_irq, and
> enable it unconditionally.

Thanks a lot for this work, much appreciated. I wish I could have been more
helpful with this driver. I will hopefully have the time to test it soon
with my VME system.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


[PATCH V2 1/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer

2018-03-19 Thread Adrian Hunter
UFS host controllers may support an autonomous power management feature
called the Auto-Hibernate Idle Timer. The timer is set to the number of
microseconds of idle time before the UFS host controller will autonomously
put the link into Hibernate state. That will save power at the expense of
increased latency. Any access to the host controller interface registers
will automatically put the link out of Hibernate state. So once configured,
the feature is transparent to the driver.

Expose the Auto-Hibernate Idle Timer value via SysFS to allow users to
choose between power efficiency or lower latency. Set a default value of
150 ms.

Signed-off-by: Adrian Hunter 
---
 Documentation/ABI/testing/sysfs-driver-ufs | 15 ++
 drivers/scsi/ufs/ufs-sysfs.c   | 77 ++
 drivers/scsi/ufs/ufshcd.c  | 26 ++
 drivers/scsi/ufs/ufshcd.h  |  3 ++
 drivers/scsi/ufs/ufshci.h  |  7 +++
 5 files changed, 128 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-driver-ufs 
b/Documentation/ABI/testing/sysfs-driver-ufs
index 83735f79e572..a4142329cc34 100644
--- a/Documentation/ABI/testing/sysfs-driver-ufs
+++ b/Documentation/ABI/testing/sysfs-driver-ufs
@@ -1,3 +1,18 @@
+What:  /sys/bus/*/drivers/ufshcd/*/auto_hibern8
+Date:  February 2018
+Contact:   linux-scsi@vger.kernel.org
+Description:
+   This file contains the auto-hibernate idle timer setting of a
+   UFS host controller. A value of '-1' means auto-hibernate is not
+   supported. A value of '0' means auto-hibernate is not enabled.
+   Otherwise the value is the number of microseconds of idle time
+   before the UFS host controller will autonomously put the link
+   into hibernate state. That will save power at the expense of
+   increased latency. Note that the hardware supports 10-bit values
+   with a power-of-ten multiplier which allows a maximum value of
+   10230. Refer to the UFS Host Controller Interface
+   specification for more details.
+
 What:  /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_type
 Date:  February 2018
 Contact:   Stanislav Nijnikov 
diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
index 4ff9e0b7eba1..17ad661b1cb5 100644
--- a/drivers/scsi/ufs/ufs-sysfs.c
+++ b/drivers/scsi/ufs/ufs-sysfs.c
@@ -3,6 +3,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "ufs.h"
@@ -117,12 +118,87 @@ static ssize_t spm_target_link_state_show(struct device 
*dev,
ufs_pm_lvl_states[hba->spm_lvl].link_state));
 }
 
+static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
+{
+   unsigned long flags;
+
+   if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
+   return;
+
+   spin_lock_irqsave(hba->host->host_lock, flags);
+   if (hba->ahit == ahit)
+   goto out_unlock;
+   hba->ahit = ahit;
+   if (!pm_runtime_suspended(hba->dev))
+   ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER);
+out_unlock:
+   spin_unlock_irqrestore(hba->host->host_lock, flags);
+}
+
+/* Convert Auto-Hibernate Idle Timer register value to microseconds */
+static int ufshcd_ahit_to_us(u32 ahit)
+{
+   int timer = FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, ahit);
+   int scale = FIELD_GET(UFSHCI_AHIBERN8_SCALE_MASK, ahit);
+
+   for (; scale > 0; --scale)
+   timer *= UFSHCI_AHIBERN8_SCALE_FACTOR;
+
+   return timer;
+}
+
+/* Convert microseconds to Auto-Hibernate Idle Timer register value */
+static u32 ufshcd_us_to_ahit(unsigned int timer)
+{
+   unsigned int scale;
+
+   for (scale = 0; timer > UFSHCI_AHIBERN8_TIMER_MASK; ++scale)
+   timer /= UFSHCI_AHIBERN8_SCALE_FACTOR;
+
+   return FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, timer) |
+  FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, scale);
+}
+
+static ssize_t auto_hibern8_show(struct device *dev,
+struct device_attribute *attr, char *buf)
+{
+   struct ufs_hba *hba = dev_get_drvdata(dev);
+   int timer = -1;
+
+   if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT)
+   timer = ufshcd_ahit_to_us(hba->ahit);
+
+   return snprintf(buf, PAGE_SIZE, "%d\n", timer);
+}
+
+static ssize_t auto_hibern8_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+   struct ufs_hba *hba = dev_get_drvdata(dev);
+   unsigned int timer;
+
+   if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
+   return -EOPNOTSUPP;
+
+   if (kstrtouint(buf, 0, ))
+   return -EINVAL;
+
+   if (timer > UFSHCI_AHIBERN8_MAX)
+   

[PATCH V2 0/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer

2018-03-19 Thread Adrian Hunter
Hi

Here is V2, now re-based on top of patch "scsi: ufs: sysfs:reworking of the
rpm_lvl and spm_lvl entries".

Michał Potomski has previously sent a patch for Auto-Hibernate, but this
patch is slightly different, based on the latest ufs-sysfs changes, it also
takes care to restore auto-hibernate during resume, and otherwise avoids
updating the register if the device is runtime suspended.  Also a default
value of 150ms is set.


Changes in V2:

Re-based on top of (yet to be applied) patch "scsi: ufs: sysfs:
reworking of the rpm_lvl and spm_lvl entries"


Adrian Hunter (1):
  scsi: ufs: Add support for Auto-Hibernate Idle Timer

 Documentation/ABI/testing/sysfs-driver-ufs | 15 ++
 drivers/scsi/ufs/ufs-sysfs.c   | 77 ++
 drivers/scsi/ufs/ufshcd.c  | 26 ++
 drivers/scsi/ufs/ufshcd.h  |  3 ++
 drivers/scsi/ufs/ufshci.h  |  7 +++
 5 files changed, 128 insertions(+)


Regards
Adrian


[PATCH 2/6] mvme147: stop using scsi_module.c

2018-03-19 Thread Christoph Hellwig
Convert the driver to modern style probing.  Given that there only is a
single instance for a given board that can be done using a global
struct Scsi_Host instance easily.

Also fix the removal path by passing the correct cookie to free_irq, and
enable it unconditionally.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/mvme147.c | 107 ++---
 1 file changed, 57 insertions(+), 50 deletions(-)

diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
index e6b2b681fda3..7d1ab414b78f 100644
--- a/drivers/scsi/mvme147.c
+++ b/drivers/scsi/mvme147.c
@@ -3,6 +3,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -14,9 +17,6 @@
 #include "wd33c93.h"
 #include "mvme147.h"
 
-#include 
-
-
 static irqreturn_t mvme147_intr(int irq, void *data)
 {
struct Scsi_Host *instance = data;
@@ -65,40 +65,57 @@ static void dma_stop(struct Scsi_Host *instance, struct 
scsi_cmnd *SCpnt,
m147_pcc->dma_cntrl = 0;
 }
 
-int mvme147_detect(struct scsi_host_template *tpnt)
+static struct scsi_host_template mvme147_host_template = {
+   .module = THIS_MODULE,
+   .proc_name  = "MVME147",
+   .name   = "MVME147 built-in SCSI",
+   .queuecommand   = wd33c93_queuecommand,
+   .eh_abort_handler   = wd33c93_abort,
+   .eh_host_reset_handler  = wd33c93_host_reset,
+   .show_info  = wd33c93_show_info,
+   .write_info = wd33c93_write_info,
+   .can_queue  = CAN_QUEUE,
+   .this_id= 7,
+   .sg_tablesize   = SG_ALL,
+   .cmd_per_lun= CMD_PER_LUN,
+   .use_clustering = ENABLE_CLUSTERING
+};
+
+static struct Scsi_Host *mvme147_shost;
+
+static int __init mvme147_init(void)
 {
-   static unsigned char called = 0;
-   struct Scsi_Host *instance;
wd33c93_regs regs;
struct WD33C93_hostdata *hdata;
+   int error = -ENOMEM;
 
-   if (!MACH_IS_MVME147 || called)
+   if (!MACH_IS_MVME147)
return 0;
-   called++;
 
-   tpnt->proc_name = "MVME147";
-   tpnt->show_info = wd33c93_show_info,
-   tpnt->write_info = wd33c93_write_info,
-
-   instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
-   if (!instance)
+   mvme147_shost = scsi_host_alloc(_host_template,
+   sizeof(struct WD33C93_hostdata));
+   if (!mvme147_shost)
goto err_out;
+   mvme147_shost->base = 0xfffe4000;
+   mvme147_shost->irq = MVME147_IRQ_SCSI_PORT;
 
-   instance->base = 0xfffe4000;
-   instance->irq = MVME147_IRQ_SCSI_PORT;
regs.SASR = (volatile unsigned char *)0xfffe4000;
regs.SCMD = (volatile unsigned char *)0xfffe4001;
-   hdata = shost_priv(instance);
+
+   hdata = shost_priv(mvme147_shost);
hdata->no_sync = 0xff;
hdata->fast = 0;
hdata->dma_mode = CTRL_DMA;
-   wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
 
-   if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
-   "MVME147 SCSI PORT", instance))
+   wd33c93_init(mvme147_shost, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
+
+   error = request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
+   "MVME147 SCSI PORT", mvme147_shost);
+   if (error)
goto err_unregister;
-   if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
-   "MVME147 SCSI DMA", instance))
+   error = request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
+   "MVME147 SCSI DMA", mvme147_shost);
+   if (error)
goto err_free_irq;
 #if 0  /* Disabled; causes problems booting */
m147_pcc->scsi_interrupt = 0x10;/* Assert SCSI bus reset */
@@ -112,40 +129,30 @@ int mvme147_detect(struct scsi_host_template *tpnt)
m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */
m147_pcc->dma_intr = 0x89;  /* Ack and enable ints */
 
-   return 1;
+   error = scsi_add_host(mvme147_shost, NULL);
+   if (error)
+   goto err_free_irq;
+   scsi_scan_host(mvme147_shost);
+   return 0;
 
 err_free_irq:
-   free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr);
+   free_irq(MVME147_IRQ_SCSI_PORT, mvme147_shost);
 err_unregister:
-   scsi_unregister(instance);
+   scsi_host_put(mvme147_shost);
 err_out:
-   return 0;
+   return error;
 }
 
-static struct scsi_host_template driver_template = {
-   .proc_name  = "MVME147",
-   .name   = "MVME147 built-in SCSI",
-   .detect = mvme147_detect,
-   .release= mvme147_release,
-   .queuecommand   = wd33c93_queuecommand,
-   .eh_abort_handler   = wd33c93_abort,
-   .eh_host_reset_handler  = 

[PATCH 6/6] scsi: remove the old scsi_module.c initialization model

2018-03-19 Thread Christoph Hellwig
After more than 15 years all users of this legacy interface are finally
gone.  Rest in peace!

Signed-off-by: Christoph Hellwig 
---
 Documentation/driver-api/scsi.rst   |   6 --
 Documentation/scsi/scsi_mid_low_api.txt | 122 +---
 drivers/scsi/hosts.c|  23 --
 drivers/scsi/scsi_module.c  |  73 ---
 include/scsi/scsi_host.h|  36 --
 5 files changed, 1 insertion(+), 259 deletions(-)
 delete mode 100644 drivers/scsi/scsi_module.c

diff --git a/Documentation/driver-api/scsi.rst 
b/Documentation/driver-api/scsi.rst
index 3ae337929721..31ad0fed6763 100644
--- a/Documentation/driver-api/scsi.rst
+++ b/Documentation/driver-api/scsi.rst
@@ -154,12 +154,6 @@ lists).
 .. kernel-doc:: drivers/scsi/scsi_lib_dma.c
:export:
 
-drivers/scsi/scsi_module.c
-~~~
-
-The file drivers/scsi/scsi_module.c contains legacy support for
-old-style host templates. It should never be used by any new driver.
-
 drivers/scsi/scsi_proc.c
 ~
 
diff --git a/Documentation/scsi/scsi_mid_low_api.txt 
b/Documentation/scsi/scsi_mid_low_api.txt
index 2c31d9ee6776..177c031763c0 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -114,9 +114,7 @@ called "xxx" could be defined as
 "static int xxx_slave_alloc(struct scsi_device * sdev) { /* code */ }"
 
 ** the scsi_host_alloc() function is a replacement for the rather vaguely
-named scsi_register() function in most situations. The scsi_register()
-and scsi_unregister() functions remain to support legacy LLDs that use
-the passive initialization model.
+named scsi_register() function in most situations.
 
 
 Hotplug initialization model
@@ -228,79 +226,6 @@ slave_configure() callbacks). Such instances are "owned" 
by the mid-level.
 struct scsi_device instances are freed after slave_destroy().
 
 
-Passive initialization model
-
-These older LLDs include a file called "scsi_module.c" [yes the ".c" is a
-little surprising] in their source code. For that file to work an
-instance of struct scsi_host_template with the name "driver_template"
-needs to be defined. Here is a typical code sequence used in this model:
-static struct scsi_host_template driver_template = {
-...
-};
-#include "scsi_module.c"
-
-The scsi_module.c file contains two functions:
-  - init_this_scsi_driver() which is executed when the LLD is
-initialized (i.e. boot time or module load time)
-  - exit_this_scsi_driver() which is executed when the LLD is shut
-down (i.e. module unload time)
-Note: since these functions are tagged with __init and __exit qualifiers
-an LLD should not call them explicitly (since the kernel does that).
-
-Here is an example of an initialization sequence when two hosts are
-detected (so detect() returns 2) and the SCSI bus scan on each host
-finds 1 SCSI device (and a second device does not respond).
-
-LLD  mid level LLD
-===--=-===--
-init_this_scsi_driver() +
-|
- detect()  -+
-|   |
-|scsi_register()
-|scsi_register()
-|
-  slave_alloc()
-  slave_configure()  -->  scsi_change_queue_depth()
-  slave_alloc()   ***
-  slave_destroy() ***
-|
-  slave_alloc()
-  slave_configure()
-  slave_alloc()   ***
-  slave_destroy() ***
-
-
-The mid level invokes scsi_change_queue_depth() with "cmd_per_lun" for that
-host as the queue length. These settings can be overridden by a
-slave_configure() supplied by the LLD.
-
-*** For scsi devices that the mid level tries to scan but do not
-respond, a slave_alloc(), slave_destroy() pair is called.
-
-Here is an LLD shutdown sequence:
-
-LLD  mid level LLD
-===--=-===--
-exit_this_scsi_driver() +
-|
- slave_destroy()
-release()   -->   scsi_unregister()
-|
- slave_destroy()
-release()   -->   scsi_unregister()
-
-
-An LLD need not define slave_destroy() (i.e. it is optional). 
-
-The shortcoming of the "passive initialization model" is that host
-registration and de-registration are (typically) tied to LLD initialization
-and shutdown. Once the LLD is 

[PATCH 4/6] scsi: remove the NCR53c406a driver

2018-03-19 Thread Christoph Hellwig
This driver hasn't seen any recent bug fixing and is one of the last
drivers using the scsi_module.c infrastruture that has been deprecated
15 years ago.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/Kconfig  |   12 -
 drivers/scsi/Makefile |1 -
 drivers/scsi/NCR53c406a.c | 1090 -
 3 files changed, 1103 deletions(-)
 delete mode 100644 drivers/scsi/NCR53c406a.c

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 117c2fb41b77..9fa0cfd5a068 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -841,18 +841,6 @@ config SCSI_IZIP_SLOW_CTR
 
  Generally, saying N is fine.
 
-config SCSI_NCR53C406A
-   tristate "NCR53c406a SCSI support"
-   depends on ISA && SCSI
-   help
- This is support for the NCR53c406a SCSI host adapter.  For user
- configurable parameters, check out 
- in the kernel source.  Also read the SCSI-HOWTO, available from
- .
-
- To compile this driver as a module, choose M here: the
- module will be called NCR53c406.
-
 config SCSI_NCR_D700
tristate "NCR Dual 700 MCA SCSI support"
depends on MCA && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 77bb0017bb02..192a58d7d9d9 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -75,7 +75,6 @@ obj-$(CONFIG_SCSI_PM8001) += pm8001/
 obj-$(CONFIG_SCSI_ISCI)+= isci/
 obj-$(CONFIG_SCSI_IPS) += ips.o
 obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
-obj-$(CONFIG_SCSI_NCR53C406A)  += NCR53c406a.o
 obj-$(CONFIG_SCSI_NCR_D700)+= 53c700.o NCR_D700.o
 obj-$(CONFIG_SCSI_NCR_Q720)+= NCR_Q720_mod.o
 obj-$(CONFIG_SCSI_SYM53C416)   += sym53c416.o
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
deleted file mode 100644
index 44b09870bf51..
--- a/drivers/scsi/NCR53c406a.c
+++ /dev/null
@@ -1,1090 +0,0 @@
-/* 
- *  NCR53c406.c
- *  Low-level SCSI driver for NCR53c406a chip.
- *  Copyright (C) 1994, 1995, 1996 Normunds Saumanis (normu...@fi.ibm.com)
- * 
- *  LILO command line usage: ncr53c406a=[,[,]]
- *  Specify IRQ = 0 for non-interrupt driven mode.
- *  FASTPIO = 1 for fast pio mode, 0 for slow mode.
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License as published by the
- *  Free Software Foundation; either version 2, or (at your option) any
- *  later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- */
-
-#define NCR53C406A_DEBUG 0
-#define VERBOSE_NCR53C406A_DEBUG 0
-
-/* Set this to 1 for PIO mode (recommended) or to 0 for DMA mode */
-#define USE_PIO 1
-
-#define USE_BIOS 0
-   /* #define BIOS_ADDR 0xD8000 *//* define this 
if autoprobe fails */
-   /* #define PORT_BASE 0x330 *//* define this if 
autoprobe fails */
-   /* #define IRQ_LEV   0  *//* define this if 
autoprobe fails */
-#define DMA_CHAN  5/* this is ignored if DMA is disabled */
-
-/* Set this to 0 if you encounter kernel lockups while transferring 
- * data in PIO mode */
-#define USE_FAST_PIO 1
-
-/* = End of user configurable parameters = */
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include "scsi.h"
-#include 
-
-/* = */
-
-#define WATCHDOG 500
-
-#define SYNC_MODE 0/* Synchronous transfer mode */
-
-#ifdef DEBUG
-#undef NCR53C406A_DEBUG
-#define NCR53C406A_DEBUG 1
-#endif
-
-#if USE_PIO
-#define USE_DMA 0
-#else
-#define USE_DMA 1
-#endif
-
-/* Default configuration */
-#define C1_IMG   0x07  /* ID=7 */
-#define C2_IMG   0x48  /* FE SCSI2 */
-#if USE_DMA
-#define C3_IMG   0x21  /* CDB TE */
-#else
-#define C3_IMG   0x20  /* CDB */
-#endif
-#define C4_IMG   0x04  /* ANE */
-#define C5_IMG   0xb6  /* AA PI SIE POL */
-
-#define REG0 (outb(C4_IMG, CONFIG4))
-#define REG1 (outb(C5_IMG, CONFIG5))
-
-#if NCR53C406A_DEBUG
-#define DEB(x) x
-#else
-#define DEB(x)
-#endif
-
-#if VERBOSE_NCR53C406A_DEBUG
-#define VDEB(x) x
-#else
-#define VDEB(x)
-#endif
-
-#define LOAD_DMA_COUNT(count) \
-  outb(count & 0xff, TC_LSB); \
-  outb((count >> 8) & 0xff, TC_MSB); \
-  outb((count >> 16) & 0xff, TC_HIGH);
-
-/* Chip commands */
-#define DMA_OP   0x80
-
-#define SCSI_NOP 0x00
-#define FLUSH_FIFO   0x01
-#define CHIP_RESET   0x02
-#define SCSI_RESET   0x03
-#define RESELECT 0x40

remove obsolete drivers and scsi_module.c V2

2018-03-19 Thread Christoph Hellwig
Hi all,

this series removes the obsolete scsi_module.c infratructure that
has been obsolete for 15 years, and the remaining drivers that depend
on them.

Changes since V1:
 - drop already merged patches
 - convert mvme147 to new-style probing instead of removing it


[PATCH 3/6] scsi: remove the fdomain and fdomain_cs drivers

2018-03-19 Thread Christoph Hellwig
These drivers haven't seen any recent bug fixing and are two of the last
drivers using the scsi_module.c infrastruture that has been deprecated
15 years ago.

Signed-off-by: Christoph Hellwig 
---
 MAINTAINERS|6 -
 arch/powerpc/configs/c2k_defconfig |1 -
 drivers/scsi/Kconfig   |   20 -
 drivers/scsi/Makefile  |1 -
 drivers/scsi/fdomain.c | 1783 
 drivers/scsi/fdomain.h |   24 -
 drivers/scsi/pcmcia/Kconfig|9 -
 drivers/scsi/pcmcia/Makefile   |2 -
 drivers/scsi/pcmcia/fdomain_core.c |2 -
 drivers/scsi/pcmcia/fdomain_stub.c |  209 -
 10 files changed, 2057 deletions(-)
 delete mode 100644 drivers/scsi/fdomain.c
 delete mode 100644 drivers/scsi/fdomain.h
 delete mode 100644 drivers/scsi/pcmcia/fdomain_core.c
 delete mode 100644 drivers/scsi/pcmcia/fdomain_stub.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 36eb73238cf5..ccde214bb82d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5842,12 +5842,6 @@ F:   tools/testing/selftests/futex/
 F: tools/perf/bench/futex*
 F: Documentation/*futex*
 
-FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit)
-M: Rik Faith 
-L: linux-scsi@vger.kernel.org
-S: Odd Fixes (e.g., new signatures)
-F: drivers/scsi/fdomain.*
-
 GCC PLUGINS
 M: Kees Cook 
 R: Emese Revfy 
diff --git a/arch/powerpc/configs/c2k_defconfig 
b/arch/powerpc/configs/c2k_defconfig
index 4bb832a41d55..6c1196b0f81e 100644
--- a/arch/powerpc/configs/c2k_defconfig
+++ b/arch/powerpc/configs/c2k_defconfig
@@ -184,7 +184,6 @@ CONFIG_MEGARAID_NEWGEN=y
 CONFIG_MEGARAID_MM=m
 CONFIG_MEGARAID_MAILBOX=m
 CONFIG_MEGARAID_SAS=m
-CONFIG_SCSI_FUTURE_DOMAIN=m
 CONFIG_SCSI_GDTH=m
 CONFIG_SCSI_IPS=m
 CONFIG_SCSI_INITIO=m
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index b18dfa1c14a1..117c2fb41b77 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -640,26 +640,6 @@ config SCSI_DMX3191D
  To compile this driver as a module, choose M here: the
  module will be called dmx3191d.
 
-config SCSI_FUTURE_DOMAIN
-   tristate "Future Domain 16xx SCSI/AHA-2920A support"
-   depends on (ISA || PCI) && SCSI
-   select CHECK_SIGNATURE
-   ---help---
- This is support for Future Domain's 16-bit SCSI host adapters
- (TMC-1660/1680, TMC-1650/1670, TMC-3260, TMC-1610M/MER/MEX) and
- other adapters based on the Future Domain chipsets (Quantum
- ISA-200S, ISA-250MG; Adaptec AHA-2920A; and at least one IBM board).
- It is explained in section 3.7 of the SCSI-HOWTO, available from
- .
-
- NOTE: Newer Adaptec AHA-2920C boards use the Adaptec AIC-7850 chip
- and should use the aic7xxx driver ("Adaptec AIC7xxx chipset SCSI
- controller support"). This Future Domain driver works with the older
- Adaptec AHA-2920A boards with a Future Domain chip on them.
-
- To compile this driver as a module, choose M here: the
- module will be called fdomain.
-
 config SCSI_GDTH
tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller 
support"
depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 46f1c1033f0e..77bb0017bb02 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -74,7 +74,6 @@ obj-$(CONFIG_SCSI_AIC94XX)+= aic94xx/
 obj-$(CONFIG_SCSI_PM8001)  += pm8001/
 obj-$(CONFIG_SCSI_ISCI)+= isci/
 obj-$(CONFIG_SCSI_IPS) += ips.o
-obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o
 obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
 obj-$(CONFIG_SCSI_NCR53C406A)  += NCR53c406a.o
 obj-$(CONFIG_SCSI_NCR_D700)+= 53c700.o NCR_D700.o
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
deleted file mode 100644
index ebbe5a3e665d..
--- a/drivers/scsi/fdomain.c
+++ /dev/null
@@ -1,1783 +0,0 @@
-/* fdomain.c -- Future Domain TMC-16x0 SCSI driver
- * Created: Sun May  3 18:53:19 1992 by fa...@cs.unc.edu
- * Revised: Mon Dec 28 21:59:02 1998 by fa...@acm.org
- * Author: Rickard E. Faith, fa...@cs.unc.edu
- * Copyright 1992-1996, 1998 Rickard E. Faith (fa...@acm.org)
- * Shared IRQ supported added 7/7/2001  Alan Cox 
-
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
-
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
-
- * You should have received a copy of the GNU General Public 

[PATCH 5/6] scsi: remove the sym53c416 driver

2018-03-19 Thread Christoph Hellwig
This driver hasn't seen any recent bug fixing and is one of the last
drivers using the scsi_module.c infrastruture that has been deprecated
15 years ago.

Signed-off-by: Christoph Hellwig 
---
 Documentation/scsi/scsi-parameters.txt |   3 -
 drivers/scsi/Kconfig   |  18 -
 drivers/scsi/Makefile  |   1 -
 drivers/scsi/sym53c416.c   | 844 -
 drivers/scsi/sym53c416.h   |  33 --
 5 files changed, 899 deletions(-)
 delete mode 100644 drivers/scsi/sym53c416.c
 delete mode 100644 drivers/scsi/sym53c416.h

diff --git a/Documentation/scsi/scsi-parameters.txt 
b/Documentation/scsi/scsi-parameters.txt
index 8f7be8a05642..2dc7f11179d1 100644
--- a/Documentation/scsi/scsi-parameters.txt
+++ b/Documentation/scsi/scsi-parameters.txt
@@ -108,9 +108,6 @@ parameters may be changed at runtime by the command
st= [HW,SCSI] SCSI tape parameters (buffers, etc.)
See Documentation/scsi/st.txt.
 
-   sym53c416=  [HW,SCSI]
-   See header of drivers/scsi/sym53c416.c.
-
tmscsim=[HW,SCSI]
See comment before function dc390_setup() in
drivers/scsi/tmscsim.c.
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 9fa0cfd5a068..11e89e56b865 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1172,24 +1172,6 @@ config SCSI_SIM710
 
  It currently supports Compaq EISA cards and NCR MCA cards
 
-config SCSI_SYM53C416
-   tristate "Symbios 53c416 SCSI support"
-   depends on ISA && SCSI
-   ---help---
- This is support for the sym53c416 SCSI host adapter, the SCSI
- adapter that comes with some HP scanners. This driver requires that
- the sym53c416 is configured first using some sort of PnP
- configuration program (e.g. isapnp) or by a PnP aware BIOS. If you
- are using isapnp then you need to compile this driver as a module
- and then load it using insmod after isapnp has run. The parameters
- of the configured card(s) should be passed to the driver. The format
- is:
-
- insmod sym53c416 sym53c416=, [sym53c416_1=,]
-
- To compile this driver as a module, choose M here: the
- module will be called sym53c416.
-
 config SCSI_DC395x
tristate "Tekram DC395(U/UW/F) and DC315(U) SCSI support"
depends on PCI && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 192a58d7d9d9..d5135efbf9cd 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -77,7 +77,6 @@ obj-$(CONFIG_SCSI_IPS)+= ips.o
 obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
 obj-$(CONFIG_SCSI_NCR_D700)+= 53c700.o NCR_D700.o
 obj-$(CONFIG_SCSI_NCR_Q720)+= NCR_Q720_mod.o
-obj-$(CONFIG_SCSI_SYM53C416)   += sym53c416.o
 obj-$(CONFIG_SCSI_QLOGIC_FAS)  += qlogicfas408.o   qlogicfas.o
 obj-$(CONFIG_PCMCIA_QLOGIC)+= qlogicfas408.o
 obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o 
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
deleted file mode 100644
index e68bcdc75bc3..
--- a/drivers/scsi/sym53c416.c
+++ /dev/null
@@ -1,844 +0,0 @@
-/*
- *  sym53c416.c
- *  Low-level SCSI driver for sym53c416 chip.
- *  Copyright (C) 1998 Lieven Willems (lw_li...@hotmail.com)
- * 
- *  Changes : 
- * 
- *  Marcelo Tosatti  : Added io_request_lock locking
- *  Alan Cox  : Cleaned up code formatting
- *  Fixed an irq locking bug
- *  Added ISAPnP support
- *  Bjoern A. Zeeb  : Initial irq locking updates
- *   Added another card with ISAPnP support
- * 
- *  LILO command line usage: sym53c416=[,]
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License as published by the
- *  Free Software Foundation; either version 2, or (at your option) any
- *  later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "scsi.h"
-#include 
-#include "sym53c416.h"
-
-#define VERSION_STRING"Version 1.0.0-ac"
-
-#define TC_LOW   0x00 /* Transfer counter low*/
-#define TC_MID   0x01 /* Transfer counter mid*/
-#define SCSI_FIFO0x02 /* SCSI FIFO register  */
-#define COMMAND_REG  0x03 /* Command Register*/
-#define STATUS_REG   0x04 /* Status Register (READ)  */
-#define 

[PATCH 1/6] esas2r: remove initialization / cleanup dead wood

2018-03-19 Thread Christoph Hellwig
esas2r has been converted to hotplug style initialization long ago, but
kept various remant of the old-style scsi_module.c initialization around.
Remove those.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/esas2r/esas2r.h  |  2 --
 drivers/scsi/esas2r/esas2r_init.c | 21 
 drivers/scsi/esas2r/esas2r_main.c | 72 +++
 3 files changed, 4 insertions(+), 91 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index 1da6407ee142..858c3b33db78 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -962,7 +962,6 @@ struct esas2r_adapter {
  * Function Declarations
  * SCSI functions
  */
-int esas2r_release(struct Scsi_Host *);
 const char *esas2r_info(struct Scsi_Host *);
 int esas2r_write_params(struct esas2r_adapter *a, struct esas2r_request *rq,
struct esas2r_sas_nvram *data);
@@ -984,7 +983,6 @@ int esas2r_target_reset(struct scsi_cmnd *cmd);
 /* Internal functions */
 int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
int index);
-int esas2r_cleanup(struct Scsi_Host *host);
 int esas2r_read_fw(struct esas2r_adapter *a, char *buf, long off, int count);
 int esas2r_write_fw(struct esas2r_adapter *a, const char *buf, long off,
int count);
diff --git a/drivers/scsi/esas2r/esas2r_init.c 
b/drivers/scsi/esas2r/esas2r_init.c
index 5b14dd29b764..9dffcb28c9b7 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -661,27 +661,6 @@ void esas2r_kill_adapter(int i)
}
 }
 
-int esas2r_cleanup(struct Scsi_Host *host)
-{
-   struct esas2r_adapter *a;
-   int index;
-
-   if (host == NULL) {
-   int i;
-
-   esas2r_debug("esas2r_cleanup everything");
-   for (i = 0; i < MAX_ADAPTERS; i++)
-   esas2r_kill_adapter(i);
-   return -1;
-   }
-
-   esas2r_debug("esas2r_cleanup called for host %p", host);
-   a = (struct esas2r_adapter *)host->hostdata;
-   index = a->index;
-   esas2r_kill_adapter(index);
-   return index;
-}
-
 int esas2r_suspend(struct pci_dev *pdev, pm_message_t state)
 {
struct Scsi_Host *host = pci_get_drvdata(pdev);
diff --git a/drivers/scsi/esas2r/esas2r_main.c 
b/drivers/scsi/esas2r/esas2r_main.c
index 4eb14301a497..e07eac5be087 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -235,7 +235,6 @@ static struct scsi_host_template driver_template = {
.module = THIS_MODULE,
.show_info  = esas2r_show_info,
.name   = ESAS2R_LONGNAME,
-   .release= esas2r_release,
.info   = esas2r_info,
.ioctl  = esas2r_ioctl,
.queuecommand   = esas2r_queuecommand,
@@ -520,44 +519,16 @@ static int esas2r_probe(struct pci_dev *pcid,
 
 static void esas2r_remove(struct pci_dev *pdev)
 {
-   struct Scsi_Host *host;
-   int index;
-
-   if (pdev == NULL) {
-   esas2r_log(ESAS2R_LOG_WARN, "esas2r_remove pdev==NULL");
-   return;
-   }
-
-   host = pci_get_drvdata(pdev);
-
-   if (host == NULL) {
-   /*
-* this can happen if pci_set_drvdata was already called
-* to clear the host pointer.  if this is the case, we
-* are okay; this channel has already been cleaned up.
-*/
-
-   return;
-   }
+   struct Scsi_Host *host = pci_get_drvdata(pdev);
+   struct esas2r_adapter *a = (struct esas2r_adapter *)host->hostdata;
 
esas2r_log_dev(ESAS2R_LOG_INFO, &(pdev->dev),
   "esas2r_remove(%p) called; "
   "host:%p", pdev,
   host);
 
-   index = esas2r_cleanup(host);
-
-   if (index < 0)
-   esas2r_log_dev(ESAS2R_LOG_WARN, &(pdev->dev),
-  "unknown host in %s",
-  __func__);
-
+   esas2r_kill_adapter(a->index);
found_adapters--;
-
-   /* if this was the last adapter, clean up the rest of the driver */
-
-   if (found_adapters == 0)
-   esas2r_cleanup(NULL);
 }
 
 static int __init esas2r_init(void)
@@ -638,30 +609,7 @@ static int __init esas2r_init(void)
for (i = 0; i < MAX_ADAPTERS; i++)
esas2r_adapters[i] = NULL;
 
-   /* initialize */
-
-   driver_template.module = THIS_MODULE;
-
-   if (pci_register_driver(_pci_driver) != 0)
-   esas2r_log(ESAS2R_LOG_CRIT, "pci_register_driver FAILED");
-   else
-   esas2r_log(ESAS2R_LOG_INFO, "pci_register_driver() OK");
-
-   if (!found_adapters) {
-   pci_unregister_driver(_pci_driver);
-   

[PATCH] scsi: unexport scsi_host_set_state

2018-03-19 Thread Christoph Hellwig
This function is only used inside the SCSI midlayer, so remove the
export for it.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/hosts.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index a0a7e4ff255c..0a5362822ed6 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -154,7 +154,6 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum 
scsi_host_state state)
 scsi_host_state_name(state)));
return -EINVAL;
 }
-EXPORT_SYMBOL(scsi_host_set_state);
 
 /**
  * scsi_remove_host - remove a scsi host
-- 
2.14.2



Re: [PATCH v4] m68k/amiga - Amiga Zorro NCR53C9x boards: new zorro_esp.c

2018-03-19 Thread Michael Schmitz
Hi Kars,

thanks, I've fixed that typo.

Cheers,

Michael


Am 19.03.2018 um 03:51 schrieb Kars de Jong:
> Hi Michael,
> 
> 2018-03-17 2:16 GMT+01:00 Michael Schmitz :
>> From: Michael Schmitz 
>>
>> New combined SCSI driver for all ESP based Zorro SCSI boards for
>> m68k Amiga.
>>
>> Code largely based on board specific parts of the old drivers (blz1230.c,
>> blz2060.c, cyberstorm.c, cyberstormII.c, fastlane.c which were removed
>> after the 2.6 kernel series for lack of maintenance) with contributions
>> by Tuomas Vainikka (TCQ bug tests and workaround) and Finn Thain (TCQ
>> bugfix by use of PIO in extended message in transfer).
>>
>> New Kconfig option and Makefile entries for new Amiga Zorro ESP SCSI
>> driver included in this patch.
>>
>> Use DMA transfers wherever possible, with board-specific DMA set-up
>> functions copied from the old driver code. Three byte reselection messages
>> do appear to cause DMA timeouts. So wire up a PIO transfer routine for
>> these instead. esp_reselect_with_tag explicitly sets esp->cmd_block_dma as
>> target address for the message bytes but PIO requires a virtual address.
>> Substiute kernel virtual address esp->cmd_block in PIO transfer call if
>> DMA address is esp->cmd_block_dma and phase is message in.
>>
>> PIO code taken from mac_esp.c where the reselection timeout issue was
>> debugged and fixed first, with minor macro and function rename.
>>
>> Signed-off-by: Michael Schmitz 
>> Reviewed-by: Finn Thain 
>> ---
>>
>> Changes since v1:
>>
>> Fixed issues raised by Finn Thain in initial code review:
>>
>> - use KBUILD_MODNAME for driver name string.
>> - use pr_fmt() for pr_* format prefix.
>> - clean up DMA error reporting: clear error flag before each DMA
>>   operation, set error flag on PIO error. Don't test phase in dma_err hook.
>> - change confusing comment about semantics of read flag, add comments
>>   indicating DMA direction to DMA setup hooks.
>> - drop spurious braces around switch clauses.
>> - lift cfreq setting out of ID switch clauses.
>> - fix indentation.
>> - fix error codes on probe fail.
>> - drop check for board ID when unmapping DMA regs in error handling:
>>   the ioaddr > 0xff test already catches all cases where the DMA
>>   registers were ioremapped.
>> - dynamically alloc zorro_private_data.
>> - fix use of driver_data field (don't mix host and zorro_esp_priv
>>   pointers). Note: require esp pointer in zorro_esp_priv to find host
>>   pointer!
>> - back out phase bits changes to pio_cmd !write branch introduced
>>   to cope with ESP SELAS command. We don't use that code so keep
>>   it in sync with Finn's version.
>> - use esp_ops.dma_length_limit() to limit transfer size. After review
>>   of old driver code, use 0xff max transfer size throughout.
>>
>> Fixed issues raised by Geert Uytterhoven:
>>
>> - dynamically alloc zorro_private_data, store as device drvdata.
>> - store ctrl_data for CyberStormI in driver private data.
>> - use dma_sync_single_for_device() instead of cache_push/clear.
>> - handle case of duplicate board identity - check whether board is
>>   Zorro III or Zorro II (use ROM resource data for this). Also fix
>>   up DMA mask for Zorro II boards to 32 bits (these are really CPU
>>   expansion slot boards).
>> - remove zorro3 field from driver_data struct (now in private data).
>> - add braces around ambiguous if - else construct.
>> - use named structs instead of array for board config data.
>> - use scsi_option driver data flag for boards with optional ESP.
>>
>> Other improvements and bugfixes
>>
>> - fix Zorro device table error (duplicate ID used, also raised
>>   by Kars de Jong).
>> - error code fixup in error handling path.
>> - add separate DMA setup for Blizzard 1230 II board.
>> - add support for Cyberstorm II board.
>> - add register structs and DMA setup for Zorro III Fastlane board,
>>   following logic from old fastlane.c driver. Wire up Fastlane DMA
>>   and interrupt status routines, map the necessary low 24 bit board
>>   address space used for DMA target address setting. Clean up DMA
>>   register space ioremap() branch for Zorro III boards (currently
>>   Fastlane only) to end confusion about what to do in error recovery.
>> - use esp_ops.fastlane_esp_dma_invalidate() on Fastlane (and skip
>>   fastlane_esp_reset_dma() in DMA setup).
>> - credit Tuomas Vainikka for contributing Blizzard 1230 code (and
>>   testing).
>> - clarify comment about unsupported Oktagon SCSI board.
>> - remove unused const definitions carried over from old driver.
>>
>> Changes since v2:
>>
>> - add SPDX-License-Identifier.
>> - remove unused ratelimit.h.
>> - drop phys_to_virt() in PIO transfer routine, after ensuring PIO is only
>>   used for message in transfers to esp->command_block. This obviates any
>>   need for finding the virtual address corresponding to a DMA handle.
>> - drop BUG_ON(!(cmd &