mbox series

[v4,0/9] UFS patches for kernel 6.11

Message ID 20240702204020.2489324-1-bvanassche@acm.org
Headers show
Series UFS patches for kernel 6.11 | expand

Message

Bart Van Assche July 2, 2024, 8:39 p.m. UTC
Hi Martin,

Please consider this series of UFS driver patches for the next merge window.

Thanks,

Bart.

Changes compared to v3:
 - In patch 9/9, enable MCQ before reading the maximum number of active commands
   (MAC).
 - Added two refactoring patches: "Inline is_mcq_enabled()" and "Move the
   ufshcd_mcq_enable() call".

Changes compared to v2:
 - In patch 1/7, remove more duplicate declarations.

Changes compared to v1:
 - Based upon reviewer feedback, a new patch that renames the
   MASK_TRANSFER_REQUESTS_SLOTS constant has been added.
 - Because there is no agreement about these patches, the following three
   patches have been left out: "Make ufshcd_poll() complain about unsupported
   arguments", "Make the polling code report which command has been completed"
   and also "Check for completion from the timeout handler".

Bart Van Assche (9):
  scsi: ufs: Declare functions once
  scsi: ufs: Initialize struct uic_command once
  scsi: ufs: Remove two constants
  scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant
  scsi: ufs: Initialize hba->reserved_slot earlier
  scsi: ufs: Inline is_mcq_enabled()
  scsi: ufs: Move the ufshcd_mcq_enable() call
  scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac()
  scsi: ufs: Make .get_hba_mac() optional

 drivers/ufs/core/ufs-mcq.c     |  24 +++++--
 drivers/ufs/core/ufshcd-priv.h |  15 +----
 drivers/ufs/core/ufshcd.c      | 112 +++++++++++++++++----------------
 include/ufs/ufshcd.h           |  13 ++--
 include/ufs/ufshci.h           |   3 +-
 5 files changed, 83 insertions(+), 84 deletions(-)

Comments

Manivannan Sadhasivam July 3, 2024, 1:01 p.m. UTC | #1
On Tue, Jul 02, 2024 at 01:39:13PM -0700, Bart Van Assche wrote:
> Move the hba->reserved_slot and the host->can_queue assignments from
> ufshcd_config_mcq() into ufshcd_alloc_mcq(). The advantages of this
> change are as follows:
> - It becomes easier to verify that these two parameters are updated
>   if hba->nutrs is updated.
> - It prevents unnecessary assignments to these two parameters. While
>   ufshcd_config_mcq() is called during host reset, ufshcd_alloc_mcq()
>   is not.
> 
> Cc: Can Guo <quic_cang@quicinc.com>
> Reviewed-by: Peter Wang <peter.wang@mediatek.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  drivers/ufs/core/ufshcd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 2cbd0f91953b..178b0abaeb30 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8678,6 +8678,9 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba)
>  	if (ret)
>  		goto err;
>  
> +	hba->host->can_queue = hba->nutrs - UFSHCD_NUM_RESERVED;
> +	hba->reserved_slot = hba->nutrs - UFSHCD_NUM_RESERVED;
> +
>  	return 0;
>  err:
>  	hba->nutrs = old_nutrs;
> @@ -8699,9 +8702,6 @@ static void ufshcd_config_mcq(struct ufs_hba *hba)
>  	ufshcd_mcq_make_queues_operational(hba);
>  	ufshcd_mcq_config_mac(hba, hba->nutrs);
>  
> -	hba->host->can_queue = hba->nutrs - UFSHCD_NUM_RESERVED;
> -	hba->reserved_slot = hba->nutrs - UFSHCD_NUM_RESERVED;
> -
>  	ufshcd_mcq_enable(hba);
>  	hba->mcq_enabled = true;
>