public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] UFS patches for kernel 6.11
@ 2024-07-01 18:03 Bart Van Assche
  2024-07-01 18:03 ` [PATCH v3 1/7] scsi: ufs: Declare functions once Bart Van Assche
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche

Hi Martin,

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

Thank you,

Bart.

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 (7):
  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 ufshcd_mcq_vops_get_hba_mac()
  scsi: ufs: Make .get_hba_mac() optional

 drivers/ufs/core/ufs-mcq.c     | 19 ++++++---
 drivers/ufs/core/ufshcd-priv.h | 14 -------
 drivers/ufs/core/ufshcd.c      | 73 ++++++++++++++++------------------
 include/ufs/ufshcd.h           |  8 ++--
 include/ufs/ufshci.h           |  3 +-
 5 files changed, 55 insertions(+), 62 deletions(-)


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

* [PATCH v3 1/7] scsi: ufs: Declare functions once
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  1:27   ` Keoseong Park
  2024-07-02  6:22   ` Peter Wang (王信友)
  2024-07-01 18:03 ` [PATCH v3 2/7] scsi: ufs: Initialize struct uic_command once Bart Van Assche
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley

Several functions are declared in include/ufs/ufshcd.h and also in
drivers/ufs/core/ufshcd-priv.h. Remove the duplicate declarations.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd-priv.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index f42d99ce5bf1..668748477e6e 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -66,14 +66,8 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag,
 int ufshcd_mcq_init(struct ufs_hba *hba);
 int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba);
 int ufshcd_mcq_memory_alloc(struct ufs_hba *hba);
-void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba);
-void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
-u32 ufshcd_mcq_read_cqis(struct ufs_hba *hba, int i);
-void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
 struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
 					   struct request *req);
-unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
-				       struct ufs_hw_queue *hwq);
 void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba,
 				    struct ufs_hw_queue *hwq);
 bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd);

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

* [PATCH v3 2/7] scsi: ufs: Initialize struct uic_command once
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
  2024-07-01 18:03 ` [PATCH v3 1/7] scsi: ufs: Declare functions once Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  6:23   ` Peter Wang (王信友)
  2024-07-01 18:03 ` [PATCH v3 3/7] scsi: ufs: Remove two constants Bart Van Assche
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Daejun Park, Avri Altman,
	Manivannan Sadhasivam, James E.J. Bottomley, Peter Wang,
	Andrew Halaney, Bean Huo, Minwoo Im, Maramaina Naresh,
	Akinobu Mita

Instead of first zero-initializing struct uic_command and next initializing
it memberwise, initialize all members at once.

Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 61 ++++++++++++++++++++-------------------
 include/ufs/ufshcd.h      |  4 +--
 2 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 1fc08e34aaf9..b7ceedba4f93 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3993,11 +3993,11 @@ static void ufshcd_host_memory_configure(struct ufs_hba *hba)
  */
 static int ufshcd_dme_link_startup(struct ufs_hba *hba)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = UIC_CMD_DME_LINK_STARTUP,
+	};
 	int ret;
 
-	uic_cmd.command = UIC_CMD_DME_LINK_STARTUP;
-
 	ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
 	if (ret)
 		dev_dbg(hba->dev,
@@ -4015,11 +4015,11 @@ static int ufshcd_dme_link_startup(struct ufs_hba *hba)
  */
 static int ufshcd_dme_reset(struct ufs_hba *hba)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = UIC_CMD_DME_RESET,
+	};
 	int ret;
 
-	uic_cmd.command = UIC_CMD_DME_RESET;
-
 	ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
 	if (ret)
 		dev_err(hba->dev,
@@ -4054,11 +4054,11 @@ EXPORT_SYMBOL_GPL(ufshcd_dme_configure_adapt);
  */
 static int ufshcd_dme_enable(struct ufs_hba *hba)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = UIC_CMD_DME_ENABLE,
+	};
 	int ret;
 
-	uic_cmd.command = UIC_CMD_DME_ENABLE;
-
 	ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
 	if (ret)
 		dev_err(hba->dev,
@@ -4111,7 +4111,12 @@ static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba)
 int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
 			u8 attr_set, u32 mib_val, u8 peer)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = peer ? UIC_CMD_DME_PEER_SET : UIC_CMD_DME_SET,
+		.argument1 = attr_sel,
+		.argument2 = UIC_ARG_ATTR_TYPE(attr_set),
+		.argument3 = mib_val,
+	};
 	static const char *const action[] = {
 		"dme-set",
 		"dme-peer-set"
@@ -4120,12 +4125,6 @@ int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
 	int ret;
 	int retries = UFS_UIC_COMMAND_RETRIES;
 
-	uic_cmd.command = peer ?
-		UIC_CMD_DME_PEER_SET : UIC_CMD_DME_SET;
-	uic_cmd.argument1 = attr_sel;
-	uic_cmd.argument2 = UIC_ARG_ATTR_TYPE(attr_set);
-	uic_cmd.argument3 = mib_val;
-
 	do {
 		/* for peer attributes we retry upon failure */
 		ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
@@ -4155,7 +4154,10 @@ EXPORT_SYMBOL_GPL(ufshcd_dme_set_attr);
 int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
 			u32 *mib_val, u8 peer)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = peer ? UIC_CMD_DME_PEER_GET : UIC_CMD_DME_GET,
+		.argument1 = attr_sel,
+	};
 	static const char *const action[] = {
 		"dme-get",
 		"dme-peer-get"
@@ -4189,10 +4191,6 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
 		}
 	}
 
-	uic_cmd.command = peer ?
-		UIC_CMD_DME_PEER_GET : UIC_CMD_DME_GET;
-	uic_cmd.argument1 = attr_sel;
-
 	do {
 		/* for peer attributes we retry upon failure */
 		ret = ufshcd_send_uic_cmd(hba, &uic_cmd);
@@ -4325,7 +4323,11 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)
  */
 int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = UIC_CMD_DME_SET,
+		.argument1 = UIC_ARG_MIB(PA_PWRMODE),
+		.argument3 = mode,
+	};
 	int ret;
 
 	if (hba->quirks & UFSHCD_QUIRK_BROKEN_PA_RXHSUNTERMCAP) {
@@ -4338,9 +4340,6 @@ int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode)
 		}
 	}
 
-	uic_cmd.command = UIC_CMD_DME_SET;
-	uic_cmd.argument1 = UIC_ARG_MIB(PA_PWRMODE);
-	uic_cmd.argument3 = mode;
 	ufshcd_hold(hba);
 	ret = ufshcd_uic_pwr_ctrl(hba, &uic_cmd);
 	ufshcd_release(hba);
@@ -4381,13 +4380,14 @@ EXPORT_SYMBOL_GPL(ufshcd_link_recovery);
 
 int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 {
-	int ret;
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = UIC_CMD_DME_HIBER_ENTER,
+	};
 	ktime_t start = ktime_get();
+	int ret;
 
 	ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_ENTER, PRE_CHANGE);
 
-	uic_cmd.command = UIC_CMD_DME_HIBER_ENTER;
 	ret = ufshcd_uic_pwr_ctrl(hba, &uic_cmd);
 	trace_ufshcd_profile_hibern8(dev_name(hba->dev), "enter",
 			     ktime_to_us(ktime_sub(ktime_get(), start)), ret);
@@ -4405,13 +4405,14 @@ EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_enter);
 
 int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
 {
-	struct uic_command uic_cmd = {0};
+	struct uic_command uic_cmd = {
+		.command = UIC_CMD_DME_HIBER_EXIT,
+	};
 	int ret;
 	ktime_t start = ktime_get();
 
 	ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_EXIT, PRE_CHANGE);
 
-	uic_cmd.command = UIC_CMD_DME_HIBER_EXIT;
 	ret = ufshcd_uic_pwr_ctrl(hba, &uic_cmd);
 	trace_ufshcd_profile_hibern8(dev_name(hba->dev), "exit",
 			     ktime_to_us(ktime_sub(ktime_get(), start)), ret);
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 9e0581115b34..d4d63507d090 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -73,8 +73,8 @@ enum ufs_event_type {
  * @done: UIC command completion
  */
 struct uic_command {
-	u32 command;
-	u32 argument1;
+	const u32 command;
+	const u32 argument1;
 	u32 argument2;
 	u32 argument3;
 	int cmd_active;

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

* [PATCH v3 3/7] scsi: ufs: Remove two constants
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
  2024-07-01 18:03 ` [PATCH v3 1/7] scsi: ufs: Declare functions once Bart Van Assche
  2024-07-01 18:03 ` [PATCH v3 2/7] scsi: ufs: Initialize struct uic_command once Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  6:23   ` Peter Wang (王信友)
  2024-07-01 18:03 ` [PATCH v3 4/7] scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant Bart Van Assche
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Manivannan Sadhasivam, Keoseong Park,
	James E.J. Bottomley, Avri Altman, Peter Wang, Bean Huo

The SCSI host template members .cmd_per_lun and .can_queue are copied
into the SCSI host data structure. Before these are used, these are
overwritten by ufshcd_init(). Hence, this patch does not change any
functionality.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Keoseong Park <keosung.park@samsung.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index b7ceedba4f93..9a0697556953 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -164,8 +164,6 @@ EXPORT_SYMBOL_GPL(ufshcd_dump_regs);
 enum {
 	UFSHCD_MAX_CHANNEL	= 0,
 	UFSHCD_MAX_ID		= 1,
-	UFSHCD_CMD_PER_LUN	= 32 - UFSHCD_NUM_RESERVED,
-	UFSHCD_CAN_QUEUE	= 32 - UFSHCD_NUM_RESERVED,
 };
 
 static const char *const ufshcd_state_name[] = {
@@ -8958,8 +8956,6 @@ static const struct scsi_host_template ufshcd_driver_template = {
 	.eh_timed_out		= ufshcd_eh_timed_out,
 	.this_id		= -1,
 	.sg_tablesize		= SG_ALL,
-	.cmd_per_lun		= UFSHCD_CMD_PER_LUN,
-	.can_queue		= UFSHCD_CAN_QUEUE,
 	.max_segment_size	= PRDT_DATA_BYTE_COUNT_MAX,
 	.max_sectors		= SZ_1M / SECTOR_SIZE,
 	.max_host_blocked	= 1,

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

* [PATCH v3 4/7] scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
                   ` (2 preceding siblings ...)
  2024-07-01 18:03 ` [PATCH v3 3/7] scsi: ufs: Remove two constants Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  6:24   ` Peter Wang (王信友)
  2024-07-01 18:03 ` [PATCH v3 5/7] scsi: ufs: Initialize hba->reserved_slot earlier Bart Van Assche
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, Avri Altman,
	Manivannan Sadhasivam, Peter Wang, Bean Huo, ChanWoo Lee

Rename this constant to prepare for the introduction of the
MASK_TRANSFER_REQUESTS_SLOTS_MCQ constant. The acronym "SDB" stands for
"single doorbell" (mode).

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 2 +-
 include/ufs/ufshci.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 9a0697556953..2cbd0f91953b 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2401,7 +2401,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
 		hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT;
 
 	/* nutrs and nutmrs are 0 based values */
-	hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS) + 1;
+	hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS_SDB) + 1;
 	hba->nutmrs =
 	((hba->capabilities & MASK_TASK_MANAGEMENT_REQUEST_SLOTS) >> 16) + 1;
 	hba->reserved_slot = hba->nutrs - 1;
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index c50f92bf2e1d..8d0cc73537c6 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -67,7 +67,7 @@ enum {
 
 /* Controller capability masks */
 enum {
-	MASK_TRANSFER_REQUESTS_SLOTS		= 0x0000001F,
+	MASK_TRANSFER_REQUESTS_SLOTS_SDB	= 0x0000001F,
 	MASK_NUMBER_OUTSTANDING_RTT		= 0x0000FF00,
 	MASK_TASK_MANAGEMENT_REQUEST_SLOTS	= 0x00070000,
 	MASK_EHSLUTRD_SUPPORTED			= 0x00400000,

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

* [PATCH v3 5/7] scsi: ufs: Initialize hba->reserved_slot earlier
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
                   ` (3 preceding siblings ...)
  2024-07-01 18:03 ` [PATCH v3 4/7] scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  6:25   ` Peter Wang (王信友)
  2024-07-01 18:03 ` [PATCH v3 6/7] scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac() Bart Van Assche
  2024-07-01 18:03 ` [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional Bart Van Assche
  6 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Can Guo, James E.J. Bottomley,
	Avri Altman, Manivannan Sadhasivam, Peter Wang, Bean Huo

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>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 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;
 

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

* [PATCH v3 6/7] scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac()
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
                   ` (4 preceding siblings ...)
  2024-07-01 18:03 ` [PATCH v3 5/7] scsi: ufs: Initialize hba->reserved_slot earlier Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  6:26   ` Peter Wang (王信友)
  2024-07-01 18:03 ` [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional Bart Van Assche
  6 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, Minwoo Im,
	Peter Wang, Stanley Jhu, ChanWoo Lee, Po-Wen Kao, Naomi Chu,
	Yang Li

Make ufshcd_mcq_decide_queue_depth() easier to read by inlining
ufshcd_mcq_vops_get_hba_mac().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufs-mcq.c     | 18 +++++++++++-------
 drivers/ufs/core/ufshcd-priv.h |  8 --------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 4bcae410c268..0482c7a1e419 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -144,14 +144,14 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr);
  */
 int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
 {
-	int mac;
+	int mac = -EOPNOTSUPP;
 
-	/* Mandatory to implement get_hba_mac() */
-	mac = ufshcd_mcq_vops_get_hba_mac(hba);
-	if (mac < 0) {
-		dev_err(hba->dev, "Failed to get mac, err=%d\n", mac);
-		return mac;
-	}
+	if (!hba->vops || !hba->vops->get_hba_mac)
+		goto err;
+
+	mac = hba->vops->get_hba_mac(hba);
+	if (mac < 0)
+		goto err;
 
 	WARN_ON_ONCE(!hba->dev_info.bqueuedepth);
 	/*
@@ -160,6 +160,10 @@ int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
 	 * shared queuing architecture is enabled.
 	 */
 	return min_t(int, mac, hba->dev_info.bqueuedepth);
+
+err:
+	dev_err(hba->dev, "Failed to get mac, err=%d\n", mac);
+	return mac;
 }
 
 static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 668748477e6e..88ce93748305 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -249,14 +249,6 @@ static inline int ufshcd_vops_mcq_config_resource(struct ufs_hba *hba)
 	return -EOPNOTSUPP;
 }
 
-static inline int ufshcd_mcq_vops_get_hba_mac(struct ufs_hba *hba)
-{
-	if (hba->vops && hba->vops->get_hba_mac)
-		return hba->vops->get_hba_mac(hba);
-
-	return -EOPNOTSUPP;
-}
-
 static inline int ufshcd_mcq_vops_op_runtime_config(struct ufs_hba *hba)
 {
 	if (hba->vops && hba->vops->op_runtime_config)

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

* [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional
  2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
                   ` (5 preceding siblings ...)
  2024-07-01 18:03 ` [PATCH v3 6/7] scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac() Bart Van Assche
@ 2024-07-01 18:03 ` Bart Van Assche
  2024-07-02  6:29   ` Peter Wang (王信友)
  6 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-01 18:03 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Daejun Park, James E.J. Bottomley,
	Minwoo Im, Peter Wang, ChanWoo Lee, Yang Li, Avri Altman,
	Manivannan Sadhasivam, Maramaina Naresh, Akinobu Mita, Bean Huo

UFSHCI controllers that are compliant with the UFSHCI 4.0 standard report
the maximum number of supported commands in the controller capabilities
register. Use that value if .get_hba_mac == NULL.

Reviewed-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufs-mcq.c | 15 +++++++++------
 include/ufs/ufshcd.h       |  4 +++-
 include/ufs/ufshci.h       |  1 +
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 0482c7a1e419..f4cc4b0676f7 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -138,18 +138,21 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr);
  *
  * MAC - Max. Active Command of the Host Controller (HC)
  * HC wouldn't send more than this commands to the device.
- * It is mandatory to implement get_hba_mac() to enable MCQ mode.
  * Calculates and adjusts the queue depth based on the depth
  * supported by the HC and ufs device.
  */
 int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
 {
-	int mac = -EOPNOTSUPP;
+	int mac;
 
-	if (!hba->vops || !hba->vops->get_hba_mac)
-		goto err;
-
-	mac = hba->vops->get_hba_mac(hba);
+	if (!hba->vops || !hba->vops->get_hba_mac) {
+		hba->capabilities =
+			ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES);
+		mac = hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS_MCQ;
+		mac++;
+	} else {
+		mac = hba->vops->get_hba_mac(hba);
+	}
 	if (mac < 0)
 		goto err;
 
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index d4d63507d090..d32637d267f3 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -325,7 +325,9 @@ struct ufs_pwr_mode_info {
  * @event_notify: called to notify important events
  * @reinit_notify: called to notify reinit of UFSHCD during max gear switch
  * @mcq_config_resource: called to configure MCQ platform resources
- * @get_hba_mac: called to get vendor specific mac value, mandatory for mcq mode
+ * @get_hba_mac: reports maximum number of outstanding commands supported by
+ *	the controller. Should be implemented for UFSHCI 4.0 or later
+ *	controllers that are not compliant with the UFSHCI 4.0 specification.
  * @op_runtime_config: called to config Operation and runtime regs Pointers
  * @get_outstanding_cqs: called to get outstanding completion queues
  * @config_esi: called to config Event Specific Interrupt
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index 8d0cc73537c6..38fe97971a65 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -68,6 +68,7 @@ enum {
 /* Controller capability masks */
 enum {
 	MASK_TRANSFER_REQUESTS_SLOTS_SDB	= 0x0000001F,
+	MASK_TRANSFER_REQUESTS_SLOTS_MCQ	= 0x000000FF,
 	MASK_NUMBER_OUTSTANDING_RTT		= 0x0000FF00,
 	MASK_TASK_MANAGEMENT_REQUEST_SLOTS	= 0x00070000,
 	MASK_EHSLUTRD_SUPPORTED			= 0x00400000,

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

* RE: [PATCH v3 1/7] scsi: ufs: Declare functions once
  2024-07-01 18:03 ` [PATCH v3 1/7] scsi: ufs: Declare functions once Bart Van Assche
@ 2024-07-02  1:27   ` Keoseong Park
  2024-07-02  6:22   ` Peter Wang (王信友)
  1 sibling, 0 replies; 18+ messages in thread
From: Keoseong Park @ 2024-07-02  1:27 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi@vger.kernel.org, James E.J. Bottomley, Keoseong Park

> Several functions are declared in include/ufs/ufshcd.h and also in
> drivers/ufs/core/ufshcd-priv.h. Remove the duplicate declarations.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Keoseong Park <keosung.park@samsung.com>

Best Regards,
Keoseong

> ---
>  drivers/ufs/core/ufshcd-priv.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
> index f42d99ce5bf1..668748477e6e 100644
> --- a/drivers/ufs/core/ufshcd-priv.h
> +++ b/drivers/ufs/core/ufshcd-priv.h
> @@ -66,14 +66,8 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag,
>  int ufshcd_mcq_init(struct ufs_hba *hba);
>  int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba);
>  int ufshcd_mcq_memory_alloc(struct ufs_hba *hba);
> -void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba);
> -void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
> -u32 ufshcd_mcq_read_cqis(struct ufs_hba *hba, int i);
> -void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i);
>  struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
>  					   struct request *req);
> -unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
> -				       struct ufs_hw_queue *hwq);
>  void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba,
>  				    struct ufs_hw_queue *hwq);
>  bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd);

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

* Re: [PATCH v3 1/7] scsi: ufs: Declare functions once
  2024-07-01 18:03 ` [PATCH v3 1/7] scsi: ufs: Declare functions once Bart Van Assche
  2024-07-02  1:27   ` Keoseong Park
@ 2024-07-02  6:22   ` Peter Wang (王信友)
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:22 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
> Several functions are declared in include/ufs/ufshcd.h and also in
> drivers/ufs/core/ufshcd-priv.h. Remove the duplicate declarations.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Reviewed-by: Keoseong Park <keosung.park@samsung.com>
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>


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

* Re: [PATCH v3 2/7] scsi: ufs: Initialize struct uic_command once
  2024-07-01 18:03 ` [PATCH v3 2/7] scsi: ufs: Initialize struct uic_command once Bart Van Assche
@ 2024-07-02  6:23   ` Peter Wang (王信友)
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:23 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: ahalaney@redhat.com, quic_mnaresh@quicinc.com,
	akinobu.mita@gmail.com, beanhuo@micron.com, avri.altman@wdc.com,
	linux-scsi@vger.kernel.org, manivannan.sadhasivam@linaro.org,
	minwoo.im@samsung.com, James.Bottomley@HansenPartnership.com,
	daejun7.park@samsung.com

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Instead of first zero-initializing struct uic_command and next
> initializing
> it memberwise, initialize all members at once.
> 
> Reviewed-by: Daejun Park <daejun7.park@samsung.com>
> Reviewed-by: Avri Altman <avri.altman@wdc.com>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>

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

* Re: [PATCH v3 3/7] scsi: ufs: Remove two constants
  2024-07-01 18:03 ` [PATCH v3 3/7] scsi: ufs: Remove two constants Bart Van Assche
@ 2024-07-02  6:23   ` Peter Wang (王信友)
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:23 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com,
	avri.altman@wdc.com, beanhuo@micron.com, keosung.park@samsung.com,
	manivannan.sadhasivam@linaro.org

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  The SCSI host template members .cmd_per_lun and .can_queue are
> copied
> into the SCSI host data structure. Before these are used, these are
> overwritten by ufshcd_init(). Hence, this patch does not change any
> functionality.
> 
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Reviewed-by: Keoseong Park <keosung.park@samsung.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>

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

* Re: [PATCH v3 4/7] scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant
  2024-07-01 18:03 ` [PATCH v3 4/7] scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant Bart Van Assche
@ 2024-07-02  6:24   ` Peter Wang (王信友)
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:24 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, James.Bottomley@HansenPartnership.com,
	avri.altman@wdc.com, beanhuo@micron.com, cw9316.lee@samsung.com,
	manivannan.sadhasivam@linaro.org

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Rename this constant to prepare for the introduction of the
> MASK_TRANSFER_REQUESTS_SLOTS_MCQ constant. The acronym "SDB" stands
> for
> "single doorbell" (mode).
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> 
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>


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

* Re: [PATCH v3 5/7] scsi: ufs: Initialize hba->reserved_slot earlier
  2024-07-01 18:03 ` [PATCH v3 5/7] scsi: ufs: Initialize hba->reserved_slot earlier Bart Van Assche
@ 2024-07-02  6:25   ` Peter Wang (王信友)
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:25 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, quic_cang@quicinc.com,
	James.Bottomley@HansenPartnership.com, beanhuo@micron.com,
	avri.altman@wdc.com, manivannan.sadhasivam@linaro.org

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  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>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>


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

* Re: [PATCH v3 6/7] scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac()
  2024-07-01 18:03 ` [PATCH v3 6/7] scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac() Bart Van Assche
@ 2024-07-02  6:26   ` Peter Wang (王信友)
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:26 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: cw9316.lee@samsung.com, linux-scsi@vger.kernel.org,
	chu.stanley@gmail.com, Powen Kao (高伯文),
	James.Bottomley@HansenPartnership.com, minwoo.im@samsung.com,
	Naomi Chu (朱詠田), yang.lee@linux.alibaba.com

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Make ufshcd_mcq_decide_queue_depth() easier to read by inlining
> ufshcd_mcq_vops_get_hba_mac().
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> 

Reviewed-by: Peter Wang <peter.wang@mediatek.com>


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

* Re: [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional
  2024-07-01 18:03 ` [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional Bart Van Assche
@ 2024-07-02  6:29   ` Peter Wang (王信友)
  2024-07-02 20:27     ` Bart Van Assche
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-02  6:29 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: quic_mnaresh@quicinc.com, akinobu.mita@gmail.com,
	beanhuo@micron.com, avri.altman@wdc.com, cw9316.lee@samsung.com,
	linux-scsi@vger.kernel.org, manivannan.sadhasivam@linaro.org,
	minwoo.im@samsung.com, James.Bottomley@HansenPartnership.com,
	daejun7.park@samsung.com, yang.lee@linux.alibaba.com

On Mon, 2024-07-01 at 11:03 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  UFSHCI controllers that are compliant with the UFSHCI 4.0 standard
> report
> the maximum number of supported commands in the controller
> capabilities
> register. Use that value if .get_hba_mac == NULL.
> 
> Reviewed-by: Daejun Park <daejun7.park@samsung.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/ufs/core/ufs-mcq.c | 15 +++++++++------
>  include/ufs/ufshcd.h       |  4 +++-
>  include/ufs/ufshci.h       |  1 +
>  3 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 0482c7a1e419..f4cc4b0676f7 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -138,18 +138,21 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_queue_cfg_addr);
>   *
>   * MAC - Max. Active Command of the Host Controller (HC)
>   * HC wouldn't send more than this commands to the device.
> - * It is mandatory to implement get_hba_mac() to enable MCQ mode.
>   * Calculates and adjusts the queue depth based on the depth
>   * supported by the HC and ufs device.
>   */
>  int ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
>  {
> -	int mac = -EOPNOTSUPP;
> +	int mac;
>  
> -	if (!hba->vops || !hba->vops->get_hba_mac)
> -		goto err;
> -
> -	mac = hba->vops->get_hba_mac(hba);
> +	if (!hba->vops || !hba->vops->get_hba_mac) {
> +		hba->capabilities =
> +			ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES);
> +		mac = hba->capabilities &
> MASK_TRANSFER_REQUESTS_SLOTS_MCQ;
> 

Hi Bart,

Before ufshcd_mcq_enable,
here read REG_CONTROLLER_CAPABILITIES should be SDB value.
Beacuse MCQ is not enable.


Thanks.
Peter



> +		mac++;
> +	} else {
> +		mac = hba->vops->get_hba_mac(hba);
> +	}
>  	if (mac < 0)
>  		goto err;
>  
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index d4d63507d090..d32637d267f3 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -325,7 +325,9 @@ struct ufs_pwr_mode_info {
>   * @event_notify: called to notify important events
>   * @reinit_notify: called to notify reinit of UFSHCD during max gear
> switch
>   * @mcq_config_resource: called to configure MCQ platform resources
> - * @get_hba_mac: called to get vendor specific mac value, mandatory
> for mcq mode
> + * @get_hba_mac: reports maximum number of outstanding commands
> supported by
> + *	the controller. Should be implemented for UFSHCI 4.0 or later
> + *	controllers that are not compliant with the UFSHCI 4.0
> specification.
>   * @op_runtime_config: called to config Operation and runtime regs
> Pointers
>   * @get_outstanding_cqs: called to get outstanding completion queues
>   * @config_esi: called to config Event Specific Interrupt
> diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
> index 8d0cc73537c6..38fe97971a65 100644
> --- a/include/ufs/ufshci.h
> +++ b/include/ufs/ufshci.h
> @@ -68,6 +68,7 @@ enum {
>  /* Controller capability masks */
>  enum {
>  	MASK_TRANSFER_REQUESTS_SLOTS_SDB	= 0x0000001F,
> +	MASK_TRANSFER_REQUESTS_SLOTS_MCQ	= 0x000000FF,
>  	MASK_NUMBER_OUTSTANDING_RTT		= 0x0000FF00,
>  	MASK_TASK_MANAGEMENT_REQUEST_SLOTS	= 0x00070000,
>  	MASK_EHSLUTRD_SUPPORTED			= 0x00400000,

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

* Re: [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional
  2024-07-02  6:29   ` Peter Wang (王信友)
@ 2024-07-02 20:27     ` Bart Van Assche
  2024-07-03  8:53       ` Peter Wang (王信友)
  0 siblings, 1 reply; 18+ messages in thread
From: Bart Van Assche @ 2024-07-02 20:27 UTC (permalink / raw)
  To: Peter Wang (王信友), martin.petersen@oracle.com
  Cc: quic_mnaresh@quicinc.com, akinobu.mita@gmail.com,
	beanhuo@micron.com, avri.altman@wdc.com, cw9316.lee@samsung.com,
	linux-scsi@vger.kernel.org, manivannan.sadhasivam@linaro.org,
	minwoo.im@samsung.com, James.Bottomley@HansenPartnership.com,
	daejun7.park@samsung.com, yang.lee@linux.alibaba.com


On 7/1/24 11:29 PM, Peter Wang (王信友) wrote:
> Before ufshcd_mcq_enable,
> here read REG_CONTROLLER_CAPABILITIES should be SDB value.
> Beacuse MCQ is not enable.

I think this needs to be fixed in another way, namely by enabling MCQ
before ufshcd_mcq_decide_queue_depth() is called. See also v3 of this
patch series.

Thanks,

Bart.


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

* Re: [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional
  2024-07-02 20:27     ` Bart Van Assche
@ 2024-07-03  8:53       ` Peter Wang (王信友)
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Wang (王信友) @ 2024-07-03  8:53 UTC (permalink / raw)
  To: bvanassche@acm.org, martin.petersen@oracle.com
  Cc: quic_mnaresh@quicinc.com, akinobu.mita@gmail.com,
	beanhuo@micron.com, avri.altman@wdc.com, cw9316.lee@samsung.com,
	linux-scsi@vger.kernel.org, manivannan.sadhasivam@linaro.org,
	minwoo.im@samsung.com, James.Bottomley@HansenPartnership.com,
	daejun7.park@samsung.com, yang.lee@linux.alibaba.com

On Tue, 2024-07-02 at 13:27 -0700, Bart Van Assche wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  
> On 7/1/24 11:29 PM, Peter Wang (王信友) wrote:
> > Before ufshcd_mcq_enable,
> > here read REG_CONTROLLER_CAPABILITIES should be SDB value.
> > Beacuse MCQ is not enable.
> 
> I think this needs to be fixed in another way, namely by enabling MCQ
> before ufshcd_mcq_decide_queue_depth() is called. See also v3 of this
> patch series.
> 
> Thanks,
> 
> Bart.
> 

Hi Bart,

Yes, enable mcq before ufshcd_mcq_decide_queue_depth is right.

Thanks.
Peter


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

end of thread, other threads:[~2024-07-03  8:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 18:03 [PATCH v3 0/7] UFS patches for kernel 6.11 Bart Van Assche
2024-07-01 18:03 ` [PATCH v3 1/7] scsi: ufs: Declare functions once Bart Van Assche
2024-07-02  1:27   ` Keoseong Park
2024-07-02  6:22   ` Peter Wang (王信友)
2024-07-01 18:03 ` [PATCH v3 2/7] scsi: ufs: Initialize struct uic_command once Bart Van Assche
2024-07-02  6:23   ` Peter Wang (王信友)
2024-07-01 18:03 ` [PATCH v3 3/7] scsi: ufs: Remove two constants Bart Van Assche
2024-07-02  6:23   ` Peter Wang (王信友)
2024-07-01 18:03 ` [PATCH v3 4/7] scsi: ufs: Rename the MASK_TRANSFER_REQUESTS_SLOTS constant Bart Van Assche
2024-07-02  6:24   ` Peter Wang (王信友)
2024-07-01 18:03 ` [PATCH v3 5/7] scsi: ufs: Initialize hba->reserved_slot earlier Bart Van Assche
2024-07-02  6:25   ` Peter Wang (王信友)
2024-07-01 18:03 ` [PATCH v3 6/7] scsi: ufs: Inline ufshcd_mcq_vops_get_hba_mac() Bart Van Assche
2024-07-02  6:26   ` Peter Wang (王信友)
2024-07-01 18:03 ` [PATCH v3 7/7] scsi: ufs: Make .get_hba_mac() optional Bart Van Assche
2024-07-02  6:29   ` Peter Wang (王信友)
2024-07-02 20:27     ` Bart Van Assche
2024-07-03  8:53       ` Peter Wang (王信友)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox