2020-12-05 02:44:16

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v4 0/8] Refine error history and introduce event_notify vop

Hi,
This series refines error history functions, do vop cleanups and introduce a new event_notify vop to allow vendor to get notification of important events.

Changes since v3:
- Fix build warning in patch [8/8]

Changes since v2:
- Add patches for vop cleanups
- Introduce phy_initialization helper and replace direct invoking in ufs-cdns and ufs-dwc by the helper
- Introduce event_notify vop implemntation in ufs-mediatek

Changes since v1:
- Change notify_event() to event_notify() to follow vop naming covention

Stanley Chu (8):
scsi: ufs: Remove unused setup_regulators variant function
scsi: ufs: Introduce phy_initialization helper
scsi: ufs-cdns: Use phy_initialization helper
scsi: ufs-dwc: Use phy_initialization helper
scsi: ufs: Add error history for abort event in UFS Device W-LUN
scsi: ufs: Refine error history functions
scsi: ufs: Introduce event_notify variant function
scsi: ufs-mediatek: Introduce event_notify implementation

drivers/scsi/ufs/cdns-pltfrm.c | 3 +-
drivers/scsi/ufs/ufs-mediatek-trace.h | 37 ++++++++
drivers/scsi/ufs/ufs-mediatek.c | 12 +++
drivers/scsi/ufs/ufshcd-dwc.c | 11 +--
drivers/scsi/ufs/ufshcd.c | 132 ++++++++++++++------------
drivers/scsi/ufs/ufshcd.h | 100 +++++++++----------
6 files changed, 175 insertions(+), 120 deletions(-)
create mode 100644 drivers/scsi/ufs/ufs-mediatek-trace.h

--
2.18.0


2020-12-05 02:44:45

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v4 1/8] scsi: ufs: Remove unused setup_regulators variant function

Since setup_regulators variant function is not used by any
vendors, simply remove it.

Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 10 +---------
drivers/scsi/ufs/ufshcd.h | 10 ----------
2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 11a4aad09f3a..c2f611516ea7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8171,16 +8171,10 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
goto out;

err = ufshcd_vops_init(hba);
- if (err)
- goto out;
-
- err = ufshcd_vops_setup_regulators(hba, true);
- if (err)
- ufshcd_vops_exit(hba);
-out:
if (err)
dev_err(hba->dev, "%s: variant %s init failed err %d\n",
__func__, ufshcd_get_var_name(hba), err);
+out:
return err;
}

@@ -8189,8 +8183,6 @@ static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
if (!hba->vops)
return;

- ufshcd_vops_setup_regulators(hba, false);
-
ufshcd_vops_exit(hba);
}

diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 7a7e056a33a9..21de7607611f 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -277,7 +277,6 @@ struct ufs_pwr_mode_info {
* @get_ufs_hci_version: called to get UFS HCI version
* @clk_scale_notify: notifies that clks are scaled up/down
* @setup_clocks: called before touching any of the controller registers
- * @setup_regulators: called before accessing the host controller
* @hce_enable_notify: called before and after HCE enable bit is set to allow
* variant specific Uni-Pro initialization.
* @link_startup_notify: called before and after Link startup is carried out
@@ -307,7 +306,6 @@ struct ufs_hba_variant_ops {
enum ufs_notify_change_status);
int (*setup_clocks)(struct ufs_hba *, bool,
enum ufs_notify_change_status);
- int (*setup_regulators)(struct ufs_hba *, bool);
int (*hce_enable_notify)(struct ufs_hba *,
enum ufs_notify_change_status);
int (*link_startup_notify)(struct ufs_hba *,
@@ -1119,14 +1117,6 @@ static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on,
return 0;
}

-static inline int ufshcd_vops_setup_regulators(struct ufs_hba *hba, bool status)
-{
- if (hba->vops && hba->vops->setup_regulators)
- return hba->vops->setup_regulators(hba, status);
-
- return 0;
-}
-
static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba,
bool status)
{
--
2.18.0

2020-12-05 02:46:30

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v4 5/8] scsi: ufs: Add error history for abort event in UFS Device W-LUN

Add error history for abort event in UFS Device W-LUN.
Besides, use specified value as parameter of ufshcd_update_reg_hist()
to identify the aborted tag or LUNs.

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

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index c2f611516ea7..922d68bca345 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6738,8 +6738,10 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
* To avoid these unnecessary/illegal step we skip to the last error
* handling stage: reset and restore.
*/
- if (lrbp->lun == UFS_UPIU_UFS_DEVICE_WLUN)
+ if (lrbp->lun == UFS_UPIU_UFS_DEVICE_WLUN) {
+ ufshcd_update_reg_hist(&hba->ufs_stats.task_abort, lrbp->lun);
return ufshcd_eh_host_reset_handler(cmd);
+ }

ufshcd_hold(hba, false);
reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
@@ -6763,7 +6765,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
*/
scsi_print_command(hba->lrb[tag].cmd);
if (!hba->req_abort_count) {
- ufshcd_update_reg_hist(&hba->ufs_stats.task_abort, 0);
+ ufshcd_update_reg_hist(&hba->ufs_stats.task_abort, tag);
ufshcd_print_host_regs(hba);
ufshcd_print_host_state(hba);
ufshcd_print_pwr_info(hba);
--
2.18.0

2020-12-05 08:08:33

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v4 0/8] Refine error history and introduce event_notify vop

Hi Stanley,
Will you split this series to 3 separate series:
Phy initialization cleanup, Error history, and event notification?
As those 3 aren't really connected?

Please maintain Can's reviewed-by tag for the error history patches,
And add mine for the phy initialization, so Martin can pick those.

Thanks,
Avri

>
> Hi,
> This series refines error history functions, do vop cleanups and introduce a
> new event_notify vop to allow vendor to get notification of important
> events.
>
> Changes since v3:
> - Fix build warning in patch [8/8]
>
> Changes since v2:
> - Add patches for vop cleanups
> - Introduce phy_initialization helper and replace direct invoking in ufs-cdns
> and ufs-dwc by the helper
> - Introduce event_notify vop implemntation in ufs-mediatek
>
> Changes since v1:
> - Change notify_event() to event_notify() to follow vop naming covention
>
> Stanley Chu (8):
> scsi: ufs: Remove unused setup_regulators variant function
> scsi: ufs: Introduce phy_initialization helper
> scsi: ufs-cdns: Use phy_initialization helper
> scsi: ufs-dwc: Use phy_initialization helper
> scsi: ufs: Add error history for abort event in UFS Device W-LUN
> scsi: ufs: Refine error history functions
> scsi: ufs: Introduce event_notify variant function
> scsi: ufs-mediatek: Introduce event_notify implementation
>
> drivers/scsi/ufs/cdns-pltfrm.c | 3 +-
> drivers/scsi/ufs/ufs-mediatek-trace.h | 37 ++++++++
> drivers/scsi/ufs/ufs-mediatek.c | 12 +++
> drivers/scsi/ufs/ufshcd-dwc.c | 11 +--
> drivers/scsi/ufs/ufshcd.c | 132 ++++++++++++++------------
> drivers/scsi/ufs/ufshcd.h | 100 +++++++++----------
> 6 files changed, 175 insertions(+), 120 deletions(-)
> create mode 100644 drivers/scsi/ufs/ufs-mediatek-trace.h
>
> --
> 2.18.0

2020-12-05 08:09:09

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v4 0/8] Refine error history and introduce event_notify vop

>
> Hi Stanley,
> Will you split this series to 3 separate series:
> Phy initialization cleanup, Error history, and event notification?
> As those 3 aren't really connected?
>
> Please maintain Can's reviewed-by tag for the error history patches,
> And add mine for the phy initialization, so Martin can pick those.
And for the new event notification vop of course. Sorry.

Thanks,
Avri

>
> Thanks,
> Avri
>
> >
> > Hi,
> > This series refines error history functions, do vop cleanups and introduce a
> > new event_notify vop to allow vendor to get notification of important
> > events.
> >
> > Changes since v3:
> > - Fix build warning in patch [8/8]
> >
> > Changes since v2:
> > - Add patches for vop cleanups
> > - Introduce phy_initialization helper and replace direct invoking in ufs-cdns
> > and ufs-dwc by the helper
> > - Introduce event_notify vop implemntation in ufs-mediatek
> >
> > Changes since v1:
> > - Change notify_event() to event_notify() to follow vop naming covention
> >
> > Stanley Chu (8):
> > scsi: ufs: Remove unused setup_regulators variant function
> > scsi: ufs: Introduce phy_initialization helper
> > scsi: ufs-cdns: Use phy_initialization helper
> > scsi: ufs-dwc: Use phy_initialization helper
> > scsi: ufs: Add error history for abort event in UFS Device W-LUN
> > scsi: ufs: Refine error history functions
> > scsi: ufs: Introduce event_notify variant function
> > scsi: ufs-mediatek: Introduce event_notify implementation
> >
> > drivers/scsi/ufs/cdns-pltfrm.c | 3 +-
> > drivers/scsi/ufs/ufs-mediatek-trace.h | 37 ++++++++
> > drivers/scsi/ufs/ufs-mediatek.c | 12 +++
> > drivers/scsi/ufs/ufshcd-dwc.c | 11 +--
> > drivers/scsi/ufs/ufshcd.c | 132 ++++++++++++++------------
> > drivers/scsi/ufs/ufshcd.h | 100 +++++++++----------
> > 6 files changed, 175 insertions(+), 120 deletions(-)
> > create mode 100644 drivers/scsi/ufs/ufs-mediatek-trace.h
> >
> > --
> > 2.18.0

2020-12-05 14:05:16

by Stanley Chu

[permalink] [raw]
Subject: RE: [PATCH v4 0/8] Refine error history and introduce event_notify vop

Hi Avri,

On Sat, 2020-12-05 at 16:05 +0800, Avri Altman wrote:
> >
> > Hi Stanley,
> > Will you split this series to 3 separate series:
> > Phy initialization cleanup, Error history, and event notification?
> > As those 3 aren't really connected?
> >
> > Please maintain Can's reviewed-by tag for the error history patches,
> > And add mine for the phy initialization, so Martin can pick those.
> And for the new event notification vop of course. Sorry.

Thanks for the review!

Sure I would separate it to 2 series
1. Cleanup phy_initialization
2. Error history and event notification since these patches are strongly
related

Please review my new posted series and feel free to provide any further
suggestion.

Thanks,
Stanley Chu

>
> Thanks,
> Avri
>
> >
> > Thanks,
> > Avri
> >
> > >
> > > Hi,
> > > This series refines error history functions, do vop cleanups and introduce a
> > > new event_notify vop to allow vendor to get notification of important
> > > events.
> > >
> > > Changes since v3:
> > > - Fix build warning in patch [8/8]
> > >
> > > Changes since v2:
> > > - Add patches for vop cleanups
> > > - Introduce phy_initialization helper and replace direct invoking in ufs-cdns
> > > and ufs-dwc by the helper
> > > - Introduce event_notify vop implemntation in ufs-mediatek
> > >
> > > Changes since v1:
> > > - Change notify_event() to event_notify() to follow vop naming covention
> > >
> > > Stanley Chu (8):
> > > scsi: ufs: Remove unused setup_regulators variant function
> > > scsi: ufs: Introduce phy_initialization helper
> > > scsi: ufs-cdns: Use phy_initialization helper
> > > scsi: ufs-dwc: Use phy_initialization helper
> > > scsi: ufs: Add error history for abort event in UFS Device W-LUN
> > > scsi: ufs: Refine error history functions
> > > scsi: ufs: Introduce event_notify variant function
> > > scsi: ufs-mediatek: Introduce event_notify implementation
> > >
> > > drivers/scsi/ufs/cdns-pltfrm.c | 3 +-
> > > drivers/scsi/ufs/ufs-mediatek-trace.h | 37 ++++++++
> > > drivers/scsi/ufs/ufs-mediatek.c | 12 +++
> > > drivers/scsi/ufs/ufshcd-dwc.c | 11 +--
> > > drivers/scsi/ufs/ufshcd.c | 132 ++++++++++++++------------
> > > drivers/scsi/ufs/ufshcd.h | 100 +++++++++----------
> > > 6 files changed, 175 insertions(+), 120 deletions(-)
> > > create mode 100644 drivers/scsi/ufs/ufs-mediatek-trace.h
> > >
> > > --
> > > 2.18.0
>