2020-03-13 09:03:18

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v4 0/8] scsi: ufs: some cleanups and make the delay for host enabling customizable

Hi,

This patchset applies some driver cleanups and performance improvement
in ufs host drivers by making the delay for host enabling customizable
according to vendors' requirements.

v3 -> v4
- Collect review tags in v2
- In patch #8, fix incorrect condition of customized delay for host enabling

v2 -> v3
- Remove /arch/arm64/configs/defconfig chnage because it is for local test only

v1 -> v2
- Add patch #1 "scsi: ufs: fix uninitialized tx_lanes in ufshcd_disable_tx_lcc"
- Remove struct ufs_init_prefetch in patch #2 "scsi: ufs: remove init_prefetch_data in struct ufs_hba"
- Introduce common delay function in patch #4
- Replace all delay places by common delay function in ufs-mediatek in patch #5
- Use common delay function instead for host enabling delay in patch #6
- Add patch #7 "scsi: ufs: make HCE polling more compact to improve initializatoin latency"
- In patch #8, customize the delay in ufs_mtk_hce_enable_notify callback instead of ufs_mtk_init (Avri)

drivers/scsi/ufs/ufs-mediatek.c | 64 ++++++++++++++++-----------
drivers/scsi/ufs/ufs-mediatek.h | 1 +
drivers/scsi/ufs/ufshcd.c | 47 +++++++++++---------
drivers/scsi/ufs/ufshcd.h | 78 ++++++++++++++++-----------------
4 files changed, 106 insertions(+), 84 deletions(-)

--
2.18.0


2020-03-13 09:03:51

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v4 1/8] scsi: ufs: fix uninitialized tx_lanes in ufshcd_disable_tx_lcc()

In ufshcd_disable_tx_lcc(), if ufshcd_dme_get() or ufshcd_dme_peer_get()
get fail, uninitialized variable "tx_lanes" may be used as unexpected lane
ID for DME configuration.

Fix this issue by initializing "tx_lanes".

Signed-off-by: Stanley Chu <[email protected]>
Reviewed-by: Asutosh Das <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5698f1164a5e..314e808b0d4e 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4315,7 +4315,7 @@ EXPORT_SYMBOL_GPL(ufshcd_hba_enable);

static int ufshcd_disable_tx_lcc(struct ufs_hba *hba, bool peer)
{
- int tx_lanes, i, err = 0;
+ int tx_lanes = 0, i, err = 0;

if (!peer)
ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES),
--
2.18.0

2020-03-13 09:04:09

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v4 7/8] scsi: ufs: make HCE polling more compact to improve initializatoin latency

Reduce the waiting period between each HCE (Host Controller Enable)
polling from 5 ms to 1 ms. In the same time, increase the maximum polling
times to make "total polling time" unchanged approximately.

This change could make HCE initializatoin faster to improve latency of
ufshcd initialization, error recovery, and resume behaviors.

Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index dcbf45d547d8..cd33d07c56cf 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4301,7 +4301,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
ufshcd_wait_us(hba->hba_enable_delay_us, 100, true);

/* wait for the host controller to complete initialization */
- retry = 10;
+ retry = 50;
while (ufshcd_is_hba_active(hba)) {
if (retry) {
retry--;
@@ -4310,7 +4310,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
"Controller enable failed\n");
return -EIO;
}
- ufshcd_wait_us(5000, 100, true);
+ ufshcd_wait_us(1000, 100, true);
}

/* enable UIC related interrupts */
--
2.18.0

2020-03-15 02:12:20

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v4 0/8] scsi: ufs: some cleanups and make the delay for host enabling customizable

Looks good to me.
Thanks,
Avri


>
> Hi,
>
> This patchset applies some driver cleanups and performance improvement
> in ufs host drivers by making the delay for host enabling customizable
> according to vendors' requirements.
>
> v3 -> v4
> - Collect review tags in v2
> - In patch #8, fix incorrect condition of customized delay for host
> enabling
>
> v2 -> v3
> - Remove /arch/arm64/configs/defconfig chnage because it is for local
> test only
>
> v1 -> v2
> - Add patch #1 "scsi: ufs: fix uninitialized tx_lanes in
> ufshcd_disable_tx_lcc"
> - Remove struct ufs_init_prefetch in patch #2 "scsi: ufs: remove
> init_prefetch_data in struct ufs_hba"
> - Introduce common delay function in patch #4
> - Replace all delay places by common delay function in ufs-mediatek in
> patch #5
> - Use common delay function instead for host enabling delay in patch #6
> - Add patch #7 "scsi: ufs: make HCE polling more compact to improve
> initializatoin latency"
> - In patch #8, customize the delay in ufs_mtk_hce_enable_notify
> callback instead of ufs_mtk_init (Avri)
>
> drivers/scsi/ufs/ufs-mediatek.c | 64 ++++++++++++++++-----------
> drivers/scsi/ufs/ufs-mediatek.h | 1 +
> drivers/scsi/ufs/ufshcd.c | 47 +++++++++++---------
> drivers/scsi/ufs/ufshcd.h | 78 ++++++++++++++++-----------------
> 4 files changed, 106 insertions(+), 84 deletions(-)
>
> --
> 2.18.0