RE: [RFC PATCH v2 2/5] scsi: ufs: Add UFS-feature layer

Daejun Park
2020-06-17T10:13:08Z

> > This patch is adding UFS feature layer to UFS core driver.
> >
> > UFS Driver data structure (struct ufs_hba)
> > │
> > ┌--------------┐
> > │ UFS feature │ <-- HPB module
> > │ layer │ <-- other extended feature module
> > └--------------┘
> > Each extended UFS-Feature module has a bus of ufs-ext feature type.
> > The UFS feature layer manages common APIs used by each extended feature
> > module. The APIs are set of UFS Query requests and UFS Vendor commands
> > related to each extended feature module.
> >
> > Other extended features can also be implemented using the proposed APIs.
> > For example, in Write Booster, "prep_fn" can be used to guarantee the
> > lifetime of UFS by updating the amount of write IO.
> > And reset/reset_host/suspend/resume can be used to manage the kernel task
> > for checking lifetime of UFS.
> >
> > The following 6 callback functions have been added to "ufshcd.c".
> > prep_fn: called after construct upiu structure
> > reset: called after proving hba
> > reset_host: called before ufshcd_host_reset_and_restore
> > suspend: called before ufshcd_suspend
> > resume: called after ufshcd_resume
> > rsp_upiu: called in ufshcd_transfer_rsp_status with SAM_STAT_GOOD state
> >
> > Signed-off-by: Daejun Park <daejun7.park@samsung.com>
> > ---
> > drivers/scsi/ufs/Makefile | 2 +-
> > drivers/scsi/ufs/ufsfeature.c | 148 ++++++++++++++++++++++++++++++++++
> > drivers/scsi/ufs/ufsfeature.h | 69 ++++++++++++++++
> > drivers/scsi/ufs/ufshcd.c | 17 ++++
> > drivers/scsi/ufs/ufshcd.h | 3 +
> > 5 files changed, 238 insertions(+), 1 deletion(-)
> > create mode 100644 drivers/scsi/ufs/ufsfeature.c
> > create mode 100644 drivers/scsi/ufs/ufsfeature.h
> >
> > diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
> > index 94c6c5d7334b..fe3a92b06c87 100644
> > --- a/drivers/scsi/ufs/Makefile
> > +++ b/drivers/scsi/ufs/Makefile
> > @@ -5,7 +5,7 @@ obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-
> > g210-pltfrm.o ufshcd-dwc.o tc-d
> > obj-$(CONFIG_SCSI_UFS_CDNS_PLATFORM) += cdns-pltfrm.o
> > obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o
> > obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o
> > -ufshcd-core-y += ufshcd.o ufs-sysfs.o
> > +ufshcd-core-y += ufshcd.o ufs-sysfs.o ufsfeature.o
> How about making it
> > ufshcd-core-$(CONFIG_UFS_FEATURES) += ufsfeature.o
> So that you won't check none-hpb driver on every response etc.

It's not a big problem because it only needs a simple checking.
In addition, I think that it is not necessary to separate them because the UFS feature is enabled in most of the user cases.

Thanks,
Daejun