Hi Daejun, On Wed, 2020-12-16 at 11:45 +0900, Daejun Park wrote: > This is a patch for the HPB initialization and adds HPB function calls to > UFS core driver. > > NAND flash-based storage devices, including UFS, have mechanisms to > translate logical addresses of IO requests to the corresponding physical > addresses of the flash storage. > In UFS, Logical-address-to-Physical-address (L2P) map data, which is > required to identify the physical address for the requested IOs, can only > be partially stored in SRAM from NAND flash. Due to this partial loading, > accessing the flash address area where the L2P information for that address > is not loaded in the SRAM can result in serious performance degradation. > > The basic concept of HPB is to cache L2P mapping entries in host system > memory so that both physical block address (PBA) and logical block address > (LBA) can be delivered in HPB read command. > The HPB READ command allows to read data faster than a read command in UFS > since it provides the physical address (HPB Entry) of the desired logical > block in addition to its logical address. The UFS device can access the > physical block in NAND directly without searching and uploading L2P mapping > table. This improves read performance because the NAND read operation for > uploading L2P mapping table is removed. > > In HPB initialization, the host checks if the UFS device supports HPB > feature and retrieves related device capabilities. Then, some HPB > parameters are configured in the device. > > Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx> > Reviewed-by: Can Guo <cang@xxxxxxxxxxxxxx> > Acked-by: Avri Altman <Avri.Altman@xxxxxxx> > Tested-by: Bean Huo <beanhuo@xxxxxxxxxx> > Signed-off-by: Daejun Park <daejun7.park@xxxxxxxxxxx> > --- > Documentation/ABI/testing/sysfs-driver-ufs | 80 +++ > drivers/scsi/ufs/Kconfig | 9 + > drivers/scsi/ufs/Makefile | 1 + > drivers/scsi/ufs/ufs-sysfs.c | 18 + > drivers/scsi/ufs/ufs.h | 13 + > drivers/scsi/ufs/ufshcd.c | 48 ++ > drivers/scsi/ufs/ufshcd.h | 23 +- > drivers/scsi/ufs/ufshpb.c | 562 +++++++++++++++++++++ > drivers/scsi/ufs/ufshpb.h | 167 ++++++ > 9 files changed, 920 insertions(+), 1 deletion(-) > create mode 100644 drivers/scsi/ufs/ufshpb.c > create mode 100644 drivers/scsi/ufs/ufshpb.h > > diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs > index d1a352194d2e..8b16a353392c 100644 > --- a/Documentation/ABI/testing/sysfs-driver-ufs > +++ b/Documentation/ABI/testing/sysfs-driver-ufs > @@ -1019,3 +1019,83 @@ Contact: Asutosh Das <asutoshd@xxxxxxxxxxxxxx> > Description: This entry shows the configured size of WriteBooster buffer. > 0400h corresponds to 4GB. > The file is read only. > + > +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/hpb_version > +Date: December 2020 > +Contact: Daejun Park <daejun7.park@xxxxxxxxxxx> > +Description: This entry shows the HPB specification version. > + The full information about the descriptor could be found at UFS > + HPB (Host Performance Booster) Extension specifications. > + Example: version 1.2.3 = 0123h > + The file is read only. > + > +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/hpb_control > +Date: December 2020 > +Contact: Daejun Park <daejun7.park@xxxxxxxxxxx> > +Description: This entry shows an indication of the HPB control mode. > + 00h: Host control mode > + 01h: Device control mode > + The file is read only. > + > +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_region_size > +Date: December 2020 > +Contact: Daejun Park <daejun7.park@xxxxxxxxxxx> > +Description: This entry shows the bHPBRegionSize which can be calculated > + as in the following (in bytes): > + HPB Region size = 512B * 2^bHPBRegionSize > + The file is read only. > + > +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_number_lu > +Date: December 2020 > +Contact: Daejun Park <daejun7.park@xxxxxxxxxxx> > +Description: This entry shows the maximum number of HPB LU supported by > + the device. > + 00h: HPB is not supported by the device. > + 01h ~ 20h: Maximum number of HPB LU supported by the device > + The file is read only. > + > +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/hpb_number_lu > +Date: December 2020 > +Contact: Daejun Park <daejun7.park@xxxxxxxxxxx> > +Description: This entry shows the maximum number of HPB LU supported by > + the device. > + 00h: HPB is not supported by the device. > + 01h ~ 20h: Maximum number of HPB LU supported by the device > + The file is read only. Please remove above duplicated item. Thanks, Stanley Chu