linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
@ 2016-08-25  9:39 Zang Leigang
  2016-09-27 22:30 ` subhashj
  0 siblings, 1 reply; 6+ messages in thread
From: Zang Leigang @ 2016-08-25  9:39 UTC (permalink / raw)
  To: vinholikatti, jejb, martin.petersen, linux-scsi, linux-kernel

Some device may cause a compatibility issue while receiving a Query UPIU
with Data Segment which does not expected.

Signed-off-by: Zang Leigang <zangleigang@hisilicon.com>
---
 drivers/scsi/ufs/ufshcd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f08d41a..9b21d88 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1266,9 +1266,12 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
 	ucd_req_ptr->header.dword_1 = UPIU_HEADER_DWORD(
 			0, query->request.query_func, 0, 0);
 
-	/* Data segment length */
-	ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
-			0, 0, len >> 8, (u8)len);
+	/* Data segment length only need for WRITE_DESC */
+	if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
+		ucd_req_ptr->header.dword_2 =
+			UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
+	else
+		ucd_req_ptr->header.dword_2 = 0;
 
 	/* Copy the Query Request buffer as is */
 	memcpy(&ucd_req_ptr->qr, &query->request.upiu_req,
-- 
2.9.3

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

* Re: [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
  2016-08-25  9:39 [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR Zang Leigang
@ 2016-09-27 22:30 ` subhashj
  2016-09-28  5:14   ` Martin K. Petersen
  0 siblings, 1 reply; 6+ messages in thread
From: subhashj @ 2016-09-27 22:30 UTC (permalink / raw)
  To: Zang Leigang
  Cc: vinholikatti, jejb, martin.petersen, linux-scsi, linux-kernel,
	linux-scsi-owner

Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>

On 2016-08-25 02:39, Zang Leigang wrote:
> Some device may cause a compatibility issue while receiving a Query 
> UPIU
> with Data Segment which does not expected.
> 
> Signed-off-by: Zang Leigang <zangleigang@hisilicon.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index f08d41a..9b21d88 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1266,9 +1266,12 @@ static void
> ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
>  	ucd_req_ptr->header.dword_1 = UPIU_HEADER_DWORD(
>  			0, query->request.query_func, 0, 0);
> 
> -	/* Data segment length */
> -	ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
> -			0, 0, len >> 8, (u8)len);
> +	/* Data segment length only need for WRITE_DESC */
> +	if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
> +		ucd_req_ptr->header.dword_2 =
> +			UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
> +	else
> +		ucd_req_ptr->header.dword_2 = 0;
> 
>  	/* Copy the Query Request buffer as is */
>  	memcpy(&ucd_req_ptr->qr, &query->request.upiu_req,

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

* Re: [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
  2016-09-27 22:30 ` subhashj
@ 2016-09-28  5:14   ` Martin K. Petersen
  2016-09-28  5:36     ` Kiwoong Kim
  2016-09-28 22:42     ` subhashj
  0 siblings, 2 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-09-28  5:14 UTC (permalink / raw)
  To: subhashj
  Cc: Zang Leigang, vinholikatti, jejb, martin.petersen, linux-scsi,
	linux-kernel, linux-scsi-owner

>>>>> "Subhash" == subhashj  <subhashj@codeaurora.org> writes:

Subhash> Looks good to me.

> -	/* Data segment length */
> -	ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
> -			0, 0, len >> 8, (u8)len);
> +	/* Data segment length only need for WRITE_DESC */
> +	if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
> +		ucd_req_ptr->header.dword_2 =
> +			UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
> +	else
> +		ucd_req_ptr->header.dword_2 = 0;

What about READ_DESC?

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* RE: [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
  2016-09-28  5:14   ` Martin K. Petersen
@ 2016-09-28  5:36     ` Kiwoong Kim
  2016-09-30  1:36       ` Martin K. Petersen
  2016-09-28 22:42     ` subhashj
  1 sibling, 1 reply; 6+ messages in thread
From: Kiwoong Kim @ 2016-09-28  5:36 UTC (permalink / raw)
  To: 'Martin K. Petersen', subhashj
  Cc: 'Zang Leigang',
	vinholikatti, jejb, linux-scsi, linux-kernel, linux-scsi-owner

Hi, Martin.

I think that the patch is correct.
UFS spec says "The Data Segment area is empty" for Read Descriptor.
I have been using similar code with it and it works.
That have been already applied in Android kernel.

Reviewed-by: Kiwoong Kim <kwmad.kim@samsung.com>

Regards.

> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of Martin K. Petersen
> Sent: Wednesday, September 28, 2016 2:14 PM
> To: subhashj@codeaurora.org
> Cc: Zang Leigang; vinholikatti@gmail.com; jejb@linux.vnet.ibm.com;
> martin.petersen@oracle.com; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-scsi-owner@vger.kernel.org
> Subject: Re: [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
> 
> >>>>> "Subhash" == subhashj  <subhashj@codeaurora.org> writes:
> 
> Subhash> Looks good to me.
> 
> > -	/* Data segment length */
> > -	ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
> > -			0, 0, len >> 8, (u8)len);
> > +	/* Data segment length only need for WRITE_DESC */
> > +	if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
> > +		ucd_req_ptr->header.dword_2 =
> > +			UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
> > +	else
> > +		ucd_req_ptr->header.dword_2 = 0;
> 
> What about READ_DESC?
> 
> --
> Martin K. Petersen	Oracle Linux Engineering
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
  2016-09-28  5:14   ` Martin K. Petersen
  2016-09-28  5:36     ` Kiwoong Kim
@ 2016-09-28 22:42     ` subhashj
  1 sibling, 0 replies; 6+ messages in thread
From: subhashj @ 2016-09-28 22:42 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Zang Leigang, vinholikatti, jejb, linux-scsi, linux-kernel,
	linux-scsi-owner

On 2016-09-27 22:14, Martin K. Petersen wrote:
>>>>>> "Subhash" == subhashj  <subhashj@codeaurora.org> writes:
> 
> Subhash> Looks good to me.
> 
>> -	/* Data segment length */
>> -	ucd_req_ptr->header.dword_2 = UPIU_HEADER_DWORD(
>> -			0, 0, len >> 8, (u8)len);
>> +	/* Data segment length only need for WRITE_DESC */
>> +	if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
>> +		ucd_req_ptr->header.dword_2 =
>> +			UPIU_HEADER_DWORD(0, 0, (len >> 8), (u8)len);
>> +	else
>> +		ucd_req_ptr->header.dword_2 = 0;
> 
> What about READ_DESC?

This patch is changing the value written to "Data Segment Length" field 
in the Basic header section of Query Request UPIU. This is description 
of "Data Segment Length" from UFS device v2.1 spec (JESD220C, 
line#1429-1430): "The Data Segment Length field contains the number of 
valid bytes within the Data Segment of the UPIU". Because we will not be 
sending any data segment in the request UPIU itself for the read 
descriptor hence this field can be zeroed out for descriptor read.
Read length for the "read descriptor" transaction needs to be specified 
(in ) in "LENGTH" of transaction specific fields of query request UPIU.

Thanks,
Subhash

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

* Re: [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR
  2016-09-28  5:36     ` Kiwoong Kim
@ 2016-09-30  1:36       ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-09-30  1:36 UTC (permalink / raw)
  To: Kiwoong Kim
  Cc: 'Martin K. Petersen', subhashj, 'Zang Leigang',
	vinholikatti, jejb, linux-scsi, linux-kernel, linux-scsi-owner

>>>>> "Kiwoong" == Kiwoong Kim <kwmad.kim@samsung.com> writes:

Kiwoong> I think that the patch is correct.  UFS spec says "The Data
Kiwoong> Segment area is empty" for Read Descriptor.  I have been using
Kiwoong> similar code with it and it works.  That have been already
Kiwoong> applied in Android kernel.

That's fine. Just checking.

Applied to 4.9/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-09-30  1:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25  9:39 [PATCH v2] UFS: Date Segment only need for WRITE DESCRIPTOR Zang Leigang
2016-09-27 22:30 ` subhashj
2016-09-28  5:14   ` Martin K. Petersen
2016-09-28  5:36     ` Kiwoong Kim
2016-09-30  1:36       ` Martin K. Petersen
2016-09-28 22:42     ` subhashj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).