RE: [PATCH 2/2] scsi: ufs: add Exynos-specific driver

2017-11-30 Thread 김기웅
Dear Jaehoon

Actually, I used to use the way what you mentioned, but
now a new way has been using with latest products.

Anyway, I would refer to your comment.

Thank you.

> -Original Message-
> From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
> ow...@vger.kernel.org] On Behalf Of Jaehoon Chung
> Sent: Tuesday, November 28, 2017 6:21 PM
> To: 김기웅; linux-scsi@vger.kernel.org; 'Martin K. Petersen'
> Cc: c...@samsung.com; 'HeonGwang Chu'; '김부진'; 'YOUNGEUN PARK'
> Subject: Re: [PATCH 2/2] scsi: ufs: add Exynos-specific driver
> 
> On 11/28/2017 05:27 PM, 김기웅 wrote:
> > Hi.
> > This is modified from Seungwon's initial patch.
> > And this has been used for several commercial products.
> > I think you feel weird because you can't see a bunch of unipro and mphy.
> > But those stuff has been changed whenever new product comes.
> > So I didn't keep those in this driver.
> 
> Unipro and mphy setting values can be got from device-tree according to
> each variant boards.
> Then it doesn't need to keep in this driver. but there is no usage for
> them in this patch.
> Otherwise, this driver may be a dead driver.
> 
> Also anyone doesn't have the interesting about this driver.
> 
> And i also added the some comment at below..
> 
> Best Regards,
> Jaehoon Chung
> 
> >
> >
> >> -Original Message-
> >> From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
> >> ow...@vger.kernel.org] On Behalf Of Jaehoon Chung
> >> Sent: Tuesday, November 28, 2017 5:20 PM
> >> To: 김기웅; linux-scsi@vger.kernel.org; Martin K. Petersen
> >> Cc: c...@samsung.com; HeonGwang Chu; 김부진; YOUNGEUN PARK
> >> Subject: Re: [PATCH 2/2] scsi: ufs: add Exynos-specific driver
> >>
> >> Hi,
> >>
> >> On 11/28/2017 02:36 PM, 김기웅 wrote:
> >>> This driver is to use UFS devices on Exynos SoC and has been already
> >>> used for many years for commercial products.
> >>
> >> Well, i'm not sure but i remembered there are the similar patches
> >> before..Seungwon and Alim's patches.
> >> Is it relevant to them?
> >>
> >> Anyway.. i think i can't test with only these patches..
> >> how did you test this patches?
> >>
> >>>
> >>> Signed-off-by: Kiwoong Kim 
> >>> ---
> >>>  drivers/scsi/ufs/Kconfig  |  10 +
> >>>  drivers/scsi/ufs/Makefile |   1 +
> >>>  drivers/scsi/ufs/ufs-exynos.c | 962
> >>> ++
> >>>  drivers/scsi/ufs/ufs-exynos.h | 351 +++
> >>>  drivers/scsi/ufs/ufshcd.h |   1 +
> >>>  5 files changed, 1325 insertions(+)  create mode 100644
> >>> drivers/scsi/ufs/ufs-exynos.c  create mode 100644
> >>> drivers/scsi/ufs/ufs-exynos.h
> >>
> >> There is no binding file.
> >>
> >>>
> >>> diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
> >>> index
> >>> e27b4d4e6ae2..7d71ad8768c3 100644
> >>> --- a/drivers/scsi/ufs/Kconfig
> >>> +++ b/drivers/scsi/ufs/Kconfig
> >>> @@ -100,3 +100,13 @@ config SCSI_UFS_QCOM
> >>>
> >>> Select this if you have UFS controller on QCOM chipset.
> >>> If unsure, say N.
> >>> +
> >>> +config SCSI_UFS_EXYNOS
> >>> + tristate "EXYNOS UFS Host Controller Driver"
> >>> + depends on SCSI_UFSHCD && SCSI_UFSHCD_PLATFORM
> >>> + ---help---
> >>> +   This selects the EXYNOS UFS host controller driver.
> >>> +
> >>> +   If you have a controller with this interface, say Y or M here.
> >>> +
> >>> +   If unsure, say N.
> >>> diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
> >>> index 9310c6c83041..3312b052dcff 100644
> >>> --- a/drivers/scsi/ufs/Makefile
> >>> +++ b/drivers/scsi/ufs/Makefile
> >>> @@ -3,6 +3,7 @@
> >>>  obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o
> >>> tc-dwc-g210.o
> >>>  obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o
> >>> ufshcd-dwc.o tc-dwc-g210.o
> >>>  obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o
> >>> +obj-$(CONFIG_SCSI_UFS_EXYNOS) += ufs-exynos.o
> >>>  obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o
> >>>  obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
> >>>  obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o diff --git
> >>> a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c new
> >>> file mode 100644 index ..98e5aeb80b06
> >>> --- /dev/null
> >>> +++ b/drivers/scsi/ufs/ufs-exynos.c
> >>> @@ -0,0 +1,962 @@
> >>> +/*
> >>> + * UFS Host Controller driver for Exynos specific extensions
> >>> + *
> >>> + * Copyright (C) 2013-2014 Samsung Electronics Co., Ltd.
> >>
> >> 2013-2014? is it right?
> >>
> >>> + *
> >>> + * 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 of the License,
> >>> +or
> >>> + * (at your option) any later version.
> >>> + */
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include "ufshcd.h"
> >>> +#include "ufshcd-pltfrm.h"
> >>> +#include "ufs-exynos.h"
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>
>

Re: [PATCH v2 01/22] qla2xxx: Fix system crash for Notify ack timeout handling

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Fix NULL pointer crash due to missing timeout handling callback
> for Notify Ack IOCB.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c 
> b/drivers/scsi/qla2xxx/qla_target.c
> index 18069edd4773..1259ec85ec0a 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -665,7 +665,7 @@ int qla24xx_async_notify_ack(scsi_qla_host_t *vha, 
> fc_port_t *fcport,
>   qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha)+2);
>  
>   sp->u.iocb_cmd.u.nack.ntfy = ntfy;
> -
> + sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
>   sp->done = qla2x00_async_nack_sp_done;
>  
>   rval = qla2x00_start_sp(sp);
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 02/22] qla2xxx: Fix gpnid error processing

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Stop GPNID command from advancing if command has failed.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_gs.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
> index bc3db6abc9a0..ddc69d36877e 100644
> --- a/drivers/scsi/qla2xxx/qla_gs.c
> +++ b/drivers/scsi/qla2xxx/qla_gs.c
> @@ -3211,6 +3211,11 @@ static void qla2x00_async_gpnid_sp_done(void *s, int 
> res)
>   sp->name, res, ct_req->req.port_id.port_id,
>   ct_rsp->rsp.gpn_id.port_name);
>  
> + if (res) {
> + sp->free(sp);
> + return;
> + }
> +
>   memset(&ea, 0, sizeof(ea));
>   memcpy(ea.port_name, ct_rsp->rsp.gpn_id.port_name, WWN_SIZE);
>   ea.sp = sp;
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 03/22] qla2xxx: Move session delete to driver work queue

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Move session delete from system work queue to driver's
> work queue for in time processing.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 3 ++-
>  drivers/scsi/qla2xxx/qla_target.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 04/22] qla2xxx: Skip IRQ affinity for Target QPairs

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Fix co-existence between Block MQ and Target Mode. Block MQ
> and initiator mode requires midlayer queue mapping to check
> for IRQ to be affinitize. For target mode, it's not the case.
> 
> Fixes: 09620eeb62c41 ("scsi: qla2xxx: Add debug knob for user control 
> workload")
> Cc:  # 4.12+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 05/22] qla2xxx: Fix re-login for Nport Handle in use

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> When NPort Handle is in use, driver needs to mark the handle
> as used and pick another. Instead, the code clears the handle
> and re-pick the same handle.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_gs.c   | 16 ++-
>  drivers/scsi/qla2xxx/qla_init.c | 44 
> +
>  drivers/scsi/qla2xxx/qla_isr.c  |  5 -
>  3 files changed, 51 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
> index ddc69d36877e..8984f857bb34 100644
> --- a/drivers/scsi/qla2xxx/qla_gs.c
> +++ b/drivers/scsi/qla2xxx/qla_gs.c
> @@ -2833,7 +2833,7 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, 
> struct event_arg *ea)
>   }
>   } else { /* fcport->d_id.b24 != ea->id.b24 */
>   fcport->d_id.b24 = ea->id.b24;
> - if (fcport->deleted == QLA_SESS_DELETED) {
> + if (fcport->deleted != QLA_SESS_DELETED) {
>   ql_dbg(ql_dbg_disc, vha, 0x2021,
>   "%s %d %8phC post del sess\n",
>   __func__, __LINE__, 
> fcport->port_name);
> @@ -3206,10 +3206,16 @@ static void qla2x00_async_gpnid_sp_done(void *s, int 
> res)
>   struct event_arg ea;
>   struct qla_work_evt *e;
>  
> - ql_dbg(ql_dbg_disc, vha, 0x2066,
> - "Async done-%s res %x ID %3phC. %8phC\n",
> - sp->name, res, ct_req->req.port_id.port_id,
> - ct_rsp->rsp.gpn_id.port_name);
> + if (res)
> + ql_dbg(ql_dbg_disc, vha, 0x2066,
> + "Async done-%s fail res %x ID %3phC. %8phC\n",
> + sp->name, res, ct_req->req.port_id.port_id,
> + ct_rsp->rsp.gpn_id.port_name);
> + else
> + ql_dbg(ql_dbg_disc, vha, 0x2066,
> + "Async done-%s good ID %3phC. %8phC\n",
> + sp->name, ct_req->req.port_id.port_id,
> + ct_rsp->rsp.gpn_id.port_name);
>  
>   if (res) {
>   sp->free(sp);
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 1bafa043f9f1..be4c67b465b8 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -1452,6 +1452,8 @@ static void
>  qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg 
> *ea)
>  {
>   port_id_t cid;  /* conflict Nport id */
> + u16 lid;
> + struct fc_port *conflict_fcport;
>  
>   switch (ea->data[0]) {
>   case MBS_COMMAND_COMPLETE:
> @@ -1467,8 +1469,12 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host 
> *vha, struct event_arg *ea)
>   qla24xx_post_prli_work(vha, ea->fcport);
>   } else {
>   ql_dbg(ql_dbg_disc, vha, 0x20ea,
> - "%s %d %8phC post gpdb\n",
> - __func__, __LINE__, ea->fcport->port_name);
> + "%s %d %8phC LoopID 0x%x in use with %06x. post 
> gnl\n",
> + __func__, __LINE__, ea->fcport->port_name,
> + ea->fcport->loop_id, ea->fcport->d_id.b24);
> +
> + set_bit(ea->fcport->loop_id, vha->hw->loop_id_map);
> + ea->fcport->loop_id = FC_NO_LOOP_ID;
>   ea->fcport->chip_reset = 
> vha->hw->base_qpair->chip_reset;
>   ea->fcport->logout_on_delete = 1;
>   ea->fcport->send_els_logo = 0;
> @@ -1513,8 +1519,38 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host 
> *vha, struct event_arg *ea)
>   ea->fcport->d_id.b.domain, ea->fcport->d_id.b.area,
>   ea->fcport->d_id.b.al_pa);
>  
> - qla2x00_clear_loop_id(ea->fcport);
> - qla24xx_post_gidpn_work(vha, ea->fcport);
> + lid = ea->iop[1] & 0x;
> + qlt_find_sess_invalidate_other(vha,
> + wwn_to_u64(ea->fcport->port_name),
> + ea->fcport->d_id, lid, &conflict_fcport);
> +
> + if (conflict_fcport) {
> + /*
> +  * Another fcport share the same loop_id/nport id.
> +  * Conflict fcport needs to finish cleanup before this
> +  * fcport can proceed to login.
> +  */
> + conflict_fcport->conflict = ea->fcport;
> + ea->fcport->login_pause = 1;
> +
> + ql_dbg(ql_dbg_disc, vha, 0x20ed,
> + "%s %d %8phC NPortId %06x inuse with loopid 0x%x. 
> post gidpn\n",
> + __

Re: [PATCH v2 06/22] qla2xxx: Retry switch command on time out

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Retry GID_PN & GPN_ID switch commands for time out case.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_gs.c | 34 ++
>  1 file changed, 26 insertions(+), 8 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 07/22] qla2xxx: Serialize GPNID for multiple RSCN

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> GPNID is triggered by RSCN. For multiple RSCNs of the same
> affected NPORT ID, serialize the GPNID to prevent confusion.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_def.h | 48 
> +++---
>  drivers/scsi/qla2xxx/qla_gs.c  | 35 +-
>  drivers/scsi/qla2xxx/qla_isr.c |  2 +-
>  drivers/scsi/qla2xxx/qla_os.c  |  1 +
>  4 files changed, 58 insertions(+), 28 deletions(-)
> 
[ .. ]
> @@ -3242,11 +3243,20 @@ static void qla2x00_async_gpnid_sp_done(void *s, int 
> res)
>   ea.rc = res;
>   ea.event = FCME_GPNID_DONE;
>  
> + spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
> + list_del(&sp->elem);
> + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
> +
>   if (res) {
>   if (res == QLA_FUNCTION_TIMEOUT)
>   qla24xx_post_gpnid_work(sp->vha, &ea.id);
>   sp->free(sp);
>   return;
> + } else if (sp->gen1) {
> + /* There was anoter RSNC for this Nport ID */
> + qla24xx_post_gpnid_work(sp->vha, &ea.id);
> + sp->free(sp);
> + return;
>   }
>  
>   qla2x00_fcport_event_handler(vha, &ea);
Two spelling errors in one line ...

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 08/22] qla2xxx: Fix login state machine stuck at GPDB

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> This patch returns discovery state machine back to
> Login Complete.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_init.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 09/22] qla2xxx: Fix NPIV host cleanup in target mode

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Sawan Chandak 
> 
> Add check to make sure we are cleaning up global target host
> list only for NPIV hosts
> 
> Fixes: bdbe24de281e2 ("scsi: qla2xxx: Cleanup NPIV host in target mode during 
> config teardown")
> Cc:  # 4.10+
> Signed-off-by: Sawan Chandak 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 10/22] qla2xxx: Relogin to target port on a cable swap

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> If user swaps one target port for another target port for same
> switch port, the new target port is not being recognized by the
> driver. Current code assumes that old Target port has recovered
> from link down. The fix will ask switch what is the WWPN of a
> specific NportID (GPNID) rather than assuming it's the same Target
> port which has came back.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_gs.c | 164 
> ++
>  drivers/scsi/qla2xxx/qla_init.c   |   6 +-
>  drivers/scsi/qla2xxx/qla_os.c |  35 +++-
>  drivers/scsi/qla2xxx/qla_target.c |  35 ++--
>  4 files changed, 194 insertions(+), 46 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 11/22] qla2xxx: Fix Relogin being triggered too fast

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Current driver design schedules relogin process via DPC thread
> every 1 second. In a large fabric, this DPC thread tries to
> schedule too many jobs and might get overloaded. As a result of
> this processing of DPC thread, it can schedule relogin earlier
> than 1 second.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_def.h |  1 +
>  drivers/scsi/qla2xxx/qla_mid.c | 24 +++-
>  drivers/scsi/qla2xxx/qla_os.c  | 22 ++
>  3 files changed, 30 insertions(+), 17 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 12/22] qla2xxx: Clear send ELS LOGO flag after target re-login

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> This patch fixes clearing out els_send_logo flag at the
> time of session deletion.
> 
> Fixes: 3515832cc614 ("scsi: qla2xxx: Reset the logo flag, after target 
> re-login.")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c 
> b/drivers/scsi/qla2xxx/qla_target.c
> index 283ff316e4b2..e824cdc77139 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -983,6 +983,7 @@ static void qlt_free_session_done(struct work_struct 
> *work)
>   logo.id = sess->d_id;
>   logo.cmd_count = 0;
>   qlt_send_first_logo(vha, &logo);
> + sess->send_els_logo = 0;
>   }
>  
>   if (sess->logout_on_delete) {
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 13/22] qla2xxx: Fix PRLI state check

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Get Port Database MBX cmd is to validate current Login state upon
> PRLI completion. Current code looks at the last login state for
> re-validation which was incorrect. This patch removed incorrect
> state check.
> 
> Fixes: 15f30a5752287 ("qla2xxx: Use IOCB interface to submit non-critical 
> MBX.")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_mbx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
> index cb717d47339f..e2b5fa47bb57 100644
> --- a/drivers/scsi/qla2xxx/qla_mbx.c
> +++ b/drivers/scsi/qla2xxx/qla_mbx.c
> @@ -6160,8 +6160,7 @@ int __qla24xx_parse_gpdb(struct scsi_qla_host *vha, 
> fc_port_t *fcport,
>   }
>  
>   /* Check for logged in state. */
> - if (current_login_state != PDS_PRLI_COMPLETE &&
> - last_login_state != PDS_PRLI_COMPLETE) {
> + if (current_login_state != PDS_PRLI_COMPLETE) {
>   ql_dbg(ql_dbg_mbx, vha, 0x119a,
>   "Unable to verify login-state (%x/%x) for loop_id %x.\n",
>   current_login_state, last_login_state, fcport->loop_id);
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


[Bug 197875] Processes hang on attempted access of WDC WD30-EZRX 3TB HDD on HP Z420 Workstation

2017-11-30 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=197875

--- Comment #8 from Chuck Burt (chuck.burt+kernel@gmail.com) ---
Created attachment 260953
  --> https://bugzilla.kernel.org/attachment.cgi?id=260953&action=edit
Output of lspci on 4.10.x kernel

I won't be able to boot into the newer kernel for about a week, however since
`lspci` is hardware-oriented, sharing the output under the older kernel in case
it's helpful.  Please let me know if you want me to run it on the new one
instead and I'll get it when I can.

-- 
You are receiving this mail because:
You are the assignee for the bug.


Re: [PATCH] scsi: fix race condition when removing target

2017-11-30 Thread Bart Van Assche
On Thu, 2017-11-30 at 09:18 +0800, Jason Yan wrote:
> Hi Bart, I chose the approach in my patch because it has been used in
> scsi_device_get() for years and been proved safe. I think using
> kobject_get_unless_zero() is safe here and can fix this issue too. And
> this approach is beneficial to all users.

Hello Jason,

A possible approach is that we start with your patch and defer any get_device()
changes until after your patch has been applied.

Bart.

Re: [PATCH v2 14/22] qla2xxx: Fix abort command deadlock due to spinlock

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Original code acquires hardware_lock to add Abort IOCB
> onto driver's request queue for processing. However,
> abort_command() will also acquire hardware lock to look up
> sp pointer before issuing abort IOCB command resulting
> into a deadlock. This patch safely removes the possible
> deadlock scenario by removing extra spinlock.
> 
> Fixes: 6eb54715b54bb ("qla2xxx: Added interface to send explicit LOGO.")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_iocb.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
> index d810a447cb4a..106f4ac4f733 100644
> --- a/drivers/scsi/qla2xxx/qla_iocb.c
> +++ b/drivers/scsi/qla2xxx/qla_iocb.c
> @@ -2394,7 +2394,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
>   struct scsi_qla_host *vha = sp->vha;
>   struct qla_hw_data *ha = vha->hw;
>   struct srb_iocb *lio = &sp->u.iocb_cmd;
> - unsigned long flags = 0;
>  
>   ql_dbg(ql_dbg_io, vha, 0x3069,
>   "%s Timeout, hdl=%x, portid=%02x%02x%02x\n",
> @@ -2402,7 +2401,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
>   fcport->d_id.b.al_pa);
>  
>   /* Abort the exchange */
> - spin_lock_irqsave(&ha->hardware_lock, flags);
>   if (ha->isp_ops->abort_command(sp)) {
>   ql_dbg(ql_dbg_io, vha, 0x3070,
>   "mbx abort_command failed.\n");
> @@ -2410,7 +2408,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
>   ql_dbg(ql_dbg_io, vha, 0x3071,
>   "mbx abort_command success.\n");
>   }
> - spin_unlock_irqrestore(&ha->hardware_lock, flags);
>  
>   complete(&lio->u.els_logo.comp);
>  }
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 15/22] qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Current code manually allocate an fcport structure that
> is not properly initialize. Replace kzalloc with
> qla2x00_alloc_fcport, so that all fields are initialized.
> Also set set scan flag to port found
> 
> Cc: 
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c 
> b/drivers/scsi/qla2xxx/qla_target.c
> index e824cdc77139..2a6242d97a7e 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -5783,7 +5783,7 @@ static fc_port_t *qlt_get_port_database(struct 
> scsi_qla_host *vha,
>   unsigned long flags;
>   u8 newfcport = 0;
>  
> - fcport = kzalloc(sizeof(*fcport), GFP_KERNEL);
> + fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
>   if (!fcport) {
>   ql_dbg(ql_dbg_tgt_mgt, vha, 0xf06f,
>   "qla_target(%d): Allocation of tmp FC port failed",
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 16/22] qla2xxx: Fix scan state field for fcport

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Add correct value of scan_state field indicating state
> of the FC port
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c 
> b/drivers/scsi/qla2xxx/qla_target.c
> index 2a6242d97a7e..1c219998ab60 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -5812,6 +5812,7 @@ static fc_port_t *qlt_get_port_database(struct 
> scsi_qla_host *vha,
>   tfcp->port_type = fcport->port_type;
>   tfcp->supported_classes = fcport->supported_classes;
>   tfcp->flags |= fcport->flags;
> + tfcp->scan_state = QLA_FCPORT_FOUND;
>  
>   del = fcport;
>   fcport = tfcp;
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 17/22] qla2xxx: Clear loop id after delete

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> clear loop id after delete to prevent session invalidation
> of stale session.
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_target.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 18/22] qla2xxx: Defer processing of GS IOCB calls

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Giridhar Malavali 
> 
> This patch defers processing of GS IOCB calls from interrupt
> context to avoid hardware spinlock recursion.
> 
> Following stack trace is seen
> 
> ? mod_timer+0x193/0x330
> ? ql_dbg+0xa7/0xf0 [qla2xxx]
> _raw_spin_lock_irqsave+0x31/0x40
> qla2x00_start_sp+0x3b/0x250 [qla2xxx]
> qla24xx_async_gnl+0x1d3/0x240 [qla2xxx]
> qla24xx_fcport_handle_login+0x285/0x290 [qla2xxx]
> ? vprintk_func+0x20/0x50
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 7dd19785f820..57b8f43c5980 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -975,7 +975,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host 
> *vha, fc_port_t *fcport)
>   ql_dbg(ql_dbg_disc, vha, 0x20bd,
>   "%s %d %8phC post gnl\n",
>   __func__, __LINE__, fcport->port_name);
> - qla24xx_async_gnl(vha, fcport);
> + qla24xx_post_gnl_work(vha, fcport);
>   } else {
>   ql_dbg(ql_dbg_disc, vha, 0x20bf,
>   "%s %d %8phC post login\n",
> @@ -1143,7 +1143,7 @@ void qla24xx_handle_relogin_event(scsi_qla_host_t *vha,
>   ql_dbg(ql_dbg_disc, vha, 0x20e9, "%s %d %8phC post gidpn\n",
>   __func__, __LINE__, fcport->port_name);
>  
> - qla24xx_async_gidpn(vha, fcport);
> + qla24xx_post_gidpn_work(vha, fcport);
>   return;
>   }
>  
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 19/22] qla2xxx: Remove aborting ELS IOCB call issued as part of timeout.

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Giridhar Malavali 
> 
> This fix the spinlock recursion issue seen while unloading the driver.
> 
> 14 [9f2e21e03db8] native_queued_spin_lock_slowpath at ad0d8802
> 15 [9f2e21e03dc0] do_raw_spin_lock at ad0d99e4
> 16 [9f2e21e03dd8] _raw_spin_lock_irqsave at ad652471
> 17 [9f2e21e03e00] qla2x00_els_dcmd_iocb_timeout at c070cd63
> 18 [9f2e21e03e40] qla2x00_sp_timeout at c06f06d3 [qla2xxx]
> 19 [9f2e21e03e68] call_timer_fn at ad0f97d8
> 20 [9f2e21e03ed8] run_timer_softirq at ad0faf47
> 21 [9f2e21e03f68] __softirqentry_text_start at ad655f32
> 
> Fixes: 6eb54715b54bb ("qla2xxx: Added interface to send explicit LOGO.")
> Cc:  # 4.10+
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_iocb.c | 10 --
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
> index 106f4ac4f733..8ea59586f4f1 100644
> --- a/drivers/scsi/qla2xxx/qla_iocb.c
> +++ b/drivers/scsi/qla2xxx/qla_iocb.c
> @@ -2392,7 +2392,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
>   srb_t *sp = data;
>   fc_port_t *fcport = sp->fcport;
>   struct scsi_qla_host *vha = sp->vha;
> - struct qla_hw_data *ha = vha->hw;
>   struct srb_iocb *lio = &sp->u.iocb_cmd;
>  
>   ql_dbg(ql_dbg_io, vha, 0x3069,
> @@ -2400,15 +2399,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
>   sp->name, sp->handle, fcport->d_id.b.domain, fcport->d_id.b.area,
>   fcport->d_id.b.al_pa);
>  
> - /* Abort the exchange */
> - if (ha->isp_ops->abort_command(sp)) {
> - ql_dbg(ql_dbg_io, vha, 0x3070,
> - "mbx abort_command failed.\n");
> - } else {
> - ql_dbg(ql_dbg_io, vha, 0x3071,
> - "mbx abort_command success.\n");
> - }
> -
>   complete(&lio->u.els_logo.comp);
>  }
>  
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 20/22] qla2xxx: Fix system crash in qlt_plogi_ack_unref

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> From: Quinn Tran 
> 
> Fix system crash due to NULL pointer access.
> 
> qlt_plogi_ack_t and fc_port structures were not properly
> bound before calling qlt_plogi_ack_unref().
> 
> RIP: 0010:qlt_plogi_ack_unref+0xa1/0x150 [qla2xxx]
> Call Trace:
> qla24xx_create_new_sess+0xb1/0x320 [qla2xxx]
> qla2x00_do_work+0x123/0x260 [qla2xxx]
> qla2x00_iocb_work_fn+0x30/0x40 [qla2xxx]
> process_one_work+0x1f3/0x530
> worker_thread+0x4e/0x480
> kthread+0x10c/0x140
> 
> Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
> Cc:  # 4.10+
> Signed-off-by: Quinn Tran 
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_os.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 2ec77b9f78b8..789030c9dd26 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -4750,11 +4750,11 @@ void qla24xx_create_new_sess(struct scsi_qla_host 
> *vha, struct qla_work_evt *e)
>   } else {
>   list_add_tail(&fcport->list, &vha->vp_fcports);
>  
> - if (pla) {
> - qlt_plogi_ack_link(vha, pla, fcport,
> - QLT_PLOGI_LINK_SAME_WWN);
> - pla->ref_count--;
> - }
> + }
> + if (pla) {
> + qlt_plogi_ack_link(vha, pla, fcport,
> + QLT_PLOGI_LINK_SAME_WWN);
> + pla->ref_count--;
>   }
>   }
>   spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 21/22] qla2xxx: Fix memory leak in dual/target mode

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> When driver is loaded in Target/Dual mode, it creates QPair
> to support MQ and allocates resources for each QPair. This Qpair
> initialization is delayed until the FW personality is changed to
> Dual/Target mode by issuing chip reset. At the time of chip reset
> firmware is re-initilized in correct personality all the QPairs
> are initialized by sending MBC_INITIALIZE_MULTIQ (001Fh).
> 
> This patch fixes memory leak by adding check to issue
> MBC_INITIALIZE_MULTIQ command only while deleting rsp/req queue
> when the flag is set for initiator mode, and clean up QPair resources
> correctly during the driver unload. This MBX does not need to be
> issued for Target/Dual mode because chip reset will reset ISP.
> 
> Fixes: d65237c7f0860 ("scsi: qla2xxx: Fix mailbox failure while deleting 
> Queue pairs")
> Cc:  # 4.10+
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_init.c |  4 +---
>  drivers/scsi/qla2xxx/qla_mid.c  | 18 ++
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 57b8f43c5980..58663df38627 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -8220,9 +8220,6 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, 
> struct qla_qpair *qpair)
>   int ret = QLA_FUNCTION_FAILED;
>   struct qla_hw_data *ha = qpair->hw;
>  
> - if (!vha->flags.qpairs_req_created && !vha->flags.qpairs_rsp_created)
> - goto fail;
> -
>   qpair->delete_in_progress = 1;
>   while (atomic_read(&qpair->ref_count))
>   msleep(500);
> @@ -8230,6 +8227,7 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, 
> struct qla_qpair *qpair)
>   ret = qla25xx_delete_req_que(vha, qpair->req);
>   if (ret != QLA_SUCCESS)
>   goto fail;
> +
>   ret = qla25xx_delete_rsp_que(vha, qpair->rsp);
>   if (ret != QLA_SUCCESS)
>   goto fail;
> diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
> index 618ca272d01a..e538e6308885 100644
> --- a/drivers/scsi/qla2xxx/qla_mid.c
> +++ b/drivers/scsi/qla2xxx/qla_mid.c
> @@ -575,14 +575,15 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct 
> rsp_que *rsp)
>  int
>  qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req)
>  {
> - int ret = -1;
> + int ret = QLA_SUCCESS;
>  
> - if (req) {
> + if (req && vha->flags.qpairs_req_created) {
>   req->options |= BIT_0;
>   ret = qla25xx_init_req_que(vha, req);
> + if (ret != QLA_SUCCESS)
> + return QLA_FUNCTION_FAILED;
>   }
> - if (ret == QLA_SUCCESS)
> - qla25xx_free_req_que(vha, req);
> + qla25xx_free_req_que(vha, req);
>  
>   return ret;
>  }
> @@ -590,14 +591,15 @@ qla25xx_delete_req_que(struct scsi_qla_host *vha, 
> struct req_que *req)
>  int
>  qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
>  {
> - int ret = -1;
> + int ret = QLA_SUCCESS;
>  
> - if (rsp) {
> + if (rsp && vha->flags.qpairs_rsp_created) {
>   rsp->options |= BIT_0;
>   ret = qla25xx_init_rsp_que(vha, rsp);
> + if (ret != QLA_SUCCESS)
> + return QLA_FUNCTION_FAILED;
>   }
> - if (ret == QLA_SUCCESS)
> - qla25xx_free_rsp_que(vha, rsp);
> + qla25xx_free_rsp_que(vha, rsp);
>  
>   return ret;
>  }
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 22/22] qla2xxx: Update driver version to 10.00.00.03-k

2017-11-30 Thread Hannes Reinecke
On 11/30/2017 04:40 AM, Himanshu Madhani wrote:
> Signed-off-by: Himanshu Madhani 
> ---
>  drivers/scsi/qla2xxx/qla_version.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_version.h 
> b/drivers/scsi/qla2xxx/qla_version.h
> index b6ec02b96d3d..911b82226d13 100644
> --- a/drivers/scsi/qla2xxx/qla_version.h
> +++ b/drivers/scsi/qla2xxx/qla_version.h
> @@ -7,7 +7,7 @@
>  /*
>   * Driver version
>   */
> -#define QLA2XXX_VERSION  "10.00.00.02-k"
> +#define QLA2XXX_VERSION  "10.00.00.03-k"
>  
>  #define QLA_DRIVER_MAJOR_VER 10
>  #define QLA_DRIVER_MINOR_VER 0
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH] scsi: fix race condition when removing target

2017-11-30 Thread gre...@linuxfoundation.org
On Thu, Nov 30, 2017 at 04:08:38PM +, Bart Van Assche wrote:
> On Thu, 2017-11-30 at 09:18 +0800, Jason Yan wrote:
> > Hi Bart, I chose the approach in my patch because it has been used in
> > scsi_device_get() for years and been proved safe. I think using
> > kobject_get_unless_zero() is safe here and can fix this issue too. And
> > this approach is beneficial to all users.
> 
> Hello Jason,
> 
> A possible approach is that we start with your patch and defer any 
> get_device()
> changes until after your patch has been applied.

That might be good, I don't have the chance to look at any driver core
changes until Monday as I'm on the road until then, sorry...

greg k-h


Re: [PATCH v2 05/22] qla2xxx: Fix re-login for Nport Handle in use

2017-11-30 Thread Madhani, Himanshu
Hi Hannes, 

> On Nov 30, 2017, at 7:51 AM, Hannes Reinecke  wrote:
> 
> Does this really belong to the above patch?
> It looks to me as if it fixes a completely different issue...

This flag indicates firmware to purge all IO’s of a session instead of 
assuming FW will purge them.

if you prefer to have this as a separate patch. I can post v3 with new patch.

Thanks,
- Himanshu



Re: [PATCH v2 07/22] qla2xxx: Serialize GPNID for multiple RSCN

2017-11-30 Thread Madhani, Himanshu

> On Nov 30, 2017, at 7:53 AM, Hannes Reinecke  wrote:
> 
> Two spelling errors in one line ...

Embarrassing.. Will fix them in v3

Thanks,
- Himanshu



Re: BUG: KASAN: use-after-scope in ep_poll+0x5cd/0xc90

2017-11-30 Thread Jason Baron
Hi,

On 11/29/2017 10:41 PM, Fengguang Wu wrote:
> Hello,
> 
> FYI this happens in mainline kernel 4.15.0-rc1.
> It looks a new regression and bisect is on the way.
> 
> It occurs in 3 out of 3 boots.
> 
> [   35.704690] init: Failed to create pty - disabling logging for job
> [   35.706676] init: Temporary process spawn error: No such file or directory
> [   35.731988] init: Failed to create pty - disabling logging for job
> [   35.734084] init: Temporary process spawn error: No such file or directory
> [   35.737946] 
> ==
> [   35.739635] BUG: KASAN: use-after-scope in ep_poll+0x5cd/0xc90:
>   ep_send_events at 
> fs/eventpoll.c:1700
>(inlined by) ep_poll at 
> fs/eventpoll.c:1829

This seems to be pointing out that 'struct ep_send_events_data esed' on
line 1700 (below) is being used out of scope?

1697 static int ep_send_events(struct eventpoll *ep,

1698   struct epoll_event __user *events, int
maxevents)
1699 {

1700 struct ep_send_events_data esed;

1701

1702 esed.maxevents = maxevents;

1703 esed.events = events;

1704

1705 return ep_scan_ready_list(ep, ep_send_events_proc, &esed,
0, false);

There have been some epoll changes new to 4.15 that would be tempting to
blame, but I don't see anything obvious wrong and the usage of 'esed'
hasn't really changed.

So I'm curious to see where your bisect leads. There also seems to be a
number of reports of false positives with KASAN out of scope reported
recently, so I'm not sure if this could be a false positive?

Thanks,

-Jason


[PATCH 0/2] Ensure that the SCSI error handler gets woken up

2017-11-30 Thread Bart Van Assche
Hello Martin,

As reported by Pavel Tikhomirov it can happen that the SCSI error handler does
not get woken up. This is very annoying because it results in a queue
stall. The two patches in this series address this issue without acquiring the
SCSI host lock in the hot path. Please consider these patches for kernel
v4.16.

Thanks,

Bart.

Changes compared to v1:
- Ensure that host_lock is held while checking host_failed.
- Moved the lockdep_assert_held() change into a separate patch.

Bart Van Assche (2):
  Ensure that the SCSI error handler gets woken up
  Convert a source code comment into a runtime check

 drivers/scsi/scsi_error.c | 11 +--
 drivers/scsi/scsi_lib.c   | 39 ---
 2 files changed, 37 insertions(+), 13 deletions(-)

-- 
2.15.0



[PATCH 1/2] Ensure that the SCSI error handler gets woken up

2017-11-30 Thread Bart Van Assche
If scsi_eh_scmd_add() is called concurrently with
scsi_host_queue_ready() while shost->host_blocked > 0 then it can
happen that neither function wakes up the SCSI error handler. Fix
this by making every function that decreases the host_busy counter
wake up the error handler if necessary and by protecting the
host_failed checks with the SCSI host lock.

Reported-by: Pavel Tikhomirov 
Fixes: commit 746650160866 ("scsi: convert host_busy to atomic_t")
Signed-off-by: Bart Van Assche 
Cc: Konstantin Khorenko 
Cc: Stuart Hayes 
Cc: Pavel Tikhomirov 
Cc: Christoph Hellwig 
Cc: Hannes Reinecke 
Cc: Johannes Thumshirn 
Cc: 
---
 drivers/scsi/scsi_error.c |  8 +++-
 drivers/scsi/scsi_lib.c   | 39 ---
 2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 5e89049e9b4e..b22a9a23c74c 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -233,19 +233,25 @@ static void scsi_eh_reset(struct scsi_cmnd *scmd)
 void scsi_eh_scmd_add(struct scsi_cmnd *scmd)
 {
struct Scsi_Host *shost = scmd->device->host;
+   enum scsi_host_state shost_state;
unsigned long flags;
int ret;
 
WARN_ON_ONCE(!shost->ehandler);
 
spin_lock_irqsave(shost->host_lock, flags);
+   shost_state = shost->shost_state;
if (scsi_host_set_state(shost, SHOST_RECOVERY)) {
ret = scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY);
WARN_ON_ONCE(ret);
}
if (shost->eh_deadline != -1 && !shost->last_reset)
shost->last_reset = jiffies;
-
+   if (shost_state != shost->shost_state) {
+   spin_unlock_irqrestore(shost->host_lock, flags);
+   synchronize_rcu();
+   spin_lock_irqsave(shost->host_lock, flags);
+   }
scsi_eh_reset(scmd);
list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
shost->host_failed++;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b6d3842b6809..7d18fb245d7d 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -318,22 +318,39 @@ static void scsi_init_cmd_errh(struct scsi_cmnd *cmd)
cmd->cmd_len = scsi_command_size(cmd->cmnd);
 }
 
-void scsi_device_unbusy(struct scsi_device *sdev)
+/*
+ * Decrement the host_busy counter and wake up the error handler if necessary.
+ * Avoid as follows that the error handler is not woken up if shost->host_busy
+ * == shost->host_failed: use synchronize_rcu() in scsi_eh_scmd_add() in
+ * combination with an RCU read lock in this function to ensure that this
+ * function in its entirety either finishes before scsi_eh_scmd_add()
+ * increases the host_failed counter or that it notices the shost state change
+ * made by scsi_eh_scmd_add().
+ */
+static void scsi_dec_host_busy(struct Scsi_Host *shost)
 {
-   struct Scsi_Host *shost = sdev->host;
-   struct scsi_target *starget = scsi_target(sdev);
unsigned long flags;
 
+   rcu_read_lock();
atomic_dec(&shost->host_busy);
-   if (starget->can_queue > 0)
-   atomic_dec(&starget->target_busy);
-
-   if (unlikely(scsi_host_in_recovery(shost) &&
-(shost->host_failed || shost->host_eh_scheduled))) {
+   if (unlikely(scsi_host_in_recovery(shost))) {
spin_lock_irqsave(shost->host_lock, flags);
-   scsi_eh_wakeup(shost);
+   if (shost->host_failed || shost->host_eh_scheduled)
+   scsi_eh_wakeup(shost);
spin_unlock_irqrestore(shost->host_lock, flags);
}
+   rcu_read_unlock();
+}
+
+void scsi_device_unbusy(struct scsi_device *sdev)
+{
+   struct Scsi_Host *shost = sdev->host;
+   struct scsi_target *starget = scsi_target(sdev);
+
+   scsi_dec_host_busy(shost);
+
+   if (starget->can_queue > 0)
+   atomic_dec(&starget->target_busy);
 
atomic_dec(&sdev->device_busy);
 }
@@ -1531,7 +1548,7 @@ static inline int scsi_host_queue_ready(struct 
request_queue *q,
list_add_tail(&sdev->starved_entry, &shost->starved_list);
spin_unlock_irq(shost->host_lock);
 out_dec:
-   atomic_dec(&shost->host_busy);
+   scsi_dec_host_busy(shost);
return 0;
 }
 
@@ -2017,7 +2034,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx 
*hctx,
return BLK_STS_OK;
 
 out_dec_host_busy:
-   atomic_dec(&shost->host_busy);
+   scsi_dec_host_busy(shost);
 out_dec_target_busy:
if (scsi_target(sdev)->can_queue > 0)
atomic_dec(&scsi_target(sdev)->target_busy);
-- 
2.15.0



[PATCH 2/2] Convert a source code comment into a runtime check

2017-11-30 Thread Bart Van Assche
Signed-off-by: Bart Van Assche 
Cc: Christoph Hellwig 
Cc: Hannes Reinecke 
Cc: Johannes Thumshirn 
---
 drivers/scsi/scsi_error.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index b22a9a23c74c..1622eacbf577 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -61,9 +61,10 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd);
 static int scsi_try_to_abort_cmd(struct scsi_host_template *,
 struct scsi_cmnd *);
 
-/* called with shost->host_lock held */
 void scsi_eh_wakeup(struct Scsi_Host *shost)
 {
+   lockdep_assert_held(shost->host_lock);
+
if (atomic_read(&shost->host_busy) == shost->host_failed) {
trace_scsi_eh_wakeup(shost);
wake_up_process(shost->ehandler);
-- 
2.15.0



Re: [PATCH 2/2] scsi: ufs: add Exynos-specific driver

2017-11-30 Thread Jaehoon Chung
Hi,

On 11/30/2017 05:35 PM, 김기웅 wrote:
> Dear Jaehoon
> 
> Actually, I used to use the way what you mentioned, but
> now a new way has been using with latest products.
> 
> Anyway, I would refer to your comment.

If you will send the next version, you need to run "checkpatch".

When i run checkpatch, there are too many errors and warnings.

total: 37 errors, 62 warnings, 1340 lines checked

I also want that exynos ufs driver will be merged.

Best Regards,
Jaehoon Chung

> 
> Thank you.
> 
>> -Original Message-
>> From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
>> ow...@vger.kernel.org] On Behalf Of Jaehoon Chung
>> Sent: Tuesday, November 28, 2017 6:21 PM
>> To: 김기웅; linux-scsi@vger.kernel.org; 'Martin K. Petersen'
>> Cc: c...@samsung.com; 'HeonGwang Chu'; '김부진'; 'YOUNGEUN PARK'
>> Subject: Re: [PATCH 2/2] scsi: ufs: add Exynos-specific driver
>>
>> On 11/28/2017 05:27 PM, 김기웅 wrote:
>>> Hi.
>>> This is modified from Seungwon's initial patch.
>>> And this has been used for several commercial products.
>>> I think you feel weird because you can't see a bunch of unipro and mphy.
>>> But those stuff has been changed whenever new product comes.
>>> So I didn't keep those in this driver.



Re: [PATCH] scsi: fix race condition when removing target

2017-11-30 Thread James Bottomley
On Thu, 2017-11-30 at 16:08 +, Bart Van Assche wrote:
> On Thu, 2017-11-30 at 09:18 +0800, Jason Yan wrote:
> > 
> > Hi Bart, I chose the approach in my patch because it has been used
> > in scsi_device_get() for years and been proved safe. I think using
> > kobject_get_unless_zero() is safe here and can fix this issue too.
> > And this approach is beneficial to all users.
> 
> Hello Jason,
> 
> A possible approach is that we start with your patch and defer any
> get_device() changes until after your patch has been applied.

It's possible, but not quite good enough: the same race can be produced
with any of our sdev lists that are deleted in the release callback,
because there could be a released device on any one of them.  The only
way to mediate it properly is to get a reference in the iterator using
kobject_get_unless_zero().

It's a bit like a huge can of worms, there's another problem every time
I look.  However, this is something like the mechanism that could work
(and if get_device() ever gets fixed, we can put it in place of
kobject_get_unless_zero()).

James

---

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 6be77b3aa8a5..c3246f26c02c 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1169,6 +1169,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct 
scsi_cmnd *SCp,
 

}
+   put_device(&SDp->sdev_gendev);
} else if(dsps == A_RESELECTED_DURING_SELECTION) {
 
/* This section is full of debugging code because I've
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index c3fc34b9964d..7736f3fb2501 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -1198,6 +1198,7 @@ static int esp_reconnect(struct esp *esp)
goto do_reset;
}
lp = dev->hostdata;
+   put_device(&dev->sdev_gendev);
 
ent = lp->non_tagged_cmd;
if (!ent) {
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index a7e4fba724b7..c96c11716152 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -677,11 +677,10 @@ struct scsi_device *__scsi_device_lookup_by_target(struct 
scsi_target *starget,
 {
struct scsi_device *sdev;
 
-   list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
-   if (sdev->sdev_state == SDEV_DEL)
-   continue;
-   if (sdev->lun ==lun)
+   __sdev_for_each_get(sdev, &starget->devices, same_target_siblings) {
+   if (sdev->sdev_state != SDEV_DEL && sdev->lun ==lun)
return sdev;
+   put_device(&sdev->sdev_gendev);
}
 
return NULL;
@@ -700,15 +699,16 @@ EXPORT_SYMBOL(__scsi_device_lookup_by_target);
 struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget,
 u64 lun)
 {
-   struct scsi_device *sdev;
+  struct scsi_device *sdev, *sdev_copy;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
unsigned long flags;
 
spin_lock_irqsave(shost->host_lock, flags);
-   sdev = __scsi_device_lookup_by_target(starget, lun);
+   sdev_copy = sdev = __scsi_device_lookup_by_target(starget, lun);
+   spin_unlock_irqrestore(shost->host_lock, flags);
if (sdev && scsi_device_get(sdev))
sdev = NULL;
-   spin_unlock_irqrestore(shost->host_lock, flags);
+   put_device(&sdev_copy->sdev_gendev);
 
return sdev;
 }
@@ -735,12 +735,12 @@ struct scsi_device *__scsi_device_lookup(struct Scsi_Host 
*shost,
 {
struct scsi_device *sdev;
 
-   list_for_each_entry(sdev, &shost->__devices, siblings) {
-   if (sdev->sdev_state == SDEV_DEL)
-   continue;
-   if (sdev->channel == channel && sdev->id == id &&
-   sdev->lun ==lun)
+   __sdev_for_each_get(sdev, &shost->__devices, siblings) {
+   if (sdev->sdev_state != SDEV_DEL &&
+   sdev->channel == channel && sdev->id == id &&
+   sdev->lun ==lun)
return sdev;
+   put_device(&sdev->sdev_gendev);
}
 
return NULL;
@@ -761,14 +761,15 @@ EXPORT_SYMBOL(__scsi_device_lookup);
 struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost,
uint channel, uint id, u64 lun)
 {
-   struct scsi_device *sdev;
+  struct scsi_device *sdev, *sdev_copy;
unsigned long flags;
 
spin_lock_irqsave(shost->host_lock, flags);
-   sdev = __scsi_device_lookup(shost, channel, id, lun);
+   sdev_copy = sdev = __scsi_device_lookup(shost, channel, id, lun);
+   spin_unlock_irqrestore(shost->host_lock, flags);
if (sdev && scsi_device_get(sdev))
sdev = NULL;
-   spin_unlock_irqrestore(shost->host_lock, flags);
+   put_device(&sdev_copy->sdev_gendev);
 
return sdev;
 }
diff --

Re: [PATCH] scsi: fix race condition when removing target

2017-11-30 Thread Finn Thain
On Thu, 30 Nov 2017, James Bottomley wrote:

> +#define __sdev_for_each_get(sdev, head, list)
> \
> + list_for_each_entry(sdev, head, list)   \
> + if (kobject_get_unless_zero(&sdev->sdev_gendev.kobj))
> +

I think that should have an 'else' clause, like this macro from 
include/drm/drmP.h:

#define for_each_if(condition) if (!(condition)) {} else

-- 


答复: 答复: [PATCH v5 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

2017-11-30 Thread liwei (CM)
Hi, Arnd
Sorry to bother you, some questions about this patch will trouble you to give 
some advice:
+   ufs: ufs@ff3b {
+   compatible = "hisilicon,hi3660-ufs", "jedec,ufs-1.1";
+   /* 0: HCI standard */
+   /* 1: UFS SYS CTRL */
+   reg = <0x0 0xff3b 0x0 0x1000>,
+   <0x0 0xff3b1000 0x0 0x1000>;
+   interrupt-parent = <&gic>;
+   interrupts = ;
+   clocks = <&crg_ctrl HI3660_CLK_GATE_UFSIO_REF>,
+   <&crg_ctrl HI3660_CLK_GATE_UFSPHY_CFG>;
+   clock-names = "clk_ref", "clk_phy";
+   freq-table-hz = <0 0>, <0 0>;
+   /* offset: 0x84; bit: 12 */
+   /* offset: 0x84; bit: 7  */
+   resets = <&crg_rst 0x84 12>,
+   <&crg_rst 0x84 7>;
+   reset-names = "rst", "assert";
+   };

1. our UFS host soc implementation can be divided into two parts: UFS 
controller and related peripheral circuit, that "HCI standard"<-> UFS 
controller,  "UFS SYS CTRL"<-> related peripheral circuit, and PHY is part of 
the peripheral circuit. So the "UFS SYS CTRL" area does not correspond 
completely to what Qualcomm have described as their PHY implementation. In 
fact, we do not have an independent register space to control the PHY. 

2. From our soc chip colleague, "rst", "assert" is not generic and related with 
our soc implementation. In fact,it is not just a rst and assert of the UFS 
controller, but for the entire UFS IP ,so I don't think it's very helpful for 
others.

I think the above places will be reserved, do you have any better advices.

Thank you very much.


-邮件原件-
发件人: liwei (CM) 
发送时间: 2017年10月31日 20:35
收件人: 'Arnd Bergmann'
抄送: Rob Herring; Mark Rutland; xuwei (O); Catalin Marinas; Will Deacon; Vinayak 
Holikatti; James E.J. Bottomley; Martin K. Petersen; Kevin Hilman; Gregory 
CLEMENT; Thomas Petazzoni; Masahiro Yamada; Riku Voipio; Thierry Reding; 
Krzysztof Kozlowski; Eric Anholt; DTML; Linux Kernel Mailing List; Linux ARM; 
linux-scsi; Guodong Xu; Fengbaopeng (kevin, Kirin Solution Dept); lihuan (Z); 
wangyupeng (A); zangleigang
主题: 答复: 答复: [PATCH v5 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

Hi, Arnd
Thank you for your reply.
-邮件原件-
发件人: arndbergm...@gmail.com [mailto:arndbergm...@gmail.com] 代表 Arnd Bergmann
发送时间: 2017年10月30日 23:22
收件人: liwei (CM)
抄送: Rob Herring; Mark Rutland; xuwei (O); Catalin Marinas; Will Deacon; Vinayak 
Holikatti; James E.J. Bottomley; Martin K. Petersen; Kevin Hilman; Gregory 
CLEMENT; Thomas Petazzoni; Masahiro Yamada; Riku Voipio; Thierry Reding; 
Krzysztof Kozlowski; Eric Anholt; DTML; Linux Kernel Mailing List; Linux ARM; 
linux-scsi; Guodong Xu; Fengbaopeng (kevin, Kirin Solution Dept); lihuan (Z); 
wangyupeng (A)
主题: Re: 答复: [PATCH v5 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

On Tue, Oct 24, 2017 at 11:06 AM, liwei (CM)  wrote:
> what's your opinion about my explanation and revision method?
> I am looking forward to your reply, thanks!

Sorry for the delay, I was travelling last week.
> 发件人: arndbergm...@gmail.com [mailto:arndbergm...@gmail.com] 代表 Arnd 
> Bergmann On Fri, Oct 20, 2017 at 10:52 AM, Li Wei  wrote:
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/ufs/ufs-hisi.txt
>> @@ -0,0 +1,46 @@
>> +* Hisilicon Universal Flash Storage (UFS) Host Controller
>> +
>> +UFS nodes are defined to describe on-chip UFS hardware macro.
>> +Each UFS Host Controller should have its own node.
>> +
>> +Required properties:
>> +- compatible: compatible list, contains one of the following -
>> +   "hisilicon,hi3660-ufs" for hisi ufs host controller
>> +present on Hi3660 chipset.

One more thing I just noticed: you don't describe the device as compatible with 
the ufshcd spec as defined in the generic binding. Shouldn't we have both 
compatible strings listed here?

Ok, I will fix it in patch v6;

> In particular, I wonder if what you describe as the "UFS SYS CTRL"
> area corresponds to what Qualcomm have described as their PHY implementation. 
> It certainly seems to driver some of the properties that would normally be 
> associated with a PHY.
>
> Liwei:Yes, a part of "UFS SYS CTRL" is associated with a PHY, but from our 
> chip colleague that we assure "UFS SYS CTRL" is associated with 
> clk/reset/power on/power off and so on.
> In fact, in addition to the controller itself, the controller related 
> periphery are all in this area. So it's not appropriate to put this into a 
> separate phy node.

I'm not sure I understand here. Do you mean the reset handle is for resetting 
the PHY rather than the UFS HCD?

Maybe my description is not clear enough, our UFS host soc implementation can 
be divided into two parts: UFS controller and related peripheral circuit, that 
"HCI standard"<-> UFS controller,  "UFS SYS CTRL"<-> related peripheral 
circuit, and PHY is part of