linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ufs: adjust queue settings to PRDT limitations
@ 2013-09-25 13:47 Akinobu Mita
  2013-09-26  6:59 ` Subhash Jadavani
  2013-10-11  5:05 ` vinayak holikatti
  0 siblings, 2 replies; 6+ messages in thread
From: Akinobu Mita @ 2013-09-25 13:47 UTC (permalink / raw)
  To: linux-scsi
  Cc: Akinobu Mita, Subhash Jadavani, Vinayak Holikatti, Santosh Y,
	James E.J. Bottomley

The data byte count field of PRDT indicates the length of data block
which is a segment of data transfer for SCSI commands.  The value of
this field shall have Dword granularity and the the maximum of length
is 256KB.

This adjusts dma pad mask and max segment size to the above-mentioned
PRDT limitations.

Signed-off-by: Akinobu Mita <mita@fixstars.com>
Cc: Subhash Jadavani <subhashj@codeaurora.org>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Cc: Santosh Y <santoshsy@gmail.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
---
* Change from v1
- Add comments for PRDT limitations as suggested by Subhash Jadavani

 drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++
 drivers/scsi/ufs/ufshci.h |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a2abe9a..660792e 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1918,6 +1918,20 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
 }
 
 /**
+ * ufshcd_slave_configure - adjust SCSI device configurations
+ * @sdev: pointer to SCSI device
+ */
+static int ufshcd_slave_configure(struct scsi_device *sdev)
+{
+	struct request_queue *q = sdev->request_queue;
+
+	blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
+	blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
+
+	return 0;
+}
+
+/**
  * ufshcd_slave_destroy - remove SCSI device configurations
  * @sdev: pointer to SCSI device
  */
@@ -2748,6 +2762,7 @@ static struct scsi_host_template ufshcd_driver_template = {
 	.proc_name		= UFSHCD,
 	.queuecommand		= ufshcd_queuecommand,
 	.slave_alloc		= ufshcd_slave_alloc,
+	.slave_configure	= ufshcd_slave_configure,
 	.slave_destroy		= ufshcd_slave_destroy,
 	.eh_abort_handler	= ufshcd_abort,
 	.eh_device_reset_handler = ufshcd_device_reset,
diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
index 0475c66..b2b7004 100644
--- a/drivers/scsi/ufs/ufshci.h
+++ b/drivers/scsi/ufs/ufshci.h
@@ -296,6 +296,11 @@ enum {
 	MASK_OCS			= 0x0F,
 };
 
+/* The maximum length of the data byte count field in the PRDT is 256KB */
+#define PRDT_DATA_BYTE_COUNT_MAX	(256 * 1024)
+/* The granularity of the data byte count field in the PRDT is 32-bit */
+#define PRDT_DATA_BYTE_COUNT_PAD	4
+
 /**
  * struct ufshcd_sg_entry - UFSHCI PRD Entry
  * @base_addr: Lower 32bit physical address DW-0
-- 
1.8.3.1


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

* Re: [PATCH v2] ufs: adjust queue settings to PRDT limitations
  2013-09-25 13:47 [PATCH v2] ufs: adjust queue settings to PRDT limitations Akinobu Mita
@ 2013-09-26  6:59 ` Subhash Jadavani
  2013-09-29 10:18   ` Dolev Raviv
  2013-10-11  5:05 ` vinayak holikatti
  1 sibling, 1 reply; 6+ messages in thread
From: Subhash Jadavani @ 2013-09-26  6:59 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: linux-scsi, Vinayak Holikatti, Santosh Y, James E.J. Bottomley

Looks good to me.

Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>

On 9/25/2013 7:17 PM, Akinobu Mita wrote:
> The data byte count field of PRDT indicates the length of data block
> which is a segment of data transfer for SCSI commands.  The value of
> this field shall have Dword granularity and the the maximum of length
> is 256KB.
>
> This adjusts dma pad mask and max segment size to the above-mentioned
> PRDT limitations.
>
> Signed-off-by: Akinobu Mita <mita@fixstars.com>
> Cc: Subhash Jadavani <subhashj@codeaurora.org>
> Cc: Vinayak Holikatti <vinholikatti@gmail.com>
> Cc: Santosh Y <santoshsy@gmail.com>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> * Change from v1
> - Add comments for PRDT limitations as suggested by Subhash Jadavani
>
>   drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++
>   drivers/scsi/ufs/ufshci.h |  5 +++++
>   2 files changed, 20 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index a2abe9a..660792e 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1918,6 +1918,20 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
>   }
>   
>   /**
> + * ufshcd_slave_configure - adjust SCSI device configurations
> + * @sdev: pointer to SCSI device
> + */
> +static int ufshcd_slave_configure(struct scsi_device *sdev)
> +{
> +	struct request_queue *q = sdev->request_queue;
> +
> +	blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
> +	blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
> +
> +	return 0;
> +}
> +
> +/**
>    * ufshcd_slave_destroy - remove SCSI device configurations
>    * @sdev: pointer to SCSI device
>    */
> @@ -2748,6 +2762,7 @@ static struct scsi_host_template ufshcd_driver_template = {
>   	.proc_name		= UFSHCD,
>   	.queuecommand		= ufshcd_queuecommand,
>   	.slave_alloc		= ufshcd_slave_alloc,
> +	.slave_configure	= ufshcd_slave_configure,
>   	.slave_destroy		= ufshcd_slave_destroy,
>   	.eh_abort_handler	= ufshcd_abort,
>   	.eh_device_reset_handler = ufshcd_device_reset,
> diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
> index 0475c66..b2b7004 100644
> --- a/drivers/scsi/ufs/ufshci.h
> +++ b/drivers/scsi/ufs/ufshci.h
> @@ -296,6 +296,11 @@ enum {
>   	MASK_OCS			= 0x0F,
>   };
>   
> +/* The maximum length of the data byte count field in the PRDT is 256KB */
> +#define PRDT_DATA_BYTE_COUNT_MAX	(256 * 1024)
> +/* The granularity of the data byte count field in the PRDT is 32-bit */
> +#define PRDT_DATA_BYTE_COUNT_PAD	4
> +
>   /**
>    * struct ufshcd_sg_entry - UFSHCI PRD Entry
>    * @base_addr: Lower 32bit physical address DW-0


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

* RE: [PATCH v2] ufs: adjust queue settings to PRDT limitations
  2013-09-26  6:59 ` Subhash Jadavani
@ 2013-09-29 10:18   ` Dolev Raviv
  0 siblings, 0 replies; 6+ messages in thread
From: Dolev Raviv @ 2013-09-29 10:18 UTC (permalink / raw)
  To: 'Subhash Jadavani', 'Akinobu Mita'
  Cc: linux-scsi, 'Vinayak Holikatti', 'Santosh Y',
	'James E.J. Bottomley'

Works on my setup.

Tested-by: Dolev Raviv <draviv@codeaurora.org>

Thanks,
Dolev
-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

-----Original Message-----
From: linux-scsi-owner@vger.kernel.org
[mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Subhash Jadavani
Sent: Thursday, September 26, 2013 9:59 AM
To: Akinobu Mita
Cc: linux-scsi@vger.kernel.org; Vinayak Holikatti; Santosh Y; James E.J.
Bottomley
Subject: Re: [PATCH v2] ufs: adjust queue settings to PRDT limitations

Looks good to me.

Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>

On 9/25/2013 7:17 PM, Akinobu Mita wrote:
> The data byte count field of PRDT indicates the length of data block 
> which is a segment of data transfer for SCSI commands.  The value of 
> this field shall have Dword granularity and the the maximum of length 
> is 256KB.
>
> This adjusts dma pad mask and max segment size to the above-mentioned 
> PRDT limitations.
>
> Signed-off-by: Akinobu Mita <mita@fixstars.com>
> Cc: Subhash Jadavani <subhashj@codeaurora.org>
> Cc: Vinayak Holikatti <vinholikatti@gmail.com>
> Cc: Santosh Y <santoshsy@gmail.com>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> * Change from v1
> - Add comments for PRDT limitations as suggested by Subhash Jadavani
>
>   drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++
>   drivers/scsi/ufs/ufshci.h |  5 +++++
>   2 files changed, 20 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c 
> index a2abe9a..660792e 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1918,6 +1918,20 @@ static int ufshcd_slave_alloc(struct scsi_device
*sdev)
>   }
>   
>   /**
> + * ufshcd_slave_configure - adjust SCSI device configurations
> + * @sdev: pointer to SCSI device
> + */
> +static int ufshcd_slave_configure(struct scsi_device *sdev) {
> +	struct request_queue *q = sdev->request_queue;
> +
> +	blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
> +	blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
> +
> +	return 0;
> +}
> +
> +/**
>    * ufshcd_slave_destroy - remove SCSI device configurations
>    * @sdev: pointer to SCSI device
>    */
> @@ -2748,6 +2762,7 @@ static struct scsi_host_template
ufshcd_driver_template = {
>   	.proc_name		= UFSHCD,
>   	.queuecommand		= ufshcd_queuecommand,
>   	.slave_alloc		= ufshcd_slave_alloc,
> +	.slave_configure	= ufshcd_slave_configure,
>   	.slave_destroy		= ufshcd_slave_destroy,
>   	.eh_abort_handler	= ufshcd_abort,
>   	.eh_device_reset_handler = ufshcd_device_reset, diff --git 
> a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index 
> 0475c66..b2b7004 100644
> --- a/drivers/scsi/ufs/ufshci.h
> +++ b/drivers/scsi/ufs/ufshci.h
> @@ -296,6 +296,11 @@ enum {
>   	MASK_OCS			= 0x0F,
>   };
>   
> +/* The maximum length of the data byte count field in the PRDT is 256KB
*/
> +#define PRDT_DATA_BYTE_COUNT_MAX	(256 * 1024)
> +/* The granularity of the data byte count field in the PRDT is 32-bit */
> +#define PRDT_DATA_BYTE_COUNT_PAD	4
> +
>   /**
>    * struct ufshcd_sg_entry - UFSHCI PRD Entry
>    * @base_addr: Lower 32bit physical address DW-0

--
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: adjust queue settings to PRDT limitations
  2013-09-25 13:47 [PATCH v2] ufs: adjust queue settings to PRDT limitations Akinobu Mita
  2013-09-26  6:59 ` Subhash Jadavani
@ 2013-10-11  5:05 ` vinayak holikatti
  2014-07-01  8:53   ` Dolev Raviv
  1 sibling, 1 reply; 6+ messages in thread
From: vinayak holikatti @ 2013-10-11  5:05 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: linux-scsi, Subhash Jadavani, Santosh Y, James E.J. Bottomley

On Wed, Sep 25, 2013 at 7:17 PM, Akinobu Mita <mita@fixstars.com> wrote:
> The data byte count field of PRDT indicates the length of data block
> which is a segment of data transfer for SCSI commands.  The value of
> this field shall have Dword granularity and the the maximum of length
> is 256KB.
>
> This adjusts dma pad mask and max segment size to the above-mentioned
> PRDT limitations.
>
> Signed-off-by: Akinobu Mita <mita@fixstars.com>
> Cc: Subhash Jadavani <subhashj@codeaurora.org>
> Cc: Vinayak Holikatti <vinholikatti@gmail.com>
> Cc: Santosh Y <santoshsy@gmail.com>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> * Change from v1
> - Add comments for PRDT limitations as suggested by Subhash Jadavani
>
>  drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++
>  drivers/scsi/ufs/ufshci.h |  5 +++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index a2abe9a..660792e 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1918,6 +1918,20 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
>  }
>
>  /**
> + * ufshcd_slave_configure - adjust SCSI device configurations
> + * @sdev: pointer to SCSI device
> + */
> +static int ufshcd_slave_configure(struct scsi_device *sdev)
> +{
> +       struct request_queue *q = sdev->request_queue;
> +
> +       blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
> +       blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
> +
> +       return 0;
> +}
> +
> +/**
>   * ufshcd_slave_destroy - remove SCSI device configurations
>   * @sdev: pointer to SCSI device
>   */
> @@ -2748,6 +2762,7 @@ static struct scsi_host_template ufshcd_driver_template = {
>         .proc_name              = UFSHCD,
>         .queuecommand           = ufshcd_queuecommand,
>         .slave_alloc            = ufshcd_slave_alloc,
> +       .slave_configure        = ufshcd_slave_configure,
>         .slave_destroy          = ufshcd_slave_destroy,
>         .eh_abort_handler       = ufshcd_abort,
>         .eh_device_reset_handler = ufshcd_device_reset,
> diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
> index 0475c66..b2b7004 100644
> --- a/drivers/scsi/ufs/ufshci.h
> +++ b/drivers/scsi/ufs/ufshci.h
> @@ -296,6 +296,11 @@ enum {
>         MASK_OCS                        = 0x0F,
>  };
>
> +/* The maximum length of the data byte count field in the PRDT is 256KB */
> +#define PRDT_DATA_BYTE_COUNT_MAX       (256 * 1024)
> +/* The granularity of the data byte count field in the PRDT is 32-bit */
> +#define PRDT_DATA_BYTE_COUNT_PAD       4
> +
>  /**
>   * struct ufshcd_sg_entry - UFSHCI PRD Entry
>   * @base_addr: Lower 32bit physical address DW-0

Acked-by: Vinayak Holikatti <vinholikatti@gmail.com>

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

* RE: [PATCH v2] ufs: adjust queue settings to PRDT limitations
  2013-10-11  5:05 ` vinayak holikatti
@ 2014-07-01  8:53   ` Dolev Raviv
  2014-07-01 14:05     ` Akinobu Mita
  0 siblings, 1 reply; 6+ messages in thread
From: Dolev Raviv @ 2014-07-01  8:53 UTC (permalink / raw)
  To: 'vinayak holikatti', 'Akinobu Mita'
  Cc: linux-scsi, 'Subhash Jadavani', 'Santosh Y',
	'James E.J. Bottomley'

Hi,
I couldn't find this patch in scsi-misc branch. Was it merged somewhere
else?

Thanks,
Dolev
-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


-----Original Message-----
From: linux-scsi-owner@vger.kernel.org
[mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of vinayak holikatti
Sent: Friday, October 11, 2013 8:05 AM
To: Akinobu Mita
Cc: linux-scsi@vger.kernel.org; Subhash Jadavani; Santosh Y; James E.J.
Bottomley
Subject: Re: [PATCH v2] ufs: adjust queue settings to PRDT limitations

On Wed, Sep 25, 2013 at 7:17 PM, Akinobu Mita <mita@fixstars.com> wrote:
> The data byte count field of PRDT indicates the length of data block 
> which is a segment of data transfer for SCSI commands.  The value of 
> this field shall have Dword granularity and the the maximum of length 
> is 256KB.
>
> This adjusts dma pad mask and max segment size to the above-mentioned 
> PRDT limitations.
>
> Signed-off-by: Akinobu Mita <mita@fixstars.com>
> Cc: Subhash Jadavani <subhashj@codeaurora.org>
> Cc: Vinayak Holikatti <vinholikatti@gmail.com>
> Cc: Santosh Y <santoshsy@gmail.com>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> * Change from v1
> - Add comments for PRDT limitations as suggested by Subhash Jadavani
>
>  drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++  
> drivers/scsi/ufs/ufshci.h |  5 +++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c 
> index a2abe9a..660792e 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1918,6 +1918,20 @@ static int ufshcd_slave_alloc(struct 
> scsi_device *sdev)  }
>
>  /**
> + * ufshcd_slave_configure - adjust SCSI device configurations
> + * @sdev: pointer to SCSI device
> + */
> +static int ufshcd_slave_configure(struct scsi_device *sdev) {
> +       struct request_queue *q = sdev->request_queue;
> +
> +       blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
> +       blk_queue_max_segment_size(q, PRDT_DATA_BYTE_COUNT_MAX);
> +
> +       return 0;
> +}
> +
> +/**
>   * ufshcd_slave_destroy - remove SCSI device configurations
>   * @sdev: pointer to SCSI device
>   */
> @@ -2748,6 +2762,7 @@ static struct scsi_host_template
ufshcd_driver_template = {
>         .proc_name              = UFSHCD,
>         .queuecommand           = ufshcd_queuecommand,
>         .slave_alloc            = ufshcd_slave_alloc,
> +       .slave_configure        = ufshcd_slave_configure,
>         .slave_destroy          = ufshcd_slave_destroy,
>         .eh_abort_handler       = ufshcd_abort,
>         .eh_device_reset_handler = ufshcd_device_reset, diff --git 
> a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index 
> 0475c66..b2b7004 100644
> --- a/drivers/scsi/ufs/ufshci.h
> +++ b/drivers/scsi/ufs/ufshci.h
> @@ -296,6 +296,11 @@ enum {
>         MASK_OCS                        = 0x0F,
>  };
>
> +/* The maximum length of the data byte count field in the PRDT is 256KB
*/
> +#define PRDT_DATA_BYTE_COUNT_MAX       (256 * 1024)
> +/* The granularity of the data byte count field in the PRDT is 32-bit */
> +#define PRDT_DATA_BYTE_COUNT_PAD       4
> +
>  /**
>   * struct ufshcd_sg_entry - UFSHCI PRD Entry
>   * @base_addr: Lower 32bit physical address DW-0

Acked-by: Vinayak Holikatti <vinholikatti@gmail.com>
--
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: adjust queue settings to PRDT limitations
  2014-07-01  8:53   ` Dolev Raviv
@ 2014-07-01 14:05     ` Akinobu Mita
  0 siblings, 0 replies; 6+ messages in thread
From: Akinobu Mita @ 2014-07-01 14:05 UTC (permalink / raw)
  To: Dolev Raviv
  Cc: vinayak holikatti, linux-scsi, Subhash Jadavani, Santosh Y,
	James E.J. Bottomley

2014-07-01 17:53 GMT+09:00 Dolev Raviv <draviv@codeaurora.org>:
> Hi,
> I couldn't find this patch in scsi-misc branch. Was it merged somewhere
> else?

No.  I have just resend it with Tested-by and Acked-by lines.
Thanks for reminding me.

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

end of thread, other threads:[~2014-07-01 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25 13:47 [PATCH v2] ufs: adjust queue settings to PRDT limitations Akinobu Mita
2013-09-26  6:59 ` Subhash Jadavani
2013-09-29 10:18   ` Dolev Raviv
2013-10-11  5:05 ` vinayak holikatti
2014-07-01  8:53   ` Dolev Raviv
2014-07-01 14:05     ` Akinobu Mita

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).