Skip to contentSkip to conversation

ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

PATCH Applied [email protected] 7 participants 10 messages Nov 2, 2023 – Nov 15, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

From: Naomi Chu <[email protected]>

Expand the MCQ queue slots to comply with the UFSHCI 4.0 specification, enabling host controllers to fully utilize the MCQ queue slots.

v2 -> v3
- Add patch description that why this patch is necessary

v1 -> v2
- Remove QUIRK_MCQ_EXPAND_QUEUE_SLOT quirk and make the change for all host controllers

v1
- Support quirk for host controllers not able to distinguish queue full or empty

Naomi Chu (1):
ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.18.0
#1 lore raw

PATCH v3 1/1 ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

From: Naomi Chu <[email protected]>

The UFSHCI 4.0 specification mandates that there should always be at least one empty slot in each queue for distinguishing between full and empty states. Enlarge the hwq->max_entries to DeviceQueueDepth +1 to allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Fixes 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ mode")
---
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufs-mcq.c +1 -1
index 2ba8ec254dce..5c75ab9d6bb5 100644
@@ -436,7 +436,7 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
 
 	for (i = 0; i < hba->nr_hw_queues; i++) {
 		hwq = &hba->uhq[i];
-		hwq->max_entries = hba->nutrs;
+		hwq->max_entries = hba->nutrs + 1;
 		spin_lock_init(&hwq->sq_lock);
 		spin_lock_init(&hwq->cq_lock);
 		mutex_init(&hwq->sq_mutex);
Signature · 1 line
2.18.0
Reviewed-by on v3 1/1
#2 lore raw
Quoted 8 lines · On Thu, Nov 2, 2023 at 2:26 PM <[email protected]> wrote:

From: Naomi Chu <[email protected]>

The UFSHCI 4.0 specification mandates that there should always be at least one empty slot in each queue for distinguishing between full and empty states. Enlarge the hwq->max_entries to DeviceQueueDepth +1 to allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Quoted 5 lines
Fixes 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ mode")
---
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw
In reply to [email protected]
Quoted 10 lines · On Thu, Nov 02, 2023 at 01:24:24PM +0800, [email protected] wrote:

From: Naomi Chu <[email protected]>

The UFSHCI 4.0 specification mandates that there should always be at least one empty slot in each queue for distinguishing between full and empty states. Enlarge the hwq->max_entries to DeviceQueueDepth +1 to allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Fixes 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ mode")

---

Where is the changelog?

- Mani

Quoted 19 lines
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufs-mcq.c +1 -1
index 2ba8ec254dce..5c75ab9d6bb5 100644
@@ -436,7 +436,7 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
 
 	for (i = 0; i < hba->nr_hw_queues; i++) {
 		hwq = &hba->uhq[i];
-		hwq->max_entries = hba->nutrs;
+		hwq->max_entries = hba->nutrs + 1;
 		spin_lock_init(&hwq->sq_lock);
 		spin_lock_init(&hwq->cq_lock);
 		mutex_init(&hwq->sq_mutex);
Signature · 1 line
2.18.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Reviewed-by on v3 1/1
#6 lore raw
In reply to [email protected]
Quoted 9 lines · On Thu, 2023-11-02 at 13:24 +0800, [email protected] wrote:

From: Naomi Chu <[email protected]>

The UFSHCI 4.0 specification mandates that there should always be at least one empty slot in each queue for distinguishing between full and
empty states. Enlarge the hwq->max_entries to DeviceQueueDepth +1 to allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Reviewed-by on v3 1/1
#7 lore raw
In reply to [email protected]
Quoted 31 lines · On Thu, 2023-11-02 at 13:24 +0800, [email protected] wrote:

From: Naomi Chu <[email protected]>

The UFSHCI 4.0 specification mandates that there should always be at least one empty slot in each queue for distinguishing between full and
empty states. Enlarge the hwq->max_entries to DeviceQueueDepth +1 to allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Fixes 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ

mode")

---
 drivers/ufs/core/ufs-mcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufs-mcq.c +1 -1
index 2ba8ec254dce..5c75ab9d6bb5 100644
@@ -436,7 +436,7 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
 
 	for (i = 0; i < hba->nr_hw_queues; i++) {
 		hwq = &hba->uhq[i];
-		hwq->max_entries = hba->nutrs;
+		hwq->max_entries = hba->nutrs + 1;
 		spin_lock_init(&hwq->sq_lock);
 		spin_lock_init(&hwq->cq_lock);
 		mutex_init(&hwq->sq_mutex);
Signature · 1 line
2.18.0
#8 lore raw
In reply to [email protected]
Quoted 5 lines

The UFSHCI 4.0 specification mandates that there should always be at least one empty slot in each queue for distinguishing between full and empty states. Enlarge the hwq->max_entries to DeviceQueueDepth +1 to allow UFSHCI 4.0 controllers to fully utilize MCQ queue slots.

Applied to 6.7/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#9 lore raw
In reply to [email protected]
Quoted 10 lines · On Thu, 02 Nov 2023 13:24:23 +0800, [email protected] wrote:

Expand the MCQ queue slots to comply with the UFSHCI 4.0 specification, enabling host controllers to fully utilize the MCQ queue slots.

v2 -> v3
- Add patch description that why this patch is necessary

v1 -> v2
- Remove QUIRK_MCQ_EXPAND_QUEUE_SLOT quirk and make the change for all host controllers

[...]

Applied to 6.7/scsi-fixes, thanks!

[1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

      https://git.kernel.org/mkp/scsi/c/defde5a50d91
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering