Skip to contentSkip to conversation

ufs: adjust queue settings to PRDT limitations

PATCH In review Akinobu Mita 4 participants 6 messages Sep 25, 2013 – Jul 1, 2014 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ufs: adjust queue settings to PRDT limitations

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.

Cc Subhash Jadavani <[email protected]>
Cc Vinayak Holikatti <[email protected]>
Cc Santosh Y <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>

---
* 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(+)
drivers/scsi/ufs/ufshcd.c +15 -0
index a2abe9a..660792e 100644
@@ -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,
drivers/scsi/ufs/ufshci.h +5 -0
index 0475c66..b2b7004 100644
@@ -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
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/1
#1 lore raw

Looks good to me.

Quoted 71 lines · Akinobu Mita

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.

Cc Subhash Jadavani <[email protected]>
Cc Vinayak Holikatti <[email protected]>
Cc Santosh Y <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>

---
* 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(+)
drivers/scsi/ufs/ufshcd.c +15 -0
index a2abe9a..660792e 100644
@@ -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,
drivers/scsi/ufs/ufshci.h +5 -0
index 0475c66..b2b7004 100644
@@ -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
Tested-by Reviewed-by Subhash Jadavani
#2 lore raw

Works on my setup.

Thanks,
Dolev

Signature · 2 lines
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

Looks good to me.

drivers/scsi/ufs/ufshcd.c static int ufshcd_slave_alloc(struct scsi_device

Quoted 27 lines · Akinobu Mita

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.

Cc Subhash Jadavani <[email protected]>
Cc Vinayak Holikatti <[email protected]>
Cc Santosh Y <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>

---
* 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(+)
drivers/scsi/ufs/ufshcd.c +0 -0
index a2abe9a..660792e 100644
@@ -1918,6 +1918,20 @@ static int ufshcd_slave_alloc(struct scsi_device

*sdev)

drivers/scsi/ufs/ufshcd.c static struct scsi_host_template

Quoted 20 lines
drivers/scsi/ufs/ufshcd.c +13 -0
  }
 
  /**
+ * 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 = {

Quoted 12 lines
drivers/scsi/ufs/ufshcd.c +1 -0
  	.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

drivers/scsi/ufs/ufshci.h enum { · line 299

Quoted 4 lines
drivers/scsi/ufs/ufshci.h +1 -0
@@ -296,6 +296,11 @@ enum {
  	MASK_OCS			= 0x0F,
  };
 
+/* The maximum length of the data byte count field in the PRDT is 256KB

*/

drivers/scsi/ufs/ufshci.h enum { · line 306

Quoted 7 lines
drivers/scsi/ufs/ufshci.h +4 -0
+#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 [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

Acked-by on v2 1/1
#3 lore raw
In reply to Akinobu Mita
Quoted 61 lines · Akinobu Mita

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.

Cc Subhash Jadavani <[email protected]>
Cc Vinayak Holikatti <[email protected]>
Cc Santosh Y <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>

---
* 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(+)
drivers/scsi/ufs/ufshcd.c +15 -0
index a2abe9a..660792e 100644
@@ -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,
drivers/scsi/ufs/ufshci.h +0 -0
index 0475c66..b2b7004 100644
@@ -296,6 +296,11 @@ enum {
        MASK_OCS                        = 0x0F,

drivers/scsi/ufs/ufshci.h enum { · line 306

Quoted 10 lines
drivers/scsi/ufs/ufshci.h +5 -0
 };
 
+/* 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
#4 lore raw

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

Thanks,
Dolev

Signature · 2 lines
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

drivers/scsi/ufs/ufshcd.c static struct scsi_host_template

Quoted 47 lines · Akinobu Mita

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.

Cc Subhash Jadavani <[email protected]>
Cc Vinayak Holikatti <[email protected]>
Cc Santosh Y <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>

---
* 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(+)
drivers/scsi/ufs/ufshcd.c +13 -0
index a2abe9a..660792e 100644
@@ -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 = {

Quoted 12 lines
drivers/scsi/ufs/ufshcd.c +1 -0
        .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

drivers/scsi/ufs/ufshci.h enum { · line 299

Quoted 4 lines
drivers/scsi/ufs/ufshci.h +1 -0
@@ -296,6 +296,11 @@ enum {
        MASK_OCS                        = 0x0F,
 };
 
+/* The maximum length of the data byte count field in the PRDT is 256KB

*/

drivers/scsi/ufs/ufshci.h enum { · line 306

Quoted 7 lines
drivers/scsi/ufs/ufshci.h +4 -0
+#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 [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

#5 lore raw

2014-07-01 17:53 GMT+09:00 Dolev Raviv <[email protected]>:

Quoted 3 lines

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.