2023-11-02 05:27:01

by naomi.chu

[permalink] [raw]
Subject: [PATCH v3 0/1] 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(-)

--
2.18.0


2023-11-02 05:27:19

by naomi.chu

[permalink] [raw]
Subject: [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")
Signed-off-by: Naomi Chu <[email protected]>
---
drivers/ufs/core/ufs-mcq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 2ba8ec254dce..5c75ab9d6bb5 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -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);
--
2.18.0

2023-11-02 13:24:16

by Stanley Jhu

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

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.
>
> Fixes: 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ mode")
> Signed-off-by: Naomi Chu <[email protected]>
> ---
> drivers/ufs/core/ufs-mcq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stanley Chu <[email protected]>

2023-11-02 16:38:08

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

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")
> Signed-off-by: Naomi Chu <[email protected]>
> ---

Where is the changelog?

- Mani

> drivers/ufs/core/ufs-mcq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 2ba8ec254dce..5c75ab9d6bb5 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -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);
> --
> 2.18.0
>

--
மணிவண்ணன் சதாசிவம்

2023-11-02 19:16:00

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

On 11/2/23 09:37, Manivannan Sadhasivam wrote:
> Where is the changelog?

I think it's here:
https://lore.kernel.org/linux-scsi/[email protected]/

Bart.

2023-11-02 19:16:34

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

On 11/1/23 22:24, [email protected] wrote:
> 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: Bart Van Assche <[email protected]>

2023-11-03 02:19:43

by Peter Wang (王信友)

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

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: Peter Wang <[email protected]>

2023-11-03 02:36:32

by Chun-Hung Wu (巫駿宏)

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

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")
> Signed-off-by: Naomi Chu <[email protected]>
> ---
> drivers/ufs/core/ufs-mcq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 2ba8ec254dce..5c75ab9d6bb5 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -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);
> --
> 2.18.0
>

Reviewed-by: Chun-Hung<[email protected]>

2023-11-15 15:13:41

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v3 0/1] ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1

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

--
Martin K. Petersen Oracle Linux Engineering